forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdraft-submit.js
More file actions
60 lines (49 loc) · 1.78 KB
/
draft-submit.js
File metadata and controls
60 lines (49 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
jQuery(function (){
// fill in submitter info when an author button is clicked
jQuery("input[type=button].author").click(function () {
var name = jQuery(this).data("name");
var email = jQuery(this).data("email");
jQuery(this).parents("form").find("input[name=submitter-name]").val(name || "");
jQuery(this).parents("form").find("input[name=submitter-email]").val(email || "");
});
jQuery("form").submit(function() {
if (this.submittedAlready)
return false;
else {
this.submittedAlready = true;
return true;
}
});
jQuery("form#cancel-submission").submit(function () {
return confirm("Cancel this submission?");
});
jQuery(".idnits-trigger").click(function (e) {
e.preventDefault();
var popup = jQuery(".idnits-popup").clone().show();
showModalBox(popup);
});
jQuery(".twopages-trigger").click(function (e) {
e.preventDefault();
var popup = jQuery(".twopages-popup").clone().show();
showModalBox(popup);
});
jQuery("form .add-author").click(function (e) {
e.preventDefault();
var table = jQuery("table.authors tbody");
var row = table.find("tr.empty").clone();
row.removeClass("empty");
var prefixInput = row.find('input[name=authors-prefix]');
// figure out a prefix
var i = 0, prefix;
do {
++i;
prefix = prefixInput.val() + i;
}
while (table.find('input[name=authors-prefix][value="' + prefix +'"]').length > 0);
prefixInput.val(prefix);
row.find('input').not(prefixInput).each(function () {
this.name = prefix + "-" + this.name;
});
table.append(row);
});
});