1$(document).ready 2 ( 3 function ($) { 4 // disable submit for dataset-search 5 //$('form[class*="dataset-search"]').submit(function(){ds_search_send($(this));}); 6 7 // initialize date picker 8 $('input[class*="date-input"]').each 9 ( 10 function () { 11 $(this).attr('data-current', $(this).val()); 12 var opts = 13 { 14 dateFormat: "M dd yy", 15 showButtonPanel: true, 16 changeMonth: true, 17 changeYear: true, 18 showAnim: "blind", 19 20 onClose: function (date) { 21 if (!date.length) { 22 $(this).val($(this).attr('data-current')); 23 } 24 else { 25 $(this).attr('data-current', date); 26 } 27 } 28 }; 29 30 if ($(this).val()) { 31 opts.defaultDate = $(this).val(); 32 } 33 34 $(this).datepicker(opts); 35 } 36 ); 37 38 // set show for ds calendar week events 39 $('.ds-calendar-week-event > label').each 40 ( 41 function () { 42 var content = $(this).parent('div').children('div').html(); 43 var options = 44 { 45 content: content, 46 style: 47 { 48 fontFamily: $('.contenttd').css('font-family'), 49 'background-color': $('.datasetmodulemodule').css('background-color'), 50 border: { width: 0 } 51 } 52 } 53 $(this).qtip(options); 54 } 55 ); 56 57 // set time pickers 58 $('input[class*="time-input"]').each 59 ( 60 function () { 61 var options = 62 { 63 defaultTime: '' 64 } 65 66 if ($(this).attr('data-extend')) { 67 eval('extend = ' + $(this).attr('data-extend')); 68 $.extend(options, extend); 69 } 70 $(this).timepicker(options); 71 } 72 ); 73 74 // initialize validation 75 $('form').validate(); 76 77 // initialize checkbox search 78 $('input[data-checkbox-search]').checkbox_search(); 79 80 // initialize simple search 81 $('input[data-db-search]').search_db(); 82 83 // inititialize size-input 84 $('input[data-size-input]').each 85 ( 86 function () { 87 $(this).change 88 ( 89 function () { 90 var config = $(this).attr('data-size-input'); 91 eval('config = ' + config); 92 var value = $(this).val(); 93 if (!isNaN(value)) { 94 var tgt = $('#' + config.id); 95 if (config.property == 'size') { 96 tgt.attr(config.property, value); 97 } else { 98 tgt.css(config.property, value + 'px'); 99 } 100 } 101 } 102 ); 103 } 104 ); 105 106 // inititate ibm menu 107 $('.ibm').each 108 ( 109 function () { 110 $(this).attr('href', '#'); 111 $(this).click 112 ( 113 function () { 114 var i = $(this).attr('data-id'); 115 $('#menu-horizontal-sub div').hide(); 116 $('#menu-horizontal-sub-' + i).toggle(); 117 } 118 ); 119 //menu-horizontal-sub- 120 } 121 ); 122 123 // initiate eyecon color picker 124 $('.color-input').each 125 ( 126 function () { 127 var options = 128 { 129 color: $(this).val(), 130 onSubmit: function (hsb, hex, rgb, el) { 131 if (hex != 'inherit') hex = '#' + hex; 132 $(el).val(hex); 133 $(el).prev('div').css('background', hex); 134 $(el).ColorPickerHide(); 135 } 136 } 137 138 if ($(this).attr('data-options')) { 139 eval('extend = ' + $(this).attr('data-options')); 140 $.extend(options, extend); 141 } 142 143 $(this).ColorPicker(options); 144 } 145 ); 146 147 // cron update 148 $('[data-cron-update]').each 149 ( 150 function () { 151 var job = $(this).attr('data-cron-update'); 152 $(this).click 153 ( 154 function () { 155 var trigger = $(this); 156 $.ajax 157 ( 158 { 159 url: '/resources/php/ajax/manual-cron.php', 160 data: { job: job }, 161 cache: false, 162 success: function (result) { 163 $(trigger).parent('span').html(result); 164 } 165 } 166 ); 167 } 168 ); 169 } 170 ); 171 172 // control table 173 $('[data-select-children]').each 174 ( 175 function () { 176 var select = $(this).find('select'); 177 var name = $(this).attr('data-select-children'); 178 $(select).change 179 ( 180 function () { 181 var v = $(this).val(); 182 $('[data-select-parent=' + name + ']').each 183 ( 184 function () { 185 $(this).hide(); 186 eval('var value =' + $(this).attr('data-value')); 187 var show = false;
188 for (var i in value) { 189 if (value[i] == v) { 190 show = true; 191 } 192 } 193 194 if (show) $(this).show(); 195 } 196 ); 197 } 198 ).trigger('change'); 199 } 200 ); 201 202 // lightbox 203 $('.gallery-lightbox').each 204 ( 205 function () { 206 $(this).find('a').lightBox(); 207 } 208 ); 209 210 // js links 211 $('a[data-href]').each 212 ( 213 function () { 214 $(this).css('cursor', 'pointer'); 215 $(this).click 216 ( 217 function () { 218 location = $(this).attr('data-href'); 219 } 220 ); 221 } 222 ); 223 224 // load icons 225 $('[data-icon-key]').each 226 ( 227 function () { 228 var icon = '[name=' + $(this).attr('data-icon-key') + ']'; 229 var icon = $('form[name=icon]').find(icon).val(); 230 $(this).attr('src', icon); 231 } 232 ); 233 234 // disable copying 235 var form = $('form[name=settings]'); 236 disable = $(form).find('input[name=disable_copying]').val() == 'yes'; 237 acc = $(form).find('input[name=acc]').val() == 1; 238 if (disable && !acc) { 239 $(document).bind 240 ( 241 'contextmenu', 242 function (e) { 243 return false; 244 } 245 ); 246 247 $(document).bind 248 ( 249 'mousedown selectstart', 250 function (e) { 251 return $(e.target).is('input, textarea, select, option, html'); 252 } 253 ); 254 } 255 256 // webmail login 257 $('[data-webmail]').click 258 ( 259 function () { 260 eval('config=' + $(this).attr('data-webmail')); 261 262 var user = config.user; 263 var pass = config.pass; 264 var domain = config.domain; 265 266 var webmail = 'http://' + domain + '/webmail/'; 267 268 var form = document.createElement('form'); 269 $(form).attr('action', webmail + 'process.php'); 270 $(form).attr('method', 'post'); 271 $(form).attr('target', '_blank'); 272 $('body').append(form); 273 274 var input = document.createElement('input'); 275 $(input).attr('name', 'f_email'); 276 $(input).val(user); 277 $(form).append(input); 278 279 var input = document.createElement('input'); 280 $(input).attr('name', 'f_pass'); 281 $(input).val(pass); 282 $(form).append(input); 283 284 $(form).submit(); 285 } 286 ); 287 288 // ckeditor 289 $('[data-ckeditor]').each 290 ( 291 function () { 292 name = $(this).attr("name"); 293 div = $("#cke-" + name + "-config"); 294 if ($(div).length) { 295 src = $(div).html(); 296 } 297 else { 298 src = $(this).attr('data-ckeditor'); 299 } 300 301 eval('var opts = ' + src); 302 var editor = CKEDITOR.replace($(this).attr('name'), opts); 303 editor.on 304 ( 305 "instanceReady", 306 function (e) { 307 //e.editor.focus(); 308 309 } 310 ); 311 } 312 ); 313 314 // hover class 315 $('[data-append-hover-class]').mouseover 316 ( 317 function () { 318 var append = $(this).attr('data-append-hover-class'); 319 $(this).addClass(append); 320 $(this).mouseout 321 ( 322 function () { 323 $(this).removeClass(append); 324 } 325 ); 326 } 327 ); 328 /* 329 // tabs 330 $('[data-tab-control]').click 331 ( 332 function () { 333 //console.log('clicked', this); 334 var tabbed = $(this).closest('.tabbed'); 335 $(tabbed).find('.tabbed-content div[data-tab]').hide(); 336 337 let cTab = $('[data-tab=' + $(this).attr('data-tab-control') + ']'); 338 cTab.show(); 339 340 // dispatch event so tab can react to opened event 341 const nTab = document.querySelector('[data-tab="' + $(this).attr('data-tab-control') + '"]'); 342 nTab.dispatchEvent(new Event('TabbedOpened')); 343 344 $(tabbed).find('[data-tab-control]').removeClass('active'); 345 $(this).addClass('active'); 346 347 loc = location; 348 group = $(this).closest('[data-tab-group]').attr('data-url'); 349 tab = $(this).attr('data-url'); 350 loc.hash = '#' + group + ':' + tab; 351 location = loc 352 } 353 ); 354 355 // check for # in url 356 if (location.hash.length) { 357 var tmp = location.hash.substr(1).split(':'); 358 var hash = 359 { 360 group: tmp[0], 361 tab: tmp[1] 362 }; 363 364 $('[data-tab-group]').each 365 ( 366 function () { 367 if (hash.group == $(this).attr('data-url')) { 368 $(this).find('li[data-url=' + hash.tab + ']').click(); 369 } 370 } 371 ); 372 } 373 374 // check for internal links 375 $('div[class=tabbed]').each 376 ( 377 function () { 378 container = this; 379 content = $(this).find('.tabbed-content'); 380 url = 381 { 382 parent: $(this).attr('data-url') 383 } 384 385 $(this).find('[data-tab-control]').each 386 ( 387 function () { 388 url.tab = $(this).attr('data-url'); 389 match = url.parent + ':' + url.tab; 390 391 $(content).find('a[href$="#' + match + '"]').attr('data-trigger-tab', url.tab); 392 $(content).find('a[href$="#' + match + '"]').click 393 ( 394 function () { 395 // maybe check location.pathname as well?? 396 btn = $(container).find('li[data-url=' + $(this).attr('data-trigger-tab') + ']'); 397 $(btn).click(); 398 $(btn).goTo(); 399 } 400 ); 401 } 402 ); 403 } 404 ); 405 */ 406 // button-hover image 407 $('img.button-hover').each 408 ( 409 function () { 410 var tgt = $(this); 411 var src = $(this).attr('src'); 412 var hover = src.split('.'); 413 var ext = hover.pop(); 414 var hvr = hover.join('.') + '-hover.' + ext; 415 416 $.ajax 417 ( 418 { 419 url: hvr, 420 success: function (result) { 421 $(tgt).mouseover 422 ( 423 function () { 424 $(this).attr('src', hvr); 425 } 426 ); 427 428 $(tgt).mouseout 429 ( 430 function () { 431 $(this).attr('src', src); 432 } 433 ); 434 } 435 } 436 ); 437 } 438 ); 439 440 $('[data-multiple=check]').each 441 ( 442 function () { 443 multiple = true; 444 var b = $.browser; 445 if ($.browser.msie) { 446 v = b.version.split('.');
447 v = new Number(v[0]); 448 if (v < 10) { 449 multiple = false; 450 } 451 } 452 453 if (multiple) { 454 $(this).attr('multiple', 'multiple'); 455 div = document.createElement('div'); 456 $(div).html('Use Shift/Ctrl to select multiple files.'); 457 $(div).css({ 'font-size': '80%', 'padding': '5px 0' }); 458 $(this).attr('onchange', ''); 459 $(this).closest('td').append(div); 460 } 461 } 462 ); 463 464 $('input[multiple]').change 465 ( 466 function () { 467 el = this; 468 // extensions 469 vext = $(this).attr('data-extensions'); 470 // create display of files 471 div = $(this).closest('td').find('[data-files]'); 472 if (!$(div).length) { 473 div = document.createElement('div'); 474 $(div).attr('data-files', true); 475 $(this).after(div); 476 } 477 478 // reset 479 $(div).html(''); 480 $(div).removeClass('errorcellerror'); 481 482 files = $(this).get(0).files; 483 $(files).each 484 ( 485 function (k, v) { 486 if (!VEXT(v.name, vext)) { 487 $(div).html('Valid extensions: ' + vext); 488 $(div).addClass('errorcellerror'); 489 $(el).replaceWith($(el).clone(true)); 490 return false; 491 } 492 else { 493 if (files.length > 1) $(div).append(v.name + '<br>'); 494 } 495 } 496 ) 497 } 498 ); 499 500 $('a[data-disable-cache]').each 501 ( 502 function () { 503 uri = $(this).attr('href'); 504 cache = 'nocache=' + Date(); 505 } 506 ); 507 } 508 ); 509 510 511(function ($) { 512 $.fn.goTo = function () { 513 $('html, body').animate({ 514 scrollTop: $(this).offset().top + 'px' 515 }, 'fast'); 516 return this; // for chaining... 517 } 518})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.