forked from Dakota628/jenkins-clean-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
master.js
146 lines (110 loc) · 4.55 KB
/
master.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// Window load event used just in case window height is dependant upon images
(function($) {
function stickyFoot() {
var bodyHeight = $("body.yui-skin-sam").height();
var vwptHeight = $(window).height();
var footHeight = 45;
var headerHeight = $("#header").height();
$("#main-table").css("min-height",vwptHeight-footHeight-headerHeight);
}
function updateExecutors() {
$('#executors th.pane a.model-link').css('max-width',$("#side-panel").width() - 15);
}
$(document).ready(function() {
stickyFoot();
updateExecutors();
// hook into build executor update
_refreshPart = window.refreshPart;
window.refreshPart = function(id, url) {
_refreshPart(id, url);
if(id == 'executors') updateExecutors();
}
});
$(window).resize(function() {
stickyFoot();
updateExecutors();
});
$(document).scroll(function() {
stickyFoot();
});
$(document).ready(function() {
setTimeout(function() {
var reloadPage = function() {
setTimeout(function() {
window.location.reload();
}, 1000)
};
setInterval(function() {
$(document)
.find("a[href^='job/'][href*='/build'], a[href='/cancelQuietDown']")
.each(function() {
var $this = $(this);
if ($this.data('forcePostInstrumented')) {
return;
}
$this.data('forcePostInstrumented', true).click(function() {
$.post($this.prop('href')).done(reloadPage);
return false;
});
});
}, 250);
// top page or view page only
if ((window.location.pathname === '/') || /\/view\/\w+\/?$/.test(window.location.pathname)) {
var countExecutingJobs = function() {
return $('#executors .progress-bar').length;
};
var executingJobNum = countExecutingJobs();
setInterval(function() {
if (executingJobNum !== countExecutingJobs()) {
reloadPage();
}
}, 1000);
}
}, 1000);
});
$(document).ready(function() {
var movies = [ 'webm', 'mp4', 'ogg', 'flv' ];
var images = [ 'jpg', 'png', 'gif', 'bmp' ];
var binaries = movies.concat(images).concat([ 'xls', 'xlsx' ]);
setInterval(function() {
movies.forEach(function(ext) {
$("a[href$='." + ext + "']").replaceWith(function() {
var $this = $(this);
var $widthSlider = $('<input />').attr({
type: 'range',
min: 50,
max: 150,
step: 20
});
var $video = $('<video />');
var minimumVideoControlWidth = 200;
var desiredVideoWidth = Math.min(Math.floor($jq(window).width() - $jq('#side-panel').width() - $jq("#main-panel div[style='float:right']").width()), 1100);
var videoWidthMargin = 250;
var videoWidth = Math.max(desiredVideoWidth - videoWidthMargin, minimumVideoControlWidth);
$widthSlider.bind('input', function() {
$video.width(($(this).val() / 100) * videoWidth);
});
$video.attr({
controls: 'controls',
width: videoWidth,
src: $this.prop('href')
}).click(function() {
if ($video.prop('paused')) {
$video[0].play();
} else {
$video[0].pause();
}
});
var $container = $('<div />');
$container.append($('<div />').append('<span>FrameSize </span>').append($widthSlider));
$container.append($video);
return $container;
});
});
binaries.forEach(function(ext) {
$("a[href$='." + ext + "/*view*/']").remove();
});
}, 250);
});
window.$jq = $; // keep for later use
})(jQuery.noConflict(true));