-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.js
More file actions
executable file
·79 lines (65 loc) · 1.98 KB
/
Copy pathdeploy.js
File metadata and controls
executable file
·79 lines (65 loc) · 1.98 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
$(document).ready(function(){
function rewind() {
$('body').addClass('rewind--active');
$('.dcm-close-rewind').on('click', rewind_close);
}
function rewind_close() {
$('body').removeClass('rewind--active');
$('.dcm-close-rewind').off('click', rewind_close);
return false;
}
function confirm_deployment() {
$('body').addClass('confirm--active');
$('body').on('keypress', handle_deploy_keypress);
$('#passwd').on('keydown', handle_deploy_signal);
$('.dcm-close').on('click', confirm_deployment_close);
}
function confirm_deployment_close() {
$('body').removeClass('confirm--active');
$('body').off('keypress', handle_deploy_keypress);
$("#passwd").off('keydown', handle_deploy_signal);
$('.dcm-close').off('click', confirm_deployment_close);
}
function handle_rewind_signal(evt) {
rewind();
}
function handle_deploy_signal(evt) {
if(13 == evt.which) {
deploy_with_confirm();
}
}
function handle_deploy_keypress(evt) {
if(0==evt.which){
confirm_deployment_close();
}
}
function deploy_with_confirm() {
$.post('./auth.php', { passwd: $('#passwd').prop('value') }, function(resp) {
swap_bg_img({"id": resp.status, "set": true});
confirm_deployment_close();
$('.main').empty().append(resp.output);
});
}
function swap_bg_img(config){
var bg_class_name = 'bg-'+config.id;
var bg_set_class = (config.set) ? $('body').addClass(bg_class_name) : $('body').removeClass(bg_class_name);
}
$("#forward").on({
'click': confirm_deployment,
'mouseenter': function(evt){
swap_bg_img({"id": "deploy", "set": true})
},
'mouseleave': function(evt){
swap_bg_img({"id": "deploy", "set": false})
}
});
$("#rewind").on({
'click': handle_rewind_signal,
'mouseenter': function(evt){
swap_bg_img({"id": "revert", "set": true});
},
'mouseleave': function(evt){
swap_bg_img({"id": "revert", "set": false})
}
})
});