-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcontent.js
More file actions
63 lines (49 loc) · 1.87 KB
/
Copy pathcontent.js
File metadata and controls
63 lines (49 loc) · 1.87 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
61
$( document ).ready(function() {
$("form").each(function(){
var form = $(this).serialize();
chrome.runtime.sendMessage({method:'setOutput', output:form});
});
/*
Write HTML string to page.
*/
writeDialog = function(html, form) {
open = '<div style="background-color: white; border-style: solid; border-width: 10px; border-color: rgb(51, 0, 51) !important; background-position: initial initial !important; background-repeat: initial initial !important;">';
close = '</div>';
//$('body').prepend(open + html + close);
$('<div style="border-style: solid; border-width: 10px; border-color: rgb(51, 0, 51) !important; background-position: initial initial !important; background-repeat: initial initial !important"></div>').appendTo('body')
.html('<div><h6>' + html + '</h6></div>')
.dialog({
modal: true, title: 'message', zIndex: 10000, autoOpen: true,
width: 'auto', resizable: false,
buttons: {
Yes: function () {
$(this).dialog("close");
formSubmit(form);
},
No: function () {
console.log('no');
$(this).dialog("close");
}
},
close: function (event, ui) {
$(this).remove();
}
});
}
formSubmit = function(form) {
form.submit();
}
$("form").submit(function (e) {
// Disable form submit from continuing until dialog allows
e.preventDefault();
var forminfo = "";
var autofilledColor = 'rgb(250, 255, 189)';
$(this).find(':text').each(function() {
var autofilled = $(this).css('backgroundColor');
if(autofilled==autofilledColor)
forminfo = forminfo.concat($(this).attr("name")) + ": " + $(this).val() + "<br/>";
console.log($(this).attr('name'));
});
writeDialog(forminfo, this);
});
});