1 2(function ($) { 3 Drupal.Panels = Drupal.Panels || {}; 4 5 Drupal.Panels.autoAttach = function() { 6 if ($.browser.msie) { 7 // If IE, attach a hover event so we can see our admin links. 8 $("div.panel-pane").hover( 9 function() { 10 $('div.panel-hide', this).addClass("panel-hide-hover"); return true; 11 }, 12 function() { 13 $('div.panel-hide', this).removeClass("panel-hide-hover"); return true; 14 } 15 ); 16 $("div.admin-links").hover( 17 function() { 18 $(this).addClass("admin-links-hover"); return true; 19 }, 20 function(){ 21 $(this).removeClass("admin-links-hover"); return true; 22 } 23 ); 24 } 25 }; 26 27 $(Drupal.Panels.autoAttach); 28})(jQuery); 29; 30/** 31 * @file 32 * Adds some show/hide to the admin form to make the UXP easier. 33 */ 34(function($){ 35 Drupal.behaviors.video = { 36 attach: function (context, settings) { 37 //lets see if we have any jmedia movies 38 if($.fn.media) { 39 $('.jmedia').media(); 40 } 41 42 if(settings.video) { 43 $.fn.media.defaults.flvPlayer = settings.video.flvplayer; 44 } 45 46 //lets setup our colorbox videos 47 $('.video-box').each(function() { 48 var url = $(this).attr('href'); 49 var data = $(this).metadata(); 50 var width = data.width; 51 var height= data.height; 52 var player = settings.video.player; //player can be either jwplayer or flowplayer. 53 $(this).colorbox({ 54 html: '<a id="video-overlay" href="'+url+'" style="height:'+height+'; width:'+width+'; display: block;"></a>', 55 onComplete:function() { 56 if(player == 'flowplayer') { 57 flowplayer("video-overlay", settings.video.flvplayer, { 58 clip: { 59 autoPlay: settings.video.autoplay, 60 autoBuffering: settings.video.autobuffer 61 } 62 }); 63 } else { 64 $('#video-overlay').media({ 65 flashvars: { 66 autostart: settings.video.autoplay 67 }, 68 width:width, 69 height:height 70 }); 71 } 72 } 73 }); 74 }); 75 } 76 }; 77 78 // On change of the thumbnails when edit. 79 Drupal.behaviors.videoEdit = { 80 attach : function(context, settings) { 81 function setThumbnail(widget, type) { 82 var thumbnails = widget.find('.video-thumbnails input'); 83 var defaultthumbnail = widget.find('.video-use-default-video-thumb'); 84 var largeimage = widget.find('.video-preview img'); 85 86 var activeThumbnail = thumbnails.filter(':checked'); 87 if (activeThumbnail.length > 0 && type != 'default') { 88 var smallimage = activeThumbnail.next('label.option').find('img'); 89 largeimage.attr('src', smallimage.attr('src')); 90 defaultthumbnail.attr('checked', false); 91 } 92 else if(defaultthumbnail.is(':checked')) { 93 thumbnails.attr('checked', false); 94 largeimage.attr('src', defaultthumbnail.data('defaultimage')); 95 } 96 else { 97 // try to select the first thumbnail. 98 if (thumbnails.length > 0) { 99 thumbnails.first().attr('checked', 'checked'); 100 setThumbnail(widget, 'thumb'); 101 } 102 } 103 } 104 105 $('.video-thumbnails input', context).change(function() { 106 setThumbnail($(this).parents('.video-widget'), 'thumb'); 107 }); 108 109 $('.video-use-default-video-thumb', context).change(function() { 110 setThumbnail($(this).parents('.video-widget'), 'default'); 111 }); 112 113 $('.video-widget', context).each(function() { 114 setThumbnail($(this), 'both'); 115 }); 116 } 117 } 118})(jQuery); 119; 120(function($) { 121 Drupal.behaviors.custom_search = { 122 attach: function(context) { 123 124 if (!Drupal.settings.custom_search.solr) { 125 // Check if the search box is not empty on submit 126 $('form.search-form', context).submit(function(){ 127 var box = $(this).find('input.custom-search-box'); 128 if (box.val() != undefined && box.val() == '') { 129 $(this).find('input.custom-search-box').addClass('error'); 130 return false;
131 } 132 // If basic search is hidden, copy or value to the keys 133 if ($(this).find('#edit-keys').parents('div.element-invisible').attr('class') == 'element-invisible') { 134 $(this).find('#edit-keys').val($(this).find('#edit-or').val()); 135 $(this).find('#edit-or').val(''); 136 } 137 return true; 138 }); 139 } 140 141 // Search from target 142 $('form.search-form').attr('target', Drupal.settings.custom_search.form_target); 143 144 // Displays Popup. 145 $('form.search-form input.custom-search-box', context).bind('click focus', function(e){ 146 $this = $(this); 147 $parentForm = $this.parents('form'); 148 // check if there's something in the popup and displays it 149 var popup = $parentForm.find('fieldset.custom_search-popup'); 150 if (popup.find('input,select').length && !popup.hasClass('opened')) { 151 popup.fadeIn().addClass('opened'); 152 } 153 e.stopPropagation(); 154 }); 155 $(document).bind('click focus', function(){ 156 $('fieldset.custom_search-popup').hide().removeClass('opened'); 157 }); 158 159 // Handle checkboxes 160 $('.custom-search-selector input:checkbox', context).each(function(){ 161 var el = $(this); 162 if (el.val() == 'c-all') { 163 el.change(function(){ 164 $(this).parents('.custom-search-selector').find('input:checkbox[value!=c-all]').attr('checked', false); 165 }); 166 } 167 else { 168 if (el.val().substr(0,2) == 'c-') { 169 el.change(function(){ 170 $('.custom-search-selector input:checkbox').each(function(){ 171 if ($(this).val().substr(0,2) == 'o-') { 172 $(this).attr('checked', false); 173 } 174 }); 175 $(this).parents('.custom-search-selector').find('input:checkbox[value=c-all]').attr('checked', false); 176 }); 177 } else { 178 el.change(function(){ 179 $(this).parents('.custom-search-selector').find('input:checkbox[value!=' + el.val() + ']').attr('checked', false); 180 }); 181 } 182 } 183 }); 184 185 // Reselect types and terms in advanced search 186 var edit_keys = $('#edit-keys').val(); 187 if(edit_keys) { 188 // types 189 var pos = edit_keys.indexOf('type:'); 190 if (pos) { 191 var pos2 = edit_keys.indexOf(' ', pos); 192 if (pos2 == -1) { 193 pos2 = edit_keys.length; 194 } 195 var types = edit_keys.substring(pos + 5,pos2); 196 types = types.split(','); 197 for (var i = 0; i < types.length; i++) { 198 $('.search-form input:checkbox[value=' + types[i] + ']').attr('checked', true); 199 } 200 } 201 // terms 202 var pos = edit_keys.indexOf('term:'); 203 if (pos) { 204 var pos2 = edit_keys.indexOf(' ', pos); 205 if (pos2 == -1) { 206 pos2 = edit_keys.length; 207 } 208 var terms = edit_keys.substring(pos + 5, pos2); 209 terms = terms.split(','); 210 for (var i = 0; i < terms.length; i++) { 211 $('#edit-term option[value=' + terms[i] + ']').attr('selected', true); 212 } 213 } 214 // languages 215 var pos = edit_keys.indexOf('language:'); 216 if (pos) { 217 var pos2 = edit_keys.indexOf(' ', pos); 218 if (pos2 == -1) { 219 pos2 = edit_keys.length; 220 } 221 var languages = edit_keys.substring(pos + 9,pos2); 222 languages = languages.split(','); 223 for (var i = 0; i < languages.length; i++) { 224 $('.search-advanced #edit-language-' + languages[i]).attr('checked', true); 225 } 226 } 227 } 228 229 var popup = $('fieldset.custom_search-popup:not(.custom_search-processed)', context).addClass("custom_search-processed"); 230 popup.click(function(e){ 231 e.stopPropagation(); 232 }) 233 popup.append('<a class="custom_search-popup-close" href="#">' + Drupal.t('Close') + '</a>'); 234 $('a.custom_search-popup-close').click(function(e){ 235 $('fieldset.custom_search-popup.opened').hide().removeClass('opened'); 236 e.preventDefault(); 237 }); 238 239 } 240 } 241})(jQuery); 242; 243Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 244 245(function ($) { 246 Drupal.TBMegaMenu.menuInstance = false;
247 Drupal.behaviors.tbMegaMenuAction = { 248 attach: function(context) { 249 $('.tb-megamenu-button').click(function() { 250 if(parseInt($(this).parent().children('.nav-collapse').height())) { 251 $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'}); 252 } 253 else { 254 $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'}); 255 } 256 }); 257 var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); 258 if(!isTouch){ 259 $(document).ready(function($){ 260 var mm_duration = 0; 261 $('.t3-megamenu').each (function(){ 262 if ($(this).data('duration')) { 263 mm_duration = $(this).data('duration'); 264 } 265 }); 266 var mm_timeout = mm_duration ? 100 + mm_duration : 500; 267 $('.nav > li, li.mega').hover(function(event) { 268 var $this = $(this); 269 if ($this.hasClass ('mega')) { 270 $this.addClass ('animating'); 271 clearTimeout ($this.data('animatingTimeout')); 272 $this.data('animatingTimeout', setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 273 clearTimeout ($this.data('hoverTimeout')); 274 $this.data('hoverTimeout', setTimeout(function(){$this.addClass ('open')}, 100)); 275 } else { 276 clearTimeout ($this.data('hoverTimeout')); 277 $this.data('hoverTimeout', 278 setTimeout(function(){$this.addClass ('open')}, 100)); 279 } 280 }, 281 function(event) { 282 var $this = $(this); 283 if ($this.hasClass ('mega')) { 284 $this.addClass ('animating'); 285 clearTimeout ($this.data('animatingTimeout')); 286 $this.data('animatingTimeout', 287 setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 288 clearTimeout ($this.data('hoverTimeout')); 289 $this.data('hoverTimeout', setTimeout(function(){$this.removeClass ('open')}, 100)); 290 } else { 291 clearTimeout ($this.data('hoverTimeout')); 292 $this.data('hoverTimeout', 293 setTimeout(function(){$this.removeClass ('open')}, 100)); 294 } 295 }); 296 }); 297 } 298 } 299 } 300})(jQuery); 301 302; 303Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 304 305(function ($) { 306 Drupal.TBMegaMenu.createTouchMenu = function(items) { 307 items.children('a').each( function() { 308 var $item = $(this); 309 var tbitem = $(this).parent(); 310 $item.click( function(event){ 311 if ($item.hasClass('tb-megamenu-clicked')) { 312 var $uri = $item.attr('href'); 313 window.location.href = $uri; 314 } 315 else { 316 event.preventDefault(); 317 $item.addClass('tb-megamenu-clicked'); 318 if(!tbitem.hasClass('open')){ 319 tbitem.addClass('open'); 320 } 321 } 322 }).closest('li').mouseleave( function(){ 323 $item.removeClass('tb-megamenu-clicked'); 324 tbitem.removeClass('open'); 325 }); 326 }); 327 /* 328 items.children('a').children('span.caret').each( function() { 329 var $item = $(this).parent(); 330 $item.click(function(event){ 331 tbitem = $item.parent(); 332 if ($item.hasClass('tb-megamenu-clicked')) { 333 Drupal.TBMegaMenu.eventStopPropagation(event); 334 if(tbitem.hasClass('open')){ 335 tbitem.removeClass('open'); 336 $item.removeClass('tb-megamenu-clicked'); 337 } 338 } 339 else { 340 Drupal.TBMegaMenu.eventStopPropagation(event); 341 $item.addClass('tb-megamenu-clicked'); 342 if(!tbitem.hasClass('open')){ 343 tbitem.addClass('open'); 344 $item.removeClass('tb-megamenu-clicked'); 345 } 346 } 347 }); 348 }); 349 */ 350 } 351 352 Drupal.TBMegaMenu.eventStopPropagation = function(event) { 353 if (event.stopPropagation) { 354 event.stopPropagation(); 355 } 356 else if (window.event) { 357 window.event.cancelBubble = true; 358 } 359 } 360 Drupal.behaviors.tbMegaMenuTouchAction = { 361 attach: function(context) { 362 var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); 363 if(isTouch){ 364 $('html').addClass('touch'); 365 Drupal.TBMegaMenu.createTouchMenu($('.tb-megamenu ul.nav li.mega').has('.dropdown-menu')); 366 } 367 } 368 } 369})(jQuery); 370; 371(function ($) { 372 373Drupal.googleanalytics = {}; 374 375$(document).ready(function() { 376 377 // Attach mousedown, keyup, touchstart events to document only and catch 378 // clicks on all elements. 379 $(document.body).bind("mousedown keyup touchstart", function(event) { 380 381 // Catch the closest surrounding link of a clicked element. 382 $(event.target).closest("a,area").each(function() { 383 384 // Is the clicked URL internal? 385 if (Drupal.googleanalytics.isInternal(this.href)) { 386 // Skip 'click' tracking, if custom tracking events are bound. 387 if ($(this).is('.colorbox') && (Drupal.settings.googleanalytics.trackColorbox)) {
388 // Do nothing here. The custom event will handle all tracking. 389 //console.info("Click on .colorbox item has been detected."); 390 } 391 // Is download tracking activated and the file extension configured for download tracking? 392 else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) { 393 // Download link clicked. 394 ga("send", { 395 "hitType": "event", 396 "eventCategory": "Downloads", 397 "eventAction": Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), 398 "eventLabel": Drupal.googleanalytics.getPageUrl(this.href), 399 "transport": "beacon" 400 }); 401 } 402 else if (Drupal.googleanalytics.isInternalSpecial(this.href)) { 403 // Keep the internal URL for Google Analytics website overlay intact. 404 ga("send", { 405 "hitType": "pageview", 406 "page": Drupal.googleanalytics.getPageUrl(this.href), 407 "transport": "beacon" 408 }); 409 } 410 } 411 else { 412 if (Drupal.settings.googleanalytics.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 413 // Mailto link clicked. 414 ga("send", { 415 "hitType": "event", 416 "eventCategory": "Mails", 417 "eventAction": "Click", 418 "eventLabel": this.href.substring(7), 419 "transport": "beacon" 420 }); 421 } 422 else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) { 423 if (Drupal.settings.googleanalytics.trackDomainMode !== 2 || (Drupal.settings.googleanalytics.trackDomainMode === 2 && !Drupal.googleanalytics.isCrossDomain(this.hostname, Drupal.settings.googleanalytics.trackCrossDomains))) { 424 // External link clicked / No top-level cross domain clicked. 425 ga("send", { 426 "hitType": "event", 427 "eventCategory": "Outbound links", 428 "eventAction": "Click", 429 "eventLabel": this.href, 430 "transport": "beacon" 431 }); 432 } 433 } 434 } 435 }); 436 }); 437 438 // Track hash changes as unique pageviews, if this option has been enabled. 439 if (Drupal.settings.googleanalytics.trackUrlFragments) { 440 window.onhashchange = function() { 441 ga("send", { 442 "hitType": "pageview", 443 "page": location.pathname + location.search + location.hash 444 }); 445 }; 446 } 447 448 // Colorbox: This event triggers when the transition has completed and the 449 // newly loaded content has been revealed. 450 if (Drupal.settings.googleanalytics.trackColorbox) { 451 $(document).bind("cbox_complete", function () { 452 var href = $.colorbox.element().attr("href"); 453 if (href) { 454 ga("send", { 455 "hitType": "pageview", 456 "page": Drupal.googleanalytics.getPageUrl(href) 457 }); 458 } 459 }); 460 } 461 462}); 463 464/** 465 * Check whether the hostname is part of the cross domains or not. 466 * 467 * @param string hostname 468 * The hostname of the clicked URL. 469 * @param array crossDomains 470 * All cross domain hostnames as JS array. 471 * 472 * @return boolean 473 */ 474Drupal.googleanalytics.isCrossDomain = function (hostname, crossDomains) { 475 /** 476 * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is 477 * `null` or `undefined`, https://bugs.jquery.com/ticket/10076, 478 * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 479 * 480 * @todo: Remove/Refactor in D8 481 */ 482 if (!crossDomains) { 483 return false; 484 } 485 else { 486 return $.inArray(hostname, crossDomains) > -1 ? true : false; 487 } 488}; 489 490/** 491 * Check whether this is a download URL or not. 492 * 493 * @param string url 494 * The web url to check. 495 * 496 * @return boolean 497 */ 498Drupal.googleanalytics.isDownload = function (url) { 499 var isDownload = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 500 return isDownload.test(url); 501}; 502 503/** 504 * Check whether this is an absolute internal URL or not. 505 * 506 * @param string url 507 * The web url to check. 508 * 509 * @return boolean 510 */ 511Drupal.googleanalytics.isInternal = function (url) { 512 var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); 513 return isInternal.test(url); 514}; 515 516/** 517 * Check whether this is a special URL or not. 518 * 519 * URL types: 520 * - gotwo.module /go/* links. 521 * 522 * @param string url 523 * The web url to check. 524 * 525 * @return boolean 526 */ 527Drupal.googleanalytics.isInternalSpecial = function (url) { 528 var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); 529 return isInternalSpecial.test(url); 530}; 531 532/** 533 * Extract the relative internal URL from an absolute internal URL. 534 * 535 * Examples: 536 * - https://mydomain.com/node/1 -> /node/1 537 * - https://example.com/foo/bar -> https://example.com/foo/bar 538 * 539 * @param string url 540 * The web url to check. 541 * 542 * @return string 543 * Internal website URL 544 */ 545Drupal.googleanalytics.getPageUrl = function (url) { 546 var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i"); 547 return url.replace(extractInternalUrl, ''); 548}; 549 550/** 551 * Extract the download file extension from the URL. 552 * 553 * @param string url 554 * The web url to check. 555 * 556 * @return string 557 * The file extension of the passed url. e.g. "zip", "txt" 558 */ 559Drupal.googleanalytics.getDownloadExtension = function (url) { 560 var extractDownloadextension = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 561 var extension = extractDownloadextension.exec(url); 562 return (extension === null) ? '' : extension[1]; 563}; 564 565})(jQuery); 566;
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.