1// $Id: thickbox.js,v 1.2.4.2 2007/06/21 02:19:44 frjo Exp $ 2 3/* 4 * Thickbox 3.1 - One Box To Rule Them All. 5 * By Cody Lindley (http://www.codylindley.com) 6 * Copyright (c) 2007 cody lindley 7 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php 8*/ 9 10 11(function ($) { 12 13//on page load call tb_init 14$(document).ready(function(){ 15 tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox 16 imgLoader = new Image();// preload image 17}); 18 19//add thickbox to href & area elements that have a class of .thickbox 20tb_init = function (domChunk){ 21 $(domChunk).click(function(){ 22 var t = this.title || this.name || null; 23 var a = this.href || this.alt; 24 var g = this.rel || false; 25 tb_show(t,a,g); 26 this.blur(); 27 return false; 28 }); 29}; 30 31tb_show = function (caption, url, imageGroup) {//function called when the user clicks on a thickbox link 32 33 var settings = Drupal.settings.thickbox; 34 35 try { 36 if (typeof document.body.style.maxHeight === "undefined") {//if IE 6 37 $("body","html").css({height: "100%", width: "100%"}); 38 $("html").css("overflow","hidden"); 39 if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6 40 $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>"); 41 $("#TB_overlay").click(tb_remove); 42 } 43 }else{//all others 44 if(document.getElementById("TB_overlay") === null){ 45 $("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>"); 46 $("#TB_overlay").click(tb_remove); 47 } 48 } 49 50 if(tb_detectMacXFF()){ 51 $("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash 52 }else{ 53 $("#TB_overlay").addClass("TB_overlayBG");//use background and opacity 54 } 55 56 if(caption===null){caption="";} 57 $("body").append("<div id='TB_load'></div>");//add loader to the page 58 $('#TB_load').show();//show loader 59 60 var baseURL; 61 if(url.indexOf("?")!==-1){ //ff there is a query string involved 62 baseURL = url.substr(0, url.indexOf("?")); 63 }else{ 64 baseURL = url; 65 } 66 67 var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/; 68 var urlType = baseURL.toLowerCase().match(urlString); 69 70 if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images 71 72 var params = []; // Amherst 73 TB_PrevCaption = ""; 74 TB_PrevURL = ""; 75 TB_PrevHTML = ""; 76 TB_NextCaption = ""; 77 TB_NextURL = ""; 78 TB_NextHTML = ""; 79 TB_imageCount = ""; 80 TB_FoundURL = false; 81 if(imageGroup){ 82 TB_TempArray = $("a[rel="+imageGroup+"]").get(); 83 for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { 84 var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); 85 if (!(TB_TempArray[TB_Counter].href == url)) { 86 if (TB_FoundURL) { 87 TB_NextCaption = TB_TempArray[TB_Counter].title; 88 TB_NextURL = TB_TempArray[TB_Counter].href; 89 TB_NextHTML = "<span id='TB_next'> <a href='#'>" + settings.next + "</a></span>"; 90 } else { 91 TB_PrevCaption = TB_TempArray[TB_Counter].title; 92 TB_PrevURL = TB_TempArray[TB_Counter].href; 93 TB_PrevHTML = "<span id='TB_prev'> <a href='#'>" + settings.prev + "</a></span>"; 94 } 95 } else { 96 TB_FoundURL = true; 97 TB_imageCount = settings.image_count.replace(/\!current/, (TB_Counter + 1)).replace(/\!total/, TB_TempArray.length); 98 } 99 } 100 } 101 102 imgPreloader = new Image(); 103 imgPreloader.onload = function(){ 104 imgPreloader.onload = null; 105 106 // Resizing large images - orginal by Christian Montoya edited by me. 107 var pagesize = tb_getPageSize(); 108 var x = pagesize[0] - 150; 109 var y = pagesize[1] - 150; 110 var imageWidth = imgPreloader.width; 111 var imageHeight = imgPreloader.height; 112 if (imageWidth > x) { 113 imageHeight = imageHeight * (x / imageWidth); 114 imageWidth = x; 115 if (imageHeight > y) { 116 imageWidth = imageWidth * (y / imageHeight); 117 imageHeight = y; 118 } 119 } else if (imageHeight > y) { 120 imageWidth = imageWidth * (y / imageHeight); 121 imageHeight = y; 122 if (imageWidth > x) { 123 imageHeight = imageHeight * (x / imageWidth); 124 imageWidth = x; 125 } 126 } 127 // End Resizing 128 129 TB_WIDTH = imageWidth + 30; 130 TB_HEIGHT = imageHeight + 60; 131 $("#TB_window").append("<a href='' id='TB_ImageOff' title='" + settings.close + "'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption.replace(/'/, "&squot;")+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='" + settings.close + "'>" + settings.close + "</a> " + settings.esc_key + "</div>"); 132 133 $("#TB_closeWindowButton").click(tb_remove); 134 135 if (!(TB_PrevHTML === "")) { 136 function goPrev(){ 137 if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);} 138 $("#TB_window").remove(); 139 $("body").append("<div id='TB_window'></div>"); 140 tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); 141 return false;
142 } 143 $("#TB_prev").click(goPrev); 144 } 145 146 if (!(TB_NextHTML === "")) { 147 function goNext(){ 148 $("#TB_window").remove(); 149 $("body").append("<div id='TB_window'></div>"); 150 tb_show(TB_NextCaption, TB_NextURL, imageGroup); 151 return false; 152 } 153 $("#TB_next").click(goNext); 154 $("#TB_ImageOff").click(goNext); 155 } else { 156 $("#TB_ImageOff").click(tb_remove); 157 } 158 159 document.onkeydown = function(e){ 160 if (e == null) { // ie 161 keycode = event.keyCode; 162 } else { // mozilla 163 keycode = e.which; 164 } 165 if(keycode == 27){ // close 166 tb_remove(); 167 } else if(keycode == 190){ // display previous image 168 if(!(TB_NextHTML == "")){ 169 document.onkeydown = ""; 170 goNext(); 171 } 172 } else if(keycode == 188){ // display next image 173 if(!(TB_PrevHTML == "")){ 174 document.onkeydown = ""; 175 goPrev(); 176 } 177 } 178 }; 179 180 tb_position(); 181 $("#TB_load").remove(); 182 $("#TB_window").css({display:"block"}); //for safari using css instead of show 183 }; 184 185 imgPreloader.src = url; 186 }else{//code to show html 187 188 var queryString = url.replace(/^[^\?]+\??/,''); 189 var params = tb_parseQuery( queryString ); 190 191 TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL 192 TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL 193 ajaxContentW = TB_WIDTH - 30; 194 ajaxContentH = TB_HEIGHT - 45; 195 196 if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window 197 urlNoQuery = url.split('TB_'); 198 $("#TB_iframeContent").remove(); 199 if(params['modal'] != "true"){//iframe no modal 200 $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='" + settings.close + "'>" + settings.close + "</a> " + settings.esc_key + "</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>"); 201 }else{//iframe modal 202 $("#TB_overlay").unbind(); 203 $("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>"); 204 } 205 }else{// not an iframe, ajax 206 if($("#TB_window").css("display") != "block"){ 207 if(params['modal'] != "true"){//ajax no modal 208 $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>" + settings.close + "</a> " + settings.esc_key + "</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>"); 209 }else{//ajax modal 210 $("#TB_overlay").unbind(); 211 $("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); 212 } 213 }else{//this means the window is already up, we are just loading new content via ajax 214 $("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; 215 $("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; 216 $("#TB_ajaxContent")[0].scrollTop = 0; 217 $("#TB_ajaxWindowTitle").html(caption); 218 } 219 } 220 221 $("#TB_closeWindowButton").click(tb_remove); 222 223 if(url.indexOf('TB_inline') != -1){ 224 $("#TB_ajaxContent").append($('#' + params['inlineId']).children()); 225 $("#TB_window").unload(function () { 226 $('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished 227 }); 228 tb_position(); 229 $("#TB_load").remove(); 230 $("#TB_window").css({display:"block"}); 231 }else if(url.indexOf('TB_iframe') != -1){ 232 tb_position(); 233 if($.browser.safari){//safari needs help because it will not fire iframe onload 234 $("#TB_load").remove(); 235 $("#TB_window").css({display:"block"}); 236 } 237 }else{ 238 $("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method 239 tb_position(); 240 $("#TB_load").remove(); 241 tb_init("#TB_ajaxContent a.thickbox"); 242 $("#TB_window").css({display:"block"}); 243 }); 244 } 245 246 } 247 248 if(!params['modal']){ 249 document.onkeyup = function(e){ 250 if (e == null) { // ie 251 keycode = event.keyCode; 252 } else { // mozilla 253 keycode = e.which; 254 } 255 if(keycode == 27){ // close 256 tb_remove(); 257 } 258 }; 259 } 260 261 } catch(e) { 262 //nothing here 263 } 264}; 265 266//helper functions below 267tb_showIframe = function (){ 268 $("#TB_load").remove(); 269 $("#TB_window").css({display:"block"}); 270}; 271 272tb_remove = function () { 273 $("#TB_imageOff").unbind("click"); 274 $("#TB_closeWindowButton").unbind("click"); 275 $("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();}); 276 $("#TB_load").remove(); 277 if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 278 $("body","html").css({height: "auto", width: "auto"}); 279 $("html").css("overflow",""); 280 } 281 document.onkeydown = ""; 282 document.onkeyup = ""; 283 return false;
284}; 285 286tb_position = function () { 287$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'}); 288 if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6 289 $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); 290 } 291}; 292 293tb_parseQuery = function ( query ) { 294 var Params = {}; 295 if ( ! query ) {return Params;}// return empty object 296 var Pairs = query.split(/[;&]/); 297 for ( var i = 0; i < Pairs.length; i++ ) { 298 var KeyVal = Pairs[i].split('='); 299 if ( ! KeyVal || KeyVal.length != 2 ) {continue;} 300 var key = unescape( KeyVal[0] ); 301 var val = unescape( KeyVal[1] ); 302 val = val.replace(/\+/g, ' '); 303 Params[key] = val; 304 } 305 return Params; 306}; 307 308tb_getPageSize = function (){ 309 var de = document.documentElement; 310 var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; 311 var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; 312 arrayPageSize = [w,h]; 313 return arrayPageSize; 314}; 315 316tb_detectMacXFF = function () { 317 var userAgent = navigator.userAgent.toLowerCase(); 318 if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) { 319 return true; 320 } 321}; 322 323})(jQuery); 324 325; 326(function ($) { 327 Drupal.viewsSlideshow = Drupal.viewsSlideshow || {}; 328 329 /** 330 * Views Slideshow Controls 331 */ 332 Drupal.viewsSlideshowControls = Drupal.viewsSlideshowControls || {}; 333 334 /** 335 * Implement the play hook for controls. 336 */ 337 Drupal.viewsSlideshowControls.play = function (options) { 338 // Route the control call to the correct control type. 339 // Need to use try catch so we don't have to check to make sure every part 340 // of the object is defined. 341 try { 342 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play == 'function') { 343 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play(options); 344 } 345 } 346 catch(err) { 347 // Don't need to do anything on error. 348 } 349 350 try { 351 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play == 'function') { 352 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play(options); 353 } 354 } 355 catch(err) { 356 // Don't need to do anything on error. 357 } 358 }; 359 360 /** 361 * Implement the pause hook for controls. 362 */ 363 Drupal.viewsSlideshowControls.pause = function (options) { 364 // Route the control call to the correct control type. 365 // Need to use try catch so we don't have to check to make sure every part 366 // of the object is defined. 367 try { 368 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause == 'function') { 369 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause(options); 370 } 371 } 372 catch(err) { 373 // Don't need to do anything on error. 374 } 375 376 try { 377 if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause == 'function') { 378 Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause(options); 379 } 380 } 381 catch(err) { 382 // Don't need to do anything on error. 383 } 384 }; 385 386 387 /** 388 * Views Slideshow Text Controls 389 */ 390 391 // Add views slieshow api calls for views slideshow text controls. 392 Drupal.behaviors.viewsSlideshowControlsText = { 393 attach: function (context) { 394 395 // Process previous link 396 $('.views_slideshow_controls_text_previous:not(.views-slideshow-controls-text-previous-processed)', context).addClass('views-slideshow-controls-text-previous-processed').each(function() { 397 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_previous_', ''); 398 $(this).click(function() { 399 Drupal.viewsSlideshow.action({ "action": 'previousSlide', "slideshowID": uniqueID }); 400 return false;
401 }); 402 }); 403 404 // Process next link 405 $('.views_slideshow_controls_text_next:not(.views-slideshow-controls-text-next-processed)', context).addClass('views-slideshow-controls-text-next-processed').each(function() { 406 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_next_', ''); 407 $(this).click(function() { 408 Drupal.viewsSlideshow.action({ "action": 'nextSlide', "slideshowID": uniqueID }); 409 return false; 410 }); 411 }); 412 413 // Process pause link 414 $('.views_slideshow_controls_text_pause:not(.views-slideshow-controls-text-pause-processed)', context).addClass('views-slideshow-controls-text-pause-processed').each(function() { 415 var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', ''); 416 $(this).click(function() { 417 if (Drupal.settings.viewsSlideshow[uniqueID].paused) { 418 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID, "force": true }); 419 } 420 else { 421 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID, "force": true }); 422 } 423 return false; 424 }); 425 }); 426 } 427 }; 428 429 Drupal.viewsSlideshowControlsText = Drupal.viewsSlideshowControlsText || {}; 430 431 /** 432 * Implement the pause hook for text controls. 433 */ 434 Drupal.viewsSlideshowControlsText.pause = function (options) { 435 var pauseText = Drupal.theme.prototype['viewsSlideshowControlsPause'] ? Drupal.theme('viewsSlideshowControlsPause') : ''; 436 $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(pauseText); 437 }; 438 439 /** 440 * Implement the play hook for text controls. 441 */ 442 Drupal.viewsSlideshowControlsText.play = function (options) { 443 var playText = Drupal.theme.prototype['viewsSlideshowControlsPlay'] ? Drupal.theme('viewsSlideshowControlsPlay') : ''; 444 $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(playText); 445 }; 446 447 // Theme the resume control. 448 Drupal.theme.prototype.viewsSlideshowControlsPause = function () { 449 return Drupal.t('Resume'); 450 }; 451 452 // Theme the pause control. 453 Drupal.theme.prototype.viewsSlideshowControlsPlay = function () { 454 return Drupal.t('Pause'); 455 }; 456 457 /** 458 * Views Slideshow Pager 459 */ 460 Drupal.viewsSlideshowPager = Drupal.viewsSlideshowPager || {}; 461 462 /** 463 * Implement the transitionBegin hook for pagers. 464 */ 465 Drupal.viewsSlideshowPager.transitionBegin = function (options) { 466 // Route the pager call to the correct pager type. 467 // Need to use try catch so we don't have to check to make sure every part 468 // of the object is defined. 469 try { 470 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin == 'function') { 471 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin(options); 472 } 473 } 474 catch(err) { 475 // Don't need to do anything on error. 476 } 477 478 try { 479 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin == 'function') { 480 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin(options); 481 } 482 } 483 catch(err) { 484 // Don't need to do anything on error. 485 } 486 }; 487 488 /** 489 * Implement the goToSlide hook for pagers. 490 */ 491 Drupal.viewsSlideshowPager.goToSlide = function (options) { 492 // Route the pager call to the correct pager type. 493 // Need to use try catch so we don't have to check to make sure every part 494 // of the object is defined. 495 try { 496 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide == 'function') { 497 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options); 498 } 499 } 500 catch(err) { 501 // Don't need to do anything on error. 502 } 503 504 try { 505 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide == 'function') { 506 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options); 507 } 508 } 509 catch(err) { 510 // Don't need to do anything on error. 511 } 512 }; 513 514 /** 515 * Implement the previousSlide hook for pagers. 516 */ 517 Drupal.viewsSlideshowPager.previousSlide = function (options) { 518 // Route the pager call to the correct pager type. 519 // Need to use try catch so we don't have to check to make sure every part 520 // of the object is defined. 521 try { 522 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide == 'function') { 523 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide(options); 524 } 525 } 526 catch(err) { 527 // Don't need to do anything on error. 528 } 529 530 try { 531 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide == 'function') { 532 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide(options); 533 } 534 } 535 catch(err) { 536 // Don't need to do anything on error. 537 } 538 }; 539 540 /** 541 * Implement the nextSlide hook for pagers. 542 */ 543 Drupal.viewsSlideshowPager.nextSlide = function (options) { 544 // Route the pager call to the correct pager type. 545 // Need to use try catch so we don't have to check to make sure every part 546 // of the object is defined. 547 try { 548 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide == 'function') { 549 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide(options); 550 } 551 } 552 catch(err) { 553 // Don't need to do anything on error. 554 } 555 556 try { 557 if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide == 'function') { 558 Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide(options); 559 } 560 } 561 catch(err) { 562 // Don't need to do anything on error. 563 } 564 }; 565 566 567 /** 568 * Views Slideshow Pager Fields 569 */ 570 571 // Add views slieshow api calls for views slideshow pager fields. 572 Drupal.behaviors.viewsSlideshowPagerFields = { 573 attach: function (context) { 574 // Process pause on hover.
575 $('.views_slideshow_pager_field:not(.views-slideshow-pager-field-processed)', context).addClass('views-slideshow-pager-field-processed').each(function() { 576 // Parse out the location and unique id from the full id. 577 var pagerInfo = $(this).attr('id').split('_'); 578 var location = pagerInfo[2]; 579 pagerInfo.splice(0, 3); 580 var uniqueID = pagerInfo.join('_'); 581 582 // Add the activate and pause on pager hover event to each pager item. 583 if (Drupal.settings.viewsSlideshowPagerFields[uniqueID][location].activatePauseOnHover) { 584 $(this).children().each(function(index, pagerItem) { 585 var mouseIn = function() { 586 Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index }); 587 Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID }); 588 } 589 590 var mouseOut = function() { 591 Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID }); 592 } 593 594 if (jQuery.fn.hoverIntent) { 595 $(pagerItem).hoverIntent(mouseIn, mouseOut); 596 } 597 else { 598 $(pagerItem).hover(mouseIn, mouseOut); 599 } 600 601 }); 602 } 603 else { 604 $(this).children().each(function(index, pagerItem) { 605 $(pagerItem).click(function() { 606 Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index }); 607 }); 608 }); 609 } 610 }); 611 } 612 }; 613 614 Drupal.viewsSlideshowPagerFields = Drupal.viewsSlideshowPagerFields || {}; 615 616 /** 617 * Implement the transitionBegin hook for pager fields pager. 618 */ 619 Drupal.viewsSlideshowPagerFields.transitionBegin = function (options) {
620 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 621 // Remove active class from pagers 622 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 623 624 // Add active class to active pager. 625 $('#views_slideshow_pager_field_item_'+ pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active'); 626 } 627 628 }; 629 630 /** 631 * Implement the goToSlide hook for pager fields pager. 632 */ 633 Drupal.viewsSlideshowPagerFields.goToSlide = function (options) { 634 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 635 // Remove active class from pagers 636 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 637 638 // Add active class to active pager. 639 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active'); 640 } 641 }; 642 643 /** 644 * Implement the previousSlide hook for pager fields pager. 645 */ 646 Drupal.viewsSlideshowPagerFields.previousSlide = function (options) {
647 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 648 // Get the current active pager. 649 var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', ''); 650 651 // If we are on the first pager then activate the last pager. 652 // Otherwise activate the previous pager. 653 if (pagerNum == 0) { 654 pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length() - 1; 655 } 656 else { 657 pagerNum--; 658 } 659 660 // Remove active class from pagers 661 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 662 663 // Add active class to active pager. 664 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + pagerNum).addClass('active'); 665 } 666 }; 667 668 /** 669 * Implement the nextSlide hook for pager fields pager. 670 */ 671 Drupal.viewsSlideshowPagerFields.nextSlide = function (options) {
672 for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { 673 // Get the current active pager. 674 var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', ''); 675 var totalPagers = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length(); 676 677 // If we are on the last pager then activate the first pager. 678 // Otherwise activate the next pager. 679 pagerNum++; 680 if (pagerNum == totalPagers) { 681 pagerNum = 0; 682 } 683 684 // Remove active class from pagers 685 $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); 686 687 // Add active class to active pager. 688 $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + slideNum).addClass('active'); 689 } 690 }; 691 692 693 /** 694 * Views Slideshow Slide Counter 695 */ 696 697 Drupal.viewsSlideshowSlideCounter = Drupal.viewsSlideshowSlideCounter || {}; 698 699 /** 700 * Implement the transitionBegin for the slide counter. 701 */ 702 Drupal.viewsSlideshowSlideCounter.transitionBegin = function (options) { 703 $('#views_slideshow_slide_counter_' + options.slideshowID + ' .num').text(options.slideNum + 1); 704 }; 705 706 /** 707 * This is used as a router to process actions for the slideshow. 708 */ 709 Drupal.viewsSlideshow.action = function (options) { 710 // Set default values for our return status. 711 var status = { 712 'value': true, 713 'text': '' 714 } 715 716 // If an action isn't specified return false. 717 if (typeof options.action == 'undefined' || options.action == '') { 718 status.value = false; 719 status.text = Drupal.t('There was no action specified.'); 720 return error; 721 } 722 723 // If we are using pause or play switch paused state accordingly. 724 if (options.action == 'pause') { 725 Drupal.settings.viewsSlideshow[options.slideshowID].paused = 1; 726 // If the calling method is forcing a pause then mark it as such. 727 if (options.force) { 728 Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 1; 729 } 730 } 731 else if (options.action == 'play') { 732 // If the slideshow isn't forced pause or we are forcing a play then play 733 // the slideshow. 734 // Otherwise return telling the calling method that it was forced paused. 735 if (!Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce || options.force) { 736 Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0; 737 Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 0; 738 } 739 else { 740 status.value = false; 741 status.text += ' ' + Drupal.t('This slideshow is forced paused.'); 742 return status; 743 } 744 } 745 746 // We use a switch statement here mainly just to limit the type of actions 747 // that are available. 748 switch (options.action) { 749 case "goToSlide": 750 case "transitionBegin": 751 case "transitionEnd": 752 // The three methods above require a slide number. Checking if it is 753 // defined and it is a number that is an integer. 754 if (typeof options.slideNum == 'undefined' || typeof options.slideNum !== 'number' || parseInt(options.slideNum) != (options.slideNum - 0)) { 755 status.value = false; 756 status.text = Drupal.t('An invalid integer was specified for slideNum.'); 757 } 758 case "pause": 759 case "play": 760 case "nextSlide": 761 case "previousSlide": 762 // Grab our list of methods. 763 var methods = Drupal.settings.viewsSlideshow[options.slideshowID]['methods']; 764 765 // if the calling method specified methods that shouldn't be called then 766 // exclude calling them. 767 var excludeMethodsObj = {}; 768 if (typeof options.excludeMethods !== 'undefined') { 769 // We need to turn the excludeMethods array into an object so we can use the in 770 // function. 771 for (var i=0; i < excludeMethods.length; i++) { 772 excludeMethodsObj[excludeMethods[i]] = ''; 773 } 774 } 775 776 // Call every registered method and don't call excluded ones. 777 for (i = 0; i < methods[options.action].length; i++) { 778 if (Drupal[methods[options.action][i]] != undefined && typeof Drupal[methods[options.action][i]][options.action] == 'function' && !(methods[options.action][i] in excludeMethodsObj)) { 779 Drupal[methods[options.action][i]][options.action](options); 780 } 781 } 782 break; 783
784 // If it gets here it's because it's an invalid action. 785 default: 786 status.value = false; 787 status.text = Drupal.t('An invalid action "!action" was specified.', { "!action": options.action }); 788 } 789 return status; 790 }; 791})(jQuery); 792; 793(function($) { 794 Drupal.behaviors.custom_search = { 795 attach: function(context) { 796 797 if (!Drupal.settings.custom_search.solr) { 798 // Check if the search box is not empty on submit 799 $('form.search-form', context).submit(function(){ 800 var $this = $(this); 801 var box = $this.find('input.custom-search-box'); 802 if (box.val() != undefined && box.val() == '') { 803 $this.find('input.custom-search-box').addClass('error'); 804 return false; 805 } 806 // If basic search is hidden, copy or value to the keys 807 if ($this.find('#edit-keys').parents('div.element-invisible').attr('class') == 'element-invisible') { 808 $this.find('#edit-keys').val($this.find('#edit-or').val()); 809 $this.find('#edit-or').val(''); 810 } 811 return true; 812 }); 813 } 814 815 // Search from target 816 $('form.search-form').attr('target', Drupal.settings.custom_search.form_target); 817 818 // Displays Popup. 819 $('form.search-form input.custom-search-box', context).bind('click focus', function(e){ 820 var $parentForm = $(this).parents('form'); 821 // check if there's something in the popup and displays it 822 var popup = $parentForm.find('fieldset.custom_search-popup'); 823 if (popup.find('input,select').length && !popup.hasClass('opened')) { 824 popup.fadeIn().addClass('opened'); 825 } 826 e.stopPropagation(); 827 }); 828 $(document).bind('click focus', function(){ 829 $('fieldset.custom_search-popup').hide().removeClass('opened'); 830 }); 831 832 // Handle checkboxes 833 $('.custom-search-selector input:checkbox', context).each(function(){ 834 var el = $(this); 835 if (el.val() == 'c-all') { 836 el.change(function(){ 837 $(this).parents('.custom-search-selector').find('input:checkbox[value!=c-all]').attr('checked', false); 838 }); 839 } 840 else { 841 if (el.val().substr(0,2) == 'c-') { 842 el.change(function(){ 843 $('.custom-search-selector input:checkbox').each(function(){ 844 if ($(this).val().substr(0,2) == 'o-') { 845 $(this).attr('checked', false); 846 } 847 }); 848 $(this).parents('.custom-search-selector').find('input:checkbox[value=c-all]').attr('checked', false); 849 }); 850 } else { 851 el.change(function(){ 852 $(this).parents('.custom-search-selector').find('input:checkbox[value!=' + el.val() + ']').attr('checked', false); 853 }); 854 } 855 } 856 }); 857 858 // Reselect types and terms in advanced search 859 var edit_keys = $('#edit-keys').val(); 860 if(edit_keys) { 861 // types 862 var pos = edit_keys.indexOf('type:'); 863 if (pos != -1) { 864 var pos2 = edit_keys.indexOf(' ', pos); 865 if (pos2 == -1) { 866 pos2 = edit_keys.length; 867 } 868 var types = edit_keys.substring(pos + 5,pos2); 869 types = types.split(','); 870 for (var i = 0; i < types.length; i++) { 871 $('.search-form input:checkbox[value=' + types[i] + ']').attr('checked', true); 872 } 873 } 874 // terms 875 var pos = edit_keys.indexOf('term:'); 876 if (pos != -1) { 877 var pos2 = edit_keys.indexOf(' ', pos); 878 if (pos2 == -1) { 879 pos2 = edit_keys.length; 880 } 881 var terms = edit_keys.substring(pos + 5, pos2); 882 terms = terms.split(','); 883 for (var i = 0; i < terms.length; i++) { 884 $('#edit-term option[value=' + terms[i] + ']').attr('selected', true); 885 } 886 } 887 // languages 888 var pos = edit_keys.indexOf('language:'); 889 if (pos != 1) { 890 var pos2 = edit_keys.indexOf(' ', pos); 891 if (pos2 == -1) { 892 pos2 = edit_keys.length; 893 } 894 var languages = edit_keys.substring(pos + 9,pos2); 895 languages = languages.split(','); 896 for (var i = 0; i < languages.length; i++) { 897 $('.search-advanced #edit-language-' + languages[i]).attr('checked', true); 898 } 899 } 900 } 901 902 var popup = $('fieldset.custom_search-popup:not(.custom_search-processed)', context).addClass("custom_search-processed"); 903 popup.click(function(e){ 904 e.stopPropagation(); 905 }) 906 popup.append('<a class="custom_search-popup-close" href="#">
906' + Drupal.t('Close') + '</a>'); 907 $('a.custom_search-popup-close').click(function(e){ 908 $('fieldset.custom_search-popup.opened').hide().removeClass('opened'); 909 e.preventDefault(); 910 }); 911 912 } 913 } 914})(jQuery); 915; 916Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 917 918(function ($) { 919 Drupal.TBMegaMenu.menuInstance = false; 920 Drupal.behaviors.tbMegaMenuAction = { 921 attach: function(context) { 922 $('.tb-megamenu-button').click(function() { 923 if(parseInt($(this).parent().children('.nav-collapse').height())) { 924 $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'}); 925 } 926 else { 927 $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'}); 928 } 929 }); 930 var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); 931 if(!isTouch){ 932 $(document).ready(function($){ 933 var mm_duration = 0; 934 $('.t3-megamenu').each (function(){ 935 if ($(this).data('duration')) { 936 mm_duration = $(this).data('duration'); 937 } 938 }); 939 var mm_timeout = mm_duration ? 100 + mm_duration : 500; 940 $('.nav > li, li.mega').hover(function(event) { 941 var $this = $(this); 942 if ($this.hasClass ('mega')) { 943 $this.addClass ('animating'); 944 clearTimeout ($this.data('animatingTimeout')); 945 $this.data('animatingTimeout', setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 946 clearTimeout ($this.data('hoverTimeout')); 947 $this.data('hoverTimeout', setTimeout(function(){$this.addClass ('open')}, 100)); 948 } else { 949 clearTimeout ($this.data('hoverTimeout')); 950 $this.data('hoverTimeout', 951 setTimeout(function(){$this.addClass ('open')}, 100)); 952 } 953 }, 954 function(event) { 955 var $this = $(this); 956 if ($this.hasClass ('mega')) { 957 $this.addClass ('animating'); 958 clearTimeout ($this.data('animatingTimeout')); 959 $this.data('animatingTimeout', 960 setTimeout(function(){$this.removeClass ('animating')}, mm_timeout)); 961 clearTimeout ($this.data('hoverTimeout')); 962 $this.data('hoverTimeout', setTimeout(function(){$this.removeClass ('open')}, 100)); 963 } else { 964 clearTimeout ($this.data('hoverTimeout')); 965 $this.data('hoverTimeout', 966 setTimeout(function(){$this.removeClass ('open')}, 100)); 967 } 968 }); 969 }); 970 } 971 } 972 } 973})(jQuery); 974 975; 976Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 977 978(function ($) { 979 Drupal.TBMegaMenu.createTouchMenu = function(items) { 980 items.children('a').each( function() { 981 var $item = $(this); 982 var tbitem = $(this).parent(); 983 $item.click( function(event){ 984 if ($item.hasClass('tb-megamenu-clicked')) { 985 var $uri = $item.attr('href'); 986 window.location.href = $uri; 987 } 988 else { 989 event.preventDefault(); 990 $item.addClass('tb-megamenu-clicked'); 991 if(!tbitem.hasClass('open')){ 992 tbitem.addClass('open'); 993 } 994 } 995 }).closest('li').mouseleave( function(){ 996 $item.removeClass('tb-megamenu-clicked'); 997 tbitem.removeClass('open'); 998 }); 999 }); 1000 /* 1001 items.children('a').children('span.caret').each( function() { 1002 var $item = $(this).parent(); 1003 $item.click(function(event){ 1004 tbitem = $item.parent(); 1005 if ($item.hasClass('tb-megamenu-clicked')) { 1006 Drupal.TBMegaMenu.eventStopPropagation(event); 1007 if(tbitem.hasClass('open')){ 1008 tbitem.removeClass('open'); 1009 $item.removeClass('tb-megamenu-clicked'); 1010 } 1011 } 1012 else { 1013 Drupal.TBMegaMenu.eventStopPropagation(event); 1014 $item.addClass('tb-megamenu-clicked'); 1015 if(!tbitem.hasClass('open')){ 1016 tbitem.addClass('open'); 1017 $item.removeClass('tb-megamenu-clicked'); 1018 } 1019 } 1020 }); 1021 }); 1022 */ 1023 } 1024 1025 Drupal.TBMegaMenu.eventStopPropagation = function(event) { 1026 if (event.stopPropagation) { 1027 event.stopPropagation(); 1028 } 1029 else if (window.event) { 1030 window.event.cancelBubble = true; 1031 } 1032 } 1033 Drupal.behaviors.tbMegaMenuTouchAction = { 1034 attach: function(context) { 1035 var isTouch = 'ontouchstart' in window && !(/hp-tablet/gi).test(navigator.appVersion); 1036 if(isTouch){ 1037 $('html').addClass('touch'); 1038 Drupal.TBMegaMenu.createTouchMenu($('.tb-megamenu ul.nav li.mega').has('.dropdown-menu')); 1039 } 1040 } 1041 } 1042})(jQuery); 1043; 1044// $Id: compact_forms.js,v 1.11 2011/01/09 05:51:15 sun Exp $ 1045 1046(function ($) { 1047 1048Drupal.compactForms = {}; 1049 1050/** 1051 * Compact Forms jQuery plugin. 1052 */ 1053$.fn.compactForm = function (stars) { 1054 stars = stars || 0; 1055 1056 this.each(function () { 1057 $(this).addClass('compact-form').find('label').each(function () { 1058 var context = this.form; 1059 var $label = $(this); 1060 if (!$label.attr('for')) { 1061 return; 1062 } 1063 var $field = $('#' + $label.attr('for'), context); 1064 if (!$field.length || !$field.is('input:text,input:password,textarea')) { 1065 return; 1066 } 1067 // Store the initial field value, in case the browser is going to 1068 // automatically fill it in upon focus. 1069 var initial_value = $field.val(); 1070 1071 if (initial_value != '') { 1072 // Firefox doesn't like .hide() here for some reason. 1073 $label.css('display', 'none'); 1074 } 1075 1076 $label.parent().addClass('compact-form-wrapper'); 1077 $label.addClass('compact-form-label'); 1078 $field.addClass('compact-form-field'); 1079 1080 if (stars === 0) { 1081 $label.find('.form-required').hide(); 1082 } 1083 else if (stars === 2) { 1084 $label.find('.form-required').insertAfter($field).prepend(' '); 1085 } 1086 1087 $field.focus(function () { 1088 // Some browsers (e.g., Firefox) are automatically inserting a stored 1089 // username and password into login forms. In case the password field is 1090 // manually emptied afterwards, and the user jumps back to the username 1091 // field (without changing it), and forth to the password field, then 1092 // the browser automatically re-inserts the password again. Therefore, 1093 // we also need to test against the initial field value. 1094 if ($field.val() === initial_value || $field.val() === '') { 1095 $label.fadeOut('fast'); 1096 } 1097 }); 1098 1099 $field.blur(function () { 1100 if ($field.val() === '') { 1101 $label.fadeIn('slow'); 1102 } 1103 }); 1104 1105 // Chrome adds passwords after page load, so we need to track changes. 1106 $field.change(function () { 1107 if ($field.get(0) != document.activeElement) { 1108 if ($field.val() === '') { 1109 $label.fadeIn('fast'); 1110 } 1111 else { 1112 $label.css('display', 'none'); 1113 } 1114 } 1115 }); 1116 }); 1117 }); 1118}; 1119 1120/** 1121 * Attach compact forms behavior to all enabled forms upon page load. 1122 */ 1123Drupal.behaviors.compactForms = { 1124 attach: function (context, settings) {
1125 if (!settings || !settings.compactForms) { 1126 return; 1127 } 1128 $('#' + settings.compactForms.forms.join(',#'), context).compactForm(settings.compactForms.stars); 1129 1130 // Safari adds passwords without triggering any event after page load. 1131 // We therefore need to wait a bit and then check for field values. 1132 if ($.browser.safari) { 1133 setTimeout(Drupal.compactForms.fixSafari, 200); 1134 } 1135 } 1136}; 1137 1138/** 1139 * Checks for field values and hides the corresponding label if non-empty. 1140 * 1141 * @todo Convert $.fn.compactForm to always use a function like this. 1142 */ 1143Drupal.compactForms.fixSafari = function () { 1144 $('label.compact-form-label').each(function () { 1145 var $label = $(this); 1146 var context = this.form; 1147 if ($('#' + $label.attr('for'), context).val() != '') { 1148 $label.css('display', 'none'); 1149 } 1150 }); 1151} 1152 1153})(jQuery); 1154; 1155(function(c,q){var m="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";c.fn.imagesLoaded=function(f){function n(){var b=c(j),a=c(h);d&&(h.length?d.reject(e,b,a):d.resolve(e));c.isFunction(f)&&f.call(g,e,b,a)}function p(b){k(b.target,"error"===b.type)}function k(b,a){b.src===m||-1!==c.inArray(b,l)||(l.push(b),a?h.push(b):j.push(b),c.data(b,"imagesLoaded",{isBroken:a,src:b.src}),r&&d.notifyWith(c(b),[a,e,c(j),c(h)]),e.length===l.length&&(setTimeout(n),e.unbind(".imagesLoaded", 1156p)))}var g=this,d=c.isFunction(c.Deferred)?c.Deferred():0,r=c.isFunction(d.notify),e=g.find("img").add(g.filter("img")),l=[],j=[],h=[];c.isPlainObject(f)&&c.each(f,function(b,a){if("callback"===b)f=a;else if(d)d[b](a)});e.length?e.bind("load.imagesLoaded error.imagesLoaded",p).each(function(b,a){var d=a.src,e=c.data(a,"imagesLoaded");if(e&&e.src===d)k(a,e.isBroken);else if(a.complete&&a.naturalWidth!==q)k(a,0===a.naturalWidth||0===a.naturalHeight);else if(a.readyState||a.complete)a.src=m,a.src=d}): 1157n();return d?d.promise(g):g}})(jQuery); 1158; 1159(function ($) { 1160 1161$(document).ready(function() { 1162 1163 // Expression to check for absolute internal links. 1164 var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); 1165 1166 // Attach onclick event to document only and catch clicks on all elements. 1167 $(document.body).click(function(event) { 1168 // Catch the closest surrounding link of a clicked element. 1169 $(event.target).closest("a,area").each(function() { 1170 1171 var ga = Drupal.settings.googleanalytics; 1172 // Expression to check for special links like gotwo.module /go/* links. 1173 var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); 1174 // Expression to check for download links. 1175 var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i"); 1176 1177 // Is the clicked URL internal? 1178 if (isInternal.test(this.href)) { 1179 // Skip 'click' tracking, if custom tracking events are bound. 1180 if ($(this).is('.colorbox')) { 1181 // Do nothing here. The custom event will handle all tracking. 1182 } 1183 // Is download tracking activated and the file extension configured for download tracking? 1184 else if (ga.trackDownload && isDownload.test(this.href)) { 1185 // Download link clicked. 1186 var extension = isDownload.exec(this.href); 1187 _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]); 1188 } 1189 else if (isInternalSpecial.test(this.href)) { 1190 // Keep the internal URL for Google Analytics website overlay intact. 1191 _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]); 1192 } 1193 } 1194 else { 1195 if (ga.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 1196 // Mailto link clicked. 1197 _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]); 1198 } 1199 else if (ga.trackOutbound && this.href.match(/^\w+:\/\//i)) { 1200 if (ga.trackDomainMode == 2 && isCrossDomain($(this).attr('hostname'), ga.trackCrossDomains)) { 1201 // Top-level cross domain clicked. document.location is handled by _link internally. 1202 event.preventDefault(); 1203 _gaq.push(["_link", this.href]); 1204 } 1205 else { 1206 // External link clicked.
1207 _gaq.push(["_trackEvent", "Outbound links", "Click", this.href]); 1208 } 1209 } 1210 } 1211 }); 1212 }); 1213 1214 // Colorbox: This event triggers when the transition has completed and the 1215 // newly loaded content has been revealed. 1216 $(document).bind("cbox_complete", function() { 1217 var href = $.colorbox.element().attr("href"); 1218 if (href) { 1219 _gaq.push(["_trackPageview", href.replace(isInternal, '')]); 1220 } 1221 }); 1222 1223}); 1224 1225/** 1226 * Check whether the hostname is part of the cross domains or not. 1227 * 1228 * @param string hostname 1229 * The hostname of the clicked URL. 1230 * @param array crossDomains 1231 * All cross domain hostnames as JS array. 1232 * 1233 * @return boolean 1234 */ 1235function isCrossDomain(hostname, crossDomains) { 1236 /** 1237 * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is 1238 * `null` or `undefined`, http://bugs.jquery.com/ticket/10076, 1239 * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 1240 * 1241 * @todo: Remove/Refactor in D8 1242 */ 1243 if (!crossDomains) { 1244 return false; 1245 } 1246 else { 1247 return $.inArray(hostname, crossDomains) > -1 ? true : false; 1248 } 1249} 1250 1251})(jQuery); 1252;
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.