1 |
|
---|
2 | var oReloadTimer = null;
|
---|
3 | var oCounterTimer = null;
|
---|
4 |
|
---|
5 | function reloadDocument() {
|
---|
6 | if(!withquery) history.pushState('', document.title, window.location.pathname);
|
---|
7 | else if (window.location.href.match(/(&|&)action=\w+/)) history.pushState('', document.title, window.location.href.replace(/(&|&)action=\w+/,''));
|
---|
8 | window.location.reload();
|
---|
9 | };
|
---|
10 |
|
---|
11 | function cdpause() {
|
---|
12 | clearTimeout(oReloadTimer);
|
---|
13 | };
|
---|
14 |
|
---|
15 | function runReloadCounter() {
|
---|
16 | var oReloadContent = document.getElementById("ReloadContent");
|
---|
17 | if (oReloadContent) {
|
---|
18 | if (counter < 0) {
|
---|
19 | counter = counterfull;
|
---|
20 | }
|
---|
21 | counter--;
|
---|
22 | }
|
---|
23 | };
|
---|
24 |
|
---|
25 | function initDoc() {
|
---|
26 | if (oReloadTimer) window.clearInterval(oReloadTimer);
|
---|
27 | oReloadTimer = window.setInterval("reloadDocument();", counterfull * 1000);
|
---|
28 | if (oCounterTimer) window.clearInterval(oCounterTimer);
|
---|
29 | oCounterTimer = window.setInterval("runReloadCounter();", 1000);
|
---|
30 | };
|
---|
31 |
|
---|
32 | function gotosite(Action) {
|
---|
33 | window.location.href = Action;
|
---|
34 | }
|
---|
35 |
|
---|
36 | /* Function for add new reader/user in readers.html/userconfig.html */
|
---|
37 | function addinsert() {
|
---|
38 | cdpause();
|
---|
39 | $("#searchTable").fadeOut('slow', function() {
|
---|
40 | $("#newinsert").fadeIn('slow');
|
---|
41 | });
|
---|
42 | }
|
---|
43 |
|
---|
44 | /* Function for add new reader/user in readers.html/userconfig.html */
|
---|
45 | function chkinsert(chkvalue) {
|
---|
46 | if(existing_inserts.indexOf(encodeURIComponent(chkvalue))!=-1){
|
---|
47 | alert('Entry "' + chkvalue + '" already exists!');
|
---|
48 | return false;
|
---|
49 | }
|
---|
50 | }
|
---|
51 |
|
---|
52 | /* Function for del entry in readers.html/userconfig.html */
|
---|
53 | function cleaninsert(deleteinsert) {
|
---|
54 | var tmp_array = existing_inserts.slice();
|
---|
55 | existing_inserts.length = 0;
|
---|
56 | var i2 = 0;
|
---|
57 | for (i = 0; i < tmp_array.length; i++) {
|
---|
58 | if (tmp_array[i] != deleteinsert){
|
---|
59 | existing_inserts[i2] = tmp_array[i];
|
---|
60 | i2++;
|
---|
61 | }
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | var beep = (function () {
|
---|
66 | var contextClass = (window.AudioContext ||
|
---|
67 | window.webkitAudioContext ||
|
---|
68 | window.mozAudioContext ||
|
---|
69 | window.oAudioContext ||
|
---|
70 | window.msAudioContext);
|
---|
71 | if (contextClass) {
|
---|
72 | var ctx = new contextClass();
|
---|
73 | return function (duration, type, freq, vol, finishedCallback) {
|
---|
74 | duration = +duration;
|
---|
75 | // Only 0-4 are valid types.
|
---|
76 | type = (type % 5) || 0;
|
---|
77 |
|
---|
78 | if (typeof finishedCallback != "function") {
|
---|
79 | finishedCallback = function () {};
|
---|
80 | }
|
---|
81 |
|
---|
82 | var osc = ctx.createOscillator();
|
---|
83 | var gainNode = ctx.createGain();
|
---|
84 | osc.type = type;
|
---|
85 | osc.connect(gainNode);
|
---|
86 | gainNode.connect(ctx.destination);
|
---|
87 | gainNode.gain.value = vol;
|
---|
88 | osc.type = type;
|
---|
89 | osc.frequency.value = freq; // value in hertz
|
---|
90 | osc.detune.value = 100; // value in cents
|
---|
91 | osc.start(0);
|
---|
92 |
|
---|
93 | setTimeout(function () {
|
---|
94 | osc.stop(0);
|
---|
95 | finishedCallback();
|
---|
96 | }, duration);
|
---|
97 | };
|
---|
98 | } else {
|
---|
99 | return function (duration, type, freq, vol, finishedCallback) {return;};
|
---|
100 | }
|
---|
101 | })();
|
---|
102 |
|
---|
103 | String.prototype.toHHMMSS = function () {
|
---|
104 | if (this.length < 1) {
|
---|
105 | return ''
|
---|
106 | }
|
---|
107 | var sec_num = parseInt(this, 10); // don't forget the second param
|
---|
108 | var years = Math.floor(sec_num / (86400*365));
|
---|
109 | var days = Math.floor(sec_num / 86400);
|
---|
110 | var hours = Math.floor(sec_num / 3600);
|
---|
111 | var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
|
---|
112 | var seconds = sec_num - (hours * 3600) - (minutes * 60);
|
---|
113 | hours = hours - (24 * days);
|
---|
114 | days = days - (365 * years);
|
---|
115 | if (years < 1) {
|
---|
116 | years = "";
|
---|
117 | } else {
|
---|
118 | years = years + "y ";
|
---|
119 | }
|
---|
120 | if (days < 1) {
|
---|
121 | days = "";
|
---|
122 | } else {
|
---|
123 | days = days + "d ";
|
---|
124 | }
|
---|
125 | if (hours < 10) {
|
---|
126 | hours = "0" + hours;
|
---|
127 | }
|
---|
128 | if (minutes < 10) {
|
---|
129 | minutes = "0" + minutes;
|
---|
130 | }
|
---|
131 | if (seconds < 10) {
|
---|
132 | seconds = "0" + seconds;
|
---|
133 | }
|
---|
134 | var time = days + hours + ':' + minutes + ':' + seconds;
|
---|
135 | return time;
|
---|
136 | }
|
---|
137 |
|
---|
138 | function runden(value) {
|
---|
139 | var k = (Math.round(value * 100) / 100).toString();
|
---|
140 | k += (k.indexOf('.') == -1) ? '.00' : '00';
|
---|
141 | return k.substring(0, k.indexOf('.') + 3);
|
---|
142 | }
|
---|
143 |
|
---|
144 | /*
|
---|
145 | * General: Eventhandler
|
---|
146 | */
|
---|
147 | $(function () {
|
---|
148 | // Pollinterval UP
|
---|
149 | $("#inc").click(function () {
|
---|
150 | if (pollintervall > 98000 || polling) return;
|
---|
151 | $(":text[name='pintervall']").val(Number($(":text[name='pintervall']").val()) + 1);
|
---|
152 | pollintervall = $(":text[name='pintervall']").val() * 1000;
|
---|
153 | if (!nostorage) {
|
---|
154 | sessionStorage.pollintervall = pollintervall;
|
---|
155 | }
|
---|
156 | });
|
---|
157 | // Pollinterval PAUSE
|
---|
158 | $("#polling").click(function () {
|
---|
159 | if (polling < 1) {
|
---|
160 | polling = 1;
|
---|
161 | $(":text[name='pintervall']").val('--');
|
---|
162 | $('#polling').attr('class','pollingdisabled');
|
---|
163 | $('#inc, #dec').attr('disabled','disabled');
|
---|
164 | } else {
|
---|
165 | polling = 0;
|
---|
166 | $(":text[name='pintervall']").val(pollintervall/1000);
|
---|
167 | $('#polling').attr('class','pollingenabled');
|
---|
168 | $('#inc, #dec').removeAttr('disabled');
|
---|
169 | clearTimeout(timer_ID);
|
---|
170 | timer_ID = setTimeout("waitForMsg()", pollintervall);
|
---|
171 | }
|
---|
172 | if (!nostorage) {
|
---|
173 | sessionStorage.polling = polling;
|
---|
174 | }
|
---|
175 | });
|
---|
176 | // Pollinterval DOWN
|
---|
177 | $("#dec").click(function () {
|
---|
178 | if (pollintervall < 2000 || polling) return;
|
---|
179 | $(":text[name='pintervall']").val(Number($(":text[name='pintervall']").val()) - 1);
|
---|
180 | pollintervall = $(":text[name='pintervall']").val() * 1000;
|
---|
181 | if (!nostorage) {
|
---|
182 | sessionStorage.pollintervall = pollintervall;
|
---|
183 | }
|
---|
184 | });
|
---|
185 | // Hover for showing Chart on Statuspage
|
---|
186 | $('table.status').on('mouseover', 'tr > td.statuscol14', function (e) {
|
---|
187 | var uid = '#' + $(this).parent().attr('id');
|
---|
188 | if ('pcr'.indexOf($(uid).attr('class')) >= 0) {
|
---|
189 | if ($(uid).data('ecmhistory')) {
|
---|
190 | var head = $(uid + ' > td:nth-child(3)').attr('title').indexOf('(') > -1 ? $(uid + ' > td:nth-child(3)').attr('title').substring(0, $(uid + ' > td:nth-child(3)').attr('title').indexOf('(')-1) : $(uid + ' > td:nth-child(3)').attr('title');
|
---|
191 | $('#charthead').text(head + ' History');
|
---|
192 | $("#graph").html('');
|
---|
193 | var arry = $(uid).data('ecmhistory').split(",");
|
---|
194 | $.each(arry, function (index, value) {
|
---|
195 | $("#graph").append(generateBar(value));
|
---|
196 | });
|
---|
197 | $("#chart").show();
|
---|
198 | }
|
---|
199 | $("#chart").offset({
|
---|
200 | left: e.pageX + 20,
|
---|
201 | top: e.pageY - 20
|
---|
202 | });
|
---|
203 | }
|
---|
204 | });
|
---|
205 | // Mousout for hiding Chart on Statuspage
|
---|
206 | $('table.status').on('mouseout', 'tr > td.statuscol14', function () {
|
---|
207 | $("#chart").hide();
|
---|
208 | });
|
---|
209 |
|
---|
210 | $("#add1regex").click(function () {
|
---|
211 | if (MAX_SEARCH_PATTERN > 98) return;
|
---|
212 | MAX_SEARCH_PATTERN++;
|
---|
213 | localStorage.MAX_SEARCH_PATTERN = MAX_SEARCH_PATTERN;
|
---|
214 | var i = MAX_SEARCH_PATTERN;
|
---|
215 | var beep_disabled = ' disabled="disabled" title="Not supported by your browser"';
|
---|
216 | var contextClass = (window.AudioContext || window.webkitAudioContext || window.mozAudioContext || window.oAudioContext || window.msAudioContext);
|
---|
217 | if (contextClass) { beep_disabled = ''; }
|
---|
218 | var prefix = "0";
|
---|
219 | if ( i > 9 ) { prefix = ""; }
|
---|
220 | $('<LI class="regex" id="regexrow' + i + '">Search' + prefix + i + ': <input type="text" name="regex' + i + '" class="regexinput" ID="regex' + i + '" value=""> Found only: <input type="checkbox" id="whitelisted' + i + '"><label></label> Hide: <input type="checkbox" id="hidden' + i + '"><label></label> Back Color: <input size="7" maxlength="7" type="text" name="color' + i + '" class="colorinput" ID="color' + i + '" value=""> Color: <input size="7" maxlength="7" type="text" name="fcolor' + i + '" class="colorinput" ID="fcolor' + i + '" value=""> Beep: <input type="checkbox" id="beep' + i + '"' + beep_disabled +'><label></label></LI>').insertBefore(".regexdata_save");
|
---|
221 | $('#color' + i).val($('.colorPicker_def_color').css('color'));
|
---|
222 | $('#fcolor' + i).val($('.colorPicker_def_fcolor').css('color'));
|
---|
223 | $('#color' + i).colorPicker();
|
---|
224 | $('#fcolor' + i).colorPicker();
|
---|
225 | });
|
---|
226 |
|
---|
227 | $("#del1regex").click(function () {
|
---|
228 | var i = MAX_SEARCH_PATTERN;
|
---|
229 | if (i < 2) return;
|
---|
230 | if ($('#regex' + i).val() != '') if (!confirm('Search' + i + ' is not empty! Delete?')) return;
|
---|
231 | $("#regexrow" + i).remove();
|
---|
232 | localStorage.removeItem('regex' + i);
|
---|
233 | localStorage.removeItem('color' + i);
|
---|
234 | localStorage.removeItem('fcolor' + i);
|
---|
235 | localStorage.removeItem('whitelisted' + i);
|
---|
236 | localStorage.removeItem('hidden' + i);
|
---|
237 | localStorage.removeItem('beep' + i);
|
---|
238 | MAX_SEARCH_PATTERN--;
|
---|
239 | localStorage.MAX_SEARCH_PATTERN = MAX_SEARCH_PATTERN;
|
---|
240 | });
|
---|
241 |
|
---|
242 | $("#regexok").click(function () {
|
---|
243 |
|
---|
244 | for (var i = 1; i < MAX_SEARCH_PATTERN + 1; i++) {
|
---|
245 | var pattern = $('#regex' + i).val();
|
---|
246 | if (pattern) {
|
---|
247 | var color = $('#color' + i).val();
|
---|
248 | var fcolor = $('#fcolor' + i).val();
|
---|
249 | } else {
|
---|
250 | var color = '';
|
---|
251 | var fcolor = '';
|
---|
252 | }
|
---|
253 | localStorage['regex' + i] = pattern ? pattern : '';
|
---|
254 | localStorage['color' + i] = color ? color : '';
|
---|
255 | localStorage['fcolor' + i] = fcolor ? fcolor : '';
|
---|
256 | localStorage['whitelisted' + i] = $('#whitelisted' + i).prop('checked') ? '1' : '0';
|
---|
257 | localStorage['hidden' + i] = $('#hidden' + i).prop('checked') ? '1' : '0';
|
---|
258 | localStorage['beep' + i] = $('#beep' + i).prop('checked') ? '1' : '0';
|
---|
259 | }
|
---|
260 |
|
---|
261 | });
|
---|
262 |
|
---|
263 | $("#regexreset").click(function () {
|
---|
264 |
|
---|
265 | if (confirm('Delete all Filters and Colors?')) {
|
---|
266 | for (var i = 1; i < MAX_SEARCH_PATTERN + 1; i++) {
|
---|
267 | $('#regex' + i).val('');
|
---|
268 | $('#whitelisted' + i).prop('checked', false);
|
---|
269 | $('#hidden' + i).prop('checked', false);
|
---|
270 | $('#color' + i).val($('.colorPicker_def_color').css('color'));
|
---|
271 | $('#color' + i).change();
|
---|
272 | $('#fcolor' + i).val($('.colorPicker_def_fcolor').css('color'));
|
---|
273 | $('#fcolor' + i).change();
|
---|
274 | $('#beep' + i).prop('checked', false);
|
---|
275 | localStorage['regex' + i] = '';
|
---|
276 | localStorage['color' + i] = '';
|
---|
277 | localStorage['fcolor' + i] = '';
|
---|
278 | localStorage['whitelisted' + i] = '0';
|
---|
279 | localStorage['hidden' + i] = '0';
|
---|
280 | localStorage['beep' + i] = '0';
|
---|
281 | }
|
---|
282 | }
|
---|
283 |
|
---|
284 | });
|
---|
285 |
|
---|
286 | $(".sizemls a, .sizeml a").click(function () {
|
---|
287 | maxloglines = parseInt($(this).attr('sendval'));
|
---|
288 | $("#sizemfrom").text(' Switch displayed log lines from ' + maxloglines + ' to ');
|
---|
289 | for (var i = 32; i <= 512; i *= 2) {
|
---|
290 | $("#sizem" + i).attr('class', (maxloglines == i) ? 'sizemls' : 'sizeml');
|
---|
291 | }
|
---|
292 | return false;
|
---|
293 | });
|
---|
294 |
|
---|
295 | $(".debugls a, .debugl a").click(function () {
|
---|
296 | parameters = parameters + "&debug=" + $(this).attr('sendval');
|
---|
297 | return false;
|
---|
298 | });
|
---|
299 |
|
---|
300 | $("#savelog").on('click', function (event) {
|
---|
301 | var txt = '';
|
---|
302 | $("#livelogdata li").each(function (i) {
|
---|
303 | txt += $(this).text() + '\n';
|
---|
304 | });
|
---|
305 | // Data URI
|
---|
306 | txtData = 'data:application/txt;charset=utf-8,' + encodeURIComponent(txt);
|
---|
307 | $(this).attr({
|
---|
308 | 'href': txtData,
|
---|
309 | 'target': '_blank'
|
---|
310 | });
|
---|
311 | });
|
---|
312 |
|
---|
313 | $("#showhidesettings").click(function () {
|
---|
314 | if ($("#showhidesettings").val() == 'Show Settings') {
|
---|
315 | $("#showhidesettings").val('Hide Settings');
|
---|
316 | $("#regexdata").fadeIn('slow');
|
---|
317 | } else {
|
---|
318 | $("#showhidesettings").val('Show Settings');
|
---|
319 | $("#regexdata").fadeOut('slow');
|
---|
320 | }
|
---|
321 | });
|
---|
322 |
|
---|
323 | $("#stoplog").click(function () {
|
---|
324 | if ($("#stoplog").val() == 'Stop Log') {
|
---|
325 | $("#stoplog").val('Start Log');
|
---|
326 | stoppoll = 1;
|
---|
327 | } else {
|
---|
328 | $("#stoplog").val('Stop Log');
|
---|
329 | stoppoll = 0;
|
---|
330 | waitForMsg();
|
---|
331 | }
|
---|
332 | });
|
---|
333 |
|
---|
334 | $("#onlineidle").click(function () {
|
---|
335 | if ($("#onlineidle").text() == 'Login*') {
|
---|
336 | $("#onlineidle")
|
---|
337 | .text('Online & Idle*')
|
---|
338 | .attr('title', 'Login info (click to switch)');
|
---|
339 | } else {
|
---|
340 | $("#onlineidle")
|
---|
341 | .text('Login*')
|
---|
342 | .attr('title', 'Online & Idle info (click to switch)');
|
---|
343 | }
|
---|
344 | if (!nostorage) localStorage.loi = $("#onlineidle").text();
|
---|
345 | waitForMsg();
|
---|
346 | });
|
---|
347 |
|
---|
348 | // switch reader ON/OFF
|
---|
349 | $("a.switchreader").click(function (e) {
|
---|
350 | e.preventDefault();
|
---|
351 | var parameters_old = parameters;
|
---|
352 | parameters += '&label=' + $(this).data('reader-name') + '&action=' + $(this).data('next-action');
|
---|
353 | var rowid = '#' + $(this).data('md5');
|
---|
354 | var img = $(this).children("img");
|
---|
355 | waitForMsg();
|
---|
356 | if ($(this).data('next-action') == 'enable') {
|
---|
357 | $(this).data('next-action', 'disable').attr('title', 'Disable Reader: ' + $(this).data('reader-name') + $(this).data('desc'));
|
---|
358 | $(rowid).attr('class', 'enabledreader');
|
---|
359 | img.attr('src', 'image?i=ICDIS').attr('alt', 'Disable');
|
---|
360 | } else {
|
---|
361 | $(this).data('next-action', 'enable').attr('title', 'Enable Reader: ' + $(this).data('reader-name') + $(this).data('desc'));
|
---|
362 | $(rowid).attr('class', 'disabledreader');
|
---|
363 | img.attr('src', 'image?i=ICENA').attr('alt', 'Enable');
|
---|
364 | }
|
---|
365 | parameters = parameters_old;
|
---|
366 | });
|
---|
367 |
|
---|
368 | // delete reader
|
---|
369 | $("a.deletereader").click(function (e) {
|
---|
370 | e.preventDefault();
|
---|
371 | if (confirm("Delete Reader " + $(this).data('reader-name') + "?")) {
|
---|
372 | var parameters_old = parameters;
|
---|
373 | parameters += '&label=' + $(this).data('reader-name') + '&action=' + $(this).data('next-action');
|
---|
374 | cleaninsert($(this).data('reader-name'));
|
---|
375 | waitForMsg();
|
---|
376 | parameters = parameters_old;
|
---|
377 | $('#' + $(this).data('md5')).fadeOut('slow');
|
---|
378 | }
|
---|
379 | });
|
---|
380 |
|
---|
381 | // switch user ON/OFF
|
---|
382 | $("a.switchuser").click(function (e) {
|
---|
383 | e.preventDefault();
|
---|
384 | var parameters_old = parameters;
|
---|
385 | parameters += '&user=' + $(this).data('user-name') + '&action=' + $(this).data('next-action');
|
---|
386 | var rowid = '#' + $(this).data('md5');
|
---|
387 | var img = $(this).children("img");
|
---|
388 | waitForMsg();
|
---|
389 | if ($(this).data('next-action') == 'enable') {
|
---|
390 | $(this).data('next-action', 'disable').attr('title', 'Disable User: ' + $(this).data('user-name') + $(this).data('desc'));
|
---|
391 | $(rowid).attr('class', 'offline');
|
---|
392 | $(rowid + ' > td.usercol2').text('offline');
|
---|
393 | img.attr('src', 'image?i=ICDIS').attr('alt', 'Disable');
|
---|
394 | } else {
|
---|
395 | $(this).data('next-action', 'enable').attr('title', 'Enable User: ' + $(this).data('user-name') + $(this).data('desc'));
|
---|
396 | $(rowid).attr('class', 'disabled');
|
---|
397 | $(rowid + ' > td.usercol2').text('offline (disabled)');
|
---|
398 | img.attr('src', 'image?i=ICENA').attr('alt', 'Enable');
|
---|
399 | }
|
---|
400 | parameters = parameters_old;
|
---|
401 | });
|
---|
402 |
|
---|
403 | // reset user stats
|
---|
404 | $("a.resetuser").click(function (e) {
|
---|
405 | e.preventDefault();
|
---|
406 | if (confirm("Reset Stats for " + $(this).data('user-name') + "?")) {
|
---|
407 | var parameters_old = parameters;
|
---|
408 | parameters += '&user=' + $(this).data('user-name') + '&action=' + $(this).data('next-action');
|
---|
409 | waitForMsg();
|
---|
410 | parameters = parameters_old;
|
---|
411 | }
|
---|
412 | });
|
---|
413 |
|
---|
414 | // delete user
|
---|
415 | $("a.deleteuser").click(function (e) {
|
---|
416 | e.preventDefault();
|
---|
417 | if (confirm("Delete User " + $(this).data('user-name') + "?")) {
|
---|
418 | var parameters_old = parameters;
|
---|
419 | parameters += '&user=' + $(this).data('user-name') + '&action=' + $(this).data('next-action');
|
---|
420 | cleaninsert($(this).data('user-name'));
|
---|
421 | waitForMsg();
|
---|
422 | parameters = parameters_old;
|
---|
423 | $('#' + $(this).data('md5')).fadeOut('slow');
|
---|
424 | }
|
---|
425 | });
|
---|
426 |
|
---|
427 | // search related events
|
---|
428 | $("#searchTerm").keyup(function () {
|
---|
429 | var value = $("#searchTerm").val().toLowerCase().trim();
|
---|
430 | $("#dataTable tr").each(function (index) {
|
---|
431 | if (!index) return;
|
---|
432 | $(this).find("td").each(function () {
|
---|
433 | var id = (($(this).data('sort-value') == undefined || $(this).hasClass("usercol2")) ? $(this).text() : $(this).data('sort-value').toString()).toLowerCase().trim();
|
---|
434 | var not_found = (id.indexOf(value) == -1);
|
---|
435 | $(this).closest('tr').toggle(!not_found);
|
---|
436 | return not_found;
|
---|
437 | });
|
---|
438 | });
|
---|
439 | });
|
---|
440 |
|
---|
441 | $("#searchTerm").click(function () {
|
---|
442 | cdpause();
|
---|
443 | });
|
---|
444 |
|
---|
445 | $("#searchTerm").blur(function () {
|
---|
446 | initDoc();
|
---|
447 | });
|
---|
448 |
|
---|
449 | var table = $('#dataTable').stupidtable();
|
---|
450 |
|
---|
451 | table.bind('beforetablesort', function (event, data) {
|
---|
452 | lockpoll = 1;
|
---|
453 | table.addClass("disabledtable");
|
---|
454 | });
|
---|
455 |
|
---|
456 | table.bind('aftertablesort', function (event, data) {
|
---|
457 | // data.column - the index of the column sorted after a click
|
---|
458 | // data.direction - the sorting direction (either asc or desc)
|
---|
459 | lockpoll = 0;
|
---|
460 | table.removeClass("disabledtable");
|
---|
461 | });
|
---|
462 |
|
---|
463 | // copy emm to single write emm
|
---|
464 | $("a.tosingleemm").click(function (e) {
|
---|
465 | var ins_emm = (/\s+[0-9a-fA-F]+\s+([0-9a-fA-F]+)\s+/).exec($(this).text());
|
---|
466 | $('#singleemm').val(ins_emm[1]);
|
---|
467 | $('#singleemm').change();
|
---|
468 | });
|
---|
469 | });
|
---|
470 |
|
---|
471 | /*
|
---|
472 | * General: Update page footer and failbannotifier
|
---|
473 | */
|
---|
474 | function updateFooter(data) {
|
---|
475 | $("#curtime").text(' ' + data.oscam.curdate + ' | ' + data.oscam.curtime + ' ');
|
---|
476 | $("#runtime").text(' ' + data.oscam.runtime);
|
---|
477 | $("#uptime") .text(' ' + data.oscam.uptime);
|
---|
478 |
|
---|
479 | if ($("#fbnotifier > span.span_notifier").length) {
|
---|
480 | if (data.oscam.failbannotifier > 0) {
|
---|
481 | $("#fbnotifier > span.span_notifier")
|
---|
482 | .text(data.oscam.failbannotifier);
|
---|
483 | }
|
---|
484 | else {
|
---|
485 | $("#fbnotifier > span.span_notifier").remove();
|
---|
486 | }
|
---|
487 | }
|
---|
488 | else if (data.oscam.failbannotifier > 0) {
|
---|
489 | $("#fbnotifier")
|
---|
490 | .append('<SPAN CLASS="span_notifier">'+ data.oscam.failbannotifier + '</SPAN>');
|
---|
491 | }
|
---|
492 | }
|
---|
493 |
|
---|
494 | /*
|
---|
495 | * identfy an element within string of elements
|
---|
496 | */
|
---|
497 | var poll_excluded;
|
---|
498 |
|
---|
499 | function is_nopoll(value) {
|
---|
500 | return (poll_excluded.indexOf(value) > (-1)) ? true : false;
|
---|
501 | }
|
---|
502 |
|
---|
503 | /*
|
---|
504 | * Userpage Functions: Update Page
|
---|
505 | */
|
---|
506 | function updateUserpage(data) {
|
---|
507 |
|
---|
508 | // update user lines
|
---|
509 | $.each(data.oscam.users, function (i, item) {
|
---|
510 | var uid = "#" + item.user.usermd5;
|
---|
511 | poll_excluded = ($(uid).attr('nopoll') != undefined) ? $(uid).attr('nopoll') : '';
|
---|
512 |
|
---|
513 | switch (item.user.classname) {
|
---|
514 | case 'online':
|
---|
515 | $(uid).attr('class', item.user.classname);
|
---|
516 |
|
---|
517 | if (!is_nopoll('usercol1')) {
|
---|
518 | if ($(uid + " td.usercol1 > span.span_notifier").length) {
|
---|
519 | if(item.user.unotify){
|
---|
520 | $(uid + " td.usercol1 > span.span_notifier")
|
---|
521 | .text(item.user.unotify);
|
---|
522 | }
|
---|
523 | else {
|
---|
524 | $(uid + " td.usercol1 > span.span_notifier").remove();
|
---|
525 | }
|
---|
526 | }
|
---|
527 | else if(item.user.unotify) {
|
---|
528 | $(uid + " td.usercol1")
|
---|
529 | .append('<SPAN CLASS="span_notifier">'+ item.user.unotify + '</SPAN>');
|
---|
530 | }
|
---|
531 | }
|
---|
532 |
|
---|
533 | if (!is_nopoll('usercol2')) {
|
---|
534 | $(uid + " td.usercol2")
|
---|
535 | .attr('title', item.user.stats.expectsleep != 'undefined' ? (item.user.stats.expectsleep > 0 ? 'Sleeping in ' + item.user.stats.expectsleep + ' minutes' : 'Sleeping') : '')
|
---|
536 | .data('sort-value', item.user.ip)
|
---|
537 | .html("<B>" + item.user.status + "</B><br>" + item.user.ip);
|
---|
538 | }
|
---|
539 |
|
---|
540 | if (!is_nopoll('usercol3')) {
|
---|
541 | $(uid + " td.usercol3").html(item.user.stats.idle + "<br>" + item.user.stats.timeonchannel.toHHMMSS());
|
---|
542 | }
|
---|
543 |
|
---|
544 | if (!is_nopoll('usercol4')) {
|
---|
545 | if (item.user.protoicon.length > 0) {
|
---|
546 | if (!$(uid + " td.usercol4 > img").length || $(uid + " td.usercol4 > img").attr('src')!='image?i=IC_' + item.user.protoicon) {
|
---|
547 | var protoimage = $('<img class="protoicon" src="image?i=IC_' + item.user.protoicon + '" />');
|
---|
548 | protoimage.hide();
|
---|
549 | $(uid + " td.usercol4").html(protoimage);
|
---|
550 | protoimage.fadeIn('slow');
|
---|
551 | }
|
---|
552 | } else {
|
---|
553 | $(uid + " td.usercol4").text(item.user.protocol);
|
---|
554 | }
|
---|
555 |
|
---|
556 | $(uid + " td.usercol4")
|
---|
557 | .attr('title', item.user.prototitle)
|
---|
558 | .data('sort-value', item.user.protosort);
|
---|
559 | }
|
---|
560 |
|
---|
561 | // channel icon
|
---|
562 | if (!is_nopoll('usercol6')) {
|
---|
563 | $(uid + " td.usercol6")
|
---|
564 | .attr('title', item.user.lastchanneltitle)
|
---|
565 | .data('sort-value', item.user.lastchannelsort);
|
---|
566 |
|
---|
567 | if (item.user.lca.length > 0) {
|
---|
568 | // if we already have a picon within link
|
---|
569 | if ($(uid + " > td.usercol6 > img.usericon").length) {
|
---|
570 | // we compare the picon name and switch if different
|
---|
571 | var image = $(uid + " > td.usercol6 > img.usericon");
|
---|
572 | if (image.attr('src') != 'image?i=IC_' + item.user.lca) {
|
---|
573 | // set title of link as tooltip
|
---|
574 | image.hide();
|
---|
575 | image.attr('src', 'image?i=IC_' + item.user.lca);
|
---|
576 | image.fadeIn('slow');
|
---|
577 | image.attr('alt', item.user.lastchanneltitle);
|
---|
578 | image.attr('title', item.user.lastchanneltitle);
|
---|
579 | }
|
---|
580 | } else {
|
---|
581 | // we have no image so we have to create one
|
---|
582 |
|
---|
583 | // if we have picon clear text
|
---|
584 | $(uid + " > td.usercol6").text('');
|
---|
585 |
|
---|
586 | // just to be sure that class of image is set
|
---|
587 | if ($(uid + " > td.usercol6 > img").length) {
|
---|
588 | $(uid + " > td.usercol6 > img").attr('class', 'usericon');
|
---|
589 | }
|
---|
590 |
|
---|
591 | newimage = $('<img class="usericon" src="image?i=IC_' + item.user.lca + '">');
|
---|
592 | newimage.hide();
|
---|
593 | $(uid + " > td.usercol6").append(newimage);
|
---|
594 | newimage.fadeIn('slow');
|
---|
595 | newimage.attr('alt', item.user.lastchanneltitle);
|
---|
596 | newimage.attr('title', item.user.lastchanneltitle);
|
---|
597 | }
|
---|
598 | } else {
|
---|
599 | $(uid + " td.usercol6").html(item.user.lastchannel);
|
---|
600 | }
|
---|
601 | }
|
---|
602 |
|
---|
603 | if (!is_nopoll('usercol7')) {
|
---|
604 | $(uid + " td.usercol7")
|
---|
605 | .text(item.user.stats.cwlastresptimems);
|
---|
606 | }
|
---|
607 | //usercol8 ???
|
---|
608 | if (!is_nopoll('usercol9')) {
|
---|
609 | $(uid + " td.usercol9").text(item.user.stats.cwok);
|
---|
610 | }
|
---|
611 | if (!is_nopoll('usercol10')) {
|
---|
612 | $(uid + " td.usercol10").text(item.user.stats.cwnok);
|
---|
613 | }
|
---|
614 | if (!is_nopoll('usercol11')) {
|
---|
615 | $(uid + " td.usercol11").text(item.user.stats.cwignore);
|
---|
616 | }
|
---|
617 | if (!is_nopoll('usercol12')) {
|
---|
618 | $(uid + " td.usercol12").text(item.user.stats.cwtimeout);
|
---|
619 | }
|
---|
620 | if (!is_nopoll('usercol13')) {
|
---|
621 | $(uid + " td.usercol13").text(item.user.stats.cwccyclechecked + ' / ' + item.user.stats.cwcycleok + ' / ' + item.user.stats.cwcyclenok + ' / ' + item.user.stats.cwcycleign);
|
---|
622 | }
|
---|
623 | if (!is_nopoll('usercol14')) {
|
---|
624 | $(uid + " td.usercol14").text(item.user.stats.cwcache);
|
---|
625 | }
|
---|
626 | if (!is_nopoll('usercol15')) {
|
---|
627 | $(uid + " td.usercol15").text(item.user.stats.cwtun);
|
---|
628 | }
|
---|
629 | if (!is_nopoll('usercol16')) {
|
---|
630 | $(uid + " td.usercol16").text(item.user.stats.cwcache);
|
---|
631 | }
|
---|
632 | if (!is_nopoll('usercol17')) {
|
---|
633 | $(uid + " td.usercol17").text(item.user.stats.emmok);
|
---|
634 | }
|
---|
635 | if (!is_nopoll('usercol18')) {
|
---|
636 | $(uid + " td.usercol18").text(item.user.stats.emmnok);
|
---|
637 | }
|
---|
638 | if (!is_nopoll('usercol19')) {
|
---|
639 | $(uid + " td.usercol19").text(item.user.stats.cwrate + item.user.stats.cwrate2);
|
---|
640 | }
|
---|
641 | if (!is_nopoll('usercol22')) {
|
---|
642 | $(uid + " td.usercol22").text(item.user.stats.cascusercomb);
|
---|
643 | }
|
---|
644 | if (!is_nopoll('usercol21')) {
|
---|
645 | $(uid + " td.usercol21").text(item.user.stats.n_requ_m);
|
---|
646 | }
|
---|
647 | if (!is_nopoll('usercol20')) {
|
---|
648 | $(uid + " td.usercol20")
|
---|
649 | .attr('title', item.user.expview)
|
---|
650 | .text(item.user.stats.expdate);
|
---|
651 | }
|
---|
652 | break;
|
---|
653 |
|
---|
654 | case 'connected':
|
---|
655 | $(uid).attr('class', item.user.classname);
|
---|
656 |
|
---|
657 | if (!is_nopoll('usercol1')) {
|
---|
658 | if ($(uid + " td.usercol1 > span.span_notifier").length) {
|
---|
659 | if(item.user.unotify){
|
---|
660 | $(uid + " td.usercol1 > span.span_notifier")
|
---|
661 | .text(item.user.unotify);
|
---|
662 | }
|
---|
663 | else {
|
---|
664 | $(uid + " td.usercol1 > span.span_notifier").remove();
|
---|
665 | }
|
---|
666 | }
|
---|
667 | else if(item.user.unotify) {
|
---|
668 | $(uid + " td.usercol1")
|
---|
669 | .append('<SPAN CLASS="span_notifier">'+ item.user.unotify + '</SPAN>');
|
---|
670 | }
|
---|
671 | }
|
---|
672 |
|
---|
673 | if (!is_nopoll('usercol2')) {
|
---|
674 | $(uid + " td.usercol2")
|
---|
675 | .attr('title', '')
|
---|
676 | .data('sort-value', item.user.ip)
|
---|
677 | .html("<B>" + item.user.status + "</B><br>" + item.user.ip);
|
---|
678 | }
|
---|
679 |
|
---|
680 | if (!is_nopoll('usercol3')) {
|
---|
681 | $(uid + " td.usercol3").html(item.user.stats.idle + "<br>" + item.user.stats.timeonchannel.toHHMMSS());
|
---|
682 | }
|
---|
683 |
|
---|
684 | if (!is_nopoll('usercol4')) {
|
---|
685 | if (item.user.protoicon.length > 0) {
|
---|
686 | if (!$(uid + " td.usercol4 > img").length || $(uid + " td.usercol4 > img").attr('src')!='image?i=IC_' + item.user.protoicon) {
|
---|
687 | var protoimage = $('<img class="protoicon" src="image?i=IC_' + item.user.protoicon + '" />');
|
---|
688 | protoimage.hide();
|
---|
689 | $(uid + " td.usercol4").html(protoimage);
|
---|
690 | protoimage.fadeIn('slow');
|
---|
691 | }
|
---|
692 | } else {
|
---|
693 | $(uid + " td.usercol4").text(item.user.protocol);
|
---|
694 | }
|
---|
695 | $(uid + " td.usercol4")
|
---|
696 | .attr('title', item.user.prototitle)
|
---|
697 | .data('sort-value', item.user.protosort);
|
---|
698 | }
|
---|
699 |
|
---|
700 | if (!is_nopoll('usercol6')) {
|
---|
701 | // channel icon
|
---|
702 | $(uid + " td.usercol6")
|
---|
703 | .attr('title', item.user.lastchanneltitle)
|
---|
704 | .data('sort-value', item.user.lastchannelsort);
|
---|
705 |
|
---|
706 | if (item.user.lca.length > 0) {
|
---|
707 | var image;
|
---|
708 | if ($(uid + " td.usercol6").html().length == 0) {
|
---|
709 | image = $('<img class="usericon" src="image?i=IC_' + item.user.lca + '" />');
|
---|
710 | image.hide();
|
---|
711 | $(uid + " td.usercol6").prepend(image);
|
---|
712 | image.fadeIn('slow');
|
---|
713 | } else {
|
---|
714 | image = $(uid + " td.usercol6 img.usericon");
|
---|
715 | if (image.attr('src') != ('image?i=IC_' + item.user.lca)) {
|
---|
716 | image.fadeOut('fast', function () {
|
---|
717 | image.attr('src', 'image?i=IC_' + item.user.lca);
|
---|
718 | image.fadeIn('slow');
|
---|
719 | });
|
---|
720 | image.attr('alt', item.user.lcb);
|
---|
721 | image.attr('title', item.user.lastchanneltitle);
|
---|
722 | }
|
---|
723 | }
|
---|
724 | } else {
|
---|
725 | $(uid + " td.usercol6").html(item.user.lastchannel);
|
---|
726 | }
|
---|
727 | }
|
---|
728 |
|
---|
729 | if (!is_nopoll('usercol7')) {
|
---|
730 | $(uid + " td.usercol7")
|
---|
731 | .text(item.user.stats.cwlastresptimems);
|
---|
732 | }
|
---|
733 | if (!is_nopoll('usercol19')) {
|
---|
734 | $(uid + " td.usercol19").text(item.user.stats.cwrate);
|
---|
735 | }
|
---|
736 | break;
|
---|
737 |
|
---|
738 | default:
|
---|
739 | //check the last status
|
---|
740 | if ('online,connected'.indexOf($(uid).attr('class')) > (-1)) {
|
---|
741 | // last status was online so cleanup offline
|
---|
742 | $(uid).attr('class', item.user.classname);
|
---|
743 | if (!is_nopoll('usercol1')) {
|
---|
744 | if ($(uid + " td.usercol1 > span.span_notifier").length) {
|
---|
745 | $(uid + " td.usercol1 > span.span_notifier").remove();
|
---|
746 | }
|
---|
747 | }
|
---|
748 | if (!is_nopoll('usercol2')) {
|
---|
749 | $(uid + " td.usercol2")
|
---|
750 | .attr('title', '')
|
---|
751 | .html(item.user.status);
|
---|
752 | }
|
---|
753 | if (!is_nopoll('usercol3')) {
|
---|
754 | $(uid + " td.usercol3").text('');
|
---|
755 | }
|
---|
756 | if (!is_nopoll('usercol4')) {
|
---|
757 | $(uid + " td.usercol4")
|
---|
758 | .text('')
|
---|
759 | .attr('title', '');
|
---|
760 | var protoimage = $(uid + " td.usercol4 img.protoicon");
|
---|
761 | if (image) {
|
---|
762 | protoimage.fadeOut('slow');
|
---|
763 | protoimage.remove();
|
---|
764 | }
|
---|
765 | }
|
---|
766 |
|
---|
767 | //channelicon
|
---|
768 | if (!is_nopoll('usercol6')) {
|
---|
769 | $(uid + " td.usercol6")
|
---|
770 | .text('')
|
---|
771 | .data('sort-value', '');
|
---|
772 |
|
---|
773 | var image = $(uid + " td.usercol6 img.usericon");
|
---|
774 | if (image) {
|
---|
775 | image.fadeOut('slow');
|
---|
776 | image.remove();
|
---|
777 | }
|
---|
778 | }
|
---|
779 | if (!is_nopoll('usercol7')) {
|
---|
780 | $(uid + " td.usercol7")
|
---|
781 | .text('');
|
---|
782 | }
|
---|
783 | }
|
---|
784 | break;
|
---|
785 | }
|
---|
786 |
|
---|
787 | if (typeof custompoll == 'function') {
|
---|
788 | custompoll(item);
|
---|
789 | }
|
---|
790 |
|
---|
791 | });
|
---|
792 |
|
---|
793 | // update user totals + ECM
|
---|
794 | updateTotals(data);
|
---|
795 |
|
---|
796 | // update footer
|
---|
797 | updateFooter(data);
|
---|
798 | }
|
---|
799 |
|
---|
800 | /*
|
---|
801 | * Readerpage Functions: Update Page
|
---|
802 | */
|
---|
803 | function updateReaderpage(data) {
|
---|
804 |
|
---|
805 | // update reader lines
|
---|
806 | $.each(data.oscam.readers, function (i, item) {
|
---|
807 | var uid = "#" + item.labelmd5;
|
---|
808 | poll_excluded = ($(uid).attr('nopoll') != undefined) ? $(uid).attr('nopoll') : '';
|
---|
809 |
|
---|
810 | $(uid).attr('class', item.classname);
|
---|
811 |
|
---|
812 | if (!is_nopoll('readercol4')) {
|
---|
813 | $(uid + " td.readercol4").text(item.stats.ecmsok + item.stats.ecmsokrel)
|
---|
814 | .data('sort-value', item.stats.ecmsok);
|
---|
815 | }
|
---|
816 | if (!is_nopoll('readercol19')) {
|
---|
817 | $(uid + " td.readercol19").text(item.stats.ecmsoklg + item.stats.ecmsoklgrel)
|
---|
818 | .data('sort-value', item.stats.ecmsoklg);
|
---|
819 | }
|
---|
820 | if (!is_nopoll('readercol5')) {
|
---|
821 | $(uid + " td.readercol5").text(item.stats.ecmsnok + item.stats.ecmsnokrel)
|
---|
822 | .data('sort-value', item.stats.ecmsnok);
|
---|
823 | }
|
---|
824 | if (!is_nopoll('readercol6')) {
|
---|
825 | $(uid + " td.readercol6").text(item.stats.ecmstout + item.stats.ecmstoutrel)
|
---|
826 | .data('sort-value', item.stats.ecmstout);
|
---|
827 | }
|
---|
828 | if (!is_nopoll('readercol7')) {
|
---|
829 | $(uid + " td.readercol7").text(item.stats.ecmsfiltered);
|
---|
830 | }
|
---|
831 | if (!is_nopoll('readercol8')) {
|
---|
832 | $(uid + " td.readercol8").text(item.stats.emmerror);
|
---|
833 | }
|
---|
834 | if (!is_nopoll('readercol9')) {
|
---|
835 | $(uid + " td.readercol9").text(item.stats.emmwritten);
|
---|
836 | }
|
---|
837 | if (!is_nopoll('readercol20')) {
|
---|
838 | $(uid + " td.readercol20").html( item.status + "<BR>" + item.ip);
|
---|
839 | }
|
---|
840 | if (!is_nopoll('readercol10')) {
|
---|
841 | $(uid + " td.readercol10").text(item.stats.emmskipped);
|
---|
842 | }
|
---|
843 | if (!is_nopoll('readercol11')) {
|
---|
844 | $(uid + " td.readercol11").text(item.stats.emmblocked);
|
---|
845 | }
|
---|
846 | if (!is_nopoll('readercol12')) {
|
---|
847 | $(uid + " td.readercol12").text(item.stats.lbweight);
|
---|
848 | }
|
---|
849 |
|
---|
850 | if (typeof custompoll == 'function') {
|
---|
851 | custompoll(item);
|
---|
852 | }
|
---|
853 | });
|
---|
854 |
|
---|
855 | // update user totals + ECM
|
---|
856 | updateTotals(data);
|
---|
857 |
|
---|
858 | // update footer
|
---|
859 | updateFooter(data);
|
---|
860 |
|
---|
861 | }
|
---|
862 |
|
---|
863 | /*
|
---|
864 | * LiveLog Functions: format the debuglevel switcher
|
---|
865 | */
|
---|
866 | function setDebuglevel(debug, maxdebug) {
|
---|
867 | var cs_dblevel = parseInt(debug);
|
---|
868 | var maxlevel = parseInt(maxdebug);
|
---|
869 | if (lastdebuglevel != cs_dblevel) {
|
---|
870 | var lvl = 0;
|
---|
871 | $("#debugfrom").text(' Switch Debug from ' + cs_dblevel + ' to ');
|
---|
872 | for (var i = 0; i < maxlevel; i++) {
|
---|
873 | lvl = 1 << i;
|
---|
874 | if (cs_dblevel & lvl) {
|
---|
875 | $("#debug" + lvl).attr('sendval', cs_dblevel - lvl);
|
---|
876 | } else {
|
---|
877 | $("#debug" + lvl).attr('sendval', cs_dblevel + lvl);
|
---|
878 | }
|
---|
879 | $("#debug" + lvl).attr('class', (cs_dblevel & lvl) ? 'debugls' : 'debugl');
|
---|
880 | }
|
---|
881 | lastdebuglevel = cs_dblevel;
|
---|
882 | }
|
---|
883 | }
|
---|
884 |
|
---|
885 | /*
|
---|
886 | * Livelog Functions: get filter color
|
---|
887 | */
|
---|
888 | function getLogColor(text) {
|
---|
889 |
|
---|
890 | if (nostorage) {
|
---|
891 | return null;
|
---|
892 | }
|
---|
893 |
|
---|
894 | for (var i = 1; i < MAX_SEARCH_PATTERN + 1; i++) {
|
---|
895 | var pattern = localStorage['regex' + i];
|
---|
896 | var color = localStorage['color' + i];
|
---|
897 | var fcolor = localStorage['fcolor' + i];
|
---|
898 | var hidden = localStorage['hidden' + i];
|
---|
899 | var beep = localStorage['beep' + i];
|
---|
900 | var regex = new RegExp(pattern);
|
---|
901 | if (pattern && (pattern != '') && (regex.exec(text))) {
|
---|
902 | return {
|
---|
903 | color: color,
|
---|
904 | fcolor: fcolor,
|
---|
905 | hidden: hidden,
|
---|
906 | beep: beep
|
---|
907 | }
|
---|
908 | }
|
---|
909 | }
|
---|
910 | return null;
|
---|
911 | }
|
---|
912 |
|
---|
913 | /*
|
---|
914 | * Livelog Functions: get whitelist state
|
---|
915 | */
|
---|
916 | function isWhitelisted(text) {
|
---|
917 |
|
---|
918 | if (nostorage) {
|
---|
919 | return 1;
|
---|
920 | }
|
---|
921 |
|
---|
922 | var numwhite = 0;
|
---|
923 | for (var i = 1; i < MAX_SEARCH_PATTERN + 1; i++) {
|
---|
924 | numwhite += parseInt(localStorage['whitelisted' + i]);
|
---|
925 | }
|
---|
926 | if (numwhite > 0) {
|
---|
927 | for (var i = 1; i < MAX_SEARCH_PATTERN + 1; i++) {
|
---|
928 | var whitelisted = localStorage['whitelisted' + i];
|
---|
929 | var pattern = localStorage['regex' + i];
|
---|
930 | var regex = new RegExp(pattern);
|
---|
931 | if (pattern && (pattern != '') && (whitelisted == '1') && (regex.exec(text))) {
|
---|
932 | return 1;
|
---|
933 | }
|
---|
934 | }
|
---|
935 | return 0;
|
---|
936 | } else {
|
---|
937 | return 1;
|
---|
938 | }
|
---|
939 | }
|
---|
940 |
|
---|
941 | /*
|
---|
942 | * LiveLog Functions: manage the delivered data / loglines
|
---|
943 | */
|
---|
944 | function updateLogpage(data) {
|
---|
945 |
|
---|
946 | lockpoll = 1;
|
---|
947 |
|
---|
948 | if (data.oscam.debug) {
|
---|
949 | setDebuglevel(data.oscam.debug, data.oscam.maxdebug);
|
---|
950 | }
|
---|
951 | if (data.oscam.logdisabled) {
|
---|
952 | stoppoll = 1;
|
---|
953 | $("#livelogdata").append('<li>Log is disabled</li>\n');
|
---|
954 | }
|
---|
955 |
|
---|
956 | $.each(data.oscam.lines, function (i, item) {
|
---|
957 |
|
---|
958 | if (isWhitelisted(Base64.decode(item.line))) {
|
---|
959 | var newcolor = getLogColor(Base64.decode(item.line));
|
---|
960 | var newline = $('<li class="' + decodeURIComponent(item.usr) + '">' + Base64.decode(item.line) + '</li>\n');
|
---|
961 | var hiddenline = 0;
|
---|
962 | if (newcolor) {
|
---|
963 | if (newcolor.hidden != '1') {
|
---|
964 | if (newcolor.color && newcolor.color != '') {
|
---|
965 | newline.css('background-color', newcolor.color);
|
---|
966 | }
|
---|
967 | if (newcolor.fcolor && newcolor.fcolor != '') {
|
---|
968 | newline.css('color', newcolor.fcolor);
|
---|
969 | }
|
---|
970 | $("#livelogdata").append(newline);
|
---|
971 | if (newcolor.beep == 1) {
|
---|
972 | beep(50, 4, 1000, 0.2);
|
---|
973 | }
|
---|
974 | } else {
|
---|
975 | hiddenline = 1;
|
---|
976 | }
|
---|
977 | } else {
|
---|
978 | $("#livelogdata").append(newline);
|
---|
979 | }
|
---|
980 |
|
---|
981 | if (!hiddenline) {
|
---|
982 | if ($("#livelog:hover").length) {
|
---|
983 | $('#livelog').stop(true);
|
---|
984 | } else {
|
---|
985 | $("#livelog").scrollTop($("#livelog").prop("scrollHeight"));
|
---|
986 | }
|
---|
987 | }
|
---|
988 | }
|
---|
989 | parameters = "?lastid=" + item.id;
|
---|
990 | });
|
---|
991 |
|
---|
992 | var len = $("#livelogdata li").length;
|
---|
993 | if (len > maxloglines) {
|
---|
994 | $("#livelogdata li").slice(0, len - maxloglines).remove();
|
---|
995 | }
|
---|
996 |
|
---|
997 | // update footer
|
---|
998 | updateFooter(data);
|
---|
999 |
|
---|
1000 | lockpoll = 0;
|
---|
1001 |
|
---|
1002 | }
|
---|
1003 |
|
---|
1004 | /*
|
---|
1005 | * Statuspage Functions: JQuery Extensions
|
---|
1006 | */
|
---|
1007 | $.fn.toHtmlString = function () {
|
---|
1008 | return $('<td></td>').html($(this).clone()).html();
|
---|
1009 | };
|
---|
1010 |
|
---|
1011 | /*
|
---|
1012 | * Statuspage Functions: Generate a Bar for Barchart
|
---|
1013 | */
|
---|
1014 | function generateBar(value) {
|
---|
1015 | var bar = $('<div class="bar"/>');
|
---|
1016 | var maxheight = 75; //$( "#graph" ).height() -15;
|
---|
1017 | var numval = parseInt(value);
|
---|
1018 | numval = Math.floor(numval / 30);
|
---|
1019 | if (numval >= maxheight) {
|
---|
1020 | bar.css('background-color', '#FF0000');
|
---|
1021 | numval = maxheight;
|
---|
1022 | }
|
---|
1023 | bar.css('height', numval + 'px');
|
---|
1024 | return bar;
|
---|
1025 | }
|
---|
1026 |
|
---|
1027 | /*
|
---|
1028 | * Statuspage Functions: Add/Remove Subheadline
|
---|
1029 | */
|
---|
1030 | function addremoveSubheadline(remove, data, container, subheadline, type) {
|
---|
1031 |
|
---|
1032 | if (remove == 1 && $("#" + subheadline).length) {
|
---|
1033 | $("#" + subheadline)
|
---|
1034 | .fadeOut('slow')
|
---|
1035 | .remove();
|
---|
1036 | $(".status tbody:empty").hide();
|
---|
1037 | }
|
---|
1038 |
|
---|
1039 | if (remove == 0 && !$("#" + subheadline).length) {
|
---|
1040 | $(container).removeAttr('style');
|
---|
1041 | var strheadline = '<TR id="' + subheadline + '"><TD CLASS="subheadline" COLSPAN="12">';
|
---|
1042 | if (type == 'c') {
|
---|
1043 | if (data.oscam.status.ucac != '') { //hide idle clients
|
---|
1044 | strheadline += '<P id="chead">Clients <span id="ucs">' + data.oscam.status.ucs + '</span>/<span id="uca">' + data.oscam.status.uca + '</span> (<span id="ucac">' + data.oscam.status.ucac + '</span> with ECM within last <span id="cfgh">' + data.oscam.status.cfgh + '</span> seconds)</P>'
|
---|
1045 | } else {
|
---|
1046 | strheadline += '<P id="chead">Clients <span id="ucs">' + data.oscam.status.ucs + '</span>/<span id="uca">' + data.oscam.status.uca + '</span></P>'
|
---|
1047 | }
|
---|
1048 | strheadline += '<DIV><input type="button" onclick="window.location.href = \'status.html?hideidle=5\';" value="Show Hidden" title="Show Hidden User">';
|
---|
1049 | strheadline += '<input type="button" onclick="window.location.href = \'status.html?hideidle=0\';" value="Show Idle" title="Show Idle User">';
|
---|
1050 | strheadline += '<input type="button" onclick="window.location.href = \'status.html?hideidle=1\';" value="Hide Idle" title="Hide Idle User">';
|
---|
1051 | } else if (type == 'm') {
|
---|
1052 | strheadline += '<P id="shead">Server <span id="scs">' + data.oscam.status.scs + '</span>/<span id="sca">' + data.oscam.status.sca + '</span> & Monitors <span id="mcs">' + data.oscam.status.mcs + '</span>/<span id="mca">' + data.oscam.status.mca + '</span></P>'
|
---|
1053 | strheadline += '<DIV><input type="button" onclick="window.location.href = \'status.html?hideidle=2\';" value="Show Hidden" title="Show Hidden Server & Monitors">';
|
---|
1054 | }
|
---|
1055 | strheadline += '</DIV></TD></TR>';
|
---|
1056 | var headline = $(strheadline);
|
---|
1057 | headline.hide();
|
---|
1058 | $(container).append(headline);
|
---|
1059 | headline.fadeIn('slow');
|
---|
1060 | }
|
---|
1061 | }
|
---|
1062 |
|
---|
1063 | /*
|
---|
1064 | * Statuspage Functions: Update Totals cacheEx
|
---|
1065 | */
|
---|
1066 | function updateCacheextotals(data) {
|
---|
1067 | $("#total_cachexpush").text(data.oscam.totals.total_cachexpush);
|
---|
1068 | $("#total_cachexgot").text(data.oscam.totals.total_cachexgot);
|
---|
1069 | $("#total_cachexhit").text(data.oscam.totals.total_cachexhit);
|
---|
1070 | $("#rel_cachexhit").text(data.oscam.totals.rel_cachexhit);
|
---|
1071 | $("#total_cachesize").text(data.oscam.totals.total_cachesize);
|
---|
1072 | }
|
---|
1073 |
|
---|
1074 | /*
|
---|
1075 | * Statuspage Functions: Update Totals User + Totals Reader + ECM + EMM
|
---|
1076 | */
|
---|
1077 | function updateTotals(data) {
|
---|
1078 | $("#total_users").text(data.oscam.totals.total_users);
|
---|
1079 | $("#total_active").text(data.oscam.totals.total_active);
|
---|
1080 | $("#total_connected").text(data.oscam.totals.total_connected);
|
---|
1081 | $("#total_online").text(data.oscam.totals.total_online);
|
---|
1082 | $("#total_disabled").text(data.oscam.totals.total_disabled);
|
---|
1083 | $("#total_expired").text(data.oscam.totals.total_expired);
|
---|
1084 | $("#total_readers").text(data.oscam.totals.total_readers);
|
---|
1085 | $("#total_active_readers").text(data.oscam.totals.total_active_readers);
|
---|
1086 | $("#total_connected_readers").text(data.oscam.totals.total_connected_readers);
|
---|
1087 | $("#total_disabled_readers").text(data.oscam.totals.total_disabled_readers);
|
---|
1088 | $("#total_cwok").text(data.oscam.totals.total_cwok);
|
---|
1089 | $("#total_cwok_readers").text(data.oscam.totals.total_cwok_readers);
|
---|
1090 | $("#rel_cwok").text(data.oscam.totals.rel_cwok);
|
---|
1091 | $("#rel_cwok_readers").text(data.oscam.totals.rel_cwok_readers);
|
---|
1092 | $("#total_cwcache").text(data.oscam.totals.total_cwcache);
|
---|
1093 | $("#rel_cwcache").text(data.oscam.totals.rel_cwcache);
|
---|
1094 | $("#total_cwnok").text(data.oscam.totals.total_cwnok);
|
---|
1095 | $("#total_cwnok_readers").text(data.oscam.totals.total_cwnok_readers);
|
---|
1096 | $("#rel_cwnok").text(data.oscam.totals.rel_cwnok);
|
---|
1097 | $("#rel_cwnok_readers").text(data.oscam.totals.rel_cwnok_readers);
|
---|
1098 | $("#total_cwtout").text(data.oscam.totals.total_cwtout);
|
---|
1099 | $("#total_cwtout_readers").text(data.oscam.totals.total_cwtout_readers);
|
---|
1100 | $("#rel_cwtout").text(data.oscam.totals.rel_cwtout);
|
---|
1101 | $("#rel_cwtout_readers").text(data.oscam.totals.rel_cwtout_readers);
|
---|
1102 | $("#total_cwign").text(data.oscam.totals.total_cwign);
|
---|
1103 | //$( "#rel_cwign" ).text( data.oscam.totals.rel_cwign );
|
---|
1104 | $("#total_ecm_min").text(data.oscam.totals.total_ecm_min);
|
---|
1105 | $("#total_cw").text(data.oscam.totals.total_cw);
|
---|
1106 | $("#total_cwpos").text(data.oscam.totals.total_cwpos);
|
---|
1107 | $("#total_cwpos_readers").text(data.oscam.totals.total_cwpos_readers);
|
---|
1108 | $("#rel_cwpos").text(data.oscam.totals.rel_cwpos);
|
---|
1109 | $("#rel_cwpos_readers").text(data.oscam.totals.rel_cwpos_readers);
|
---|
1110 | $("#total_cwneg").text(data.oscam.totals.total_cwneg);
|
---|
1111 | $("#total_cwneg_readers").text(data.oscam.totals.total_cwneg_readers);
|
---|
1112 | $("#rel_cwneg").text(data.oscam.totals.rel_cwneg);
|
---|
1113 | $("#rel_cwneg_readers").text(data.oscam.totals.rel_cwneg_readers);
|
---|
1114 | $("#total_emok").text(data.oscam.totals.total_emok);
|
---|
1115 | $("#rel_emok").text(data.oscam.totals.rel_emok);
|
---|
1116 | $("#total_emnok").text(data.oscam.totals.total_emnok);
|
---|
1117 | $("#rel_emnok").text(data.oscam.totals.rel_emnok);
|
---|
1118 | $("#total_em").text(data.oscam.totals.total_em);
|
---|
1119 | $("#total_elenr").text(data.oscam.totals.total_elenr);
|
---|
1120 | $("#total_eheadr").text(data.oscam.totals.total_eheadr);
|
---|
1121 | $("#total_emmerroruk_readers").text(data.oscam.totals.total_emmerroruk_readers);
|
---|
1122 | $("#total_emmerrorg_readers").text(data.oscam.totals.total_emmerrorg_readers);
|
---|
1123 | $("#total_emmerrors_readers").text(data.oscam.totals.total_emmerrors_readers);
|
---|
1124 | $("#total_emmerroruq_readers").text(data.oscam.totals.total_emmerroruq_readers);
|
---|
1125 | $("#total_emmwrittenuk_readers").text(data.oscam.totals.total_emmwrittenuk_readers);
|
---|
1126 | $("#total_emmwritteng_readers").text(data.oscam.totals.total_emmwritteng_readers);
|
---|
1127 | $("#total_emmwrittens_readers").text(data.oscam.totals.total_emmwrittens_readers);
|
---|
1128 | $("#total_emmwrittenuq_readers").text(data.oscam.totals.total_emmwrittenuq_readers);
|
---|
1129 | $("#total_emmskippeduk_readers").text(data.oscam.totals.total_emmskippeduk_readers);
|
---|
1130 | $("#total_emmskippedg_readers").text(data.oscam.totals.total_emmskippedg_readers);
|
---|
1131 | $("#total_emmskippeds_readers").text(data.oscam.totals.total_emmskippeds_readers);
|
---|
1132 | $("#total_emmskippeduq_readers").text(data.oscam.totals.total_emmskippeduq_readers);
|
---|
1133 | $("#total_emmblockeduk_readers").text(data.oscam.totals.total_emmblockeduk_readers);
|
---|
1134 | $("#total_emmblockedg_readers").text(data.oscam.totals.total_emmblockedg_readers);
|
---|
1135 | $("#total_emmblockeds_readers").text(data.oscam.totals.total_emmblockeds_readers);
|
---|
1136 | $("#total_emmblockeduq_readers").text(data.oscam.totals.total_emmblockeduq_readers);
|
---|
1137 | $("#total_sum_all_readers_ecm").text(data.oscam.totals.total_sum_all_readers_ecm);
|
---|
1138 | $("#total_sum_all_readers_emm").text(data.oscam.totals.total_sum_all_readers_emm);
|
---|
1139 | }
|
---|
1140 |
|
---|
1141 | /*
|
---|
1142 | * Statuspage Functions: Update Totals Sysinfo
|
---|
1143 | */
|
---|
1144 | var first_run = 1;
|
---|
1145 |
|
---|
1146 | function updateSysinfo(data) {
|
---|
1147 | $("#mem_cur_total").text(data.oscam.sysinfo.mem_cur_total);
|
---|
1148 | $("#mem_cur_free").text(data.oscam.sysinfo.mem_cur_free);
|
---|
1149 | $("#mem_cur_used").text(data.oscam.sysinfo.mem_cur_used);
|
---|
1150 | $("#mem_cur_buff").text(data.oscam.sysinfo.mem_cur_buff);
|
---|
1151 | $("#mem_cur_cached").text(data.oscam.sysinfo.mem_cur_cached);
|
---|
1152 | $("#mem_cur_freem").attr('title', 'max Free: ' + data.oscam.sysinfo.mem_cur_freem + ' \n(incl. Buffer & Cached)');
|
---|
1153 | $("#mem_cur_totalsw").text(data.oscam.sysinfo.mem_cur_totalsw);
|
---|
1154 | $("#mem_cur_freesw").text(data.oscam.sysinfo.mem_cur_freesw);
|
---|
1155 | $("#mem_cur_usedsw").text(data.oscam.sysinfo.mem_cur_usedsw);
|
---|
1156 | $("#mem_cur_shared").text(data.oscam.sysinfo.mem_cur_shared);
|
---|
1157 | $("#oscam_vmsize").text(data.oscam.sysinfo.oscam_vmsize);
|
---|
1158 | $("#oscam_rsssize").text(data.oscam.sysinfo.oscam_rsssize);
|
---|
1159 | $("#server_procs").text(data.oscam.sysinfo.server_procs);
|
---|
1160 | $("#cpu_load_0").text(data.oscam.sysinfo.cpu_load_0);
|
---|
1161 | $("#cpu_load_1").text(data.oscam.sysinfo.cpu_load_1);
|
---|
1162 | $("#cpu_load_2").text(data.oscam.sysinfo.cpu_load_2);
|
---|
1163 | if (!first_run) {
|
---|
1164 | $("#oscam_refresh").text(data.oscam.sysinfo.oscam_refresh);
|
---|
1165 | $("#oscam_cpu_user").text(data.oscam.sysinfo.oscam_cpu_user);
|
---|
1166 | $("#oscam_cpu_sys").text(data.oscam.sysinfo.oscam_cpu_sys);
|
---|
1167 | $("#oscam_cpu_sum").text(data.oscam.sysinfo.oscam_cpu_sum);
|
---|
1168 | }
|
---|
1169 | first_run = 0;
|
---|
1170 | }
|
---|
1171 |
|
---|
1172 | /*
|
---|
1173 | * Statuspage Functions: Update Page
|
---|
1174 | */
|
---|
1175 | function updateStatuspage(data) {
|
---|
1176 |
|
---|
1177 | var updatedclients = "";
|
---|
1178 | // update status lines
|
---|
1179 | $.each(data.oscam.status.client, function (i, item) {
|
---|
1180 | var newrow;
|
---|
1181 |
|
---|
1182 | //add ID's for type c and m to list of existing elements. We need this to delete all not longer existing
|
---|
1183 | updatedclients += item.thid + ",";
|
---|
1184 |
|
---|
1185 | var uid = "#" + item.thid;
|
---|
1186 | poll_excluded = ($(uid).attr('nopoll') != undefined) ? $(uid).attr('nopoll') : '';
|
---|
1187 |
|
---|
1188 | if (!$(uid).length && 'rpcxm'.indexOf(item.type) > (-1)) {
|
---|
1189 | //build new row
|
---|
1190 | var rowcontent = '<TR ID="' + item.thid + '"><TD CLASS="statuscol0"/><TD CLASS="statuscol1"/><TD CLASS="statuscol4"/>';
|
---|
1191 | rowcontent += '<TD CLASS="statuscol5"/><TD CLASS="statuscol7"/><TD CLASS="statuscol8"/><TD CLASS="statuscol9"/>';
|
---|
1192 | rowcontent += '<TD CLASS="statuscol12"/><TD CLASS="statuscol13"/><TD CLASS="statuscol14"/><TD CLASS="statuscol15"/>';
|
---|
1193 | rowcontent += '<TD CLASS="statuscol16"/></TR>';
|
---|
1194 | newrow = $(rowcontent);
|
---|
1195 | newrow.hide();
|
---|
1196 | // if we have no clients we have to add the headline first
|
---|
1197 |
|
---|
1198 | // append new clientrow to table
|
---|
1199 | var container = '';
|
---|
1200 | if ('hms'.indexOf(item.type) > (-1)) {
|
---|
1201 | container = '#tbodys';
|
---|
1202 | if (item.type == 'm') {
|
---|
1203 | if (!$("#Serverheadline").length) {
|
---|
1204 | addremoveSubheadline(0, data, container, "Serverheadline", item.type);
|
---|
1205 | } else if (!$("#mca").length) {
|
---|
1206 | $("#shead").append(' & Monitors <span id="mcs">' + data.oscam.status.mcs + '</span>/<span id="mca">' + data.oscam.status.mca + '</span>');
|
---|
1207 | }
|
---|
1208 | }
|
---|
1209 | } else if ('px'.indexOf(item.type) > (-1)) {
|
---|
1210 | container = '#tbodyp';
|
---|
1211 | } else {
|
---|
1212 | container = '#tbody' + item.type;
|
---|
1213 | if (!$("#Userheadline").length && item.type == 'c') {
|
---|
1214 | addremoveSubheadline(0, data, container, "Userheadline", item.type);
|
---|
1215 | }
|
---|
1216 | }
|
---|
1217 | $(container).append(newrow);
|
---|
1218 |
|
---|
1219 | var name1, name2, name3, kill1, kill2, kill3, edit1;
|
---|
1220 | switch (item.type) {
|
---|
1221 | case 'c':
|
---|
1222 | case 'm':
|
---|
1223 | name1 = 'User';
|
---|
1224 | name2 = item.name_enc;
|
---|
1225 | kill1 = '" href="status.html?action=kill&threadid=' + item.thid.substring(3, item.thid.length);
|
---|
1226 | kill2 = 'Kill'
|
---|
1227 | kill3 = 'ICKIL';
|
---|
1228 | edit1 = 'user_edit.html?user=';
|
---|
1229 | break;
|
---|
1230 | case 'r':
|
---|
1231 | case 'p':
|
---|
1232 | case 'x':
|
---|
1233 | name1 = (item.type == 'r') ? 'Reader' : 'Proxy';
|
---|
1234 | name2 = item.rname_enc;
|
---|
1235 | kill1 = '" href="status.html?action=restart&label=' + name2;
|
---|
1236 | kill2 = 'Restart';
|
---|
1237 | kill3 = 'ICRES';
|
---|
1238 | edit1 = 'readerconfig.html?label=';
|
---|
1239 | break;
|
---|
1240 | }
|
---|
1241 | name3 = decodeURIComponent(name2);
|
---|
1242 |
|
---|
1243 | if (!is_nopoll('statuscol0')) {
|
---|
1244 | $(uid + " > td.statuscol0").append('<a title="Hide ' +
|
---|
1245 | name1 + ': ' + name3 + (item.desc ? '\n' + item.desc.replace(' ', '') : '') +
|
---|
1246 | '" href="status.html?hide=' +
|
---|
1247 | item.thid.substring(3, item.thid.length) +
|
---|
1248 | '"><img class="icon" alt="Hide"' +
|
---|
1249 | '" src="image?i=ICHID"></img>');
|
---|
1250 | }
|
---|
1251 |
|
---|
1252 | if (!is_nopoll('statuscol1')) {
|
---|
1253 | $(uid + " > td.statuscol1").append('<a title="' + kill2 + ' ' +
|
---|
1254 | name1 + ': ' + name3 + (item.desc ? '\n' + item.desc.replace(' ', '') : '') +
|
---|
1255 | kill1 + '"><img class="icon" alt="' + kill2 +
|
---|
1256 | '" src="image?i=' + kill3 + '"></img>');
|
---|
1257 | }
|
---|
1258 |
|
---|
1259 | if (!is_nopoll('statuscol4')) {
|
---|
1260 | if (data.oscam.piconenabled == "1" && !item.upicmissing) {
|
---|
1261 | $(uid + " > td.statuscol4").append('<a href="' + edit1 + name2 + '"><img class="statususericon" title="Edit ' +
|
---|
1262 | name1 + ': ' + name3 + (item.desc ? '\n' + item.desc.replace(' ', '') : '') + '" src="image?i=IC_' + name2 + '"></img></a>');
|
---|
1263 | } else {
|
---|
1264 | $(uid + " > td.statuscol4").append('<a href="' + edit1 + name2 + '" title="Edit ' + name1 + ': ' +
|
---|
1265 | name3 + (item.desc ? '\n' + item.desc.replace(' ', '') : '') + '\n' + item.upicmissing + '">' + name3 + '</a>');
|
---|
1266 | }
|
---|
1267 | }
|
---|
1268 |
|
---|
1269 | if (!is_nopoll('statuscol13')) {
|
---|
1270 | $(uid + " > td.statuscol13").append('<A HREF="files.html?file=' + data.oscam.srvidfile + '" TITLE="' + item.request + '"/>');
|
---|
1271 | }
|
---|
1272 |
|
---|
1273 | if (!is_nopoll('statuscol9')) {
|
---|
1274 | if (data.oscam.piconenabled == "1" && item.protoicon) {
|
---|
1275 | $(uid + " > td.statuscol9").append('<img class="protoicon" title="Protocol ' + item.protocol + ' ' +
|
---|
1276 | item.protocolext + '" alt="IC_' + item.protoicon + '" src="image?i=IC_' + item.protoicon + '"></img>');
|
---|
1277 | } else {
|
---|
1278 | $(uid + " > td.statuscol9").attr('title', item.protocolext).text(item.protocol);
|
---|
1279 | }
|
---|
1280 | }
|
---|
1281 | }
|
---|
1282 |
|
---|
1283 | $(uid).attr('class', item.type).data('ecmhistory', item.request.ecmhistory).removeAttr('style');
|
---|
1284 |
|
---|
1285 | // fix for anonymous newcamd-clients
|
---|
1286 | if ($(uid + " > td.statuscol4").text().match('anonymous')) {
|
---|
1287 | if (!is_nopoll('statuscol9')) {
|
---|
1288 | if (data.oscam.piconenabled == "1" && item.protoicon) {
|
---|
1289 | $(uid + " > td.statuscol9").html('<img class="protoicon" title="Protocol ' + item.protocol + ' ' +
|
---|
1290 | item.protocolext + '" alt="IC_' + item.protoicon + '" src="image?i=IC_' + item.protoicon + '"></img>');
|
---|
1291 | } else {
|
---|
1292 | $(uid + " > td.statuscol9").attr('title', item.protocolext).text(item.protocol);
|
---|
1293 | }
|
---|
1294 | }
|
---|
1295 |
|
---|
1296 | if (!is_nopoll('statuscol4')) {
|
---|
1297 | if (data.oscam.piconenabled == "1" && !item.upicmissing) {
|
---|
1298 | $(uid + " > td.statuscol4").html('<a href="user_edit.html?user=' + item.name_enc +
|
---|
1299 | '"><img class="statususericon" title="Edit User: ' + decodeURIComponent(item.name_enc) + item.desc +
|
---|
1300 | '" src="image?i=IC_' + item.name_enc + '"></img></a>');
|
---|
1301 | } else {
|
---|
1302 | $(uid + " > td.statuscol4").html('<a href="user_edit.html?user=' + item.name_enc + '" title="Edit User: ' +
|
---|
1303 | decodeURIComponent(item.name_enc) + item.desc + item.upicmissing + '">' + decodeURIComponent(item.name_enc) + '</a>');
|
---|
1304 | }
|
---|
1305 | }
|
---|
1306 | }
|
---|
1307 |
|
---|
1308 | if (!is_nopoll('statuscol5')) {
|
---|
1309 | switch (item.au) {
|
---|
1310 | case '0':
|
---|
1311 | $(uid + " > td.statuscol5").text('OFF').attr('class', 'statuscol5 statuscol5OFF');
|
---|
1312 | break;
|
---|
1313 | case '-1':
|
---|
1314 | $(uid + " > td.statuscol5").html('<a class="tooltip" href="#">ON<span>' + item.aufmt + '</span></a>').attr('class', 'statuscol5 statuscol5ON');
|
---|
1315 | break;
|
---|
1316 | default:
|
---|
1317 | $(uid + " > td.statuscol5").html('<a class="tooltip" href="#">ACTIVE<span>' + item.aufmt + '</span></a>').attr('class', 'statuscol5 statuscol5ACTIVE');
|
---|
1318 | break;
|
---|
1319 | }
|
---|
1320 | }
|
---|
1321 |
|
---|
1322 | if (!is_nopoll('statuscol4')) {
|
---|
1323 | $(uid + " > td.statuscol4").attr('title', decodeURIComponent(item.type == 'c' ? item.name_enc : item.rname_enc) + (item.desc ? '\n' + item.desc.replace(' ', '') : ''));
|
---|
1324 | }
|
---|
1325 | if (!is_nopoll('statuscol7')) {
|
---|
1326 | $(uid + " > td.statuscol7").text(item.connection.ip);
|
---|
1327 | }
|
---|
1328 | if (!is_nopoll('statuscol8')) {
|
---|
1329 | $(uid + " > td.statuscol8").text(item.connection.port);
|
---|
1330 | }
|
---|
1331 | if (!is_nopoll('statuscol9')) {
|
---|
1332 | $(uid + " > td.statuscol9").attr('title', item.protocolext);
|
---|
1333 | }
|
---|
1334 | if (!is_nopoll('statuscol12')) {
|
---|
1335 | $(uid + " > td.statuscol12").text(item.request.srvid + ':' + item.request.caid + '@' + item.request.provid);
|
---|
1336 | }
|
---|
1337 |
|
---|
1338 | if (!is_nopoll('statuscol13')) {
|
---|
1339 | var newimage;
|
---|
1340 |
|
---|
1341 | if (data.oscam.piconenabled == '1' && item.request.srvid != '0000' && item.request.picon) {
|
---|
1342 |
|
---|
1343 | // if we already have a picon within link
|
---|
1344 | if ($(uid + " > td.statuscol13 > a > img.statususericon").length) {
|
---|
1345 | // we compare the picon name and switch if different
|
---|
1346 | var image = $(uid + " > td.statuscol13 > a > img.statususericon");
|
---|
1347 | if (image.attr('src') != 'image?i=IC_' + item.request.picon) {
|
---|
1348 | // set title of link as tooltip
|
---|
1349 | $(uid + " > td.statuscol13 > a").attr('title', item.request.chname + item.request.chprovider);
|
---|
1350 | image.hide();
|
---|
1351 | image.attr('src', 'image?i=IC_' + item.request.picon);
|
---|
1352 | image.fadeIn('slow');
|
---|
1353 | }
|
---|
1354 | } else {
|
---|
1355 | // we have no image so we have to create one
|
---|
1356 |
|
---|
1357 | // if we have picon clear text
|
---|
1358 | $(uid + " > td.statuscol13").text('');
|
---|
1359 |
|
---|
1360 | // if we have no link we create one
|
---|
1361 | if (!$(uid + " > td.statuscol13 > a").length) {
|
---|
1362 | $(uid + " > td.statuscol13").append('<a href="files.html?file=' + data.oscam.srvidfile + '"/>');
|
---|
1363 | }
|
---|
1364 | // set title of link as tooltip
|
---|
1365 | $(uid + " > td.statuscol13 > a").attr('title', item.request.chname + item.request.chprovider);
|
---|
1366 |
|
---|
1367 | // just to be sure that class of image is set
|
---|
1368 | if ($(uid + " > td.statuscol13 > a > img").length) {
|
---|
1369 | $(uid + " > td.statuscol13 > a > img").attr('class', 'statususericon');
|
---|
1370 | }
|
---|
1371 |
|
---|
1372 | newimage = $('<img class="statususericon" src="image?i=IC_' + item.request.picon + '">');
|
---|
1373 | newimage.hide();
|
---|
1374 | $(uid + " > td.statuscol13 > a").append(newimage);
|
---|
1375 | newimage.fadeIn('slow');
|
---|
1376 | }
|
---|
1377 |
|
---|
1378 | } else {
|
---|
1379 | // picon is not delivered in JSON - we set the text of column
|
---|
1380 | if (item.request.chname && item.request.srvid != '0000') {
|
---|
1381 | $(uid + " > td.statuscol13").html('<a href="files.html?file=' + data.oscam.srvidfile + '"/>');
|
---|
1382 | $(uid + " > td.statuscol13 > a").html(item.request.chname + item.request.chprovider);
|
---|
1383 | $(uid + " > td.statuscol13 > a").attr('title', item.request.chname + item.request.chprovider);
|
---|
1384 | } else {
|
---|
1385 | $(uid + " > td.statuscol13").html('');
|
---|
1386 | }
|
---|
1387 | }
|
---|
1388 | }
|
---|
1389 |
|
---|
1390 | if (!is_nopoll('statuscol14')) {
|
---|
1391 | if ('hms'.indexOf(item.type) > (-1)) {
|
---|
1392 | $(uid + " > td.statuscol14").text('');
|
---|
1393 | } else {
|
---|
1394 | var value = item.type == 'c' ? (item.request.answered ? item.request.answered + ' (' + item.request.msvalue + ' ms)' : '') : item.request.lbvalue;
|
---|
1395 | if (data.oscam.lbdefined) {
|
---|
1396 | var label = item.rname_enc.replace('+%28cache%29', '');
|
---|
1397 | var name = item.type == 'c' ? item.request.answered.replace(' (cache)', '') : decodeURIComponent(label);
|
---|
1398 | if (!$(uid + " > td.statuscol14 > a").length) {
|
---|
1399 | $(uid + " > td.statuscol14")
|
---|
1400 | .text('')
|
---|
1401 | .append('<a href="readerstats.html?label=' + label + '&show=0" TITLE="Show statistics for: ' + name + '">');
|
---|
1402 | } else {
|
---|
1403 | $(uid + " > td.statuscol14 > a")
|
---|
1404 | .attr('href','readerstats.html?label=' + label + '&show=0')
|
---|
1405 | .attr('title','Show statistics for: ' + name);
|
---|
1406 | }
|
---|
1407 | $(uid + " > td.statuscol14 > a").text(value);
|
---|
1408 | } else {
|
---|
1409 | $(uid + " > td.statuscol14").text(value);
|
---|
1410 | }
|
---|
1411 | }
|
---|
1412 | }
|
---|
1413 |
|
---|
1414 | if (!is_nopoll('statuscol15')) {
|
---|
1415 | if ($("#onlineidle").text() != 'Login*') {
|
---|
1416 | $(uid + " > td.statuscol15")
|
---|
1417 | .html(item.times.online.toHHMMSS() + '<br>' + item.times.idle.toHHMMSS())
|
---|
1418 | .attr('title', 'Login: ' + item.times.loginfmt);
|
---|
1419 | } else {
|
---|
1420 | $(uid + " > td.statuscol15")
|
---|
1421 | .html(item.times.loginfmt.substring(0, 8) + '<br>' + item.times.loginfmt.substring(10, 18))
|
---|
1422 | .attr('title', 'Online: ' + item.times.online.toHHMMSS() + '\nIDLE: ' + item.times.idle.toHHMMSS());
|
---|
1423 | }
|
---|
1424 | }
|
---|
1425 |
|
---|
1426 | if (!is_nopoll('statuscol16')) {
|
---|
1427 | var entitlement = '';
|
---|
1428 |
|
---|
1429 | switch (item.type) {
|
---|
1430 | case 'r':
|
---|
1431 | // entitlement for native cards
|
---|
1432 |
|
---|
1433 | var activeentitlements = item.connection.entitlements.length;
|
---|
1434 | if (activeentitlements > 0) {
|
---|
1435 | entitlement += '<br><a href="entitlements.html?label=' + item.rname_enc + '&hideexpired=1" class="tooltip">';
|
---|
1436 | entitlement += '(' + activeentitlements + ' entitlement' + ((activeentitlements != 1) ? 's)' : ')');
|
---|
1437 | entitlement += '<span>';
|
---|
1438 | $.each(item.connection.entitlements, function (i, obj) {
|
---|
1439 | entitlement += obj.caid + ':' + obj.provid + '<br>' + obj.exp + '<br><br>';
|
---|
1440 | });
|
---|
1441 | entitlement = entitlement.substring(0, entitlement.length - 4);
|
---|
1442 | entitlement += '</span></a>';
|
---|
1443 | } else {
|
---|
1444 | entitlement += '<br><a href="entitlements.html?label=';
|
---|
1445 | entitlement += item.rname_enc + '&hideexpired=1" class="tooltip1">(no entitlements)<span>No active entitlements found</span></a>';
|
---|
1446 | }
|
---|
1447 | break;
|
---|
1448 |
|
---|
1449 | case 'p':
|
---|
1450 | if (item.connection.entitlements.length > 0 && item.protocol.indexOf('cccam') > -1) {
|
---|
1451 | // cccam
|
---|
1452 | var entobj = item.connection.entitlements[0];
|
---|
1453 | entitlement += '<br><a href="entitlements.html?label=' + item.rname_enc + '" class="tooltip' + entobj.cccreshare + '">';
|
---|
1454 | entitlement += '(' + entobj.locals + ' of ' + entobj.cccount + ' card' + (entobj.cccount > 1 ? "s" : "") + ')';
|
---|
1455 | entitlement += '<span>card_count=' + entobj.cccount + '<br>';
|
---|
1456 | entitlement += 'hop1=' + entobj.ccchop1 + '<br>';
|
---|
1457 | entitlement += 'hop2=' + entobj.ccchop2 + '<br>';
|
---|
1458 | entitlement += 'hopx=' + entobj.ccchopx + '<br>';
|
---|
1459 | entitlement += 'currenthops=' + entobj.ccccurr + '<br><br>';
|
---|
1460 | entitlement += 'reshare0=' + entobj.cccres0 + '<br>';
|
---|
1461 | entitlement += 'reshare1=' + entobj.cccres1 + '<br>';
|
---|
1462 | entitlement += 'reshare2=' + entobj.cccres2 + '<br>';
|
---|
1463 | entitlement += 'resharex=' + entobj.cccresx + '</span></a>';
|
---|
1464 | }
|
---|
1465 | if (item.protocol.indexOf('gbox') > -1) {
|
---|
1466 | // TO DO gbox
|
---|
1467 | var $html = $(uid + " > td.statuscol16").toHtmlString();
|
---|
1468 | if ($html != undefined) {
|
---|
1469 | entitlement = $html.substring($html.indexOf('<br>'), $html.indexOf('</a>'));
|
---|
1470 | if (entitlement) entitlement += '</a>';
|
---|
1471 | }
|
---|
1472 | }
|
---|
1473 | break;
|
---|
1474 | }
|
---|
1475 |
|
---|
1476 | $(uid + " > td.statuscol16").empty().html(item.connection.status + entitlement).attr('class', 'statuscol16 statuscol16' + item.connection.status);
|
---|
1477 | }
|
---|
1478 |
|
---|
1479 | if (newrow) {
|
---|
1480 | newrow.fadeIn("slow");
|
---|
1481 | }
|
---|
1482 |
|
---|
1483 | if (typeof custompoll == 'function') {
|
---|
1484 | custompoll(item);
|
---|
1485 | }
|
---|
1486 |
|
---|
1487 | });
|
---|
1488 |
|
---|
1489 | //remove non existing elements
|
---|
1490 | $("tr.c, tr.m, tr.r, tr.p, tr.h").each(function () {
|
---|
1491 | if (updatedclients.indexOf($(this).attr('id')) == -1) {
|
---|
1492 | $(this).fadeOut('slow').remove();
|
---|
1493 | }
|
---|
1494 | });
|
---|
1495 |
|
---|
1496 | // if we have no clients left we remove the headline
|
---|
1497 | if (!$("tr.c").length && data.oscam.status.uca == '0') {
|
---|
1498 | addremoveSubheadline(1, '', '', "Userheadline", 'c');
|
---|
1499 | }
|
---|
1500 | // if we have no servers/monitors left we remove the headline
|
---|
1501 | if (!$("tr.m").length && data.oscam.status.mca == '0') {
|
---|
1502 | if ($("#mca").length) {
|
---|
1503 | $("#shead").replaceWith('<P id="shead">Server <span id="scs">' + data.oscam.status.scs + '</span>/<span id="sca">' + data.oscam.status.sca + '</span></P>');
|
---|
1504 | }
|
---|
1505 | if (!$("tr.s").length && !$("tr.h").length && data.oscam.status.sch == '0') {
|
---|
1506 | addremoveSubheadline(1, '', '', "Serverheadline", 'm');
|
---|
1507 | }
|
---|
1508 | }
|
---|
1509 |
|
---|
1510 | //update client-headline
|
---|
1511 | if (data.oscam.status.uca != '0') {
|
---|
1512 | if (!$("#Userheadline").length) {
|
---|
1513 | addremoveSubheadline(0, data, "#tbodyc", "Userheadline", "c");
|
---|
1514 | } else {
|
---|
1515 | $("#ucs").text(data.oscam.status.ucs);
|
---|
1516 | $("#uca").text(data.oscam.status.uca);
|
---|
1517 | if (data.oscam.status.ucac != '0') $("#ucac").text(data.oscam.status.ucac);
|
---|
1518 | }
|
---|
1519 | }
|
---|
1520 | //update server/monitor-headline
|
---|
1521 | if (data.oscam.status.mca != '0' && $("#mcs")) {
|
---|
1522 | $("#mcs").text(data.oscam.status.mcs);
|
---|
1523 | $("#mca").text(data.oscam.status.mca);
|
---|
1524 | }
|
---|
1525 |
|
---|
1526 | //update reader-headline
|
---|
1527 | if(data.oscam.status.rco != '0') {
|
---|
1528 | var rcon = (data.oscam.status.rca - data.oscam.status.rco);
|
---|
1529 | if($("#rco").length) {
|
---|
1530 | $("#rcc").text(data.oscam.status.rcc);
|
---|
1531 | $("#rca").text(data.oscam.status.rca);
|
---|
1532 | $("#rco").text(rcon);
|
---|
1533 | } else {
|
---|
1534 | $("#rhead").html('Readers <span id="rcc">' + data.oscam.status.rcc + '</span>/' + data.oscam.status.rca + ' (<span id="rco">' + rcon + '</span> of ' + data.oscam.status.rca + ' CARDOK)');
|
---|
1535 | }
|
---|
1536 | } else if($("#rco").length) {
|
---|
1537 | $("#rhead").html('Readers <span id="rcc">' + data.oscam.status.rcc + '</span>/' + data.oscam.status.rca);
|
---|
1538 | } else {
|
---|
1539 | $("#rcc").text(data.oscam.status.rcc);
|
---|
1540 | $("#rca").text(data.oscam.status.rca);
|
---|
1541 | }
|
---|
1542 |
|
---|
1543 | //update proxy-headline
|
---|
1544 | if(data.oscam.status.pco != '0') {
|
---|
1545 | var pcon = (data.oscam.status.pca - data.oscam.status.pco);
|
---|
1546 | if($("#pco").length) {
|
---|
1547 | $("#pcc").text(data.oscam.status.pcc);
|
---|
1548 | $("#pca").text(data.oscam.status.pca);
|
---|
1549 | $("#pco").text(pcon);
|
---|
1550 | } else {
|
---|
1551 | $("#phead").html('Proxies <span id="pcc">' + data.oscam.status.pcc + '</span>/' + data.oscam.status.pca + ' (<span id="pco">' + pcon + '</span> of ' + data.oscam.status.pca + ' online)');
|
---|
1552 | }
|
---|
1553 | } else if($("#pco").length) {
|
---|
1554 | $("#phead").html('Proxies <span id="pcc">' + data.oscam.status.pcc + '</span>/' + data.oscam.status.pca);
|
---|
1555 | } else {
|
---|
1556 | $("#pcc").text(data.oscam.status.pcc);
|
---|
1557 | $("#pca").text(data.oscam.status.pca);
|
---|
1558 | }
|
---|
1559 |
|
---|
1560 | // update footer
|
---|
1561 | updateFooter(data);
|
---|
1562 |
|
---|
1563 | // sysinfos
|
---|
1564 | if ($("#mem_cur_total").length) updateSysinfo(data);
|
---|
1565 |
|
---|
1566 | // user + ecm totals
|
---|
1567 | if ($("#total_users").length) updateTotals(data);
|
---|
1568 |
|
---|
1569 | // cachex
|
---|
1570 | if ($("#total_cachexpush").length) updateCacheextotals(data);
|
---|
1571 |
|
---|
1572 | }
|
---|
1573 |
|
---|
1574 |
|
---|
1575 | /*
|
---|
1576 | * Cacheexpage Functions: Update Page
|
---|
1577 | */
|
---|
1578 | function updateCacheexpage(data) {
|
---|
1579 |
|
---|
1580 | updateCacheextotals(data);
|
---|
1581 |
|
---|
1582 | }
|
---|
1583 |
|
---|
1584 | /*
|
---|
1585 | * General fork into page refresh functions
|
---|
1586 | */
|
---|
1587 | function updatePage(data) {
|
---|
1588 |
|
---|
1589 | // show heartbeat
|
---|
1590 | if ($("input.pintervall").length && $("input.pintervall").css("background-color") != $("#picolor").css("background-color")) {
|
---|
1591 | var orgstyle = $("input.pintervall").css("background-color");
|
---|
1592 | $("input.pintervall").css("background-color", $("#picolor").css("background-color"));
|
---|
1593 | }
|
---|
1594 |
|
---|
1595 | switch (page) {
|
---|
1596 | case 'status':
|
---|
1597 | updateStatuspage(data);
|
---|
1598 | break;
|
---|
1599 | case 'user':
|
---|
1600 | updateUserpage(data);
|
---|
1601 | break;
|
---|
1602 | case 'reader':
|
---|
1603 | updateReaderpage(data);
|
---|
1604 | break;
|
---|
1605 | case 'livelog':
|
---|
1606 | updateLogpage(data);
|
---|
1607 | break;
|
---|
1608 | case 'cacheex':
|
---|
1609 | updateCacheexpage(data);
|
---|
1610 | break;
|
---|
1611 | default:
|
---|
1612 | break;
|
---|
1613 | }
|
---|
1614 |
|
---|
1615 | // hide heartbeat
|
---|
1616 | if ($("input.pintervall").length && $("input.pintervall").css("background-color") == $("#picolor").css("background-color")) {
|
---|
1617 | setTimeout(function () {
|
---|
1618 | $("input.pintervall").css("background-color", orgstyle);
|
---|
1619 | }, 300);
|
---|
1620 | }
|
---|
1621 |
|
---|
1622 | if (typeof afterpoll == 'function') {
|
---|
1623 | afterpoll();
|
---|
1624 | }
|
---|
1625 | }
|
---|
1626 |
|
---|
1627 | function setPollerr(error) {
|
---|
1628 | if (error && !$("#pollerr").length) {
|
---|
1629 | $("body").append('<div id="pollerr" style="top:5px;left:5px;background-color:red;color:yellow;">POLLERR</div>');
|
---|
1630 | } else {
|
---|
1631 | if ($("#pollerr").length) {
|
---|
1632 | $("#pollerr").fadeOut('slow').remove();
|
---|
1633 | }
|
---|
1634 | }
|
---|
1635 | }
|
---|
1636 |
|
---|
1637 | /*
|
---|
1638 | * General Polling
|
---|
1639 | */
|
---|
1640 | var lockpoll = 0;
|
---|
1641 | var timer_ID;
|
---|
1642 |
|
---|
1643 | function waitForMsg() {
|
---|
1644 |
|
---|
1645 | if (typeof pollrefresh == 'undefined') return;
|
---|
1646 |
|
---|
1647 | if (lockpoll > 0) {
|
---|
1648 | /* assumed that previous poll is not finnished yet we not
|
---|
1649 | call new data and just set the next intervall */
|
---|
1650 | clearTimeout(timer_ID);
|
---|
1651 | timer_ID = setTimeout("waitForMsg()", pollintervall);
|
---|
1652 | return;
|
---|
1653 | }
|
---|
1654 |
|
---|
1655 | $.ajax({
|
---|
1656 | type: "GET",
|
---|
1657 | url: jsonurl + parameters,
|
---|
1658 | dataType: "JSON",
|
---|
1659 | async: true,
|
---|
1660 | cache: false,
|
---|
1661 | success: function (data) {
|
---|
1662 | setPollerr(0);
|
---|
1663 | if ((!pollrefresh || polling ) && page != 'livelog') return;
|
---|
1664 | updatePage(data);
|
---|
1665 | if (!stoppoll) {
|
---|
1666 | clearTimeout(timer_ID);
|
---|
1667 | timer_ID = setTimeout("waitForMsg()", pollintervall);
|
---|
1668 | }
|
---|
1669 | },
|
---|
1670 | error: function (XMLHttpRequest, textStatus, errorThrown) {
|
---|
1671 | clearTimeout(timer_ID);
|
---|
1672 | timer_ID = setTimeout("waitForMsg()", 15000);
|
---|
1673 | setPollerr(1);
|
---|
1674 | }
|
---|
1675 | });
|
---|
1676 | }
|
---|
1677 |
|
---|
1678 | /*
|
---|
1679 | * General: Set Poll Interval
|
---|
1680 | */
|
---|
1681 | function setPollrefresh() {
|
---|
1682 | // Set pollintervall, if pollrefresh set to 0 disable polling
|
---|
1683 | if (pollrefresh) {
|
---|
1684 | pollintervall = parseInt(pollrefresh) * 1000;
|
---|
1685 | if (pollintervall > 99000) pollintervall == 99000;
|
---|
1686 | if (!nostorage) {
|
---|
1687 | if (sessionStorage.pollintervall) pollintervall = sessionStorage.pollintervall;
|
---|
1688 | else sessionStorage.pollintervall = pollintervall;
|
---|
1689 | if (sessionStorage.polling == 1) polling = 1;
|
---|
1690 | }
|
---|
1691 | }
|
---|
1692 | }
|
---|
1693 |
|
---|
1694 | // static for paranoid Browsers
|
---|
1695 | var nostorage = 0;
|
---|
1696 |
|
---|
1697 | /*
|
---|
1698 | * General: Start Polling
|
---|
1699 | */
|
---|
1700 | $(document).ready(function () {
|
---|
1701 |
|
---|
1702 | try {
|
---|
1703 | if (!localStorage) {
|
---|
1704 | nostorage = 1;
|
---|
1705 | // remove whole filter block - makes no sense
|
---|
1706 | // without saving
|
---|
1707 | $('#regex').remove();
|
---|
1708 | }
|
---|
1709 | } catch(err){
|
---|
1710 | nostorage = 1;
|
---|
1711 | $('#regex').remove();
|
---|
1712 | }
|
---|
1713 |
|
---|
1714 | // set default to nothing excluded
|
---|
1715 | poll_excluded = '';
|
---|
1716 |
|
---|
1717 | // help wiki links
|
---|
1718 | if (typeof oscamconf != "undefined") {
|
---|
1719 | var language = $('meta[http-equiv="language"]').attr("content");
|
---|
1720 | var wikihref = "https://wiki.streamboard.tv/wiki/OSCam/" + language + "/Config/oscam." + oscamconf + "#";
|
---|
1721 | $("form table a").click(function () {
|
---|
1722 | if (!$(this).attr("href") && !$(this).attr("name")) {
|
---|
1723 | if ($(this).data('p')) {
|
---|
1724 | var parm = $(this).data('p');
|
---|
1725 | } else {
|
---|
1726 | var parm = $(this).parent().next().find("input,select,textarea").attr('name');
|
---|
1727 | }
|
---|
1728 | window.open(wikihref + parm);
|
---|
1729 | }
|
---|
1730 | });
|
---|
1731 | }
|
---|
1732 |
|
---|
1733 | // Title
|
---|
1734 | var pagename = (typeof page != 'undefined' ? page : $(location).attr('pathname').replace(/.*\/|\.[^.]*$/g, ''));
|
---|
1735 | $(document).attr('title', $(document).attr('title') + ' (' + pagename[0].toUpperCase() + pagename.slice(1) + ')');
|
---|
1736 |
|
---|
1737 | if (typeof page != 'undefined') {
|
---|
1738 |
|
---|
1739 | switch (page) {
|
---|
1740 |
|
---|
1741 | case 'livelog':
|
---|
1742 |
|
---|
1743 | var saved_regex = localStorage.MAX_SEARCH_PATTERN;
|
---|
1744 | MAX_SEARCH_PATTERN = parseInt(saved_regex ? saved_regex : MAX_SEARCH_PATTERN);
|
---|
1745 | $('<LI style="display:none;"><span class="colorPicker_def_color"></span><span class="colorPicker_def_fcolor"></span></LI>').insertBefore(".regexdata_save");
|
---|
1746 |
|
---|
1747 | var beep_disabled = ' disabled="disabled" title="Not supported by your browser"';
|
---|
1748 | var contextClass = (window.AudioContext || window.webkitAudioContext || window.mozAudioContext || window.oAudioContext || window.msAudioContext);
|
---|
1749 | if (contextClass) { beep_disabled = ''; }
|
---|
1750 |
|
---|
1751 | for (var i = 1; i < MAX_SEARCH_PATTERN + 1; i++) {
|
---|
1752 |
|
---|
1753 | var prefix = "0";
|
---|
1754 | if ( i > 9 ) { prefix = ""; }
|
---|
1755 |
|
---|
1756 | $('<LI class="regex" id="regexrow' + i + '">Search' + prefix + i + ': <input type="text" name="regex' + i + '" class="regexinput" ID="regex' + i + '" value=""> Found only: <input type="checkbox" id="whitelisted' + i + '"><label></label> Hide: <input type="checkbox" id="hidden' + i + '"><label></label> Back Color: <input size="7" maxlength="7" type="text" name="color' + i + '" class="colorinput" ID="color' + i + '" value=""> Color: <input size="7" maxlength="7" type="text" name="fcolor' + i + '" class="colorinput" ID="fcolor' + i + '" value=""> Beep: <input type="checkbox" id="beep' + i + '"' + beep_disabled +'><label></label></LI>').insertBefore(".regexdata_save");
|
---|
1757 | }
|
---|
1758 |
|
---|
1759 | if (!nostorage) {
|
---|
1760 | for (var i = 1; i < MAX_SEARCH_PATTERN + 1; i++) {
|
---|
1761 | var pattern = localStorage['regex' + i];
|
---|
1762 | var color = localStorage['color' + i];
|
---|
1763 | var fcolor = localStorage['fcolor' + i];
|
---|
1764 | $('#regex' + i).val(pattern ? pattern : '');
|
---|
1765 | $('#color' + i).val(color ? color : $('.colorPicker_def_color').css('color'));
|
---|
1766 | $('#fcolor' + i).val(fcolor ? fcolor : $('.colorPicker_def_fcolor').css('color'));
|
---|
1767 | $('#color' + i).colorPicker();
|
---|
1768 | $('#fcolor' + i).colorPicker();
|
---|
1769 | $('#whitelisted' + i).prop('checked', localStorage['whitelisted' + i] == '1' ? true : false);
|
---|
1770 | $('#hidden' + i).prop('checked', localStorage['hidden' + i] == '1' ? true : false);
|
---|
1771 | $('#beep' + i).prop('checked', localStorage['beep' + i] == '1' ? true : false);
|
---|
1772 | }
|
---|
1773 | }
|
---|
1774 | waitForMsg();
|
---|
1775 |
|
---|
1776 | break;
|
---|
1777 |
|
---|
1778 | case 'status':
|
---|
1779 |
|
---|
1780 | $(".status tbody:empty").hide();
|
---|
1781 | $("#chart").hide();
|
---|
1782 | if (!nostorage) {
|
---|
1783 | if (localStorage.loi == 'Login*') {
|
---|
1784 | $("#onlineidle")
|
---|
1785 | .text('Login*')
|
---|
1786 | .css('cursor','pointer')
|
---|
1787 | .attr('title', 'Online & Idle info (click to switch)');
|
---|
1788 | } else {
|
---|
1789 | $("#onlineidle")
|
---|
1790 | .text('Online & Idle*')
|
---|
1791 | .css('cursor','pointer')
|
---|
1792 | .attr('title', 'Login info (click to switch)');
|
---|
1793 | }
|
---|
1794 | }
|
---|
1795 | break;
|
---|
1796 |
|
---|
1797 | default:
|
---|
1798 | //do nothing
|
---|
1799 |
|
---|
1800 | break;
|
---|
1801 | }
|
---|
1802 |
|
---|
1803 | // if pollrefresh set to 0 hide pollselector
|
---|
1804 | setPollrefresh();
|
---|
1805 | if (pollrefresh) {
|
---|
1806 | if (polling) {
|
---|
1807 | $(":text[name='pintervall']").val('--');
|
---|
1808 | $('#polling').attr('class','pollingdisabled');
|
---|
1809 | $('#inc, #dec').attr('disabled','disabled');
|
---|
1810 | } else {
|
---|
1811 | $(":text[name='pintervall']").val(pollintervall / 1000);
|
---|
1812 | $('#polling').attr('class','pollingenabled');
|
---|
1813 | $('#inc, #dec').removeAttr('disabled');
|
---|
1814 | waitForMsg();
|
---|
1815 | }
|
---|
1816 | $("#poll").show();
|
---|
1817 | }
|
---|
1818 | }
|
---|
1819 | });
|
---|
1820 |
|
---|
1821 | function decodeVideoguardEMM(text, target, addHideButton) {
|
---|
1822 |
|
---|
1823 | text = text.trim();
|
---|
1824 |
|
---|
1825 | var bytes = text.replace(/[^A-Fa-f0-9]/g, "").toUpperCase().match(/.{1,2}/g) || [];
|
---|
1826 | var html = '';
|
---|
1827 |
|
---|
1828 | if (addHideButton) {
|
---|
1829 | html += '<p><input type="button" value="Hide" title="Hide" onclick="$(\'' + target + '\').css(\'display\', \'none\');" /></p><br/>';
|
---|
1830 | }
|
---|
1831 |
|
---|
1832 | var AddTextType = {"data":"Data", "length":"Length", "type":"Type", "emmType":"EMM-Type", "encryptionType":"Encryption Type",
|
---|
1833 | "keyIndex":"Key-Index", "keyIndex2":"Key-Index2", "fixedValue":"Fixed Value", "pairingDevice":"Pairing Device", "date":"Date",
|
---|
1834 | "checksum":"Checksum", "emmStartMarker":"EMM Marker", "cardSerial":"Serial Number (Smartcard)",
|
---|
1835 | "boxSerial":"Serial Number (Receiver)", "emmEndMarker":"Sub-EMM End", "rest":"rest ????",
|
---|
1836 | "cardEmmLength":"Card EMM Length", "cardNanoLength":"Card Nano Length", "irdEmmLength":"IRD EMM Length",
|
---|
1837 | "filterSectionLength":"Filter Section Length", "irdNanoLength":"IRD Nano Length", "cardNanoType":"Card Nano Type",
|
---|
1838 | "irdNanoType":"IRD Nano Type", "filterNanoType":"Filter Nano Type", "cardGroupSerial":"Serial Number (Card Group)",
|
---|
1839 | "mpegSectionLength":"EMM Length", "irdEmmChecksum":"IRD EMM Checksum", "pairingdeviceCount":"Pairing Device Count"};
|
---|
1840 |
|
---|
1841 | function addText(count, color, text, parm) {
|
---|
1842 |
|
---|
1843 | html += '<font style="color: ' + color + '"><b>';
|
---|
1844 |
|
---|
1845 | var ret = '';
|
---|
1846 | for (var i = 0; i < count; i++) {
|
---|
1847 | var v = bytes.shift();
|
---|
1848 | if (typeof v === 'undefined') {
|
---|
1849 | v = '??';
|
---|
1850 | }
|
---|
1851 | html += v + ' ';
|
---|
1852 | ret += v;
|
---|
1853 | if (((i + 1) % 16) == 0) {
|
---|
1854 | html += '<br/>';
|
---|
1855 | }
|
---|
1856 | }
|
---|
1857 |
|
---|
1858 | switch (text) {
|
---|
1859 | case AddTextType.emmStartMarker:
|
---|
1860 | if(ret.substring(2) == '00') {
|
---|
1861 | text += " (cccam)";
|
---|
1862 | }
|
---|
1863 | break;
|
---|
1864 |
|
---|
1865 | case AddTextType.mpegSectionLength:
|
---|
1866 | var len = ((parseInt(parm, 16) << 8) + parseInt(ret, 16)) & 0x0FFF;
|
---|
1867 | text += ' - <b>' + len + '</b>';
|
---|
1868 |
|
---|
1869 | if (bytes.length >= len) {
|
---|
1870 | text += ' - <font style="color:#009900"><b>OK (' + bytes.length + ')</b></font>';
|
---|
1871 | } else {
|
---|
1872 | text += ' - <font style="color:#F00000"><b>FAIL (' + bytes.length + ')</b></font>';
|
---|
1873 | }
|
---|
1874 | ret = len;
|
---|
1875 | break;
|
---|
1876 |
|
---|
1877 | case AddTextType.length:
|
---|
1878 | case AddTextType.cardEmmLength:
|
---|
1879 | case AddTextType.cardNanoLength:
|
---|
1880 | case AddTextType.irdEmmLength:
|
---|
1881 | case AddTextType.filterSectionLength:
|
---|
1882 | case AddTextType.irdNanoLength:
|
---|
1883 |
|
---|
1884 | var len = parseInt(ret, 16);
|
---|
1885 | text += ' - <b>' + len + '</b>';
|
---|
1886 |
|
---|
1887 | if (bytes.length >= len) {
|
---|
1888 | text += ' - <font style="color:#009900"><b>OK (' + bytes.length + ')</b></font>';
|
---|
1889 | } else {
|
---|
1890 | text += ' - <font style="color:#F00000"><b>FAIL (' + bytes.length + ')</b></font>';
|
---|
1891 | }
|
---|
1892 | ret = len;
|
---|
1893 | break;
|
---|
1894 | case AddTextType.type:
|
---|
1895 |
|
---|
1896 | var type = parseInt(ret, 16) & 0xC0;
|
---|
1897 | var subEmmCount = ((parseInt(ret, 16) & 0x30) >> 16) + 1;
|
---|
1898 |
|
---|
1899 | if (type == 0x40) {
|
---|
1900 | text += ' - <b>unique</b> EMM For Smartcard';
|
---|
1901 | }
|
---|
1902 | else if (type == 0xC0) {
|
---|
1903 | text += ' - <b>unique</b> EMM For Receiver/CAM';
|
---|
1904 | }
|
---|
1905 | else if (type == 0x80) {
|
---|
1906 | text += ' - <b>shared</b> EMM For Smartcard';
|
---|
1907 | }
|
---|
1908 | else {
|
---|
1909 | text += ' - <b>global</b> EMM';
|
---|
1910 | }
|
---|
1911 |
|
---|
1912 | text += ' (' + subEmmCount + ' Sub EMMs)';
|
---|
1913 |
|
---|
1914 | break;
|
---|
1915 |
|
---|
1916 | case AddTextType.emmType:
|
---|
1917 | switch (ret) {
|
---|
1918 | case '02':
|
---|
1919 | text += ' - <b>Default</b>';
|
---|
1920 | break;
|
---|
1921 | case '07':
|
---|
1922 | text += ' - <b>With Filter Nanos</b>';
|
---|
1923 | break;
|
---|
1924 | default:
|
---|
1925 | text += ' - <b>unknown</b>';
|
---|
1926 | break;
|
---|
1927 | }
|
---|
1928 | break;
|
---|
1929 |
|
---|
1930 | case AddTextType.encryptionType:
|
---|
1931 | switch (ret) {
|
---|
1932 | case '44':
|
---|
1933 | text += ' - <b>User-Encryption</b>';
|
---|
1934 | break;
|
---|
1935 | case '60':
|
---|
1936 | text += ' - <b>System-Encryption</b>';
|
---|
1937 | break;
|
---|
1938 | case '40':
|
---|
1939 | text += ' - <b>System-Encryption</b>';
|
---|
1940 | break;
|
---|
1941 | default:
|
---|
1942 | text += ' - <b>unknown</b>';
|
---|
1943 | break;
|
---|
1944 | }
|
---|
1945 |
|
---|
1946 | break;
|
---|
1947 |
|
---|
1948 | case AddTextType.cardNanoType:
|
---|
1949 | switch (ret) {
|
---|
1950 | case '01':
|
---|
1951 | text += ' - <b>Set date</b>';
|
---|
1952 | break;
|
---|
1953 | case '90':
|
---|
1954 | text += ' - <b>Encrypted Nano</b>';
|
---|
1955 | break;
|
---|
1956 | case '41':
|
---|
1957 | text += ' - <b>Add a ChID</b>';
|
---|
1958 | break;
|
---|
1959 | case '42':
|
---|
1960 | text += ' - <b>Delete a ChID</b>';
|
---|
1961 | break;
|
---|
1962 | default:
|
---|
1963 | text += ' - <b>unknown</b>';
|
---|
1964 | break;
|
---|
1965 | }
|
---|
1966 | break;
|
---|
1967 |
|
---|
1968 | case AddTextType.irdNanoType:
|
---|
1969 | switch (ret) {
|
---|
1970 | case '02':
|
---|
1971 | text += ' - <b>Set Date/Time</b>';
|
---|
1972 | break;
|
---|
1973 | case '07':
|
---|
1974 | case '08':
|
---|
1975 | text += ' - <b>Download Firmware</b>';
|
---|
1976 | break;
|
---|
1977 | case '2B':
|
---|
1978 | text += ' - <b>Pairing Data</b>';
|
---|
1979 | break;
|
---|
1980 | default:
|
---|
1981 | text += ' - <b>unknown</b>';
|
---|
1982 | break;
|
---|
1983 | }
|
---|
1984 | break;
|
---|
1985 |
|
---|
1986 | case AddTextType.filterNanoType:
|
---|
1987 | switch (ret) {
|
---|
1988 | case '30':
|
---|
1989 | text += ' - <b>Always Valid</b>';
|
---|
1990 | break;
|
---|
1991 | case '31':
|
---|
1992 | text += ' - <b>Card Address</b>';
|
---|
1993 | break;
|
---|
1994 | default:
|
---|
1995 | text += ' - <b>unknown</b>';
|
---|
1996 | break;
|
---|
1997 | }
|
---|
1998 | break;
|
---|
1999 |
|
---|
2000 | case AddTextType.keyIndex:
|
---|
2001 |
|
---|
2002 | if (!isV13V14V15) {
|
---|
2003 | text += ' - <b>' + ret + '</b>';
|
---|
2004 | }
|
---|
2005 |
|
---|
2006 | switch (ret) {
|
---|
2007 | case '01':
|
---|
2008 | text += ' - <b>V13</b>';
|
---|
2009 | break;
|
---|
2010 | case '02':
|
---|
2011 | text += ' - <b>V14</b>';
|
---|
2012 | break;
|
---|
2013 | case '03':
|
---|
2014 | text += ' - <b>V15</b>';
|
---|
2015 | break;
|
---|
2016 | default:
|
---|
2017 | text += ' - <b>unknown</b>';
|
---|
2018 | break;
|
---|
2019 | }
|
---|
2020 |
|
---|
2021 | break;
|
---|
2022 | case AddTextType.keyIndex2:
|
---|
2023 | text += ' - <b>unknown</b>';
|
---|
2024 | break;
|
---|
2025 | case AddTextType.fixedValue:
|
---|
2026 | if (ret == parm) {
|
---|
2027 | text += ' - <font style="color:#009900"><b>OK</b></font>';
|
---|
2028 | } else {
|
---|
2029 | text += ' - <font style="color:#F00000"><b>FAIL (' + parm + ')</b></font>';
|
---|
2030 | }
|
---|
2031 | break;
|
---|
2032 | case AddTextType.pairingDevice:
|
---|
2033 | switch (ret) {
|
---|
2034 | default: text += ' - <b>Device ' + ret + '</b>';
|
---|
2035 | break;
|
---|
2036 | }
|
---|
2037 | break;
|
---|
2038 | case AddTextType.date:
|
---|
2039 | var b = ret.replace(/[^A-Fa-f0-9]/g, "").match(/.{1,2}/g) || [];
|
---|
2040 |
|
---|
2041 | var bin = parseInt(b[2] + b[3], 16);
|
---|
2042 | var time = {};
|
---|
2043 | time.s = ((bin & parseInt('11111', 2)) * 2);
|
---|
2044 | bin = bin >>> 5;
|
---|
2045 | time.m = (bin & parseInt('111111', 2));
|
---|
2046 | bin = bin >>> 6;
|
---|
2047 | time.h = (bin & parseInt('11111', 2));
|
---|
2048 | bin = bin >>> 5;
|
---|
2049 |
|
---|
2050 | bin = parseInt(b[0] + b[1], 16);
|
---|
2051 | var date = {};
|
---|
2052 | date.d = (bin & parseInt('11111111', 2));
|
---|
2053 | bin = bin >>> 8;
|
---|
2054 | date.m = (bin & parseInt('11111111', 2));
|
---|
2055 | bin = bin >>> 8;
|
---|
2056 |
|
---|
2057 | date.y = parseInt(date.m / 12) + 2004;
|
---|
2058 | date.m -= (((date.y - 2004) * 12) - 1);
|
---|
2059 |
|
---|
2060 | text += ' - <b>' + date.d + '.' + date.m + '.' + date.y + '</b>';
|
---|
2061 | text += ' <b>' + time.h + ':' + time.m + ':' + time.s + ' UTC</b>';
|
---|
2062 | break;
|
---|
2063 | case AddTextType.checksum:
|
---|
2064 | case AddTextType.irdEmmChecksum:
|
---|
2065 | var checksumData = parseInt(ret, 16);
|
---|
2066 | var checksum = 0x00;
|
---|
2067 |
|
---|
2068 | for(var i = 0; i < parm.length; i++) {
|
---|
2069 | checksum += parseInt(parm[i], 16);
|
---|
2070 | checksum &= 0xFF;
|
---|
2071 | }
|
---|
2072 |
|
---|
2073 | if (checksumData == checksum) {
|
---|
2074 | text += ' - <font style="color:#009900"><b>OK</b></font>';
|
---|
2075 | } else {
|
---|
2076 | text += ' - <font style="color:#F00000"><b>FAIL (' + checksum.toString(16).toUpperCase() + ')</b></font>';
|
---|
2077 | }
|
---|
2078 | break;
|
---|
2079 | }
|
---|
2080 |
|
---|
2081 | html += '</b></font> - ' + text + '<br/>';
|
---|
2082 | return ret;
|
---|
2083 | }
|
---|
2084 |
|
---|
2085 | function ReadSingleCardEMM() {
|
---|
2086 | var cardEmmLength = addText(1, '#00F', AddTextType.cardEmmLength);
|
---|
2087 | var remainingDataLength = cardEmmLength;
|
---|
2088 |
|
---|
2089 | while (remainingDataLength > 0 && bytes.length) {
|
---|
2090 | var cardNanoType = addText(1, '#008000', AddTextType.cardNanoType);
|
---|
2091 |
|
---|
2092 | var fixedSizeNanos = {
|
---|
2093 | "01": 0x04,
|
---|
2094 | "09": 0x03,
|
---|
2095 | "10": 0x02,
|
---|
2096 | "19": 0x01,
|
---|
2097 | "1E": 0x08,
|
---|
2098 | "24": 0x00,
|
---|
2099 | "25": 0x00,
|
---|
2100 | "27": 0x0D,
|
---|
2101 | "2B": 0x02,//0x03
|
---|
2102 | "2D": 0x04,
|
---|
2103 | "30": 0x00,
|
---|
2104 | "31": 0x04,//0x03
|
---|
2105 | "32": 0x03,
|
---|
2106 | "33": 0x23,
|
---|
2107 | "3D": 0x02,
|
---|
2108 | "3E": 0x00,
|
---|
2109 | "41": 0x05,//0x04
|
---|
2110 | "42": 0x02,
|
---|
2111 | "44": 0x04,
|
---|
2112 | "4E": 0x04,
|
---|
2113 | "7A": 0x02,
|
---|
2114 |
|
---|
2115 | "02": 0x01,
|
---|
2116 | "03": 0x03,
|
---|
2117 | "04": 0x00,
|
---|
2118 | "48": 0x00,
|
---|
2119 | "C0": 0x00,
|
---|
2120 |
|
---|
2121 | };
|
---|
2122 |
|
---|
2123 | if (fixedSizeNanos[cardNanoType] != undefined) {
|
---|
2124 |
|
---|
2125 | if (cardNanoType == "01") {
|
---|
2126 | addText(4, '#00A0A0', AddTextType.date);
|
---|
2127 | }
|
---|
2128 | else {
|
---|
2129 | addText(fixedSizeNanos[cardNanoType], '#000', AddTextType.data);
|
---|
2130 | }
|
---|
2131 | remainingDataLength -= fixedSizeNanos[cardNanoType] + 1;
|
---|
2132 | }
|
---|
2133 | else {
|
---|
2134 | var cardNanoLength = addText(1, '#00F', AddTextType.cardNanoLength);
|
---|
2135 |
|
---|
2136 | if (cardNanoType == "90") {
|
---|
2137 | var encryptionType = addText(1, '#b22222', AddTextType.encryptionType);
|
---|
2138 | switch (encryptionType) {
|
---|
2139 | case '40':
|
---|
2140 | case '44':
|
---|
2141 | case '60':
|
---|
2142 | addText(1, '#b22222', AddTextType.keyIndex);
|
---|
2143 | addText((cardNanoLength - 2), '#000', AddTextType.data);
|
---|
2144 |
|
---|
2145 | break;
|
---|
2146 | default:
|
---|
2147 | addText(1, '#b22222', AddTextType.keyIndex2);
|
---|
2148 | addText((cardNanoLength - 2), '#000', AddTextType.data);
|
---|
2149 | break;
|
---|
2150 | }
|
---|
2151 | }
|
---|
2152 | else {
|
---|
2153 | addText(cardNanoLength, '#000', AddTextType.data);
|
---|
2154 | }
|
---|
2155 |
|
---|
2156 | remainingDataLength -= cardNanoLength + 2;
|
---|
2157 | }
|
---|
2158 |
|
---|
2159 | }
|
---|
2160 |
|
---|
2161 | }
|
---|
2162 |
|
---|
2163 | function ReadIrdNano() {
|
---|
2164 |
|
---|
2165 | var irdNanoType = addText(1, '#008000', AddTextType.irdNanoType);
|
---|
2166 |
|
---|
2167 | var fixedSizeNanos = {
|
---|
2168 | "02": 0x04,
|
---|
2169 | };
|
---|
2170 |
|
---|
2171 | if (fixedSizeNanos[irdNanoType] != undefined) {
|
---|
2172 |
|
---|
2173 | if (irdNanoType == "02") {
|
---|
2174 | addText(4, '#00A0A0', AddTextType.date);
|
---|
2175 | }
|
---|
2176 | else {
|
---|
2177 | addText(fixedSizeNanos[cardNanoType], '#000', AddTextType.data);
|
---|
2178 | }
|
---|
2179 | return fixedSizeNanos[irdNanoType] + 1;
|
---|
2180 | }
|
---|
2181 | else {
|
---|
2182 | var irdNanoLength = addText(1, '#00F', AddTextType.irdNanoLength);
|
---|
2183 |
|
---|
2184 | switch (irdNanoType) {
|
---|
2185 | case '2B':
|
---|
2186 | addText(1, '#000', AddTextType.pairingdeviceCount);
|
---|
2187 |
|
---|
2188 | var remainingDataLengthNano = irdNanoLength - 1;
|
---|
2189 | while (remainingDataLengthNano > 0 && bytes.length) {
|
---|
2190 | var startLength = bytes.length;
|
---|
2191 | addText(1, '#E000E0', AddTextType.pairingDevice);
|
---|
2192 | addText(4, '#cc7000', AddTextType.boxSerial);
|
---|
2193 | ReadSingleCardEMM();
|
---|
2194 | remainingDataLengthNano -= startLength - bytes.length;
|
---|
2195 | }
|
---|
2196 | break;
|
---|
2197 |
|
---|
2198 | default:
|
---|
2199 | addText(irdNanoLength, '#000', AddTextType.data);
|
---|
2200 | break;
|
---|
2201 | }
|
---|
2202 |
|
---|
2203 | return irdNanoLength + 2;
|
---|
2204 | }
|
---|
2205 | }
|
---|
2206 |
|
---|
2207 | // ----------------------------------------------------------------------
|
---|
2208 | // ----------------------------------------------------------------------
|
---|
2209 | // ----------------------------------------------------------------------
|
---|
2210 |
|
---|
2211 | var partOfLength = bytes[1];
|
---|
2212 | addText(2, '#000', AddTextType.emmStartMarker);
|
---|
2213 | addText(1, '#00F', AddTextType.mpegSectionLength, partOfLength);
|
---|
2214 |
|
---|
2215 | var filterByte = parseInt(addText(1, '#199a8d', AddTextType.type), 16);
|
---|
2216 | var type = filterByte & 0xC0;
|
---|
2217 | var subEmmCount = ((filterByte & 0x30) >> 16) + 1;
|
---|
2218 |
|
---|
2219 | if(partOfLength != 0) { // partOfLength == 0 for emms by cccam clients, these do not have the serials part
|
---|
2220 | for(var i = 0; i < subEmmCount; i++) {
|
---|
2221 | if (type == 0x40) { // unique: card
|
---|
2222 | addText(4, '#cc7000', AddTextType.cardSerial);
|
---|
2223 | } else if (type == 0xC0) { // unique: receiver/cam
|
---|
2224 | addText(4, '#cc7000', AddTextType.boxSerial);
|
---|
2225 | } else if (type == 0x80) { // shared: card group
|
---|
2226 | addText(3, '#cc7000', AddTextType.cardGroupSerial);
|
---|
2227 | addText(1, '#000', AddTextType.fixedValue, '01');
|
---|
2228 | }
|
---|
2229 | }
|
---|
2230 | }
|
---|
2231 |
|
---|
2232 | while (bytes.length) {
|
---|
2233 | var emmtype = addText(1, '#008000', AddTextType.emmType);
|
---|
2234 |
|
---|
2235 | var irdEmmLength = addText(1, '#00F', AddTextType.irdEmmLength);
|
---|
2236 | var checksumData = {};
|
---|
2237 |
|
---|
2238 | if (irdEmmLength > 0) {
|
---|
2239 | checksumData = bytes.slice(0, irdEmmLength - 1);
|
---|
2240 | checksumData.unshift(irdEmmLength.toString(16));
|
---|
2241 | checksumData.unshift(emmtype);
|
---|
2242 | }
|
---|
2243 |
|
---|
2244 | if (irdEmmLength > 0) {
|
---|
2245 | switch (emmtype) {
|
---|
2246 | case '02':
|
---|
2247 |
|
---|
2248 | var remainingDataLength = irdEmmLength - 1;
|
---|
2249 | while(remainingDataLength > 0 && bytes.length) {
|
---|
2250 | remainingDataLength -= ReadIrdNano();
|
---|
2251 | }
|
---|
2252 | break;
|
---|
2253 |
|
---|
2254 | case '07':
|
---|
2255 | var filterSectionLength = addText(1, '#00F', AddTextType.filterSectionLength);
|
---|
2256 | var remainingDataLength = filterSectionLength;
|
---|
2257 |
|
---|
2258 | while (remainingDataLength > 0 && bytes.length) {
|
---|
2259 | var filterNano = addText(1, '#008000', AddTextType.filterNanoType);
|
---|
2260 | switch (filterNano) {
|
---|
2261 | case '30':
|
---|
2262 | remainingDataLength -= 1;
|
---|
2263 | break;
|
---|
2264 |
|
---|
2265 | case '31':
|
---|
2266 | addText(4, '#cc7000', AddTextType.cardSerial);
|
---|
2267 | remainingDataLength -= 5;
|
---|
2268 | break;
|
---|
2269 |
|
---|
2270 | default:
|
---|
2271 | addText(remainingDataLength - 1, '#000', AddTextType.data);
|
---|
2272 | remainingDataLength = 0;
|
---|
2273 | break;
|
---|
2274 | }
|
---|
2275 | }
|
---|
2276 |
|
---|
2277 | var remainingDataLength = irdEmmLength - 1 - filterSectionLength - 1;
|
---|
2278 | while(remainingDataLength > 0 && bytes.length) {
|
---|
2279 | remainingDataLength -= ReadIrdNano();
|
---|
2280 | }
|
---|
2281 | break;
|
---|
2282 |
|
---|
2283 | default:
|
---|
2284 | addText(irdEmmLength - 1, '#000', AddTextType.data);
|
---|
2285 | break;
|
---|
2286 | }
|
---|
2287 |
|
---|
2288 | addText(1, '#800080', AddTextType.irdEmmChecksum, checksumData);
|
---|
2289 | }
|
---|
2290 |
|
---|
2291 | ReadSingleCardEMM();
|
---|
2292 | }
|
---|
2293 |
|
---|
2294 | $(target).html(html);
|
---|
2295 | }
|
---|
2296 |
|
---|
2297 | /**
|
---|
2298 | * Really Simple Color Picker in jQuery
|
---|
2299 | *
|
---|
2300 | * Licensed under the MIT (MIT-LICENSE.txt) licenses.
|
---|
2301 | *
|
---|
2302 | * Copyright (c) 2008-2012
|
---|
2303 | * Lakshan Perera (www.laktek.com) & Daniel Lacy (daniellacy.com)
|
---|
2304 | *
|
---|
2305 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
2306 | * of this software and associated documentation files (the "Software"), to
|
---|
2307 | * deal in the Software without restriction, including without limitation the
|
---|
2308 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
---|
2309 | * sell copies of the Software, and to permit persons to whom the Software is
|
---|
2310 | * furnished to do so, subject to the following conditions:
|
---|
2311 | *
|
---|
2312 | * The above copyright notice and this permission notice shall be included in
|
---|
2313 | * all copies or substantial portions of the Software.
|
---|
2314 | *
|
---|
2315 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
2316 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
2317 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
2318 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
---|
2319 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
2320 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
---|
2321 | * IN THE SOFTWARE.
|
---|
2322 | */
|
---|
2323 | (function (e) {
|
---|
2324 | var t, n, r = 0,
|
---|
2325 | i = {
|
---|
2326 | control: e('<div class="colorPicker-picker"> </div>'),
|
---|
2327 | palette: e('<div id="colorPicker_palette" class="colorPicker-palette" />'),
|
---|
2328 | swatch: e('<div class="colorPicker-swatch"> </div>'),
|
---|
2329 | hexLabel: e('<label for="colorPicker_hex">Hex</label>'),
|
---|
2330 | hexField: e('<input type="text" id="colorPicker_hex" />')
|
---|
2331 | },
|
---|
2332 | s = "transparent",
|
---|
2333 | o;
|
---|
2334 | e.fn.colorPicker = function (t) {
|
---|
2335 | return this.each(function () {
|
---|
2336 | var n = e(this),
|
---|
2337 | o = e.extend({}, e.fn.colorPicker.defaults, t),
|
---|
2338 | u = e.fn.colorPicker.toHex(n.val().length > 0 ? n.val() : o.pickerDefault),
|
---|
2339 | a = i.control.clone(),
|
---|
2340 | f = i.palette.clone().attr("id", "colorPicker_palette-" + r),
|
---|
2341 | l = i.hexLabel.clone(),
|
---|
2342 | c = i.hexField.clone(),
|
---|
2343 | h = f[0].id,
|
---|
2344 | p, d;
|
---|
2345 | e.each(o.colors, function (t) {
|
---|
2346 | p = i.swatch.clone();
|
---|
2347 | if (o.colors[t] === s) {
|
---|
2348 | p.addClass(s).text("X");
|
---|
2349 | e.fn.colorPicker.bindPalette(c, p, s)
|
---|
2350 | } else {
|
---|
2351 | p.css("background-color", "#" + this);
|
---|
2352 | e.fn.colorPicker.bindPalette(c, p)
|
---|
2353 | }
|
---|
2354 | p.appendTo(f)
|
---|
2355 | });
|
---|
2356 | l.attr("for", "colorPicker_hex-" + r);
|
---|
2357 | c.attr({
|
---|
2358 | id: "colorPicker_hex-" + r,
|
---|
2359 | value: u
|
---|
2360 | });
|
---|
2361 | c.bind("keydown", function (t) {
|
---|
2362 | if (t.keyCode === 13) {
|
---|
2363 | var r = e.fn.colorPicker.toHex(e(this).val());
|
---|
2364 | e.fn.colorPicker.changeColor(r ? r : n.val())
|
---|
2365 | }
|
---|
2366 | if (t.keyCode === 27) {
|
---|
2367 | e.fn.colorPicker.hidePalette()
|
---|
2368 | }
|
---|
2369 | });
|
---|
2370 | c.bind("keyup", function (t) {
|
---|
2371 | var r = e.fn.colorPicker.toHex(e(t.target).val());
|
---|
2372 | e.fn.colorPicker.previewColor(r ? r : n.val())
|
---|
2373 | });
|
---|
2374 | c.bind("blur", function (t) {
|
---|
2375 | var r = e.fn.colorPicker.toHex(e(this).val());
|
---|
2376 | e.fn.colorPicker.changeColor(r ? r : n.val())
|
---|
2377 | });
|
---|
2378 | e('<div class="colorPicker_hexWrap" />').append(l).appendTo(f);
|
---|
2379 | f.find(".colorPicker_hexWrap").append(c);
|
---|
2380 | if (o.showHexField === false) {
|
---|
2381 | c.hide();
|
---|
2382 | l.hide()
|
---|
2383 | }
|
---|
2384 | e("body").append(f);
|
---|
2385 | f.hide();
|
---|
2386 | a.css("background-color", u);
|
---|
2387 | a.bind("click", function () {
|
---|
2388 | if (n.is(":not(:disabled)")) {
|
---|
2389 | e.fn.colorPicker.togglePalette(e("#" + h), e(this))
|
---|
2390 | }
|
---|
2391 | });
|
---|
2392 | if (t && t.onColorChange) {
|
---|
2393 | a.data("onColorChange", t.onColorChange)
|
---|
2394 | } else {
|
---|
2395 | a.data("onColorChange", function () {})
|
---|
2396 | } if (d = n.data("text")) a.html(d);
|
---|
2397 | n.after(a);
|
---|
2398 | n.bind("change", function () {
|
---|
2399 | n.next(".colorPicker-picker").css("background-color", e.fn.colorPicker.toHex(e(this).val()))
|
---|
2400 | });
|
---|
2401 | n.val(u);
|
---|
2402 | if (n[0].tagName.toLowerCase() === "input") {
|
---|
2403 | try {
|
---|
2404 | n.attr("type", "hidden")
|
---|
2405 | } catch (v) {
|
---|
2406 | n.css("visibility", "hidden").css("position", "absolute")
|
---|
2407 | }
|
---|
2408 | } else {
|
---|
2409 | n.hide()
|
---|
2410 | }
|
---|
2411 | r++
|
---|
2412 | })
|
---|
2413 | };
|
---|
2414 | e.extend(true, e.fn.colorPicker, {
|
---|
2415 | toHex: function (e) {
|
---|
2416 | if (e.match(/[0-9A-F]{6}|[0-9A-F]{3}$/i)) {
|
---|
2417 | return e.charAt(0) === "#" ? e : "#" + e
|
---|
2418 | } else if (e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/)) {
|
---|
2419 | var t = [parseInt(RegExp.$1, 10), parseInt(RegExp.$2, 10), parseInt(RegExp.$3, 10)],
|
---|
2420 | n = function (e) {
|
---|
2421 | if (e.length < 2) {
|
---|
2422 | for (var t = 0, n = 2 - e.length; t < n; t++) {
|
---|
2423 | e = "0" + e
|
---|
2424 | }
|
---|
2425 | }
|
---|
2426 | return e
|
---|
2427 | };
|
---|
2428 | if (t.length === 3) {
|
---|
2429 | var r = n(t[0].toString(16)),
|
---|
2430 | i = n(t[1].toString(16)),
|
---|
2431 | s = n(t[2].toString(16));
|
---|
2432 | return "#" + r + i + s
|
---|
2433 | }
|
---|
2434 | } else {
|
---|
2435 | return false
|
---|
2436 | }
|
---|
2437 | },
|
---|
2438 | checkMouse: function (r, i) {
|
---|
2439 | var s = n,
|
---|
2440 | o = e(r.target).parents("#" + s.attr("id")).length;
|
---|
2441 | if (r.target === e(s)[0] || r.target === t[0] || o > 0) {
|
---|
2442 | return
|
---|
2443 | }
|
---|
2444 | e.fn.colorPicker.hidePalette()
|
---|
2445 | },
|
---|
2446 | hidePalette: function () {
|
---|
2447 | e(document).unbind("mousedown", e.fn.colorPicker.checkMouse);
|
---|
2448 | e(".colorPicker-palette").hide()
|
---|
2449 | },
|
---|
2450 | showPalette: function (n) {
|
---|
2451 | var r = t.prev("input").val();
|
---|
2452 | n.css({
|
---|
2453 | top: t.offset().top + t.outerHeight(),
|
---|
2454 | left: t.offset().left
|
---|
2455 | });
|
---|
2456 | e("#color_value").val(r);
|
---|
2457 | n.show();
|
---|
2458 | e(document).bind("mousedown", e.fn.colorPicker.checkMouse)
|
---|
2459 | },
|
---|
2460 | togglePalette: function (r, i) {
|
---|
2461 | if (i) {
|
---|
2462 | t = i
|
---|
2463 | }
|
---|
2464 | n = r;
|
---|
2465 | if (n.is(":visible")) {
|
---|
2466 | e.fn.colorPicker.hidePalette()
|
---|
2467 | } else {
|
---|
2468 | e.fn.colorPicker.showPalette(r)
|
---|
2469 | }
|
---|
2470 | },
|
---|
2471 | changeColor: function (n) {
|
---|
2472 | t.css("background-color", n);
|
---|
2473 | t.prev("input").val(n).change();
|
---|
2474 | e.fn.colorPicker.hidePalette();
|
---|
2475 | t.data("onColorChange").call(t, e(t).prev("input").attr("id"), n)
|
---|
2476 | },
|
---|
2477 | previewColor: function (e) {
|
---|
2478 | t.css("background-color", e)
|
---|
2479 | },
|
---|
2480 | bindPalette: function (n, r, i) {
|
---|
2481 | i = i ? i : e.fn.colorPicker.toHex(r.css("background-color"));
|
---|
2482 | r.bind({
|
---|
2483 | click: function (t) {
|
---|
2484 | o = i;
|
---|
2485 | e.fn.colorPicker.changeColor(i)
|
---|
2486 | },
|
---|
2487 | mouseover: function (t) {
|
---|
2488 | o = n.val();
|
---|
2489 | e(this).css("border-color", "#598FEF");
|
---|
2490 | n.val(i);
|
---|
2491 | e.fn.colorPicker.previewColor(i)
|
---|
2492 | },
|
---|
2493 | mouseout: function (r) {
|
---|
2494 | e(this).css("border-color", "#000");
|
---|
2495 | n.val(t.css("background-color"));
|
---|
2496 | n.val(o);
|
---|
2497 | e.fn.colorPicker.previewColor(o)
|
---|
2498 | }
|
---|
2499 | })
|
---|
2500 | }
|
---|
2501 | });
|
---|
2502 | e.fn.colorPicker.defaults = {
|
---|
2503 | pickerDefault: "FFFFFF",
|
---|
2504 | colors: ["000000", "993300", "333300", "000080", "333399", "333333", "800000", "FF6600", "808000", "008000", "008080", "0000FF", "666699", "808080", "FF0000", "FF9900", "99CC00", "339966", "33CCCC", "3366FF", "800080", "999999", "FF00FF", "FFCC00", "FFFF00", "00FF00", "00FFFF", "00CCFF", "993366", "C0C0C0", "FF99CC", "FFCC99", "FFFF99", "CCFFFF", "99CCFF", "FFFFFF"],
|
---|
2505 | addColors: [],
|
---|
2506 | showHexField: true
|
---|
2507 | }
|
---|
2508 | })(jQuery);
|
---|
2509 | /**
|
---|
2510 | * Stupid jQuery Table Sort
|
---|
2511 | * Copyright (c) 2012 Joseph McCullough
|
---|
2512 | * https://github.com/joequery/Stupid-Table-Plugin#readme
|
---|
2513 | */
|
---|
2514 | (function (e) {
|
---|
2515 | e.fn.stupidtable = function (t) {
|
---|
2516 | return this.each(function () {
|
---|
2517 | var n = e(this);
|
---|
2518 | t = t || {};
|
---|
2519 | t = e.extend({}, e.fn.stupidtable.default_sort_fns, t);
|
---|
2520 | n.on("click.stupidtable", "th", function () {
|
---|
2521 | var r = e(this);
|
---|
2522 | var i = 0;
|
---|
2523 | var s = e.fn.stupidtable.dir;
|
---|
2524 | n.find("#headline > th").slice(0, r.index()).each(function () {
|
---|
2525 | var t = e(this).attr("colspan") || 1;
|
---|
2526 | i += parseInt(t, 10)
|
---|
2527 | });
|
---|
2528 | var o = r.data("sort-default") || s.ASC;
|
---|
2529 | if (r.data("sort-dir")) o = r.data("sort-dir") === s.ASC ? s.DESC : s.ASC;
|
---|
2530 | var u = r.data("sort") || null;
|
---|
2531 | if (u === null) {
|
---|
2532 | return
|
---|
2533 | }
|
---|
2534 | n.trigger("beforetablesort", {
|
---|
2535 | column: i,
|
---|
2536 | direction: o
|
---|
2537 | });
|
---|
2538 | n.css("display");
|
---|
2539 | setTimeout(function () {
|
---|
2540 | var a = [];
|
---|
2541 | var f = t[u];
|
---|
2542 | var l = n.children("tbody").children("tr");
|
---|
2543 | l.each(function (t, n) {
|
---|
2544 | var r = e(n).children().eq(i);
|
---|
2545 | var s = r.data("sort-value");
|
---|
2546 | var o = typeof s !== "undefined" ? s : r.text();
|
---|
2547 | a.push([o, n])
|
---|
2548 | });
|
---|
2549 | a.sort(function (e, t, s) {
|
---|
2550 | return f(e[0], t[0], o)
|
---|
2551 | });
|
---|
2552 | if (o != s.ASC) a.reverse();
|
---|
2553 | l = e.map(a, function (e) {
|
---|
2554 | return e[1]
|
---|
2555 | });
|
---|
2556 | n.children("tbody").append(l);
|
---|
2557 | n.find("th.sorting-desc, th.sorting-asc").data("sort-dir", null).removeClass("sorting-desc sorting-asc").addClass("sortable");
|
---|
2558 | r.data("sort-dir", o).removeClass("sortable").addClass("sorting-" + o);
|
---|
2559 | $('tr').find('td.td-sorting').removeClass('td-sorting');
|
---|
2560 | $('tr').find('td:eq(' + i + ')').addClass('td-sorting');
|
---|
2561 | n.trigger("aftertablesort", {
|
---|
2562 | column: i,
|
---|
2563 | direction: o
|
---|
2564 | });
|
---|
2565 | n.css("display")
|
---|
2566 | }, 10)
|
---|
2567 | })
|
---|
2568 | })
|
---|
2569 | };
|
---|
2570 | e.fn.stupidtable.dir = {
|
---|
2571 | ASC: "asc",
|
---|
2572 | DESC: "desc"
|
---|
2573 | };
|
---|
2574 | var convert_locale = function (c) {
|
---|
2575 | if (c == "") return 0;
|
---|
2576 | if(locale_decpoint == ",") {
|
---|
2577 | c = c.toString().replace( /\./g,"" ).replace( /,/,"." );
|
---|
2578 | }else if(locale_decpoint == "."){
|
---|
2579 | c = c.toString().replace( /,/g,"" );
|
---|
2580 | }
|
---|
2581 | return(c);
|
---|
2582 | }
|
---|
2583 | var ip2int = function dot2num(dot, s) {
|
---|
2584 | if (dot == "" && s == "asc") return 4300000000;
|
---|
2585 | if (dot == "" && s == "desc") return 1;
|
---|
2586 | var d = dot.split('.');
|
---|
2587 | return ((((((+d[0])*256)+(+d[1]))*256)+(+d[2]))*256)+(+d[3]);
|
---|
2588 | }
|
---|
2589 | e.fn.stupidtable.default_sort_fns = {
|
---|
2590 | "int": function (e, t, s) {
|
---|
2591 | return parseInt(convert_locale(e), 10) - parseInt(convert_locale(t), 10)
|
---|
2592 | },
|
---|
2593 | "float": function (e, t, s) {
|
---|
2594 | return parseFloat(convert_locale(e)) - parseFloat(convert_locale(t))
|
---|
2595 | },
|
---|
2596 | "ip": function (a, b, s) {
|
---|
2597 | aIP = ip2int(a, s);
|
---|
2598 | bIP = ip2int(b, s);
|
---|
2599 | return aIP - bIP;
|
---|
2600 | },
|
---|
2601 | "string": function (e, t, s) {
|
---|
2602 | if (e == "" && s == "asc") return +1;
|
---|
2603 | if (t == "" && s == "asc") return -1;
|
---|
2604 | if (e < t) return -1;
|
---|
2605 | if (e > t) return +1;
|
---|
2606 | return 0
|
---|
2607 | },
|
---|
2608 | "string-ins": function (e, t, s) {
|
---|
2609 | e = e.toString().toLowerCase();
|
---|
2610 | t = t.toString().toLowerCase();
|
---|
2611 | if (e == "" && s == "asc") return +1;
|
---|
2612 | if (t == "" && s == "asc") return -1;
|
---|
2613 | if (e < t) return -1;
|
---|
2614 | if (e > t) return +1;
|
---|
2615 | return 0
|
---|
2616 | }
|
---|
2617 | }
|
---|
2618 | })(jQuery)
|
---|
2619 |
|
---|
2620 | // Create Base64 Object
|
---|
2621 | var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r)}else if(r>127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n<e.length){r=e.charCodeAt(n);if(r<128){t+=String.fromCharCode(r);n++}else if(r>191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}}
|
---|