/
init.js
59 lines (51 loc) · 1.84 KB
/
init.js
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
django.jQuery('#start-button').click(function() {
LogTailer.startReading();
});
django.jQuery('#stop-button').click(function() {
LogTailer.stopReading();
});
django.jQuery('#auto-scroll').click(function() {
LogTailer.changeAutoScroll();
});
django.jQuery('#filter-select').change(function() {
LogTailer.customFilter();
});
django.jQuery('#log-window').html("")
LogTailer.customFilter();
django.jQuery("#save-logs").colorbox({width:"500px",
height:"300px",
inline:true,
href:"#clipboard-form-container",
onOpen: function(){
django.jQuery("#clipboard-logs").val(getSelectedText());
django.jQuery("#clipboard-name").val("Name");
django.jQuery("#clipboard-notes").val("Notes");
django.jQuery("#clipboard-error").html("");
}});
django.jQuery('#clipboard-form').submit(function() {
var error = false;
if(django.jQuery("#clipboard-name").val().length<1){
django.jQuery("#clipboard-error").html("Field name is mandatory");
error = true;
}
if(django.jQuery("#clipboard-logs").val().length<1){
django.jQuery("#clipboard-error").html("No log lines selected");
error = true;
}
if(!error){
django.jQuery.ajax({type: 'POST',
url: clipboard_url,
data: {
name: django.jQuery("#clipboard-name").val(),
notes: django.jQuery("#clipboard-notes").val(),
logs: django.jQuery("#clipboard-logs").val(),
file: django.jQuery("#clipboard-file").val()
},
success: function(result){
alert(result);
django.jQuery("#save-logs").colorbox.close();
},
dataType: "text/html"});
}
return false;
});