1/* Standaard 1.1 */ 2//if (config_url == 'http://vpn.publi4u.be/cms4u') config_url = ''; 3if (config_url != '') config_url += '/'; 4if (site_url == '#site_url#') site_url = ''; 5if (site_url != '') site_url += '/'; 6if (typeof gmap_address == 'undefined') gmap_address = 'James Ensorplein 4, 8550 Zwevegem'; 7if (typeof gmap_link == 'undefined') gmap_link = "https://www.google.be/maps/place/"+gmap_address.replace(' ','+'); 8if (typeof popupcookie_name == 'undefined') popupcookie_name = "boilercookie"; 9 10var old_w = -1; 11var is_mobile = false; 12var cms4u_loaded_event; 13 14$(document).ready(function() { 15 if (typeof cms4u_site_id != 'undefined') $.ajaxSetup({ data:{ 'cms4u_site_id': cms4u_site_id, } }); 16 17 $.getScript = function(url, callback, cache) 18 { 19 if (typeof cache == 'undefined') cache = false; 20 $.ajax({ 21 type: "GET", 22 url: url, 23 success: callback, 24 dataType: "script", 25 cache: cache 26 }); 27 }; 28 29 initResponsiveImages(); 30 31 initCookies(); 32 initCookiePopup(); 33 initDatepicker(); 34 35 intCollapsibleCategoryMenu(); 36 initTestUploadSize(); 37 initCategoryFilter(); 38 initDropdown(); 39 initVideoBanner(); 40 initAlertsAndToolbar(); 41 initEditor(); 42 initAjaxCombobox(); 43 initFilters(); 44 if ($('a[data-ga]').length) $('a[data-ga]').attr('onclick', $('a[data-ga]').data('ga')); 45 46 fetchHttpBufferAsync(); 47 48 $('li.new_window a').each(function() { 49 $(this).attr('target', '_blank') 50 .attr('rel', 'noopener'); 51 }); 52 notifyBrowser(); 53}); 54 55 56 /* ====================================================================================================================================================== 57 Functions loaded. Notify other scripts that all plugins are available 58 ====================================================================================================================================================== */ 59 function notifyBrowser() { 60 try { 61 cms4u_loaded_event = new CustomEvent('cms4u_loaded', {'bubbles':false, 'cancelable':false}); 62 }catch(e) { 63 //-- IE bug 64 cms4u_loaded_event = document.createEvent('Event'); 65 cms4u_loaded_event.initEvent('cms4u_loaded', true, false); 66 } 67 document.dispatchEvent(cms4u_loaded_event); 68 } 69 /* ====================================================================================================================================================== 70 Banner + lightbox init 71 ====================================================================================================================================================== */ 72 function initBanner() { 73 $('a.lightbox').nivoLightbox(); 74 $(document).ajaxStop(function() { $('a.lightbox').nivoLightbox(); }); 75 $(document).on('click', ".lightbox", function(){ addSwipeTo(".nivo-lightbox-overlay"); }); 76 77 if (!$('#slides').length) return; 78 if ($('#slides .slides-container li').length == 1) $('#slides .slides-container').append($('#slides .slides-container li:first-child').clone()); 79 80 $('#slides').superslides({ 81 hashchange: false, 82 animation: superslides_animation, 83 play: superslides_play, 84 animation_speed: superslides_animation_speed, 85 animation_easing: superslides_easing, 86 inherit_width_from: '#superslides', 87 inherit_height_from: '#superslides' 88 }); 89 90 if (getParameterByName('bpi') != null) $('html, body').scrollTop($('#slides').position().top); 91 92 setTimeout(function() { 93 $('#slides .slides-container').css({'opacity': 1, }); 94 }, 400); 95 } 96/* ====================================================================================================================================================== 97/* Nav mobile 98====================================================================================================================================================== */ 99function initResponsiveImages() { 100 check(); 101 setTimeout(function() { initBanner(); }, 500); 102 $(window).bind('resize', function() { check(); }); 103} 104 105function toggle() { 106 $('#nav_mobile ul').slideToggle( 107 "fast", 108 function() { 109 setScrollHeight(); 110 } 111 ); 112} 113 114function setScrollHeight () { 115 if($("#nav_mobile ul").is(":hidden")) { 116 $("#banner").show(); 117 $("#newsletter").show(); 118 $("#core_activities").show(); 119 $("#container").show(); 120 $("#footer").show(); 121 }else if($("#nav_mobile ul").is(":visible")) { 122 $("#banner").hide(); 123 $("#newsletter").hide(); 124 $("#core_activities").hide(); 125 $("#container").hide(); 126 $("#footer").hide(); 127 } 128} 129 130function check() { 131 var w=window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 132 if (old_w != w) { 133 if (w<768) { 134 goMobile(); 135 }else if(w<1000) { 136 goTablet(); 137 }else { 138 goDefault(); 139 } 140 old_w = w; 141 } 142} 143 144function goTablet() { 145 if (is_mobile) $('img[data-d]').each(function() { this.src = $(this).attr('data-d'); }); 146 showBtnMenu(); 147} 148 149function goMobile() { 150 is_mobile = true; 151 $('img[data-m]').each(function() { $(this).attr('src', $(this).data('m')); }); 152 153 showBtnMenu(); 154 setScrollHeight(); 155} 156 157function goDefault() { 158 is_mobile = false; 159 $('img[data-d]').each(function() { this.src = $(this).attr('data-d'); }); 160 removeBtnMenu(); 161} 162 163function showBtnMenu() { 164 if (typeof $("#nav_mobile .selected").html() === "undefined") $('#nav_mobile .root a').addClass('selected'); 165 $("#btn_nav_mobile").html('<img src="'+config_url+'/images/icon-menu.png" />'+$("#nav_mobile .selected").html()); 166 $('#nav_main').hide(); 167 $('#nav_mobile').show(); 168 $('#nav_mobile ul').hide(); 169} 170 171function removeBtnMenu() { 172 if ($("#btn_nav_mobile").length > 0) { 173 $('#nav_main').show(); 174 $("#nav_mobile").hide(); 175 } 176 $('#nav_mobile ul').slideUp( 177 "fast", 178 function() { 179 setScrollHeight(); 180 } 181 ); 182} 183/* ======================================================================================================================================================
184 Category filter 185 ====================================================================================================================================================== */ 186function initCategoryFilter() { 187 if (!$('#frm_filters').length) return; 188 189 $('#frm_filters').on('click', 'input[type=checkbox]', function(){ 190 var ids = new Array(); 191 $('#frm_filters input[type=checkbox]:checked').each(function() { 192 ids.push($(this).val()); 193 }); 194 getItems(ids, category_type_filter); 195 }); 196 197 $('#frm_filters').on('change', 'select', function(){ 198 if ($(this).val() == -1) getItems([], category_type_filter); 199 $('#frm_filters input[type=checkbox]').prop('checked', false); 200 $('#frm_filters input[type=checkbox][value="'+$(this).val()+'"]').prop('checked', true); 201 getItems($(this).val(), category_type_filter); 202 }); 203} 204 function getItems(ids, type) { 205 if (!(ids instanceof Array)) { 206 var tmp = ids; 207 ids = new Array(); 208 ids.push(tmp); 209 } 210 if (ids.length == 0) ids = null; 211 $.ajax({ 212 type: "POST", 213 data: {'ids': ids, 'type': type}, 214 url: config_url + 'ajax/common/get_items.php', 215 cache: false, 216 beforeSend: function() { 217 $('.article_overview').html('<img src="' + config_url + '/images/ajax-loader.gif" />'); 218 }, 219 success: function(d){ 220 var decodedJson = null; 221 try { 222 decodedJson = jQuery.parseJSON(d); 223 } catch (e){} 224 if (decodedJson == null) { 225 $('.article_overview').replaceWith(d); 226 }else{ 227 window.location = decodedJson.route; 228 } 229 } 230 }); 231 } 232 233function initDropdown() { 234 if (!$('li.dropdown').length) return; 235 $('li.dropdown').each(function(){ $(this).find('ul').css('min-width', $(this).width() - 40); }); 236 $('li.dropdown ul li.dropdown ul').css('left', $('li.dropdown ul').width() +20); 237} 238 239function initVideoBanner() { 240 var can_autoplay = !window.matchMedia('(prefers-reduced-motion)').matches; 241 $('video').each(function() { 242 var video = $(this).get(0); 243 var button = $(this).next('button').length ? $(this).next('button') : null; 244 245 if (!is_mobile && can_autoplay && $(this).data('autoplay')) toggleVideo(video, button, true); 246 247 video.addEventListener('touchstart', function() { 248 toggleVideo(video, button); 249 }); 250 251 if (button) button.on('click', function() { 252 toggleVideo(video, button); 253 }); 254 }); 255} 256 257function toggleVideo(video, button, force) { 258 if (video.paused || force) { 259 video.play(); 260 if (button) button.addClass('playing'); 261 }else{ 262 video.pause(); 263 if (button) button.removeClass('playing'); 264 } 265} 266/* 267/* ====================================================================================================================================================== 268 Cookies 269 ====================================================================================================================================================== */ 270function initCookies() { 271 $(document).on('click', 'button[data-decline]', function(e) { 272 e.preventDefault(); 273 hide_cookie_bar('#cookie_message', true); 274 }); 275 276 $(document).on('click', 'button[data-accept]', function(e) { 277 e.preventDefault(); 278 create_cookie($(this).data('accept'), $(this).data('value')); 279 hide_cookie_bar('#cookie_message', true); 280 }); 281} 282function create_cookie(cookie_name, value, days) { 283 if (typeof(days) == 'undefined') days = 365; 284 $.cookie(cookie_name , value, { 'expires' : days, 'path' : '/', }); 285} 286function check_cookie(cookie_name) { 287 return $.cookie(cookie_name) != null && $.cookie(cookie_name) != ""; 288} 289function hide_cookie_bar(elem, effect){ 290 if (effect == true) $(elem).slideUp(); 291 else $(elem).hide(); 292} 293 294/* ====================================================================================================================================================== 295 Popup 296 ====================================================================================================================================================== */ 297function initCookiePopup() { 298 popup_show(popupcookie_name); 299 $('#popup-trigger').nivoLightbox({ 300 afterHideLightbox: function(){ 301 if ($('#popup-trigger').data('remember') == true) popup_close(popupcookie_name); 302 }, 303 }); 304} 305 function popup_show(cookie_name) { 306 if (check_cookie(cookie_name) && $('#popup-trigger').data('remember')) return; 307 if ($('#popup').length > 0 && !$('#popup').hasClass('hide_m')){ 308 $('#popup').css({'width': $('#popup-trigger').data('width'),'height': $('#popup-trigger').data('height')}); 309 setTimeout(function (){ 310 $('#popup-trigger').trigger('click'); 311 }, $('#popup-trigger').data('timeout')); 312 } 313 } 314 315 function popup_close(cookie_name) { 316 create_cookie(cookie_name); 317 } 318/* ====================================================================================================================================================== 319 Inline editor 320 =================================================================================================================================================== */ 321 var editor_state = false; 322 var share_buttons = []; 323 324 function initEditor() { 325 $(document).on('click', '#editor', function() { 326 if ($(this).hasClass('rotate')) $('#chk_show_adjustable').prop('checked', true); 327 toggleEditorState($('#chk_show_adjustable').is(':checked')); 328 }); 329 330 $(document).on('change', '#chk_show_adjustable', function() { 331 toggleEditorState($(this).is(':checked')); 332 }); 333 334 $(document).on('click', '*[data-key][data-table][data-value]', function(e) { 335 if ($(this).attr('contenteditable') == 'true') { 336 e.preventDefault(); 337 e.stopPropagation(); 338 } 339 }); 340 $(document).on('input', '*[data-key][data-table][data-value]', function(e) { 341 $('*[data-key="'+$(this).data('key')+'"][data-table="'+$(this).data('table')+'"][data-value="'+$
341(this).data('value')+'"]').not($(this)).html($(this).html()); 342 }); 343 344 $(document).on('click', '#save_changes', function(e) { 345 e.preventDefault(); 346 var edits = {}; 347 $(this).attr('disabled', true); 348 349 $('*[data-key][data-table][data-value]').each(function() { 350 if (typeof edits[$(this).data('table')] == 'undefined') edits[$(this).data('table')] = {}; 351 if (typeof edits[$(this).data('table')][$(this).data('key')] == 'undefined') edits[$(this).data('table')][$(this).data('key')] = {}; 352 if (typeof edits[$(this).data('table')][$(this).data('key')][$(this).data('value')] == 'undefined') edits[$(this).data('table')][$(this).data('key')][$(this).data('value')] = []; 353 edits[$(this).data('table')][$(this).data('key')][$(this).data('value')].push({ 354 'field': $(this).data('field') ? $(this).data('field') : 'content', 355 'value': $(this).html(), 356 'html': $(this).hasClass('ckeditor') ? 1 : 0, 357 358 }); 359 }); 360 361 console.log(edits); 362 363 var that = $(this); 364 $.post(config_url + '/cp/ajax/common/editor.php', { 'edits': edits, }, function(out) { 365 that.attr('disabled', false); 366 $('#chk_show_adjustable').prop('checked', false).trigger('change'); 367 $('.toolbar button.extend').trigger('click'); 368 }); 369 }); 370 } 371 372 function toggleEditorState(state) { 373 if (state === editor_state) { 374 /** 375 console.log('State did not change!'); 376 console.log('- Current state:', editor_state); 377 console.log('- Checkbox state:', $('#chk_show_adjustable').is(':checked')); 378 **/ 379 return; 380 } 381 382 //remove add2any 383 if ($('h1 span').length) $('h1 span:first').each(function() { 384 $(this).parent().html($(this).html()).next().remove(); 385 }); 386 387 $('*[data-key][data-table][data-value]').attr('contenteditable', function(i, val) { 388 return state ? 'true' : 'false'; 389 }); 390 $('#save_changes').attr('disabled', !state); 391 392 if (state) enableCkeditor(); 393 else destroyCkeditor(); 394 395 editor_state = state; 396 //console.log('Editor state set to', editor_state); 397 } 398 399 function enableCkeditor() { 400 //console.log('Enabling CKEditor'); 401 $('.ckeditor').each(function() { 402 var opts = {}; 403 if ($(this).data('toolbar')) opts = { 404 'toolbar' : $(this).data('toolbar'), 405 }; 406 $(this).ckeditor(opts); 407 }); 408 //console.log('Done'); 409 } 410 411 function destroyCkeditor() { 412 //console.log('Destroying CKEditor'); 413 for(name in CKEDITOR.instances) CKEDITOR.instances[name].destroy(true); 414 } 415 416 function callbackTaskEditor(elem, output) { 417 elem.html(output); 418 /** Load CKEditor for sections which require it **/ 419 if ($('.ckeditor').length) { 420 CKEDITOR.disableAutoInline = true; 421 CKFinder.setupCKEditor( null, config_url + '/cp/ckfinder' ); 422 } 423 } 424 425 /* ====================================================================================================================================================== 426 Ajax Combobox 427 =================================================================================================================================================== */ 428function initAjaxCombobox() { 429 if ($('select[data-ajax], div.checkbox[data-ajax]').length) { 430 $('select[data-ajax], div.checkbox[data-ajax]').each(function() { 431 var select = $(this); 432 var trigger = $('#'+select.data('field')); 433 if (trigger.length == 0) return; 434 435 trigger.on(select.data('event'), function() { 436 if (trigger.data('ignore')) { 437 var ignore = trigger.data('ignore')+""; 438 ignore = ignore.split(';'); 439 if ($.inArray(trigger.val(), ignore) > -1) return; 440 } 441 442 var skip = trigger.is('select') ? $('option:selected', trigger).data('skip') || $('option:selected', trigger).data('ignore') : trigger.data('skip') || trigger.data('ignore'); 443 if (skip) return; 444 445 trigger.attr('disabled', true); 446 447 var data = select.data(); 448 data[select.data('field')] = trigger.val(); 449 450 if (typeof select.data('data-options')['data-callback'] != 'undefined' && typeof window[select.data('data-options')['data-callback']] != undefined) window[select.data('data-options')['data-callback']](data); 451 452 $.ajax({
453 type: "POST", 454 data : data, 455 url: select.data('ajax'), 456 cache: false, 457 success: function(data){ 458 if (select.data('callback') != 'default' && typeof window[select.data('callback')] != 'undefined') { 459 window[select.data('callback')](select, trigger, data); 460 }else{ 461 select.html(data); 462 } 463 },error: function(err) { 464 var message = null; 465 try { 466 message = JSON.parse(err.responseText); 467 }catch(e){ console.log(e.message); } 468 469 message = message ? message.error : err.responseText; 470 showPopup(trigger, message, 'error', false, 10000); 471 },complete: function() { 472 trigger.attr('disabled', false); 473 }, 474 }); 475 }); 476 }); 477 } 478} 479 480 481function initFilters() { 482 if($('.filters').length) { 483 $(document).on('click', '*[data-filter-value]', function() { 484 var parent = $(this).parent().parent().parent(); 485 $.post(parent.data('ajax'), { 486 'filters' : getFilters(parent), 487 'item_category' : parent.data('item-category') 488 }, function(html) { 489 $('.calendar_overview').html(html); 490 }); 491 }); 492 } 493} 494 495function getFilters(parent) { 496 var object = {}; 497 $('*[data-filter-value]:checked', parent).each(function() { 498 if (typeof object[$(this).data('filter-key')] == 'undefined') object[$(this).data('filter-key')] = []; 499 object[$(this).data('filter-key')].push($(this).data('filter-value')); 500 }); 501 return object; 502} 503 /* ====================================================================================================================================================== 504 Helpers 505 =================================================================================================================================================== */ 506function initAlertsAndToolbar() { 507 $(document).on('click', '.alert-box .close, .toolbar .close', function(e) { 508 e.preventDefault(); 509 $(this).parent().fadeOut(); 510 }); 511 512 $(document).on('click', '.toolbar button.extend', function(e) { 513 e.preventDefault(); 514 $(this).toggleClass('rotate'); 515 $('.toolbar-extended').slideToggle(); 516 }); 517} 518 519function intCollapsibleCategoryMenu() { 520 return; 521 $('.nav_sidebar > li.collapsible a').not('.selected').next().hide(); 522 $('.nav_sidebar > li.collapsible > a').on('click', function(e){ 523 if ($('ul', $(this).parent()).length) { 524 e.preventDefault(); 525 if ($(this).hasClass('selected')) { 526 $(this).removeClass('selected'); 527 $(this).parent().removeClass('selected'); 528 $(this).next().slideUp(); 529 }else{ 530 $('.nav_sidebar > li.collapsible, .nav_sidebar > li.collapsible a').removeClass('selected'); 531 532 $(this).addClass('selected'); 533 $(this).parent().addClass('selected'); 534 $('.nav_sidebar > li.collapsible a').next().slideUp() 535 $(this).next().slideToggle(); 536 } 537 } 538 }); 539} 540function is_numeric(v) { 541 return !isNaN(parseFloat(v)) && isFinite(v); 542} 543 544function print_article() { 545 window.print(); 546} 547/** =========== 548 PASSWORDS 549=============== **/ 550function passwordCheck() { 551 if (typeof required_check_password == 'undefined' || required_check_password) return; 552 $(document).no('keyup focus focusout blur', 'input[type=password][id$=txt_pass]', function() { 553 validatePassword($(this)); 554 //#pswd_info; 555 }); 556} 557function validatePassword(password) { 558 var value = password.val(); 559 var button = password.closest('form').find('button[type="submit"]');; 560 561 var errors = []; 562 563 doPasswordCheck(errors, value.length < 8, 'invalid_length'); 564 doPasswordCheck(errors, value.match(/[A-Z]/) == false, 'use_uppercase'); 565 doPasswordCheck(errors, value.match(/[a-z]/) == false, 'use_lowercase'); 566 567 button.attr('disabled', errors.length > 0); 568} 569 function doPasswordCheck(errors, bool, message) { 570 if (!bool) errors.push(message); 571 } 572 573/** =========== 574 MAX. UPLOAD 575=============== **/ 576function initTestUploadSize() { 577 if (!$('form').length || !$('form input[type="file"]').length) return; 578 579 $('form').submit(function(e) { 580 var submitable = true; 581 $(this).find('input[type="file"]').each(function() { 582 if (this.files.length == 0) return; 583 if (this.files[0].size > llama) { 584 submitable = false; 585 586 var input = $(this); 587 var input_id = input.attr('id'); 588 var popup_id = input_id+'_popup'; 589 590 if ($('#'+popup_id).length == 0) { 591 $(this).wrap('<div class="popup_wrapper" id="'+popup_id+'"></div>'); 592 $(this).after('<span class="popup">' + llama_message + '</span>'); 593 $('#'+ popup_id+ ' span.popup').css('left', (input.css('margin-left'))); 594 $('#'+ popup_id+ ' span.popup').css('margin-left', '25px'); 595 596 $('html, body').animate({ 597 scrollTop: $(this).offset().top 598 }, 500,function() { 599 setTimeout(function() { 600 $('#'+ popup_id+ ' span.popup').fadeOut(500, function() { 601 $('#'+popup_id).replaceWith(input); 602 });
603 }, 1500); 604 }); 605 } 606 return; 607 //$(this).replaceWith($(this).clone(true)); 608 } 609 }); 610 return submitable; 611 }); 612} 613/** =========== 614 HTTP BUFFER 615=============== **/ 616 function fetchHttpBufferAsync() { 617 if (!$('*[data-buffer]').length) return; 618 619 var tasks = new Array(); 620 $('*[data-buffer]').each(function() { 621 $(this).attr('data-buffered-task', tasks.length); 622 tasks.push({ 623 'id' : $(this).data('buffered-task'), 624 'task' : $(this).data('buffer'), 625 'timeout' : $(this).data('timeout'), 626 'loader' : $(this).data('loader') == 'true' || $(this).data('loader') == 1, 627 'args' : $(this).data('args'), 628 'function' : $(this).data('function'), 629 }); 630 }); 631 if (tasks.length == 0) return; 632 var errors = []; 633 634 $.ajax({ 635 type: "POST", 636 data: {'tasks': tasks,}, 637 dataType: 'json', 638 url: config_url + 'ajax/common/http_buffer.php', 639 cache: false, 640 success: function(tasks){ 641 if (tasks) { 642 var notices = []; 643 tasks.forEach(function(task) { 644 if (typeof task.error != 'undefined') { 645 errors.push('Task <span>'+task.task+'</span>'+' - '+task.error); 646 } 647 if (typeof task.output == 'undefined' || task.output === null) return; 648 task.callbacks.forEach(function(callback) { 649 if ($('*[data-buffered-task="'+callback.id+'"]').length == 0) return; 650 651 var callback_function = null; 652 if (callback.function != '') { 653 callback_function = window[callback.function]; 654 if(typeof callback_function !== 'function') { 655 console.log('Task warning: '+ callback.function + ' is not a valid function'); 656 callback_function = null; 657 } 658 } 659 660 if (callback.timeout == 0) { 661 if (callback_function === null) { 662 $('*[data-buffered-task="'+callback.id+'"]').html(task.output[callback.id]); 663 }else{ 664 callback_function($('*[data-buffered-task="'+callback.id+'"]'), task.output[callback.id]); 665 } 666 }else{ 667 if (callback.loader && callback.loader === true) $('*[data-buffered-task="'+callback.id+'"]').html('<img src="' + config_url + 'images/ajax-loader.gif" style="display:block;margin:0 auto;" />'); 668 setTimeout(function() { 669 $('*[data-buffered-task="'+callback.id+'"]').fadeOut(400, function() { 670 if (callback_function === null) { 671 $(this).html(task.output[callback.id]).fadeIn(); 672 }else{ 673 callback_function($('*[data-buffered-task="'+callback.id+'"]'), task.output[callback.id]); 674 } 675 }); 676 }, callback.timeout * 1000); 677 } 678 }); 679 }); 680 if (errors.length) { 681 $.post(config_url + 'ajax/common/http_buffer_error.php',{'errors': errors, 'message': 'Found '+errors.length+' error(s) when executing the HTTP Buffer', }, function(html) { 682 $('body').append(html); 683 }); 684 } 685 } 686 },error: function(e) { 687 $.post(config_url + 'ajax/common/http_buffer_error.php',{'errors': e.responseText, }, function(html) { 688 $('body').append(html); 689 }); 690 } 691 }); 692 } 693 694 function tools(e, res) {} 695 /** =========== 696 NIVO LIGHTBOX / NIVO SLIDER 697 =============== **/ 698 var addSwipeTo = function(selector) { 699 $(selector).swipe("destroy"); 700 $(selector).swipe({ 701 swipe:function(event, direction, distance, duration, fingerCount, fingerData) { 702 if (direction == "left") { 703 $(".nivo-lightbox-content").animate({ 704 marginLeft: '-300px', 705 opacity: '0' 706 }, "fast", function() { 707 $(this).css({marginLeft:'300px'}); 708 }); 709 $(".nivo-lightbox-next").trigger("click"); 710 $(".nivo-lightbox-content").animate({ 711 marginLeft: '0', 712 opacity: '1' 713 }); 714 } 715 if (direction == "right") { 716 $(".nivo-lightbox-content").animate({ 717 marginLeft: '300px', 718 opacity: '0' 719 }, "fast", function() { 720 $(this).css({marginLeft:'-300px'}); 721 });
722 $(".nivo-lightbox-prev").trigger("click"); 723 $(".nivo-lightbox-content").animate({ 724 marginLeft: '0', 725 opacity: '1' 726 }); 727 } 728 } 729 }); 730 }; 731 732 function stopSlider() { 733 $('#slides').superslides('stop'); 734 return 'Slider stopped'; 735 } 736 737 /** =========== 738 DATAPICKER INIT() 739 =============== **/ 740 function initDatepicker(async) { 741 if (typeof async == undefined) async = false; 742 if ($('.datepicker').length > 0) { 743 if (typeof $.fn.datepicker == 'undefined') { 744 if (!async) setTimeout(function() { initDatepicker(true);}, 250); 745 return; 746 } 747 748 if (typeof cms4u_datepicker_locale != 'undefined') { 749 $.datepicker.regional.xx = cms4u_datepicker_locale; 750 $.datepicker.setDefaults($.datepicker.regional.xx); 751 } 752 753 $('.datepicker').each(function() { 754 $(this).datepicker({ 755 showOn: "button", 756 buttonImage: config_url + "cp/images/icon-calendar.png", 757 dateFormat: 'dd-mm-yy', 758 buttonImageOnly: true, 759 minDate: typeof calendar_util != 'undefined' && typeof calendar_util.min_date != undefined ? calendar_util.min_date : null, 760 onClose: function( selectedDate ) { 761 if ($(this).attr('id').indexOf('txt_start_date') != -1) { 762 $( "#"+$(this).attr('id').replace('txt_start_date', 'txt_end_date')).datepicker( "option", "minDate", selectedDate ); 763 } 764 }, 765 beforeShow : function ( ) { 766 if ($(this).attr('id').indexOf('txt_end_date') != -1) { 767 $(this).datepicker( "option", "minDate", $("#"+$(this).attr('id').replace('txt_end_date', 'txt_start_date')).val() ); 768 } 769 }, 770 beforeShowDay: function(date) { 771 if (typeof calendar_util == 'undefined') return [ 1, ]; 772 773 /** Check disabled days set in the controller (weekends, fixed closing day) 0 = sunday, 1 = monday, ... **/ 774 if (typeof calendar_util.disabled_days != 'undefined' && calendar_util.disabled_dates !== null && calendar_util.disabled_days.length > 0) { 775 var day = date.getDay(); 776 if (day == 0) day = 7; 777 if (calendar_util.disabled_days.indexOf(day) > -1) return false; 778 } 779 780 var string = jQuery.datepicker.formatDate('dd-mm-yy', date); 781 var hit = false 782 /** Check if date was set **/ 783 if (typeof calendar_util.selected_dates != 'undefined') { 784 $.each(calendar_util.selected_dates, function(index, value) { 785 if (string == value) { 786 hit = true; 787 return; 788 } 789 }); 790 } 791 if (hit) return [ 1, 'selected' ]; 792 793 /** Check disabled dates set in the controller **/ 794 if (typeof calendar_util.days == 'undefined' || calendar_util.days === null || calendar_util.days.length == 0) return [ 1 ]; 795 796 var string = jQuery.datepicker.formatDate('yy-mm-dd', date)+' 12:00:00'; 797 var enabled = true; 798 var css_class = tooltip = ''; 799 800 $.each(calendar_util.days, function(index, value) { 801 if (typeof value == 'string') { 802 if (string == value) { 803 enabled = false; 804 return false; 805 } 806 }else{ 807 if (value.hasOwnProperty('min') && value.hasOwnProperty('max')) { 808 var start = new Date(value.min); 809 var end = new Date(value.max); 810 811 start.setHours(0); start.setMinutes(0); start.setSeconds(0); 812 end.setHours(23); end.setMinutes(59); end.setSeconds(59); 813 814 var d = new Date(string); 815 if (d >= start && d <= end) { 816 enabled = value.enabled; 817 css_class = value.hasOwnProperty('class') ? value.class : ''; 818 tooltip = value.hasOwnProperty('tooltip') ? value.tooltip : ''; 819 return false; 820 } 821 } 822 } 823 }); 824 return [ enabled, css_class, tooltip ]; 825 }, 826 }); 827 }); 828 } 829 } 830 function getParameterByName(name, url) { 831 if (!url) url = window.location.href; 832 name = name.replace(/[\[\]]/g, "\\$&"); 833 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), 834 results = regex.exec(url); 835 if (!results) return null; 836 if (!results[2]) return ''; 837 return decodeURIComponent(results[2].replace(/\+/g, " "));
838 } 839 840 function loadCSS(href){ 841 var ss = window.document.createElement('link'), ref = window.document.getElementsByTagName('head')[0]; 842 ss.rel = 'stylesheet'; 843 ss.href = href; 844 ss.media = 'only x'; 845 846 ref.parentNode.insertBefore(ss, ref); 847 setTimeout( function(){ ss.media = 'all'; },0); 848 } 849 850 function showPopup(input, message, box_class, scrollTop, tFadeOut, marginLeft) { 851 if (typeof scrollTop == 'undefined') scrollTop = true; 852 if (typeof tFadeOut == 'undefined') tFadeOut = 500; 853 var input_id = input.attr('id'); 854 var popup_id = input_id+'_popup'; 855 box_class = box_class || 'error'; 856 if ($('#'+popup_id).length == 0) { 857 var $div = $('<div class="popup_wrapper alert-box '+box_class+'" id="'+popup_id+'"></div>'); 858 $div.append('<span>' + message + '</span>'); 859 if (typeof marginLeft != 'undefined' && marginLeft != null) $div.css({'margin-left':marginLeft}); 860 861 $(input).after($div); 862 863 var animate_parms; 864 if (scrollTop) { 865 animate_parms = { scrollTop: input.offset().top, }; 866 }else{ 867 animate_parms = {}; 868 } 869 $('html, body').animate(animate_parms, 500,function() { 870 setTimeout(function() { 871 $('#'+ popup_id+ ' span.popup').fadeOut(tFadeOut, function() { 872 //$('#'+popup_id).replaceWith(input); 873 $('#'+popup_id).remove() 874 }); 875 }, 2500); 876 }); 877 } 878 } 879 880 function getUrlFilter(object) { 881 882 } 883 /* ====================================================================================================================================================== 884 Banner nivoslider - Not used anymore 885 ====================================================================================================================================================== */ 886 /** 887 if (typeof(transition_time) == 'undefined' || transition_time == null) transition_time = 3000; 888 if (typeof(transition_effect) == 'undefined' || transition_effect == null) transition_effect = 'fade'; 889 890 if ($.inArray(transition_effect , ['sliceDown', 'sliceDownLeft', 'sliceUp', 'sliceUpLeft', 'sliceUpDown', 'sliceUpDownLeft' ,'fold', 'fade', 'random', 'slideInRight', 'slideInLeft', 'boxRandom', 'boxRain', 'boxRainReverse', 'boxRainGrow', 'boxRainGrowReverse']) == -1) transition_effect = 'fade'; 891 892 $('#banner').fadeTo("slow", 1); 893 894 if ($('#slider').length) $('#slider').nivoSlider({ 895 directionNav: true, 896 controlNav: false, 897 effect : transition_effect, 898 pauseTime : (transition_time < 10) ? transition_time * 1000 : transition_time, 899 }) 900 **/
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.