1Drupal.locale = { 'pluralFormula': function ($n) { return Number((($n==1)?(0):((($n>=2)&&($n<=4))?(1):2))); }, 'strings': {"":{"An AJAX HTTP error occurred.":"Vyskytla sa chyba AJAX HTTP.","HTTP Result Code: !status":"HTTP Result Code: !status","An AJAX HTTP request terminated abnormally.":"Abnorm\u00e1lne ukon\u010denie AJAX HTTP po\u017eiadavky.","Debugging information follows.":"Nasleduje v\u00fdpis ladiacich inform\u00e1ci\u00ed.","Path: !uri":"Cesta: !uri","StatusText: !statusText":"Stavov\u00fd text: !statusText","ResponseText: !responseText":"ResponseText: !responseText","ReadyState: !readyState":"ReadyState: !readyState","(active tab)":"(akt\u00edvna karta)","Shortcuts":"Skratky","All":"V\u0161etko","Configure":"Konfigurova\u0165","Edit":"Upravi\u0165","Hide":"Skry\u0165","Show":"Zobrazi\u0165","@number comments per page":"@number koment\u00e1rov na str\u00e1nku","Requires a title":"Vy\u017eaduje nadpis","Not published":"Nezverejnen\u00e9","Don\u0027t display post information":"Nezobrazova\u0165 inform\u00e1cie o publikovan\u00ed","Hide summary":"Skry\u0165 zhrnutie","
1Edit summary":"Upravi\u0165 zhrnutie","Not in menu":"Nie je v menu","New revision":"Nov\u00e1 rev\u00edzia","No revision":"\u017diadna rev\u00edzia","By @name on @date":"Od pou\u017e\u00edvate\u013ea @name - @date","By @name":"Pod\u013ea @name","Alias: @alias":"Alias: @alias","No alias":"\u017diaden alias","Autocomplete popup":"Pole s automatick\u00fdm dopl\u0148ovan\u00edm","Searching for matches...":"H\u013eadaj\u00fa sa zhody...","Re-order rows by numerical weight instead of dragging.":"Namiesto \u0165ahania preusporiadajte riadky pomocou \u010d\u00edseln\u00fdch v\u00e1h.","Show row weights":"Zobrazi\u0165 v\u00e1hy riadkov","Hide row weights":"Skry\u0165 v\u00e1hy riadkov","Drag to re-order":"Potiahnut\u00edm zmen\u00edte poradie","Changes made in this table will not be saved until the form is submitted.":"Zmeny vykonan\u00e9 v tejto tabu\u013eke nebud\u00fa ulo\u017een\u00e9 pokia\u013e sa formul\u00e1r neodo\u0161le.","This permission is inherited from the authenticated user role.":"Toto opr\u00e1vnenie sa ded\u00ed z kateg\u00f3rie Prihl\u00e1sen\u00fd pou\u017e\u00edvate\u013e.","Select all rows in this table":"Ozna\u010di\u0165 v\u0161etky riadky v tejto tabu\u013eke","Deselect all rows in this table":"Odzna\u010di\u0165 v\u0161etky riadky v tejto tabu\u013eke","Please wait...":"Pros\u00edm \u010dakajte...","Add":"Prida\u0165","Status":"Stav","Cancel":"Zru\u0161i\u0165","Disabled":"Zak\u00e1zan\u00e9","Enabled":"Povolen\u00e9","Size":"Ve\u013ekos\u0165","Search":"Vyh\u013ead\u00e1vanie","- None -":"- \u017diadne -","none":"\u017eiadne","Save":"Ulo\u017ei\u0165","Filename":"N\u00e1zov s\u00faboru","Published":"Zverejnen\u00e9","N\/A":"N\/A","This field is required.":"Toto pole je povinn\u00e9.","The changes to these blocks will not be saved until the \u003Cem\u003ESave blocks\u003C\/em\u003E button is clicked.":"Zmeny v rozmiestnen\u00ed blokov sa neprejavia, pok\u00fdm nestla\u010d\u00edte tla\u010didlo \u003Cem\u003EUlo\u017ei\u0165 bloky\u003C\/em\u003E","Not restricted":"Neobmedzen\u00e9","Not customizable":"Neprisp\u00f4sobite\u013en\u00fd","Restricted to certain pages":"Obmedzi\u0165 pre konkr\u00e9tne str\u00e1nky","The block cannot be placed in this region.":"Blok nem\u00f4\u017ee by\u0165 umiestnen\u00fd v tomto regi\u00f3ne.","The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.":"Zvolen\u00fd s\u00fabor %filename nie je mo\u017en\u00e9 nahra\u0165. Povolen\u00e9 s\u00fa len s\u00fabory s t\u00fdmito pr\u00edponami: %extensions.","Close":"Zatvori\u0165","No title":"Bez n\u00e1zvu","Add files":"Pridaj s\u00fabory","No results found.":"Nena\u0161iel sa \u017eiaden v\u00fdsledok."}} };; 2(function ($) { 3 Drupal.theme.prototype.builder_modal = function () { 4 var html = ''; 5 html += '<div id="ctools-modal" class="popups-box">'; 6 html += ' <div class="ctools-modal-content ctools-modal-builder-modal-content">'; 7 html += ' <div class="popups-container">'; 8 html += ' <div class="modal-header popups-title">'; 9 html += ' <span id="modal-title" class="modal-title"></span>'; 10 html += ' <span class="popups-close"><a class="icon-builder-cancel-circled-outline close" href="#">' + Drupal.CTools.Modal.currentSettings.closeText + '</a></span>'; 11 html += ' <div class="clear-block"></div>'; 12 html += ' </div>'; 13 html += ' <div class="modal-scroll"><div id="modal-content" class="modal-content popups-body"></div></div>'; 14 html += ' <div class="popups-buttons"></div>'; //Maybe someday add the option for some specific buttons. 15 html += ' <div class="popups-footer"></div>'; //Maybe someday add some footer. 16 html += ' </div>'; 17 html += ' </div>'; 18 html += '</div>'; 19 return html; 20 } 21})(jQuery);; 22(function() { 23 var MutationObserver, Util, WeakMap, getComputedStyle, getComputedStyleRX, 24 bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, 25 indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; 26 27 Util = (function() { 28 function Util() {} 29 30 Util.prototype.extend = function(custom, defaults) { 31 var key, value; 32 for (key in defaults) { 33 value = defaults[key]; 34 if (custom[key] == null) { 35 custom[key] = value; 36 } 37 } 38 return custom; 39 }; 40 41 Util.prototype.isMobile = function(agent) { 42 return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent); 43 }; 44 45 Util.prototype.createEvent = function(event, bubble, cancel, detail) { 46 var customEvent; 47 if (bubble == null) { 48 bubble = false;
vendor: 10,749 bytes, lines 49-408
49 } 50 if (cancel == null) { 51 cancel = false; 52 } 53 if (detail == null) { 54 detail = null; 55 } 56 if (document.createEvent != null) { 57 customEvent = document.createEvent('CustomEvent'); 58 customEvent.initCustomEvent(event, bubble, cancel, detail); 59 } else if (document.createEventObject != null) { 60 customEvent = document.createEventObject(); 61 customEvent.eventType = event; 62 } else { 63 customEvent.eventName = event; 64 } 65 return customEvent; 66 }; 67 68 Util.prototype.emitEvent = function(elem, event) { 69 if (elem.dispatchEvent != null) { 70 return elem.dispatchEvent(event); 71 } else if (event in (elem != null)) { 72 return elem[event](); 73 } else if (("on" + event) in (elem != null)) { 74 return elem["on" + event](); 75 } 76 }; 77 78 Util.prototype.addEvent = function(elem, event, fn) { 79 if (elem.addEventListener != null) { 80 return elem.addEventListener(event, fn, false); 81 } else if (elem.attachEvent != null) { 82 return elem.attachEvent("on" + event, fn); 83 } else { 84 return elem[event] = fn; 85 } 86 }; 87 88 Util.prototype.removeEvent = function(elem, event, fn) { 89 if (elem.removeEventListener != null) { 90 return elem.removeEventListener(event, fn, false); 91 } else if (elem.detachEvent != null) { 92 return elem.detachEvent("on" + event, fn); 93 } else { 94 return delete elem[event]; 95 } 96 }; 97 98 Util.prototype.innerHeight = function() { 99 if ('innerHeight' in window) { 100 return window.innerHeight; 101 } else { 102 return document.documentElement.clientHeight; 103 } 104 }; 105 106 return Util; 107 108 })(); 109 110 WeakMap = this.WeakMap || this.MozWeakMap || (WeakMap = (function() { 111 function WeakMap() { 112 this.keys = []; 113 this.values = []; 114 } 115 116 WeakMap.prototype.get = function(key) { 117 var i, item, j, len, ref; 118 ref = this.keys; 119 for (i = j = 0, len = ref.length; j < len; i = ++j) { 120 item = ref[i]; 121 if (item === key) { 122 return this.values[i]; 123 } 124 } 125 }; 126 127 WeakMap.prototype.set = function(key, value) { 128 var i, item, j, len, ref; 129 ref = this.keys; 130 for (i = j = 0, len = ref.length; j < len; i = ++j) { 131 item = ref[i]; 132 if (item === key) { 133 this.values[i] = value; 134 return; 135 } 136 } 137 this.keys.push(key); 138 return this.values.push(value); 139 }; 140 141 return WeakMap; 142 143 })()); 144 145 MutationObserver = this.MutationObserver || this.WebkitMutationObserver || this.MozMutationObserver || (MutationObserver = (function() { 146 function MutationObserver() { 147 if (typeof console !== "undefined" && console !== null) { 148 console.warn('MutationObserver is not supported by your browser.'); 149 } 150 if (typeof console !== "undefined" && console !== null) { 151 console.warn('WOW.js cannot detect dom mutations, please call .sync() after loading new content.'); 152 } 153 } 154 155 MutationObserver.notSupported = true; 156 157 MutationObserver.prototype.observe = function() {}; 158 159 return MutationObserver; 160 161 })()); 162 163 getComputedStyle = this.getComputedStyle || function(el, pseudo) { 164 this.getPropertyValue = function(prop) { 165 var ref; 166 if (prop === 'float') { 167 prop = 'styleFloat'; 168 } 169 if (getComputedStyleRX.test(prop)) { 170 prop.replace(getComputedStyleRX, function(_, _char) { 171 return _char.toUpperCase(); 172 }); 173 } 174 return ((ref = el.currentStyle) != null ? ref[prop] : void 0) || null; 175 }; 176 return this; 177 }; 178 179 getComputedStyleRX = /(\-([a-z]){1})/g; 180 181 this.WOW = (function() { 182 WOW.prototype.defaults = { 183 boxClass: 'wow', 184 animateClass: 'animated', 185 offset: 0, 186 mobile: true, 187 live: true, 188 callback: null 189 }; 190 191 function WOW(options) { 192 if (options == null) { 193 options = {}; 194 } 195 this.scrollCallback = bind(this.scrollCallback, this); 196 this.scrollHandler = bind(this.scrollHandler, this); 197 this.resetAnimation = bind(this.resetAnimation, this); 198 this.start = bind(this.start, this); 199 this.scrolled = true; 200 this.config = this.util().extend(options, this.defaults); 201 this.animationNameCache = new WeakMap(); 202 this.wowEvent = this.util().createEvent(this.config.boxClass); 203 } 204 205 WOW.prototype.init = function() { 206 var ref; 207 this.element = window.document.documentElement; 208 if ((ref = document.readyState) === "interactive" || ref === "complete") { 209 this.start(); 210 } else { 211 this.util().addEvent(document, 'DOMContentLoaded', this.start); 212 } 213 return this.finished = []; 214 }; 215 216 WOW.prototype.start = function() { 217 var box, j, len, ref; 218 this.stopped = false; 219 this.boxes = (function() { 220 var j, len, ref, results; 221 ref = this.element.querySelectorAll("." + this.config.boxClass); 222 results = []; 223 for (j = 0, len = ref.length; j < len; j++) { 224 box = ref[j]; 225 results.push(box); 226 } 227 return results; 228 }).call(this); 229 this.all = (function() { 230 var j, len, ref, results; 231 ref = this.boxes; 232 results = []; 233 for (j = 0, len = ref.length; j < len; j++) { 234 box = ref[j]; 235 results.push(box); 236 } 237 return results; 238 }).call(this); 239 if (this.boxes.length) { 240 if (this.disabled()) { 241 this.resetStyle(); 242 } else { 243 ref = this.boxes; 244 for (j = 0, len = ref.length; j < len; j++) { 245 box = ref[j]; 246 this.applyStyle(box, true); 247 } 248 } 249 } 250 if (!this.disabled()) { 251 this.util().addEvent(window, 'scroll', this.scrollHandler); 252 this.util().addEvent(window, 'resize', this.scrollHandler); 253 this.interval = setInterval(this.scrollCallback, 50); 254 } 255 if (this.config.live) { 256 return new MutationObserver((function(_this) { 257 return function(records) { 258 var k, len1, node, record, results; 259 results = []; 260 for (k = 0, len1 = records.length; k < len1; k++) { 261 record = records[k]; 262 results.push((function() { 263 var l, len2, ref1, results1; 264 ref1 = record.addedNodes || []; 265 results1 = []; 266 for (l = 0, len2 = ref1.length; l < len2; l++) { 267 node = ref1[l]; 268 results1.push(this.doSync(node)); 269 } 270 return results1; 271 }).call(_this)); 272 } 273 return results; 274 }; 275 })(this)).observe(document.body, { 276 childList: true, 277 subtree: true 278 }); 279 } 280 }; 281 282 WOW.prototype.stop = function() { 283 this.stopped = true; 284 this.util().removeEvent(window, 'scroll', this.scrollHandler); 285 this.util().removeEvent(window, 'resize', this.scrollHandler); 286 if (this.interval != null) { 287 return clearInterval(this.interval); 288 } 289 }; 290 291 WOW.prototype.sync = function(element) { 292 if (MutationObserver.notSupported) { 293 return this.doSync(this.element); 294 } 295 }; 296 297 WOW.prototype.doSync = function(element) { 298 var box, j, len, ref, results; 299 if (element == null) { 300 element = this.element; 301 } 302 if (element.nodeType !== 1) { 303 return; 304 } 305 element = element.parentNode || element; 306 ref = element.querySelectorAll("." + this.config.boxClass); 307 results = []; 308 for (j = 0, len = ref.length; j < len; j++) { 309 box = ref[j]; 310 if (indexOf.call(this.all, box) < 0) { 311 this.boxes.push(box); 312 this.all.push(box); 313 if (this.stopped || this.disabled()) { 314 this.resetStyle(); 315 } else { 316 this.applyStyle(box, true); 317 } 318 results.push(this.scrolled = true); 319 } else { 320 results.push(void 0); 321 } 322 } 323 return results; 324 }; 325 326 WOW.prototype.show = function(box) { 327 this.applyStyle(box); 328 box.className = box.className + " " + this.config.animateClass; 329 if (this.config.callback != null) { 330 this.config.callback(box); 331 } 332 this.util().emitEvent(box, this.wowEvent); 333 this.util().addEvent(box, 'animationend', this.resetAnimation); 334 this.util().addEvent(box, 'oanimationend', this.resetAnimation); 335 this.util().addEvent(box, 'webkitAnimationEnd', this.resetAnimation); 336 this.util().addEvent(box, 'MSAnimationEnd', this.resetAnimation); 337 return box; 338 }; 339 340 WOW.prototype.applyStyle = function(box, hidden) { 341 var delay, duration, iteration; 342 duration = box.getAttribute('data-wow-duration'); 343 delay = box.getAttribute('data-wow-delay'); 344 iteration = box.getAttribute('data-wow-iteration'); 345 return this.animate((function(_this) { 346 return function() { 347 return _this.customStyle(box, hidden, duration, delay, iteration); 348 }; 349 })(this)); 350 }; 351 352 WOW.prototype.animate = (function() { 353 if ('requestAnimationFrame' in window) { 354 return function(callback) { 355 return window.requestAnimationFrame(callback); 356 }; 357 } else { 358 return function(callback) { 359 return callback(); 360 }; 361 } 362 })(); 363 364 WOW.prototype.resetStyle = function() { 365 var box, j, len, ref, results; 366 ref = this.boxes; 367 results = []; 368 for (j = 0, len = ref.length; j < len; j++) { 369 box = ref[j]; 370 results.push(box.style.visibility = 'visible'); 371 } 372 return results; 373 }; 374 375 WOW.prototype.resetAnimation = function(event) { 376 var target; 377 if (event.type.toLowerCase().indexOf('animationend') >= 0) { 378 target = event.target || event.srcElement; 379 return target.className = target.className.replace(this.config.animateClass, '').trim(); 380 } 381 }; 382 383 WOW.prototype.customStyle = function(box, hidden, duration, delay, iteration) { 384 if (hidden) { 385 this.cacheAnimationName(box); 386 } 387 box.style.visibility = hidden ? 'hidden' : 'visible'; 388 if (duration) { 389 this.vendorSet(box.style, { 390 animationDuration: duration 391 }); 392 } 393 if (delay) { 394 this.vendorSet(box.style, { 395 animationDelay: delay 396 }); 397 } 398 if (iteration) { 399 this.vendorSet(box.style, { 400 animationIterationCount: iteration 401 }); 402 } 403 this.vendorSet(box.style, { 404 animationName: hidden ? 'none' : this.cachedAnimationName(box) 405 }); 406 return box; 407 }; 408
409 WOW.prototype.vendors = ["moz", "webkit"]; 410 411 WOW.prototype.vendorSet = function(elem, properties) { 412 var name, results, value, vendor; 413 results = []; 414 for (name in properties) { 415 value = properties[name]; 416 elem["" + name] = value; 417 results.push((function() { 418 var j, len, ref, results1; 419 ref = this.vendors; 420 results1 = []; 421 for (j = 0, len = ref.length; j < len; j++) { 422 vendor = ref[j]; 423 results1.push(elem["" + vendor + (name.charAt(0).toUpperCase()) + (name.substr(1))] = value); 424 } 425 return results1; 426 }).call(this)); 427 } 428 return results; 429 }; 430 431 WOW.prototype.vendorCSS = function(elem, property) { 432 var j, len, ref, result, style, vendor; 433 style = getComputedStyle(elem); 434 result = style.getPropertyCSSValue(property); 435 ref = this.vendors; 436 for (j = 0, len = ref.length; j < len; j++) { 437 vendor = ref[j]; 438 result = result || style.getPropertyCSSValue("-" + vendor + "-" + property); 439 } 440 return result; 441 }; 442 443 WOW.prototype.animationName = function(box) { 444 var animationName; 445 try { 446 animationName = this.vendorCSS(box, 'animation-name').cssText; 447 } catch (_error) { 448 animationName = getComputedStyle(box).getPropertyValue('animation-name'); 449 } 450 if (animationName === 'none') { 451 return ''; 452 } else { 453 return animationName; 454 } 455 }; 456 457 WOW.prototype.cacheAnimationName = function(box) { 458 return this.animationNameCache.set(box, this.animationName(box)); 459 }; 460 461 WOW.prototype.cachedAnimationName = function(box) { 462 return this.animationNameCache.get(box); 463 }; 464 465 WOW.prototype.scrollHandler = function() { 466 return this.scrolled = true; 467 }; 468 469 WOW.prototype.scrollCallback = function() { 470 var box; 471 if (this.scrolled) { 472 this.scrolled = false; 473 this.boxes = (function() { 474 var j, len, ref, results; 475 ref = this.boxes; 476 results = []; 477 for (j = 0, len = ref.length; j < len; j++) { 478 box = ref[j]; 479 if (!(box)) { 480 continue; 481 } 482 if (this.isVisible(box)) { 483 this.show(box); 484 continue; 485 } 486 results.push(box); 487 } 488 return results; 489 }).call(this); 490 if (!(this.boxes.length || this.config.live)) { 491 return this.stop(); 492 } 493 } 494 }; 495 496 WOW.prototype.offsetTop = function(element) { 497 var top; 498 while (element.offsetTop === void 0) { 499 element = element.parentNode; 500 } 501 top = element.offsetTop; 502 while (element = element.offsetParent) { 503 top += element.offsetTop; 504 } 505 return top; 506 }; 507 508 WOW.prototype.isVisible = function(box) { 509 var bottom, offset, top, viewBottom, viewTop; 510 offset = box.getAttribute('data-wow-offset') || this.config.offset; 511 viewTop = window.pageYOffset; 512 viewBottom = viewTop + Math.min(this.element.clientHeight, this.util().innerHeight()) - offset; 513 top = this.offsetTop(box); 514 bottom = top + box.clientHeight; 515 return top <= viewBottom && bottom >= viewTop; 516 }; 517 518 WOW.prototype.util = function() { 519 return this._util != null ? this._util : this._util = new Util(); 520 }; 521 522 WOW.prototype.disabled = function() { 523 return !this.config.mobile && this.util().isMobile(navigator.userAgent); 524 }; 525 526 return WOW; 527 528 })(); 529 530}).call(this); 531; 532(function ($) { 533 Drupal.behaviors.builder = { 534 attach: function (context, settings) { 535 536 wow = new WOW( 537 { 538 boxClass: 'builder-animation', 539 animateClass: 'animated', // default 540 offset: 0, // default 541 mobile: true, // default 542 live: true // default 543 } 544 ); 545 wow.init(); 546 547 548 $(document).ready(function(){ 549 550 551 $( ".builder-content-builder-custom-text img" ).each(function( index ) { 552 $(this).parent().css('margin',0); 553}); 554 555 // Add minus icon for collapse element which is open by default 556 $(".collapse.in").each(function(){ 557 $(this).siblings(".panel-heading").find(".icon").addClass("icon-down").removeClass("icon-right"); 558 }); 559 560 // Toggle plus minus icon on show hide of collapse element 561 $(".collapse").on('show.bs.collapse', function(){ 562 $(this).parent().find(".icon").addClass("rot-down"); 563 }).on('hide.bs.collapse', function(){ 564 $(this).parent().find(".icon").removeClass("rot-down"); 565 }); 566 }); 567 568 569 } 570 }; 571 572})(jQuery); 573 574(function ($) { 575 Drupal.behaviors.autocompleteSupervisor = { 576 attach: function (context) { 577 $("input#edit-author", context).bind('autocompleteSelect', function(event, node) { 578 console.log($(this).val()); // user-entered string 579 console.log($(node).data('autocompleteValue')); // key of selected item 580 console.log($(node).text()); // label of selected item 581 var values = $(this).val().split('|'); // my key was a pipe-delimited string (name|id) 582 console.log(values); 583 console.log($(this)); 584 if (values[1]) { this.value = values[1]; 585 window.location.href = "/ludia-na-tuzvo/"+values[0]; 586 } }); 587 } 588 }; 589})(jQuery); 590 591 592; 593(function ($) { 594 595/** 596 * A progressbar object. Initialized with the given id. Must be inserted into 597 * the DOM afterwards through progressBar.element. 598 * 599 * method is the function which will perform the HTTP request to get the 600 * progress bar state. Either "GET" or "POST". 601 * 602 * e.g. pb = new progressBar('myProgressBar'); 603 * some_element.appendChild(pb.element); 604 */ 605Drupal.progressBar = function (id, updateCallback, method, errorCallback) { 606 var pb = this; 607 this.id = id; 608 this.method = method || 'GET'; 609 this.updateCallback = updateCallback; 610 this.errorCallback = errorCallback; 611
612 // The WAI-ARIA setting aria-live="polite" will announce changes after users 613 // have completed their current activity and not interrupt the screen reader. 614 this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); 615 this.element.html('<div class="bar"><div class="filled"></div></div>' + 616 '<div class="percentage"></div>' + 617 '<div class="message"> </div>'); 618}; 619 620/** 621 * Set the percentage and status message for the progressbar. 622 */ 623Drupal.progressBar.prototype.setProgress = function (percentage, message) { 624 if (percentage >= 0 && percentage <= 100) { 625 $('div.filled', this.element).css('width', percentage + '%'); 626 $('div.percentage', this.element).html(percentage + '%'); 627 } 628 $('div.message', this.element).html(message); 629 if (this.updateCallback) { 630 this.updateCallback(percentage, message, this); 631 } 632}; 633 634/** 635 * Start monitoring progress via Ajax. 636 */ 637Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { 638 this.delay = delay; 639 this.uri = uri; 640 this.sendPing(); 641}; 642 643/** 644 * Stop monitoring progress via Ajax. 645 */ 646Drupal.progressBar.prototype.stopMonitoring = function () { 647 clearTimeout(this.timer); 648 // This allows monitoring to be stopped from within the callback. 649 this.uri = null; 650}; 651 652/** 653 * Request progress data from server. 654 */ 655Drupal.progressBar.prototype.sendPing = function () { 656 if (this.timer) { 657 clearTimeout(this.timer); 658 } 659 if (this.uri) { 660 var pb = this; 661 // When doing a post request, you need non-null data. Otherwise a 662 // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. 663 $.ajax({ 664 type: this.method, 665 url: this.uri, 666 data: '', 667 dataType: 'json', 668 success: function (progress) { 669 // Display errors. 670 if (progress.status == 0) { 671 pb.displayError(progress.data); 672 return; 673 } 674 // Update display. 675 pb.setProgress(progress.percentage, progress.message); 676 // Schedule next timer. 677 pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); 678 }, 679 error: function (xmlhttp) { 680 pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); 681 } 682 }); 683 } 684}; 685 686/** 687 * Display errors on the page. 688 */ 689Drupal.progressBar.prototype.displayError = function (string) { 690 var error = $('<div class="messages error"></div>').html(string); 691 $(this.element).before(error).hide(); 692 693 if (this.errorCallback) { 694 this.errorCallback(this); 695 } 696}; 697 698})(jQuery); 699; 700/*! 701 * jCarousel - Riding carousels with jQuery 702 * http://sorgalla.com/jcarousel/ 703 * 704 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com) 705 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 706 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 707 * 708 * Built on top of the jQuery library 709 * http://jquery.com 710 * 711 * Inspired by the "Carousel Component" by Bill Scott 712 * http://billwscott.com/carousel/ 713 */ 714 715/*global window, jQuery */ 716(function($) { 717 // Default configuration properties. 718 var defaults = { 719 vertical: false, 720 rtl: false, 721 start: 1, 722 offset: 1, 723 size: null, 724 scroll: 1, 725 visible: null, 726 animation: 'normal', 727 easing: 'swing', 728 auto: 0, 729 wrap: null, 730 initCallback: null, 731 setupCallback: null, 732 reloadCallback: null, 733 itemLoadCallback: null, 734 itemFirstInCallback: null, 735 itemFirstOutCallback: null, 736 itemLastInCallback: null, 737 itemLastOutCallback: null, 738 itemVisibleInCallback: null, 739 itemVisibleOutCallback: null, 740 animationStepCallback: null, 741 buttonNextHTML: '<div></div>', 742 buttonPrevHTML: '<div></div>', 743 buttonNextEvent: 'click', 744 buttonPrevEvent: 'click', 745 buttonNextCallback: null, 746 buttonPrevCallback: null, 747 itemFallbackDimension: null 748 }, windowLoaded = false; 749 750 $(window).bind('load.jcarousel', function() { windowLoaded = true; }); 751 752 /** 753 * The jCarousel object. 754 * 755 * @constructor 756 * @class jcarousel 757 * @param e {HTMLElement} The element to create the carousel for. 758 * @param o {Object} A set of key/value pairs to set as configuration properties. 759 * @cat Plugins/jCarousel 760 */ 761 $.jcarousel = function(e, o) { 762 this.options = $.extend({}, defaults, o || {}); 763 764 this.locked = false;
765 this.autoStopped = false; 766 767 this.container = null; 768 this.clip = null; 769 this.list = null; 770 this.buttonNext = null; 771 this.buttonPrev = null; 772 this.buttonNextState = null; 773 this.buttonPrevState = null; 774 775 // Only set if not explicitly passed as option 776 if (!o || o.rtl === undefined) { 777 this.options.rtl = ($(e).attr('dir') || $('html').attr('dir') || '').toLowerCase() == 'rtl'; 778 } 779 780 this.wh = !this.options.vertical ? 'width' : 'height'; 781 this.lt = !this.options.vertical ? (this.options.rtl ? 'right' : 'left') : 'top'; 782 783 // Extract skin class 784 var skin = '', split = e.className.split(' '); 785 786 for (var i = 0; i < split.length; i++) { 787 if (split[i].indexOf('jcarousel-skin') != -1) { 788 $(e).removeClass(split[i]); 789 skin = split[i]; 790 break; 791 } 792 } 793 794 if (e.nodeName.toUpperCase() == 'UL' || e.nodeName.toUpperCase() == 'OL') { 795 this.list = $(e); 796 this.clip = this.list.parents('.jcarousel-clip'); 797 this.container = this.list.parents('.jcarousel-container'); 798 } else { 799 this.container = $(e); 800 this.list = this.container.find('ul,ol').eq(0); 801 this.clip = this.container.find('.jcarousel-clip'); 802 } 803 804 if (this.clip.size() === 0) { 805 this.clip = this.list.wrap('<div></div>').parent(); 806 } 807 808 if (this.container.size() === 0) { 809 this.container = this.clip.wrap('<div></div>').parent(); 810 } 811 812 if (skin !== '' && this.container.parent()[0].className.indexOf('jcarousel-skin') == -1) { 813 this.container.wrap('<div class=" '+ skin + '"></div>'); 814 } 815 816 this.buttonPrev = $('.jcarousel-prev', this.container); 817 818 if (this.buttonPrev.size() === 0 && this.options.buttonPrevHTML !== null) { 819 this.buttonPrev = $(this.options.buttonPrevHTML).appendTo(this.container); 820 } 821 822 this.buttonPrev.addClass(this.className('jcarousel-prev')); 823 824 this.buttonNext = $('.jcarousel-next', this.container); 825 826 if (this.buttonNext.size() === 0 && this.options.buttonNextHTML !== null) { 827 this.buttonNext = $(this.options.buttonNextHTML).appendTo(this.container); 828 } 829 830 this.buttonNext.addClass(this.className('jcarousel-next')); 831 832 this.clip.addClass(this.className('jcarousel-clip')).css({ 833 position: 'relative' 834 }); 835 836 this.list.addClass(this.className('jcarousel-list')).css({ 837 overflow: 'hidden', 838 position: 'relative', 839 top: 0, 840 margin: 0, 841 padding: 0 842 }).css((this.options.rtl ? 'right' : 'left'), 0); 843 844 this.container.addClass(this.className('jcarousel-container')).css({ 845 position: 'relative' 846 }); 847 848 if (!this.options.vertical && this.options.rtl) { 849 this.container.addClass('jcarousel-direction-rtl').attr('dir', 'rtl'); 850 } 851 852 var di = this.options.visible !== null ? Math.ceil(this.clipping() / this.options.visible) : null; 853 var li = this.list.children('li'); 854 855 var self = this; 856 857 if (li.size() > 0) { 858 var wh = 0, j = this.options.offset; 859 li.each(function() { 860 self.format(this, j++); 861 wh += self.dimension(this, di); 862 }); 863 864 this.list.css(this.wh, (wh + 100) + 'px'); 865 866 // Only set if not explicitly passed as option 867 if (!o || o.size === undefined) { 868 this.options.size = li.size(); 869 } 870 } 871 872 // For whatever reason, .show() does not work in Safari... 873 this.container.css('display', 'block'); 874 this.buttonNext.css('display', 'block'); 875 this.buttonPrev.css('display', 'block'); 876 877 this.funcNext = function() { self.next(); return false; }; 878 this.funcPrev = function() { self.prev(); return false; }; 879 this.funcResize = function() { 880 if (self.resizeTimer) { 881 clearTimeout(self.resizeTimer); 882 } 883 884 self.resizeTimer = setTimeout(function() { 885 self.reload(); 886 }, 100); 887 }; 888 889 if (this.options.initCallback !== null) { 890 this.options.initCallback(this, 'init'); 891 } 892 893 if (!windowLoaded && $jc.isSafari()) { 894 this.buttons(false, false);
895 $(window).bind('load.jcarousel', function() { self.setup(); }); 896 } else { 897 this.setup(); 898 } 899 }; 900 901 // Create shortcut for internal use 902 var $jc = $.jcarousel; 903 904 $jc.fn = $jc.prototype = { 905 jcarousel: '0.2.9' 906 }; 907 908 $jc.fn.extend = $jc.extend = $.extend; 909 910 $jc.fn.extend({ 911 /** 912 * Setups the carousel. 913 * 914 * @method setup 915 * @return undefined 916 */ 917 setup: function() { 918 this.first = null; 919 this.last = null; 920 this.prevFirst = null; 921 this.prevLast = null; 922 this.animating = false; 923 this.timer = null; 924 this.resizeTimer = null; 925 this.tail = null; 926 this.inTail = false; 927 928 if (this.locked) { 929 return; 930 } 931 932 this.list.css(this.lt, this.pos(this.options.offset) + 'px'); 933 var p = this.pos(this.options.start, true); 934 this.prevFirst = this.prevLast = null; 935 this.animate(p, false); 936 937 $(window).unbind('resize.jcarousel', this.funcResize).bind('resize.jcarousel', this.funcResize); 938 939 if (this.options.setupCallback !== null) { 940 this.options.setupCallback(this); 941 } 942 }, 943 944 /** 945 * Clears the list and resets the carousel. 946 * 947 * @method reset 948 * @return undefined 949 */ 950 reset: function() { 951 this.list.empty(); 952 953 this.list.css(this.lt, '0px'); 954 this.list.css(this.wh, '10px'); 955 956 if (this.options.initCallback !== null) { 957 this.options.initCallback(this, 'reset'); 958 } 959 960 this.setup(); 961 }, 962 963 /** 964 * Reloads the carousel and adjusts positions. 965 * 966 * @method reload 967 * @return undefined 968 */ 969 reload: function() { 970 if (this.tail !== null && this.inTail) { 971 this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail); 972 } 973 974 this.tail = null; 975 this.inTail = false; 976 977 if (this.options.reloadCallback !== null) { 978 this.options.reloadCallback(this); 979 } 980 981 if (this.options.visible !== null) { 982 var self = this; 983 var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt = 0; 984 this.list.children('li').each(function(i) { 985 wh += self.dimension(this, di); 986 if (parseInt(jQuery(this).attr('jcarouselindex')) < self.first) { 987 lt = wh; 988 } 989 }); 990 991 this.list.css(this.wh, wh + 'px'); 992 this.list.css(this.lt, -lt + 'px'); 993 } 994 995 this.scroll(this.first, false); 996 }, 997 998 /** 999 * Locks the carousel. 1000 * 1001 * @method lock 1002 * @return undefined 1003 */ 1004 lock: function() { 1005 this.locked = true; 1006 this.buttons(); 1007 }, 1008 1009 /** 1010 * Unlocks the carousel. 1011 * 1012 * @method unlock 1013 * @return undefined 1014 */ 1015 unlock: function() { 1016 this.locked = false; 1017 this.buttons(); 1018 }, 1019 1020 /** 1021 * Sets the size of the carousel. 1022 * 1023 * @method size 1024 * @return undefined 1025 * @param s {Number} The size of the carousel. 1026 */ 1027 size: function(s) { 1028 if (s !== undefined) { 1029 this.options.size = s; 1030 if (!this.locked) { 1031 this.buttons(); 1032 } 1033 } 1034 1035 return this.options.size; 1036 }, 1037 1038 /** 1039 * Checks whether a list element exists for the given index (or index range). 1040 * 1041 * @method get 1042 * @return bool 1043 * @param i {Number} The index of the (first) element. 1044 * @param i2 {Number} The index of the last element. 1045 */ 1046 has: function(i, i2) { 1047 if (i2 === undefined || !i2) { 1048 i2 = i; 1049 } 1050 1051 if (this.options.size !== null && i2 > this.options.size) { 1052 i2 = this.options.size; 1053 } 1054 1055 for (var j = i;
1055 j <= i2; j++) { 1056 var e = this.get(j); 1057 if (!e.length || e.hasClass('jcarousel-item-placeholder')) { 1058 return false; 1059 } 1060 } 1061 1062 return true; 1063 }, 1064 1065 /** 1066 * Returns a jQuery object with list element for the given index. 1067 * 1068 * @method get 1069 * @return jQuery 1070 * @param i {Number} The index of the element. 1071 */ 1072 get: function(i) { 1073 return $('>.jcarousel-item-' + i, this.list); 1074 }, 1075 1076 /** 1077 * Adds an element for the given index to the list. 1078 * If the element already exists, it updates the inner html. 1079 * Returns the created element as jQuery object. 1080 * 1081 * @method add 1082 * @return jQuery 1083 * @param i {Number} The index of the element. 1084 * @param s {String} The innerHTML of the element. 1085 */ 1086 add: function(i, s) { 1087 var e = this.get(i), old = 0, n = $(s); 1088 1089 if (e.length === 0) { 1090 var c, j = $jc.intval(i); 1091 e = this.create(i); 1092 while (true) { 1093 c = this.get(--j); 1094 if (j <= 0 || c.length) { 1095 if (j <= 0) { 1096 this.list.prepend(e); 1097 } else { 1098 c.after(e); 1099 } 1100 break; 1101 } 1102 } 1103 } else { 1104 old = this.dimension(e); 1105 } 1106 1107 if (n.get(0).nodeName.toUpperCase() == 'LI') { 1108 e.replaceWith(n); 1109 e = n; 1110 } else { 1111 e.empty().append(s); 1112 } 1113 1114 this.format(e.removeClass(this.className('jcarousel-item-placeholder')), i); 1115 1116 var di = this.options.visible !== null ? Math.ceil(this.clipping() / this.options.visible) : null; 1117 var wh = this.dimension(e, di) - old; 1118 1119 if (i > 0 && i < this.first) { 1120 this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - wh + 'px'); 1121 } 1122 1123 this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh + 'px'); 1124 1125 return e; 1126 }, 1127 1128 /** 1129 * Removes an element for the given index from the list. 1130 * 1131 * @method remove 1132 * @return undefined 1133 * @param i {Number} The index of the element. 1134 */ 1135 remove: function(i) { 1136 var e = this.get(i); 1137 1138 1139 // Check if item exists and is not currently visible 1140 if (!e.length || (i >= this.first && i <= this.last)) { 1141 return; 1142 } 1143 1144 var d = this.dimension(e); 1145 1146 if (i < this.first) { 1147 this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px'); 1148 } 1149 1150 e.remove(); 1151 1152 this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d + 'px'); 1153 }, 1154 1155 /** 1156 * Moves the carousel forwards. 1157 * 1158 * @method next 1159 * @return undefined 1160 */ 1161 next: function() { 1162 if (this.tail !== null && !this.inTail) { 1163 this.scrollTail(false); 1164 } else { 1165 this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size !== null && this.last == this.options.size) ? 1 : this.first + this.options.scroll); 1166 } 1167 }, 1168 1169 /** 1170 * Moves the carousel backwards. 1171 * 1172 * @method prev 1173 * @return undefined 1174 */ 1175 prev: function() { 1176 if (this.tail !== null && this.inTail) { 1177 this.scrollTail(true); 1178 } else { 1179 this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size !== null && this.first == 1) ? this.options.size : this.first - this.options.scroll); 1180 } 1181 }, 1182 1183 /** 1184 * Scrolls the tail of the carousel. 1185 * 1186 * @method scrollTail 1187 * @return undefined 1188 * @param b {Boolean} Whether scroll the tail back or forward. 1189 */ 1190 scrollTail: function(b) { 1191 if (this.locked || this.animating || !this.tail) { 1192 return; 1193 } 1194 1195 this.pauseAuto(); 1196 1197 var pos = $jc.intval(this.list.css(this.lt)); 1198 1199 pos = !b ? pos - this.tail : pos + this.tail; 1200 this.inTail = !b; 1201 1202 // Save for callbacks 1203 this.prevFirst = this.first; 1204 this.prevLast = this.last; 1205 1206 this.animate(pos); 1207 }, 1208 1209 /** 1210 * Scrolls the carousel to a certain position. 1211 * 1212 * @method scroll 1213 * @return undefined 1214 * @param i {Number} The index of the element to scoll to. 1215 * @param a {Boolean} Flag indicating whether to perform animation. 1216 */ 1217 scroll: function(i, a) { 1218 if (this.locked || this.animating) { 1219 return; 1220 } 1221 1222 this.pauseAuto(); 1223 this.animate(this.pos(i), a); 1224 }, 1225 1226 /** 1227 * Prepares the carousel and return the position for a certian index. 1228 * 1229 * @method pos 1230 * @return {Number} 1231 * @param i {Number} The index of the element to scoll to. 1232 * @param fv {Boolean} Whether to force last item to be visible. 1233 */ 1234 pos: function(i, fv) { 1235 var pos = $jc.intval(this.list.css(this.lt)); 1236 1237 if (this.locked || this.animating) { 1238 return pos; 1239 } 1240 1241 if (this.options.wrap != 'circular') { 1242 i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i); 1243 } 1244 1245 var back = this.first > i; 1246 1247 // Create placeholders, new list width/height 1248 // and new list position 1249 var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first; 1250 var c = back ? this.get(f) : this.get(this.last); 1251 var j = back ? f : f - 1; 1252 var e = null, l = 0, p = false, d = 0, g; 1253 1254 while (back ? --j >= i : ++j < i) { 1255 e = this.get(j); 1256 p = !e.length; 1257 if (e.length === 0) { 1258 e = this.create(j).addClass(this.className('jcarousel-item-placeholder')); 1259 c[back ? 'before' : 'after' ](e); 1260 1261 if (this.first !== null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) { 1262 g = this.get(this.index(j)); 1263 if (g.length) { 1264 e = this.add(j, g.clone(true)); 1265 } 1266 } 1267 } 1268 1269 c = e; 1270 d = this.dimension(e); 1271 1272 if (p) { 1273 l += d; 1274 } 1275 1276 if (this.first !== null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size === null || j <= this.options.size)))) { 1277 pos = back ? pos + d : pos - d; 1278 } 1279 } 1280 1281 // Calculate visible items 1282 var clipping = this.clipping(), cache = [], visible = 0, v = 0; 1283 c = this.get(i - 1); 1284 j = i; 1285 1286 while (++visible) { 1287 e = this.get(j); 1288 p = !e.length; 1289 if (e.length === 0) { 1290 e = this.create(j).addClass(this.className('jcarousel-item-placeholder')); 1291 // This should only happen on a next scroll 1292 if (c.length === 0) { 1293 this.list.prepend(e); 1294 } else { 1295 c[back ? 'before' : 'after' ](e); 1296 } 1297 1298 if (this.first !== null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) { 1299 g = this.get(this.index(j)); 1300 if (g.length) { 1301 e = this.add(j, g.clone(true)); 1302 } 1303 } 1304 } 1305 1306 c = e; 1307 d = this.dimension(e); 1308 if (d === 0) { 1309 throw new Error('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...'); 1310 } 1311 1312 if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size) { 1313 cache.push(e); 1314 } else if (p) { 1315 l += d; 1316 } 1317 1318 v += d; 1319 1320 if (v >= clipping) { 1321 break; 1322 } 1323 1324 j++; 1325 } 1326 1327 // Remove out-of-range placeholders 1328 for (var x = 0; x < cache.length; x++) { 1329 cache[x].remove(); 1330 } 1331 1332 // Resize list 1333 if (l > 0) { 1334 this.list.css(this.wh, this.dimension(this.list) + l + 'px'); 1335 1336 if (back) { 1337 pos -= l; 1338 this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px'); 1339 } 1340 } 1341 1342 // Calculate first and last item 1343 var last = i + visible - 1; 1344 if (this.options.wrap != 'circular' && this.options.size && last > this.options.size) { 1345 last = this.options.size; 1346 } 1347 1348 if (j > last) { 1349 visible = 0; 1350 j = last; 1351 v = 0; 1352 while (++visible) { 1353 e = this.get(j--); 1354 if (!e.length) { 1355 break; 1356 } 1357 v += this.dimension(e); 1358 if (v >= clipping) { 1359 break; 1360 } 1361 } 1362 } 1363 1364 var first = last - visible + 1; 1365 if (this.options.wrap != 'circular' && first < 1) { 1366 first = 1; 1367 } 1368 1369 if (this.inTail && back) { 1370 pos += this.tail; 1371 this.inTail = false;
1372 } 1373 1374 this.tail = null; 1375 if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) { 1376 var m = $jc.intval(this.get(last).css(!this.options.vertical ? 'marginRight' : 'marginBottom')); 1377 if ((v - m) > clipping) { 1378 this.tail = v - clipping - m; 1379 } 1380 } 1381 1382 if (fv && i === this.options.size && this.tail) { 1383 pos -= this.tail; 1384 this.inTail = true; 1385 } 1386 1387 // Adjust position 1388 while (i-- > first) { 1389 pos += this.dimension(this.get(i)); 1390 } 1391 1392 // Save visible item range 1393 this.prevFirst = this.first; 1394 this.prevLast = this.last; 1395 this.first = first; 1396 this.last = last; 1397 1398 return pos; 1399 }, 1400 1401 /** 1402 * Animates the carousel to a certain position. 1403 * 1404 * @method animate 1405 * @return undefined 1406 * @param p {Number} Position to scroll to. 1407 * @param a {Boolean} Flag indicating whether to perform animation. 1408 */ 1409 animate: function(p, a) { 1410 if (this.locked || this.animating) { 1411 return; 1412 } 1413 1414 this.animating = true; 1415 1416 var self = this; 1417 var scrolled = function() { 1418 self.animating = false; 1419 1420 if (p === 0) { 1421 self.list.css(self.lt, 0); 1422 } 1423 1424 if (!self.autoStopped && (self.options.wrap == 'circular' || self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size === null || self.last < self.options.size || (self.last == self.options.size && self.tail !== null && !self.inTail))) { 1425 self.startAuto(); 1426 } 1427 1428 self.buttons(); 1429 self.notify('onAfterAnimation'); 1430 1431 // This function removes items which are appended automatically for circulation. 1432 // This prevents the list from growing infinitely. 1433 if (self.options.wrap == 'circular' && self.options.size !== null) { 1434 for (var i = self.prevFirst+1; i <= self.prevLast; i++) { 1435 if (i !== null && !(i >= self.first && i <= self.last) && (i < 1 || i > self.options.size)) { 1436 self.remove(i); 1437 } 1438 } 1439 } 1440 }; 1441 1442 this.notify('onBeforeAnimation'); 1443 1444 // Animate 1445 if (!this.options.animation || a === false) { 1446 this.list.css(this.lt, p + 'px'); 1447 scrolled(); 1448 } else { 1449 var o = !this.options.vertical ? (this.options.rtl ? {'right': p} : {'left': p}) : {'top': p}; 1450 // Define animation settings. 1451 var settings = { 1452 duration: this.options.animation, 1453 easing: this.options.easing, 1454 complete: scrolled 1455 }; 1456 // If we have a step callback, specify it as well. 1457 if ($.isFunction(this.options.animationStepCallback)) { 1458 settings.step = this.options.animationStepCallback; 1459 } 1460 // Start the animation. 1461 this.list.animate(o, settings); 1462 } 1463 }, 1464 1465 /** 1466 * Starts autoscrolling. 1467 * 1468 * @method auto 1469 * @return undefined 1470 * @param s {Number} Seconds to periodically autoscroll the content. 1471 */ 1472 startAuto: function(s) { 1473 if (s !== undefined) { 1474 this.options.auto = s; 1475 } 1476 1477 if (this.options.auto === 0) { 1478 return this.stopAuto(); 1479 } 1480 1481 if (this.timer !== null) { 1482 return; 1483 } 1484 1485 this.autoStopped = false; 1486 1487 var self = this; 1488 this.timer = window.setTimeout(function() { self.next(); }, this.options.auto * 1000); 1489 }, 1490 1491 /** 1492 * Stops autoscrolling. 1493 * 1494 * @method stopAuto 1495 * @return undefined 1496 */ 1497 stopAuto: function() { 1498 this.pauseAuto(); 1499 this.autoStopped = true; 1500 }, 1501 1502 /** 1503 * Pauses autoscrolling. 1504 * 1505 * @method pauseAuto 1506 * @return undefined 1507 */ 1508 pauseAuto: function() { 1509 if (this.timer === null) { 1510 return; 1511 } 1512 1513 window.clearTimeout(this.timer); 1514 this.timer = null; 1515 }, 1516 1517 /** 1518 * Sets the states of the prev/next buttons. 1519 * 1520 * @method buttons 1521 * @return undefined 1522 */ 1523 buttons: function(n, p) { 1524 if (n == null) { 1525 n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size === null || this.last < this.options.size); 1526 if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size !== null && this.last >= this.options.size) { 1527 n = this.tail !== null && !this.inTail; 1528 } 1529 } 1530 1531 if (p == null) { 1532 p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1); 1533 if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size !== null && this.first == 1) { 1534 p = this.tail !== null && this.inTail; 1535 } 1536 } 1537 1538 var self = this; 1539 1540 if (this.buttonNext.size() > 0) { 1541 this.buttonNext.unbind(this.options.buttonNextEvent + '.jcarousel', this.funcNext); 1542 1543 if (n) { 1544 this.buttonNext.bind(this.options.buttonNextEvent + '.jcarousel', this.funcNext); 1545 } 1546 1547 this.buttonNext[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true); 1548 1549 if (this.options.buttonNextCallback !== null && this.buttonNext.data('jcarou
1549selstate') != n) { 1550 this.buttonNext.each(function() { self.options.buttonNextCallback(self, this, n); }).data('jcarouselstate', n); 1551 } 1552 } else { 1553 if (this.options.buttonNextCallback !== null && this.buttonNextState != n) { 1554 this.options.buttonNextCallback(self, null, n); 1555 } 1556 } 1557 1558 if (this.buttonPrev.size() > 0) { 1559 this.buttonPrev.unbind(this.options.buttonPrevEvent + '.jcarousel', this.funcPrev); 1560 1561 if (p) { 1562 this.buttonPrev.bind(this.options.buttonPrevEvent + '.jcarousel', this.funcPrev); 1563 } 1564 1565 this.buttonPrev[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true); 1566 1567 if (this.options.buttonPrevCallback !== null && this.buttonPrev.data('jcarouselstate') != p) { 1568 this.buttonPrev.each(function() { self.options.buttonPrevCallback(self, this, p); }).data('jcarouselstate', p); 1569 } 1570 } else { 1571 if (this.options.buttonPrevCallback !== null && this.buttonPrevState != p) { 1572 this.options.buttonPrevCallback(self, null, p); 1573 } 1574 } 1575 1576 this.buttonNextState = n; 1577 this.buttonPrevState = p; 1578 }, 1579 1580 /** 1581 * Notify callback of a specified event. 1582 * 1583 * @method notify 1584 * @return undefined 1585 * @param evt {String} The event name 1586 */ 1587 notify: function(evt) { 1588 var state = this.prevFirst === null ? 'init' : (this.prevFirst < this.first ? 'next' : 'prev'); 1589 1590 // Load items 1591 this.callback('itemLoadCallback', evt, state); 1592 1593 if (this.prevFirst !== this.first) { 1594 this.callback('itemFirstInCallback', evt, state, this.first); 1595 this.callback('itemFirstOutCallback', evt, state, this.prevFirst); 1596 } 1597 1598 if (this.prevLast !== this.last) { 1599 this.callback('itemLastInCallback', evt, state, this.last); 1600 this.callback('itemLastOutCallback', evt, state, this.prevLast); 1601 } 1602 1603 this.callback('itemVisibleInCallback', evt, state, this.first, this.last, this.prevFirst, this.prevLast); 1604 this.callback('itemVisibleOutCallback', evt, state, this.prevFirst, this.prevLast, this.first, this.last); 1605 }, 1606 1607 callback: function(cb, evt, state, i1, i2, i3, i4) { 1608 if (this.options[cb] == null || (typeof this.options[cb] != 'object' && evt != 'onAfterAnimation')) { 1609 return; 1610 } 1611 1612 var callback = typeof this.options[cb] == 'object' ? this.options[cb][evt] : this.options[cb]; 1613 1614 if (!$.isFunction(callback)) { 1615 return; 1616 } 1617 1618 var self = this; 1619 1620 if (i1 === undefined) { 1621 callback(self, state, evt); 1622 } else if (i2 === undefined) { 1623 this.get(i1).each(function() { callback(self, this, i1, state, evt); }); 1624 } else { 1625 var call = function(i) { 1626 self.get(i).each(function() { callback(self, this, i, state, evt); }); 1627 }; 1628 for (var i = i1; i <= i2; i++) { 1629 if (i !== null && !(i >= i3 && i <= i4)) { 1630 call(i); 1631 } 1632 } 1633 } 1634 }, 1635 1636 create: function(i) { 1637 return this.format('<li></li>', i); 1638 }, 1639 1640 format: function(e, i) { 1641 e = $(e); 1642 var split = e.get(0).className.split(' '); 1643 for (var j = 0; j < split.length; j++) { 1644 if (split[j].indexOf('jcarousel-') != -1) { 1645 e.removeClass(split[j]); 1646 } 1647 } 1648 e.addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-' + i)).css({ 1649 'float': (this.options.rtl ? 'right' : 'left'), 1650 'list-style': 'none' 1651 }).attr('jcarouselindex', i); 1652 return e; 1653 }, 1654 1655 className: function(c) { 1656 return c + ' ' + c + (!this.options.vertical ? '-horizontal' : '-vertical'); 1657 }, 1658 1659 dimension: function(e, d) { 1660 var el = $(e); 1661 1662 if (d == null) { 1663 return !this.options.vertical ? 1664 ((el.innerWidth() + 1665 $jc.intval(el.css('margin-left')) + 1666 $jc.intval(el.css('margin-right')) + 1667 $jc.intval(el.css('border-left-width')) + 1668 $jc.intval(el.css('border-right-width'))) || $jc.intval(this.options.itemFallbackDimension)) :
1669 ((el.innerHeight() + 1670 $jc.intval(el.css('margin-top')) + 1671 $jc.intval(el.css('margin-bottom')) + 1672 $jc.intval(el.css('border-top-width')) + 1673 $jc.intval(el.css('border-bottom-width'))) || $jc.intval(this.options.itemFallbackDimension)); 1674 } else { 1675 var w = !this.options.vertical ? 1676 d - $jc.intval(el.css('marginLeft')) - $jc.intval(el.css('marginRight')) : 1677 d - $jc.intval(el.css('marginTop')) - $jc.intval(el.css('marginBottom')); 1678 1679 $(el).css(this.wh, w + 'px'); 1680 1681 return this.dimension(el); 1682 } 1683 }, 1684 1685 clipping: function() { 1686 return !this.options.vertical ? 1687 this.clip[0].offsetWidth - $jc.intval(this.clip.css('borderLeftWidth')) - $jc.intval(this.clip.css('borderRightWidth')) : 1688 this.clip[0].offsetHeight - $jc.intval(this.clip.css('borderTopWidth')) - $jc.intval(this.clip.css('borderBottomWidth')); 1689 }, 1690 1691 index: function(i, s) { 1692 if (s == null) { 1693 s = this.options.size; 1694 } 1695 1696 return Math.round((((i-1) / s) - Math.floor((i-1) / s)) * s) + 1; 1697 } 1698 }); 1699 1700 $jc.extend({ 1701 /** 1702 * Gets/Sets the global default configuration properties. 1703 * 1704 * @method defaults 1705 * @return {Object} 1706 * @param d {Object} A set of key/value pairs to set as configuration properties. 1707 */ 1708 defaults: function(d) { 1709 return $.extend(defaults, d || {}); 1710 }, 1711 1712 intval: function(v) { 1713 v = parseInt(v, 10); 1714 return isNaN(v) ? 0 : v; 1715 }, 1716 1717 windowLoaded: function() { 1718 windowLoaded = true; 1719 }, 1720 1721 isSafari: function() { 1722 var ua = navigator.userAgent.toLowerCase(), 1723 match = /(chrome)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || [], 1724 browser = match[1] || ""; 1725 1726 return browser === 'webkit'; 1727 } 1728 }); 1729 1730 /** 1731 * Creates a carousel for all matched elements. 1732 * 1733 * @example $("#mycarousel").jcarousel(); 1734 * @before <ul id="mycarousel" class="jcarousel-skin-name"><li>First item</li><li>Second item</li></ul> 1735 * @result 1736 * 1737 * <div class="jcarousel-skin-name"> 1738 * <div class="jcarousel-container"> 1739 * <div class="jcarousel-clip"> 1740 * <ul class="jcarousel-list"> 1741 * <li class="jcarousel-item-1">First item</li> 1742 * <li class="jcarousel-item-2">Second item</li> 1743 * </ul> 1744 * </div> 1745 * <div disabled="disabled" class="jcarousel-prev jcarousel-prev-disabled"></div> 1746 * <div class="jcarousel-next"></div> 1747 * </div> 1748 * </div> 1749 * 1750 * @method jcarousel 1751 * @return jQuery 1752 * @param o {Hash|String} A set of key/value pairs to set as configuration properties or a method name to call on a formerly created instance. 1753 */ 1754 $.fn.jcarousel = function(o) { 1755 if (typeof o == 'string') { 1756 var instance = $(this).data('jcarousel'), args = Array.prototype.slice.call(arguments, 1); 1757 return instance[o].apply(instance, args); 1758 } else { 1759 return this.each(function() { 1760 var instance = $(this).data('jcarousel'); 1761 if (instance) { 1762 if (o) { 1763 $.extend(instance.options, o); 1764 } 1765 instance.reload(); 1766 } else { 1767 $(this).data('jcarousel', new $jc(this, o)); 1768 } 1769 }); 1770 } 1771 }; 1772 1773})(jQuery); 1774; 1775/** 1776 * @file 1777 * Add jCarousel behaviors to the page and provide Views-support. 1778 */ 1779 1780(function($) { 1781 1782Drupal.behaviors.jcarousel = {}; 1783Drupal.behaviors.jcarousel.attach = function(context, settings) { 1784 settings = settings || Drupal.settings; 1785 1786 // If no carousels exist on this part of the page, work no further.
1787 if (!settings.jcarousel || !settings.jcarousel.carousels) { 1788 return; 1789 } 1790 1791 $("ul.jcarousel li").css("display", ""); 1792 1793 $.each(settings.jcarousel.carousels, function(key, options) { 1794 var $carousel = $(options.selector + ':not(.jcarousel-processed)', context); 1795 1796 // If this carousel has already been processed or doesn't exist, move on. 1797 if (!$carousel.length) { 1798 return; 1799 } 1800 1801 1802 1803 1804 1805 // Callbacks need to be converted from a string to an actual function. 1806 $.each(options, function(optionKey) { 1807 if (optionKey.match(/Callback$/) && typeof options[optionKey] == 'string') { 1808 var callbackFunction = window; 1809 var callbackParents = options[optionKey].split('.'); 1810 $.each(callbackParents, function(objectParent) { 1811 callbackFunction = callbackFunction[callbackParents[objectParent]]; 1812 }); 1813 options[optionKey] = callbackFunction; 1814 } 1815 }); 1816 1817 // Add standard options required for AJAX functionality. 1818 if (options.ajax && !options.itemLoadCallback) { 1819 options.itemLoadCallback = Drupal.jcarousel.ajaxLoadCallback; 1820 } 1821 1822 // If auto-scrolling, pause animation when hoving over the carousel. 1823 if (options.auto && options.autoPause && !options.initCallback) { 1824 options.initCallback = function(carousel, state) { 1825 Drupal.jcarousel.autoPauseCallback(carousel, state); 1826 }; 1827 } 1828 1829 // Add responsive behavior. 1830 if (options.responsive && !options.reloadCallback) { 1831 options.vertical = false;
1832 options.visible = null; 1833 options.reloadCallback = Drupal.jcarousel.reloadCallback; 1834 } 1835 1836 // Add navigation to the carousel if enabled. 1837 if (!options.setupCallback) { 1838 options.setupCallback = function(carousel) { 1839 Drupal.jcarousel.setupCarousel(carousel); 1840 if (options.navigation) { 1841 Drupal.jcarousel.addNavigation(carousel, options.navigation); 1842 } 1843 if (options.responsive) { 1844 carousel.reload(); 1845 } 1846 }; 1847 if (options.navigation && !options.itemVisibleInCallback) { 1848 options.itemLastInCallback = { 1849 onAfterAnimation: Drupal.jcarousel.updateNavigationActive 1850 }; 1851 } 1852 } 1853 1854 if (!options.hasOwnProperty('buttonNextHTML') && !options.hasOwnProperty('buttonPrevHTML')) { 1855 options.buttonNextHTML = Drupal.theme('jCarouselButton', 'next'); 1856 options.buttonPrevHTML = Drupal.theme('jCarouselButton', 'previous'); 1857 } 1858 1859 // Initialize the jcarousel. 1860 $carousel.addClass('jcarousel-processed').jcarousel(options); 1861 }); 1862}; 1863 1864Drupal.jcarousel = {}; 1865Drupal.jcarousel.reloadCallback = function(carousel) { 1866 // Set the clip and container to auto width so that they will fill 1867 // the available space. 1868 carousel.container.css('width', 'auto'); 1869 carousel.clip.css('width', 'auto'); 1870 var clipWidth = carousel.clip.width(); 1871 var containerExtra = carousel.container.width() - carousel.clip.outerWidth(true); 1872 // Determine the width of an item. 1873 var itemWidth = carousel.list.find('li').first().outerWidth(true); 1874 var numItems = Math.floor(carousel.clip.width() / itemWidth) || 1; 1875 // Set the new scroll number. 1876 carousel.options.scroll = numItems; 1877 var newClipWidth = numItems * itemWidth; 1878 var newContainerWidth = newClipWidth + containerExtra; 1879 // Resize the clip and container. 1880 carousel.clip.width(newClipWidth); 1881 carousel.container.width(newContainerWidth); 1882}; 1883Drupal.jcarousel.ajaxLoadCallback = function(jcarousel, state) { 1884 // Check if the requested items already exist. 1885 if (state == 'init' || jcarousel.has(jcarousel.first, jcarousel.last)) { 1886 return; 1887 } 1888 1889 var $list = jcarousel.list; 1890 var $view = $list.parents('.view:first'); 1891 var ajaxPath = Drupal.settings.jcarousel.ajaxPath; 1892 var target = $view.get(0); 1893 1894 // Find this view's settings in the Views AJAX settings. 1895 var settings; 1896 $.each(Drupal.settings.jcarousel.carousels, function(domID, carouselSettings) { 1897 if ($list.is('.' + domID)) { 1898 settings = carouselSettings['view_options']; 1899 } 1900 }); 1901 1902 // Copied from ajax_view.js: 1903 var viewData = { 'js': 1, 'first': jcarousel.first - 1, 'last': jcarousel.last }; 1904 // Construct an object using the settings defaults and then overriding 1905 // with data specific to the link. 1906 $.extend( 1907 viewData, 1908 settings 1909 ); 1910 1911 $.ajax({ 1912 url: ajaxPath, 1913 type: 'GET', 1914 data: viewData, 1915 success: function(response) { 1916 Drupal.jcarousel.ajaxResponseCallback(jcarousel, target, response); 1917 }, 1918 error: function(xhr) { 1919 Drupal.jcarousel.ajaxErrorCallback(xhr, ajaxPath); 1920 }, 1921 dataType: 'json' 1922 }); 1923 1924}; 1925 1926/** 1927 * Init callback for jCarousel. Pauses the carousel when hovering over. 1928 */ 1929Drupal.jcarousel.autoPauseCallback = function(carousel, state) { 1930 function pauseAuto() { 1931 carousel.stopAuto(); 1932 } 1933 function resumeAuto() { 1934 carousel.startAuto(); 1935 } 1936 1937 carousel.clip.hover(pauseAuto, resumeAuto); 1938 carousel.buttonNext.hover(pauseAuto, resumeAuto); 1939 carousel.buttonPrev.hover(pauseAuto, resumeAuto); 1940}; 1941 1942/** 1943 * Setup callback for jCarousel. Calculates number of pages. 1944 */ 1945Drupal.jcarousel.setupCarousel = function(carousel) { 1946 // Determine the number of pages this carousel includes. 1947 // This only works for a positive starting point. Also, .first is 1-based 1948 // while .last is a count, so we need to reset the .first number to be 1949 // 0-based to make the math work. 1950 carousel.pageSize = carousel.last - (carousel.first - 1); 1951 1952 // jCarousel's Views integration sets "size" in the carousel options. Use that 1953 // if available, otherwise count the number of items in the carousel. 1954 var itemCount = carousel.options.size ? carousel.options.size : $(carou
1954sel.list).children('li').length; 1955 carousel.pageCount = Math.ceil(itemCount / carousel.pageSize); 1956 carousel.pageNumber = 1; 1957 1958 // Disable the previous/next arrows if there is only one page. 1959 if (carousel.options.wrap != 'circular' && carousel.pageCount == 1) { 1960 carousel.buttons(false, false); 1961 } 1962 1963 // Always remove the hard-coded display: block from the navigation. 1964 carousel.buttonNext.css('display', ''); 1965 carousel.buttonPrev.css('display', ''); 1966} 1967 1968/** 1969 * Setup callback for jCarousel. Adds the navigation to the carousel if enabled. 1970 */ 1971Drupal.jcarousel.addNavigation = function(carousel, position) { 1972 // Don't add a pager if there's only one page of results. 1973 if (carousel.pageCount = 1) { 1974 return; 1975 } 1976 1977 // Add a class to the wrapper so it can adjust CSS. 1978 $(carousel.list).parents('.jcarousel-container:first').addClass('jcarousel-navigation-' + position); 1979 1980 var navigation = $('<ul class="jcarousel-navigation"></ul>'); 1981 1982 for (var i = 1; i <= carousel.pageCount; i++) { 1983 var pagerItem = $(Drupal.theme('jCarouselPageLink', i)); 1984 var listItem = $('<li></li>').attr('jcarousel-page', i).append(pagerItem); 1985 navigation.append(listItem); 1986 1987 // Make the first page active by default. 1988 if (i === 1) { 1989 listItem.addClass('active'); 1990 } 1991 1992 // Scroll to the correct page when a pager is clicked. 1993 pagerItem.bind('click', function() { 1994 // We scroll to the new page based on item offsets. This works with 1995 // circular carousels that do not divide items evenly, making it so that 1996 // going back or forward in pages will not skip or repeat any items. 1997 var newPageNumber = $(this).parent().attr('jcarousel-page'); 1998 var itemOffset = (newPageNumber - carousel.pageNumber) * carousel.pageSize; 1999 2000 if (itemOffset) { 2001 carousel.scroll(carousel.first + itemOffset); 2002 } 2003 2004 return false; 2005 }); 2006 } 2007 2008 $(carousel.list).parents('.jcarousel-clip:first')[position](navigation); 2009} 2010 2011/** 2012 * itemVisibleInCallback for jCarousel. Update the navigation after page change. 2013 */ 2014Drupal.jcarousel.updateNavigationActive = function(carousel, item, idx, state) { 2015 // The navigation doesn't even exist yet when this is called on init. 2016 var $listItems = $(carousel.list).parents('.jcarousel-container:first').find('.jcarousel-navigation li'); 2017 if ($listItems.length == 0) { 2018 return; 2019 } 2020 2021 // jCarousel does some very odd things with circular wraps. Items before the 2022 // first item are given negative numbers and items after the last are given 2023 // numbers beyond the total number of items. This complicated logic calculates 2024 // which page number is active based off this numbering scheme. 2025 var pageNumber = Math.ceil(idx / carousel.pageSize); 2026 if (pageNumber <= 0 || pageNumber > carousel.pageCount) { 2027 pageNumber = pageNumber % carousel.pageCount; 2028 pageNumber = pageNumber == 0 ? carousel.pageCount : pageNumber; 2029 pageNumber = pageNumber < 0 ? pageNumber + carousel.pageCount : pageNumber; 2030 } 2031 carousel.pageNumber = pageNumber; 2032 var currentPage = $listItems.get(carousel.pageNumber - 1); 2033 2034 // Set the current page to be active. 2035 $listItems.not(currentPage).removeClass('active'); 2036 $(currentPage).addClass('active'); 2037} 2038 2039/** 2040 * AJAX callback for all jCarousel-style views. 2041 */ 2042Drupal.jcarousel.ajaxResponseCallback = function(jcarousel, target, response) { 2043 if (response.debug) { 2044 alert(response.debug); 2045 } 2046 2047 var $view = $(target); 2048 var jcarousel = $view.find('ul.jcarousel').data('jcarousel'); 2049 2050 // Add items to the jCarousel. 2051 $('ul.jcarousel > li', response.display).each(function(i) { 2052 var itemNumber = this.className.replace(/.*?jcarousel-item-(\d+).*/, '$1'); 2053 jcarousel.add(itemNumber, this.innerHTML); 2054 }); 2055 2056 // Add Drupal behaviors to the content of the carousel to affect new items. 2057 Drupal.attachBehaviors(jcarousel.list.get(0)); 2058 2059 // Treat messages the same way that Views typically handles messages. 2060 if (response.messages) { 2061 // Show any messages (but first remove old ones, if there are any). 2062 $view.find('.views-messages').remove().end().prepend(response.messages); 2063 } 2064}; 2065 2066/** 2067 * Display error messages using the same mechanism as Views module. 2068 */ 2069Drupal.jcarousel.ajaxErrorCallback = function (xhr, path) { 2070 var error_text = ''; 2071 2072 if ((xhr.status == 500 && xhr.responseText) || xhr.status == 200) { 2073 error_text = xhr.responseText; 2074 2075 // Replace all < and > by < and > 2076 error_text = error_text.replace("/&(lt|gt);/g", function (m, p) { 2077 return (p == "lt")? "<" : ">"; 2078 }); 2079 2080 // Now, replace all html tags by empty spaces 2081 error_text = error_text.replace(/<("[^"]*"|'[^']*'|[^'">])*>/gi,""); 2082 2083 // Fix end lines 2084 error_text = error_text.replace(/[\n]+\s+/g,"\n"); 2085 } 2086 else if (xhr.status == 500) { 2087 error_text = xhr.status + ': ' + Drupal.t("Internal server error. Please see server or PHP logs for error information."); 2088 } 2089 else { 2090 error_text = xhr.status + ': ' + xhr.statusText; 2091 } 2092 2093 alert(Drupal.t("An error occurred at @path.\n\nError Description: @error", {'@path': path, '@error': error_text})); 2094}; 2095
2096Drupal.theme.prototype.jCarouselButton = function(type) { 2097 // Use links for buttons for accessibility. 2098 return '<div class="half"><a href="javascript:void(0)"></a></div>'; 2099}; 2100 2101Drupal.theme.prototype.jCarouselPageLink = function(pageNumber) { 2102 return '<a href="javascript:void(0)"><span>' + (pageNumber) + '</span></a>'; 2103}; 2104 2105})(jQuery); 2106; 2107/** 2108 * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!) 2109 * Common usage: wipe images (left and right to show the previous or next image) 2110 * 2111 * @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de) 2112 * @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems) 2113 * @version 1.1 (1st September 2010) - support wipe up and wipe down 2114 * @version 1.0 (15th July 2010) 2115 */ 2116(function($){$.fn.touchwipe=function(settings){var config={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};if(settings)$.extend(config,settings);this.each(function(){var startX;var startY;var isMoving=false;function cancelTouch(){this.removeEventListener('touchmove',onTouchMove);startX=null;isMoving=false}function onTouchMove(e){if(config.preventDefaultEvents){e.preventDefault()}if(isMoving){var x=e.touches[0].pageX;var y=e.touches[0].pageY;var dx=startX-x;var dy=startY-y;if(Math.abs(dx)>=config.min_move_x){cancelTouch();if(dx>0){config.wipeLeft()}else{config.wipeRight()}}else if(Math.abs(dy)>=config.min_move_y){cancelTouch();if(dy>0){config.wipeDown()}else{config.wipeUp()}}}}function onTouchStart(e){if(e.touches.length==1){startX=e.touches[0].pageX;startY=e.touches[0].pageY;isMoving=true;this.addEventListener('touchmove',onTouchMove,false)}}if('ontouchstart'in document.documentElement){this.addEventListener('touchstart',onTouchStart,false)}});return this}})(jQuery);; 2117Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 2118 2119(function ($) { 2120 Drupal.TBMegaMenu.oldWindowWidth = 0; 2121 Drupal.TBMegaMenu.displayedMenuMobile = false; 2122 Drupal.TBMegaMenu.supportedScreens = [980]; 2123 Drupal.TBMegaMenu.menuResponsive = function () { 2124 var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); 2125 var navCollapse = $('.tb-megamenu').children('.nav-collapse'); 2126 if (windowWidth < Drupal.TBMegaMenu.supportedScreens[0]) { 2127 navCollapse.addClass('collapse'); 2128 if (Drupal.TBMegaMenu.displayedMenuMobile) { 2129 navCollapse.css({height: 'auto', overflow: 'visible'}); 2130 } else { 2131 navCollapse.css({height: 0, overflow: 'hidden'}); 2132 } 2133 } else { 2134 // If width of window is greater than 980 (supported screen). 2135 navCollapse.removeClass('collapse'); 2136 if (navCollapse.height() <= 0) { 2137 navCollapse.css({height: 'auto', overflow: 'visible'}); 2138 } 2139 } 2140 }; 2141 2142 Drupal.TBMegaMenu.focusNextPrevElement = function (direction) { 2143 // Add all the elements we want to include in our selection 2144 var focusableElements = 'a:not([disabled]), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), details:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])'; 2145 var $current = $(document.activeElement); 2146 2147 if ($current.length) { 2148 var $focusable = $(focusableElements).filter(function() { 2149 var $this = $(this); 2150 return $this.closest('.tb-megamenu-subnav').length === 0 && $this.is(':visible'); 2151 }) 2152 2153 var index = $focusable.index($current); 2154 if (index > -1) { 2155 if (direction === 'next') { 2156 var nextElement = $focusable[index + 1] || $focusable[0]; 2157 } 2158 else { 2159 var nextElement = $focusable[index - 1] || $focusable[0]; 2160 } 2161 2162 nextElement.focus(); 2163 } 2164 } 2165 } 2166 2167 2168 Drupal.behaviors.tbMegaMenuAction = { 2169 attach: function(context) { 2170 2171 /* Keyboard Control Setup */ 2172 // Semi-Global Variables 2173 $('.tb-megamenu').once('tb-megamenu', function() { 2174 2175 var navParent = document.querySelector('.tb-megamenu'), 2176 linkArray = new Array(), 2177 curPos = new Array(-1,-1,-1); 2178 2179 // Each Top-Level Link 2180 $('.tb-megamenu').find('.level-1').children('a').not('.mobile-only').each(function(i,toplink) { 2181 linkArray[i] = new Array(); 2182 2183 // Add Link to Array 2184 linkArray[i][-1] = toplink; 2185 2186 // Determine Coordinates 2187 $(toplink).data({ coordinate: [i, -1] }); 2188 2189 // Each Column 2190 $(toplink).next().children().children().children('.mega-col-nav').each(function(j,column) { 2191 linkArray[i][j] = new Array(); 2192 2193 // Each Link 2194 $(column).find('a').each(function(k,sublink) { 2195 2196 // Add Link to Array 2197 linkArray[i][j][k] = sublink; 2198 2199 // Determine Coordinates 2200 $(sublink).data({ coordinate: [i, j, k] }); 2201 }); // each link 2202 2203 }); // each column 2204 2205 }); // each top-level link 2206 2207 // Update Position on Focus 2208 $('.tb-megamenu').find('a').focus(function() { 2209 curPos = $(this).data('coordinate'); 2210 }); 2211 2212 /* Event Listener */ 2213 // On Keydown 2214 if (navParent !== null) { 2215 navParent.addEventListener('keydown',keydownEvent); 2216 } 2217 2218 // Key Pressed 2219 function keydownEvent(k) { 2220 k.stopPropagation(); 2221 // Determine Key 2222 switch(k.keyCode) { 2223 2224 // TAB 2225 case 9: 2226 k.preventDefault(); 2227 nav_tab(k); 2228 console.log("tab"); 2229 break; 2230 2231 // RETURN 2232 case 13: 2233 nav_open_link(); 2234 break; 2235 2236 // ESC 2237 case 27: 2238 nav_esc(); 2239 break; 2240 2241 // LEFT 2242 case 37: 2243 k.preventDefault(); 2244 nav_left(); 2245 console.log("left"); 2246 break; 2247 2248 // UP 2249 case 38: 2250 k.preventDefault(); 2251 nav_up(); 2252 console.log("up"); 2253 break; 2254 2255 // RIGHT 2256 case 39: 2257 k.preventDefault(); 2258 nav_right(); 2259 console.log("right"); 2260 break; 2261 2262 // DOWN 2263 case 40: 2264 k.preventDefault(); 2265 nav_down(); 2266 console.log("down"); 2267 break; 2268 2269 // HOME 2270 case 36: 2271 nav_home(); 2272 break; 2273 2274 // END 2275 case 35: 2276 nav_end(); 2277 break; 2278 2279 // Else 2280 default:
2281 // Do nothing 2282 2283 } // determine key 2284 } // keydownEvent 2285 2286 /* Keypress Functions */ 2287 // Tab 2288 function nav_tab(k) { 2289 if(nav_is_toplink()) { 2290 if(k.shiftKey) { 2291 nav_prev_toplink(); 2292 } else { 2293 nav_next_toplink(); 2294 } 2295 } else { 2296 if(k.shiftKey) { 2297 nav_up(); 2298 } else { 2299 nav_down(); 2300 } 2301 } 2302 } 2303 2304 // Open Link 2305 function nav_open_link() { 2306 linkArray[curPos[0]][curPos[1]][curPos[2]].click(); 2307 } 2308 2309 // Escape 2310 function nav_esc() { 2311 nav_close_megamenu(); 2312 } 2313 2314 // Left 2315 function nav_left() { 2316 if(nav_is_toplink()) { 2317 nav_prev_toplink(); 2318 } else { 2319 nav_prev_column(); 2320 } 2321 } 2322 2323 // Right 2324 function nav_right() { 2325 if(nav_is_toplink()) { 2326 nav_next_toplink(); 2327 } else { 2328 nav_next_column(); 2329 } 2330 } 2331 2332 // Up 2333 function nav_up() { 2334 if(nav_is_toplink()) { 2335 nav_prev_toplink(); 2336 } else { 2337 if(linkArray[curPos[0]][curPos[1]][curPos[2] - 1]) { 2338 linkArray[curPos[0]][curPos[1]][curPos[2] - 1].focus(); 2339 } else { 2340 nav_prev_column(); 2341 } 2342 } 2343 } 2344 2345 // Down 2346 function nav_down() { 2347 if(nav_is_toplink()) { 2348 nav_next_column(); 2349 } else { 2350 if(linkArray[curPos[0]][curPos[1]][curPos[2] + 1]) { 2351 linkArray[curPos[0]][curPos[1]][curPos[2] + 1].focus(); 2352 } else { 2353 nav_next_column(); 2354 } 2355 } 2356 } 2357 2358 // Home Button 2359 function nav_home() { 2360 if(nav_is_toplink()) { 2361 linkArray[0][-1].focus(); 2362 } else { 2363 linkArray[curPos[0]][0][0].focus(); 2364 } 2365 } 2366 2367 // End Button 2368 function nav_end() { 2369 if(nav_is_toplink()) { 2370 linkArray.slice(-1)[0][-1].focus(); 2371 } else { 2372 linkArray[curPos[0]].slice(-1)[0].slice(-1)[0].focus(); 2373 } 2374 } 2375 2376 /* Helper Functions */ 2377 // Determine Link Level 2378 function nav_is_toplink() { 2379 return (curPos[1] < 0); 2380 } 2381 2382 // Close Mega Menu 2383 function nav_close_megamenu() { 2384 $('.tb-megamenu .open').removeClass('open'); 2385 $('.tb-megamenu-item.dropdown-submenu.open').removeClass('open'); 2386 ariaCheck(); 2387 } 2388 2389 // Next Toplink 2390 function nav_next_toplink() { 2391 if(linkArray[curPos[0] + 1]) { 2392 linkArray[curPos[0] + 1][-1].focus(); 2393 } else { 2394 nav_close_megamenu(); 2395 2396 // Focus on the next element. 2397 Drupal.TBMegaMenu.focusNextPrevElement('next'); 2398 } 2399 } 2400 2401 // Previous Toplink 2402 function nav_prev_toplink() { 2403 if(linkArray[curPos[0] - 1]) { 2404 linkArray[curPos[0] - 1][-1].focus(); 2405 } else { 2406 // Focus on the previous element. 2407 Drupal.TBMegaMenu.focusNextPrevElement('prev'); 2408 } 2409 } 2410 2411 // Previous Column 2412 function nav_prev_column() { 2413 if(linkArray[curPos[0]][curPos[1] - 1][0]) { 2414 linkArray[curPos[0]][curPos[1] - 1][0].focus(); 2415 } else { 2416 nav_parent_toplink(); 2417 } 2418 } 2419 2420 // Next Column 2421 function nav_next_column() { 2422 if(linkArray[curPos[0]][curPos[1] + 1]) { 2423 linkArray[curPos[0]][curPos[1] + 1][0].focus(); 2424 } else { 2425 nav_parent_toplink(); 2426 } 2427 } 2428 2429 // Go to Parent Toplink 2430 function nav_parent_toplink() { 2431 linkArray[curPos[0]][-1].focus(); 2432 } 2433 2434 var ariaCheck = function() { 2435 $("li.tb-megamenu-item").each(function () { 2436 if ($(this).is('.mega-group')) { 2437 // Mega menu item has mega class (it's a true mega menu) 2438 if(!$(this).parents().is('.open')) { 2439 // Mega menu item has mega class and its ancestor is closed, so apply appropriate ARIA attributes 2440 $(this).children().attr('aria-expanded', 'false'); 2441 } 2442 else if ($(this).parents().is('.open')) { 2443 // Mega menu item has mega class and its ancestor is o
2443pen, so apply appropriate ARIA attributes 2444 $(this).children().attr('aria-expanded', 'true'); 2445 } 2446 } 2447 else if ($(this).is('.dropdown') || $(this).is('.dropdown-submenu')) { 2448 // Mega menu item has dropdown (it's a flyout menu) 2449 if (!$(this).is('.open')) { 2450 // Mega menu item has dropdown class and is closed, so apply appropriate ARIA attributes 2451 $(this).children().attr('aria-expanded', 'false'); 2452 } 2453 else if ($(this).is('.open')) { 2454 // Mega menu item has dropdown class and is open, so apply appropriate ARIA attributes 2455 $(this).children().attr('aria-expanded', 'true'); 2456 } 2457 } 2458 else { 2459 // Mega menu item is neither a mega or dropdown class, so remove ARIA attributes (it doesn't have children) 2460 $(this).children().removeAttr('aria-expanded'); 2461 } 2462 }); 2463 }; 2464 2465 var showMenu = function ($subMenu, mm_timeout) { 2466 // console.log("showMenu"); 2467 if ($subMenu.hasClass('mega')) { 2468 $subMenu.addClass('animating'); 2469 clearTimeout($subMenu.data('animatingTimeout')); 2470 $subMenu.data('animatingTimeout', setTimeout(function () { 2471 $subMenu.removeClass('animating') 2472 }, mm_timeout)); 2473 clearTimeout($subMenu.data('hoverTimeout')); 2474 $subMenu.data('hoverTimeout', setTimeout(function () { 2475 $subMenu.addClass('open'); 2476 ariaCheck(); 2477 }, 100)); 2478 } 2479 else { 2480 clearTimeout($subMenu.data('hoverTimeout')); 2481 $subMenu.data('hoverTimeout', 2482 setTimeout(function () { 2483 $subMenu.addClass('open'); 2484 ariaCheck(); 2485 }, 100)); 2486 } 2487 }; 2488 var hideMenu = function ($subMenu, mm_timeout) { 2489 // console.log("hideMenu"); 2490 $subMenu.children('.dropdown-toggle').attr('aria-expanded', 'false'); 2491 if ($subMenu.hasClass('mega')) { 2492 $subMenu.addClass('animating'); 2493 clearTimeout($subMenu.data('animatingTimeout')); 2494 $subMenu.data('animatingTimeout', setTimeout(function () { 2495 $subMenu.removeClass('animating') 2496 }, mm_timeout)); 2497 clearTimeout($subMenu.data('hoverTimeout')); 2498 $subMenu.data('hoverTimeout', setTimeout(function () { 2499 $subMenu.removeClass('open'); 2500 ariaCheck(); 2501 }, 100)); 2502 } 2503 else { 2504 clearTimeout($subMenu.data('hoverTimeout')); 2505 $subMenu.data('hoverTimeout', setTimeout(function () { 2506 $subMenu.removeClass('open'); 2507 ariaCheck(); 2508 }, 100)); 2509 } 2510 }; 2511 2512 $('.tb-megamenu-button', context).once('menuIstance', function () { 2513 var This = this; 2514 $(This).click(function() { 2515 if(parseInt($(this).parent().children('.nav-collapse').height())) { 2516 $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'}); 2517 Drupal.TBMegaMenu.displayedMenuMobile = false; 2518 } 2519 else { 2520 $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'}); 2521 Drupal.TBMegaMenu.displayedMenuMobile = true; 2522 } 2523 }); 2524 }); 2525 2526 2527 var isTouch = window.matchMedia('(pointer: coarse)').matches; 2528 if (!isTouch) { 2529 $(document).ready(function ($) { 2530 var mm_duration = 0; 2531 $('.tb-megamenu', context).each(function () { 2532 if ($(this).data('duration')) { 2533 mm_duration = $(this).data('duration'); 2534 } 2535 }); 2536 2537 var mm_timeout = mm_duration ? 100 + mm_duration : 500; 2538 $('.nav > li, li.mega', context).bind('mouseenter', function (event) { 2539 showMenu($(this), mm_timeout); 2540 }); 2541 $('.nav > li > .dropdown-toggle, li.mega > .dropdown-toggle', context).bind('focus', function (event) { 2542 var $this = $(this); 2543 var $subMenu = $this.closest('li'); 2544 // console.log("showMenu call"); 2545 showMenu($subMenu, mm_timeout); 2546 // If the focus moves outside of the subMenu, close it. 2547 $(document).bind('focusin', function (event) { 2548 if ($subMenu.has(event.target).length) { 2549 return; 2550 } 2551 $(document).unbind(event); 2552 // console.log("hideMenu call"); 2553 hideMenu($subMenu, mm_timeout); 2554 }); 2555 }); 2556 $('.nav > li, li.mega', context).bind('mouseleave', function (event) { 2557 hideMenu($(this), mm_timeout); 2558 }); 2559 }); 2560 2561 /** 2562 * Allow tabbing by appending the open class. 2563 * Works in tandem with CSS changes that utilize opacity rather than 2564 * display none 2565 */ 2566 // If the selected anchor is not in the TB Megamenu, remove all "open" 2567 // class occurrences 2568 $('a').focus(function (event) { 2569 if (!$(this).parent().hasClass('tb-megamenu-item') && !$(this).parents('.tb-megamenu-block').length) {
2570 nav_close_megamenu(); 2571 } 2572 }); 2573 2574 $('.nav > li > a, li.mega > a').focus(function (event) { 2575 // Remove all occurrences of "open" from other menu trees 2576 var siblings = $(this).parents('.tb-megamenu-item').siblings(); 2577 // var siblings = $(this).closest('.tb-megamenu-item.level-1').siblings(); 2578 $.each(siblings, function (i, v) { 2579 var cousins = $(v).find('.open'); 2580 $.each(cousins, function (index, value) { 2581 $(value).removeClass('open'); 2582 ariaCheck($(this)); 2583 }); 2584 $(v).removeClass('open'); 2585 ariaCheck(); 2586 }); 2587 // Open the submenu if the selected item has one 2588 if ($(this).next(".tb-megamenu-submenu").length > 0) { 2589 if (!$(this).parent().hasClass("open")) { 2590 $(this).parent().addClass("open"); 2591 } 2592 } 2593 // If the anchor's top-level parent is not open, open it 2594 if (!$(this).closest('.tb-megamenu-item.dropdown').hasClass('open') && $(this).closest('.tb-megamenu-item.dropdown').find('.tb-megamenu-submenu').length > 0) { 2595 $(this).closest('.tb-megamenu-item.dropdown').addClass('open'); 2596 ariaCheck(); 2597 } 2598 // If anchor's parent submenus are not open, open them 2599 var parents = $(this).parents('.tb-megamenu-item.dropdown-submenu'); 2600 $.each(parents, function (i, v) { 2601 if (!$(v).hasClass('open')) { 2602 $(v).addClass('open'); 2603 ariaCheck(); 2604 } 2605 }); 2606 }); 2607 } 2608 2609 $(window).resize(function() { 2610 var windowWidth = window.innerWidth ? window.innerWidth : $(window).width(); 2611 if(windowWidth != Drupal.TBMegaMenu.oldWindowWidth){ 2612 Drupal.TBMegaMenu.oldWindowWidth = windowWidth; 2613 Drupal.TBMegaMenu.menuResponsive(); 2614 } 2615 }); 2616 2617 }); 2618 }, 2619 } 2620})(jQuery); 2621; 2622Drupal.TBMegaMenu = Drupal.TBMegaMenu || {}; 2623 2624(function ($) { 2625 Drupal.TBMegaMenu.createTouchMenu = function(items) { 2626 items.children('a, .tb_nolink').each( function() { 2627 var $item = $(this); 2628 var tbitem = $(this).parent(); 2629 2630 $item.click( function(event){ 2631 if ($item.hasClass('tb-megamenu-clicked')) { 2632 var $uri = $item.attr('href'); 2633 if ($uri && $uri !== '#') { 2634 window.location.href = $uri; 2635 } 2636 } 2637 else { 2638 event.preventDefault(); 2639 $item.addClass('tb-megamenu-clicked'); 2640 if(!tbitem.hasClass('open')){ 2641 tbitem.addClass('open'); 2642 } 2643 2644 // Find any parent siblings that are open and close them. 2645 tbitem.siblings('.open').find('.tb-megamenu-clicked').removeClass('tb-megamenu-clicked'); 2646 tbitem.siblings('.open').removeClass('open'); 2647 2648 $('body').addClass('tb-megamenu-open'); 2649 } 2650 }); 2651 }); 2652 } 2653 2654 Drupal.TBMegaMenu.eventStopPropagation = function(event) { 2655 if (event.stopPropagation) { 2656 event.stopPropagation(); 2657 } 2658 else if (window.event) { 2659 window.event.cancelBubble = true; 2660 } 2661 } 2662 2663 Drupal.behaviors.tbMegaMenuTouchAction = { 2664 attach: function(context) { 2665 var isTouch = window.matchMedia('(pointer: coarse)').matches; 2666 if(isTouch){ 2667 $('html').addClass('touch'); 2668 Drupal.TBMegaMenu.createTouchMenu($('.tb-megamenu ul.nav li.mega').has('.dropdown-menu')); 2669 2670 // When the user touches anywhere outside of the open menu item, close 2671 // the open menu item. 2672 $(document).on('touchstart', function(event) { 2673 if ($('body').hasClass('tb-megamenu-open') && !$(event.target).closest('.mega.open').length) { 2674 $('.tb-megamenu ul.nav li.mega a, .tb-megamenu ul.nav li.mega .tb_nolink').removeClass('tb-megamenu-clicked'); 2675 $('.tb-megamenu ul.nav li.mega').removeClass('open'); 2676 $('body').removeClass('tb-megamenu-open'); 2677 } 2678 }); 2679 } 2680 } 2681 } 2682})(jQuery); 2683; 2684(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", 2685p)))}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");
2685if(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}): 2686n();return d?d.promise(g):g}})(jQuery); 2687; 2688/** 2689 * @file 2690 * Integrate codrops' ResponsiveMultiLevelMenu library with Responsive Menus. 2691 */ 2692(function ($) { 2693 Drupal.behaviors.responsive_menus_codrops_responsive_multi = { 2694 attach: function (context, settings) { 2695 settings.responsive_menus = settings.responsive_menus || {}; 2696 var $windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 2697 $.each(settings.responsive_menus, function(ind, iteration) { 2698 if (iteration.responsive_menus_style != 'codrops_responsive_multi') { 2699 return true; 2700 } 2701 if (!iteration.selectors.length) { 2702 return; 2703 } 2704 // Only apply if window size is correct. Runs once on page load. 2705 var $media_size = iteration.media_size || 768; 2706 if ($windowWidth <= $media_size) { 2707 // Call codrops ResponsiveMultiLevelMenu with our settings. 2708 $(iteration.selectors).once('responsive-menus-codrops-multi-menu', function() { 2709 $(this).prepend('<button class="dl-trigger">Open Menu</button>'); 2710 // Removing other classes / IDs. 2711 $(this) 2712 .attr('class', 'dl-menuwrapper') 2713 .attr('id', 'dl-menu') 2714 .css('z-index', '999'); 2715 // Find the parent ul. 2716 var $parent_ul = $(this).find('ul:not(.contextual-links)').first(); 2717 $parent_ul 2718 .attr('class', 'dl-menu') 2719 .attr('id', 'rm-dl-menu') 2720 .find('li').removeAttr('id').removeAttr('class') 2721 .find('a').removeAttr('id').removeAttr('class'); 2722 // Add submenu classes. 2723 $parent_ul.find('ul').each(function(subIndex, subMenu) { 2724 $(this).removeAttr('id').attr('class', 'dl-submenu'); 2725 $subnav_link = $(this).parent('li').find('a').first()[0].outerHTML; 2726 $(this).prepend('<li>' + $subnav_link + '</li>'); 2727 }); 2728 // Call the ResponsiveMultiLevelMenu dlmenu function. 2729 $(this).dlmenu({ 2730 animationClasses : { 2731 classin : iteration.animation_in || 'dl-animate-in-1', 2732 classout : iteration.animation_out || 'dl-animate-out-1' 2733 } 2734 }); 2735 }); 2736 } 2737 2738 }); 2739 2740 } 2741 }; 2742}(jQuery)); 2743; 2744/* Modernizr 2.6.2 (Custom Build) | MIT & BSD 2745 * Build: http://modernizr.com/download/#-cssanimations-csstransitions-touch-shiv-cssclasses-prefixed-teststyles-testprop-testallprops-prefixes-domprefixes-load 2746 */ 2747;window.Modernizr=function(a,b,c){function z(a){j.cssText=a}function A(a,b){return z(m.join(a+";")+(b||""))}function B(a,b){return typeof a===b}function C(a,b){return!!~(""+a).indexOf(b)}function D(a,b){for(var d in a){var e=a[d];if(!C(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function E(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:B(f,"function")?f.bind(d||b):f}return!1}function F(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return B(b,"string")||B(b,"undefined")?D(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),E(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},x={}.hasOwnProperty,y;!B(x,"undefined")&&!B(x.call,"undefined")?y=function(a,b){return x.call(a,b)}:y=function(a,b){return b in a&&B(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;
vendor: 9,411 bytes, lines 2747-2815
2747var d=u.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e}),q.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:w(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},q.cssanimations=function(){return F("animationName")},q.csstransitions=function(){return F("transition")};for(var G in q)y(q,G)&&(v=G.toLowerCase(),e[v]=q[G](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)y(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},z(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.testProp=function(a){return D([a])},e.testAllProps=F,e.testStyles=w,e.prefixed=function(a,b,c){return b?F(a,b,c):F(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};; 2748/** 2749 * jquery.dlmenu.js v1.0.1 2750 * http://www.codrops.com 2751 * 2752 * Licensed under the MIT license. 2753 * http://www.opensource.org/licenses/mit-license.php 2754 * 2755 * Copyright 2013, Codrops 2756 * http://www.codrops.com 2757 */ 2758;( function( $, window, undefined ) { 2759 2760 'use strict'; 2761 2762 // global 2763 var Modernizr = window.Modernizr, $body = $( 'body' ); 2764 2765 $.DLMenu = function( options, element ) { 2766 this.$el = $( element ); 2767 this._init( options ); 2768 }; 2769 2770 // the options 2771 $.DLMenu.defaults = { 2772 // classes for the animation effects 2773 animationClasses : { classin : 'dl-animate-in-1', classout : 'dl-animate-out-1' }, 2774 // callback: click a link that has a sub menu 2775 // el is the link element (li); name is the level name 2776 onLevelClick : function( el, name ) { return false; }, 2777 // callback: click a link that does not have a sub menu 2778 // el is the link element (li); ev is the event obj 2779 onLinkClick : function( el, ev ) { return false; } 2780 }; 2781 2782 $.DLMenu.prototype = { 2783 _init : function( options ) { 2784 2785 // options 2786 this.options = $.extend( true, {}, $.DLMenu.defaults, options ); 2787 // cache some elements and initialize some variables 2788 this._config(); 2789 2790 var animEndEventNames = { 2791 'WebkitAnimation' : 'webkitAnimationEnd', 2792 'OAnimation' : 'oAnimationEnd', 2793 'msAnimation' : 'MSAnimationEnd', 2794 'animation' : 'animationend' 2795 }, 2796 transEndEventNames = { 2797 'WebkitTransition' : 'webkitTransitionEnd', 2798 'MozTransition' : 'transitionend', 2799 'OTransition' : 'oTransitionEnd', 2800 'msTransition' : 'MSTransitionEnd', 2801 'transition' : 'transitionend' 2802 }; 2803 // animation end event name 2804 this.animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ] + '.dlmenu'; 2805 // transition end event name 2806 this.transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ] + '.dlmenu', 2807 // support for css animations and css transitions 2808 this.supportAnimations = Modernizr.cssanimations, 2809 this.supportTransitions = Modernizr.csstransitions; 2810 2811 this._initEvents(); 2812 2813 }, 2814 _config : function() { 2815 this.open = false;
2816 this.$trigger = this.$el.children( '.dl-trigger' ); 2817 this.$menu = this.$el.children( 'ul.dl-menu' ); 2818 this.$menuitems = this.$menu.find( 'li:not(.dl-back)' ); 2819 this.$el.find( 'ul.dl-submenu' ).prepend( '<li class="dl-back"><a href="#">späť</a></li>' ); 2820 this.$back = this.$menu.find( 'li.dl-back' ); 2821 }, 2822 _initEvents : function() { 2823 2824 var self = this; 2825 2826 this.$trigger.on( 'click.dlmenu', function() { 2827 2828 if( self.open ) { 2829 self._closeMenu(); 2830 } 2831 else { 2832 self._openMenu(); 2833 } 2834 return false; 2835 2836 } ); 2837 2838 this.$menuitems.on( 'click.dlmenu', function( event ) { 2839 2840 event.stopPropagation(); 2841 2842 var $item = $(this), 2843 $submenu = $item.children( 'ul.dl-submenu' ); 2844 2845 if( $submenu.length > 0 ) { 2846 2847 var $flyin = $submenu.clone().css( 'opacity', 0 ).insertAfter( self.$menu ), 2848 onAnimationEndFn = function() { 2849 self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classout ).addClass( 'dl-subview' ); 2850 $item.addClass( 'dl-subviewopen' ).parents( '.dl-subviewopen:first' ).removeClass( 'dl-subviewopen' ).addClass( 'dl-subview' ); 2851 $flyin.remove(); 2852 }; 2853 2854 setTimeout( function() { 2855 $flyin.addClass( self.options.animationClasses.classin ); 2856 self.$menu.addClass( self.options.animationClasses.classout ); 2857 if( self.supportAnimations ) { 2858 self.$menu.on( self.animEndEventName, onAnimationEndFn ); 2859 } 2860 else { 2861 onAnimationEndFn.call(); 2862 } 2863 2864 self.options.onLevelClick( $item, $item.children( 'a:first' ).text() ); 2865 } ); 2866 2867 return false; 2868 2869 } 2870 else { 2871 self.options.onLinkClick( $item, event ); 2872 } 2873 2874 } ); 2875 2876 this.$back.on( 'click.dlmenu', function( event ) { 2877 2878 var $this = $( this ), 2879 $submenu = $this.parents( 'ul.dl-submenu:first' ), 2880 $item = $submenu.parent(), 2881 2882 $flyin = $submenu.clone().insertAfter( self.$menu ); 2883 2884 var onAnimationEndFn = function() { 2885 self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classin ); 2886 $flyin.remove(); 2887 }; 2888 2889 setTimeout( function() { 2890 $flyin.addClass( self.options.animationClasses.classout ); 2891 self.$menu.addClass( self.options.animationClasses.classin ); 2892 if( self.supportAnimations ) { 2893 self.$menu.on( self.animEndEventName, onAnimationEndFn ); 2894 } 2895 else { 2896 onAnimationEndFn.call(); 2897 } 2898 2899 $item.removeClass( 'dl-subviewopen' ); 2900 2901 var $subview = $this.parents( '.dl-subview:first' ); 2902 if( $subview.is( 'li' ) ) { 2903 $subview.addClass( 'dl-subviewopen' ); 2904 } 2905 $subview.removeClass( 'dl-subview' ); 2906 } ); 2907 2908 return false; 2909 2910 } ); 2911 2912 }, 2913 closeMenu : function() { 2914 if( this.open ) { 2915 this._closeMenu(); 2916 } 2917 }, 2918 _closeMenu : function() { 2919 var self = this, 2920 onTransitionEndFn = function() { 2921 self.$menu.off( self.transEndEventName ); 2922 self._resetMenu(); 2923 }; 2924 2925 this.$menu.removeClass( 'dl-menuopen' ); 2926 this.$menu.addClass( 'dl-menu-toggle' ); 2927 this.$trigger.removeClass( 'dl-active' ); 2928 2929 if( this.supportTransitions ) { 2930 this.$menu.on( this.transEndEventName, onTransitionEndFn ); 2931 } 2932 else { 2933 onTransitionEndFn.call(); 2934 } 2935 2936 this.open = false; 2937 }, 2938 openMenu : function() { 2939 if( !this.open ) { 2940 this._openMenu(); 2941 } 2942 }, 2943 _openMenu : function() { 2944 var self = this; 2945 // clicking somewhere else makes the menu close 2946 $body.off( 'click' ).on( 'click.dlmenu', function() { 2947 self._closeMenu() ; 2948 } ); 2949 this.$menu.addClass( 'dl-menuopen dl-menu-toggle' ).on( this.transEndEventName, function() { 2950 $( this ).removeClass( 'dl-menu-toggle' ); 2951 } ); 2952 this.$trigger.addClass( 'dl-active' ); 2953 this.open = true; 2954 }, 2955 // resets the menu to its original state (first level of options) 2956 _resetMenu : function() { 2957 this.$menu.removeClass( 'dl-subview' ); 2958 this.$menuitems.removeClass( 'dl-subview dl-subviewopen' ); 2959 } 2960 }; 2961 2962 var logError = function( message ) { 2963 if ( window.console ) { 2964 window.console.error( message ); 2965 } 2966 }; 2967 2968 $.fn.dlmenu = function( options ) { 2969 if ( typeof options === 'string' ) { 2970 var args = Array.prototype.slice.call( arguments, 1 ); 2971 this.each(function() { 2972 var instance = $.data( this, 'dlmenu' ); 2973 if ( !instance ) { 2974 logError( "cannot call methods on dlmenu prior to initialization; " + 2975 "attempted to call method '" + options + "'" ); 2976 return; 2977 } 2978 if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) { 2979 logError( "no such method '" + options + "' for dlmenu instance" ); 2980 return; 2981 } 2982 instance[ options ].apply( instance, args ); 2983 }); 2984 } 2985 else { 2986 this.each(function() { 2987 var instance = $.data( this, 'dlmenu' ); 2988 if ( instance ) { 2989 instance._init(); 2990 } 2991 else { 2992 instance = $.data( this, 'dlmenu', new $.DLMenu( options, this ) ); 2993 } 2994 }); 2995 } 2996 return this; 2997 }; 2998 2999} )( jQuery, window );; 3000(function ($) { 3001 3002Drupal.googleanalytics = {}; 3003 3004$(document).ready(function() { 3005 3006 // Attach mousedown, keyup, touchstart events to document only and catch 3007 // clicks on all elements. 3008 $(document.body).bind("mousedown keyup touchstart", function(event) { 3009 3010 // Catch the closest surrounding link of a clicked element. 3011 $(event.target).closest("a,area").each(function() { 3012 3013 // Is the clicked URL internal? 3014 if (Drupal.googleanalytics.isInternal(this.href)) { 3015 // Skip 'click' tracking, if custom tracking events are bound. 3016 if ($(this).is('.colorbox') && (Drupal.settings.googleanalytics.trackColorbox)) {
3017 // Do nothing here. The custom event will handle all tracking. 3018 //console.info("Click on .colorbox item has been detected."); 3019 } 3020 // Is download tracking activated and the file extension configured for download tracking? 3021 else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) { 3022 // Download link clicked. 3023 ga("send", { 3024 "hitType": "event", 3025 "eventCategory": "Downloads", 3026 "eventAction": Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), 3027 "eventLabel": Drupal.googleanalytics.getPageUrl(this.href), 3028 "transport": "beacon" 3029 }); 3030 } 3031 else if (Drupal.googleanalytics.isInternalSpecial(this.href)) { 3032 // Keep the internal URL for Google Analytics website overlay intact. 3033 ga("send", { 3034 "hitType": "pageview", 3035 "page": Drupal.googleanalytics.getPageUrl(this.href), 3036 "transport": "beacon" 3037 }); 3038 } 3039 } 3040 else { 3041 if (Drupal.settings.googleanalytics.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 3042 // Mailto link clicked. 3043 ga("send", { 3044 "hitType": "event", 3045 "eventCategory": "Mails", 3046 "eventAction": "Click", 3047 "eventLabel": this.href.substring(7), 3048 "transport": "beacon" 3049 }); 3050 } 3051 else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) { 3052 if (Drupal.settings.googleanalytics.trackDomainMode !== 2 || (Drupal.settings.googleanalytics.trackDomainMode === 2 && !Drupal.googleanalytics.isCrossDomain(this.hostname, Drupal.settings.googleanalytics.trackCrossDomains))) { 3053 // External link clicked / No top-level cross domain clicked. 3054 ga("send", { 3055 "hitType": "event", 3056 "eventCategory": "Outbound links", 3057 "eventAction": "Click", 3058 "eventLabel": this.href, 3059 "transport": "beacon" 3060 }); 3061 } 3062 } 3063 } 3064 }); 3065 }); 3066 3067 // Track hash changes as unique pageviews, if this option has been enabled. 3068 if (Drupal.settings.googleanalytics.trackUrlFragments) { 3069 window.onhashchange = function() { 3070 ga("send", { 3071 "hitType": "pageview", 3072 "page": location.pathname + location.search + location.hash 3073 }); 3074 }; 3075 } 3076 3077 // Colorbox: This event triggers when the transition has completed and the 3078 // newly loaded content has been revealed. 3079 if (Drupal.settings.googleanalytics.trackColorbox) { 3080 $(document).bind("cbox_complete", function () { 3081 var href = $.colorbox.element().attr("href"); 3082 if (href) { 3083 ga("send", { 3084 "hitType": "pageview", 3085 "page": Drupal.googleanalytics.getPageUrl(href) 3086 }); 3087 } 3088 }); 3089 } 3090 3091}); 3092 3093/** 3094 * Check whether the hostname is part of the cross domains or not. 3095 * 3096 * @param string hostname 3097 * The hostname of the clicked URL. 3098 * @param array crossDomains 3099 * All cross domain hostnames as JS array. 3100 * 3101 * @return boolean 3102 */ 3103Drupal.googleanalytics.isCrossDomain = function (hostname, crossDomains) { 3104 /** 3105 * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is 3106 * `null` or `undefined`, http://bugs.jquery.com/ticket/10076, 3107 * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 3108 * 3109 * @todo: Remove/Refactor in D8 3110 */ 3111 if (!crossDomains) { 3112 return false; 3113 } 3114 else { 3115 return $.inArray(hostname, crossDomains) > -1 ? true : false; 3116 } 3117}; 3118 3119/** 3120 * Check whether this is a download URL or not. 3121 * 3122 * @param string url 3123 * The web url to check. 3124 * 3125 * @return boolean 3126 */ 3127Drupal.googleanalytics.isDownload = function (url) { 3128 var isDownload = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 3129 return isDownload.test(url); 3130}; 3131 3132/** 3133 * Check whether this is an absolute internal URL or not. 3134 * 3135 * @param string url 3136 * The web url to check. 3137 * 3138 * @return boolean 3139 */ 3140Drupal.googleanalytics.isInternal = function (url) { 3141 var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); 3142 return isInternal.test(url); 3143}; 3144 3145/** 3146 * Check whether this is a special URL or not. 3147 * 3148 * URL types: 3149 * - gotwo.module /go/* links. 3150 * 3151 * @param string url 3152 * The web url to check. 3153 * 3154 * @return boolean 3155 */ 3156Drupal.googleanalytics.isInternalSpecial = function (url) { 3157 var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); 3158 return isInternalSpecial.test(url); 3159}; 3160 3161/** 3162 * Extract the relative internal URL from an absolute internal URL. 3163 * 3164 * Examples: 3165 * - http://mydomain.com/node/1 -> /node/1 3166 * - http://example.com/foo/bar -> http://example.com/foo/bar 3167 * 3168 * @param string url 3169 * The web url to check. 3170 * 3171 * @return string 3172 * Internal website URL 3173 */ 3174Drupal.googleanalytics.getPageUrl = function (url) { 3175 var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i"); 3176 return url.replace(extractInternalUrl, ''); 3177}; 3178 3179/** 3180 * Extract the download file extension from the URL. 3181 * 3182 * @param string url 3183 * The web url to check. 3184 * 3185 * @return string 3186 * The file extension of the passed url. e.g. "zip", "txt" 3187 */ 3188Drupal.googleanalytics.getDownloadExtension = function (url) { 3189 var extractDownloadextension = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 3190 var extension = extractDownloadextension.exec(url); 3191 return (extension === null) ? '' : extension[1]; 3192}; 3193 3194})(jQuery); 3195;
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.