https://www.soundvision.com/sites/default/files/js/js_vs6Nz99MnA1VxD3qTFZXFNeYeG48-6DE5x6DMfAx8IM.js
1/** 2 * @file 3 * Some basic behaviors and utility functions for Views. 4 */ 5(function ($) { 6 7 Drupal.Views = {}; 8 9 /** 10 * JQuery UI tabs, Views integration component. 11 */ 12 Drupal.behaviors.viewsTabs = { 13 attach: function (context) { 14 if ($.viewsUi && $.viewsUi.tabs) { 15 $('#views-tabset').once('views-processed').viewsTabs({ 16 selectedClass: 'active' 17 }); 18 } 19 20 $('a.views-remove-link').once('views-processed').click(function (event) { 21 var id = $(this).attr('id').replace('views-remove-link-', ''); 22 $('#views-row-' + id).hide(); 23 $('#views-removed-' + id).get(0).checked = true; 24 event.preventDefault(); 25 }); 26 // Here is to handle display deletion 27 // (checking in the hidden checkbox and hiding out the row). 28 $('a.display-remove-link') 29 .addClass('display-processed') 30 .click(function () { 31 var id = $(this).attr('id').replace('display-remove-link-', ''); 32 $('#display-row-' + id).hide(); 33 $('#display-removed-' + id).get(0).checked = true; 34 return false; 35 }); 36 } 37 }; 38 39 /** 40 * Helper function to parse a querystring. 41 */ 42 Drupal.Views.parseQueryString = function (query) { 43 var args = {}; 44 var pos = query.indexOf('?'); 45 if (pos != -1) { 46 query = query.substring(pos + 1); 47 } 48 var pairs = query.split('&'); 49 for (var i in pairs) { 50 if (typeof(pairs[i]) == 'string') { 51 var pair = pairs[i].split('='); 52 // Ignore the 'q' path argument, if present. 53 if (pair[0] != 'q' && pair[1]) { 54 args[decodeURIComponent(pair[0].replace(/\+/g, ' '))] = decodeURIComponent(pair[1].replace(/\+/g, ' ')); 55 } 56 } 57 } 58 return args; 59 }; 60 61 /** 62 * Helper function to return a view's arguments based on a path. 63 */ 64 Drupal.Views.parseViewArgs = function (href, viewPath) { 65 // Provide language prefix. 66 if (Drupal.settings.pathPrefix) { 67 var viewPath = Drupal.settings.pathPrefix + viewPath; 68 } 69 var returnObj = {}; 70 var path = Drupal.Views.getPath(href); 71 // Ensure there is a correct path. 72 if (viewPath && path.substring(0, viewPath.length + 1) == viewPath + '/') { 73 var args = decodeURIComponent(path.substring(viewPath.length + 1, path.length)); 74 returnObj.view_args = args; 75 returnObj.view_path = path; 76 } 77 return returnObj; 78 }; 79 80 /** 81 * Strip off the protocol plus domain from an href. 82 */ 83 Drupal.Views.pathPortion = function (href) { 84 // Remove e.g. http://example.com if present. 85 var protocol = window.location.protocol; 86 if (href.substring(0, protocol.length) == protocol) { 87 // 2 is the length of the '//' that normally follows the protocol. 88 href = href.substring(href.indexOf('/', protocol.length + 2)); 89 } 90 return href; 91 }; 92 93 /** 94 * Return the Drupal path portion of an href. 95 */ 96 Drupal.Views.getPath = function (href) { 97 href = Drupal.Views.pathPortion(href); 98 href = href.substring(Drupal.settings.basePath.length, href.length); 99 // 3 is the length of the '?q=' added to the URL without clean URLs. 100 if (href.substring(0, 3) == '?q=') { 101 href = href.substring(3, href.length); 102 } 103 var chars = ['#', '?', '&']; 104 for (var i in chars) { 105 if (href.indexOf(chars[i]) > -1) { 106 href = href.substr(0, href.indexOf(chars[i])); 107 } 108 } 109 return href; 110 }; 111 112})(jQuery); 113; 114(function ($) { 115 116/** 117 * A progressbar object. Initialized with the given id. Must be inserted into 118 * the DOM afterwards through progressBar.element. 119 * 120 * method is the function which will perform the HTTP request to get the 121 * progress bar state. Either "GET" or "POST". 122 * 123 * e.g. pb = new progressBar('myProgressBar'); 124 * some_element.appendChild(pb.element); 125 */ 126Drupal.progressBar = function (id, updateCallback, method, errorCallback) { 127 var pb = this; 128 this.id = id; 129 this.method = method || 'GET'; 130 this.updateCallback = updateCallback; 131 this.errorCallback = errorCallback; 132 133 // The WAI-ARIA setting aria-live="polite" will announce changes after users 134 // have completed their current activity and not interrupt the screen reader.
135 this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); 136 this.element.html('<div class="bar"><div class="filled"></div></div>' + 137 '<div class="percentage"></div>' + 138 '<div class="message"> </div>'); 139}; 140 141/** 142 * Set the percentage and status message for the progressbar. 143 */ 144Drupal.progressBar.prototype.setProgress = function (percentage, message) { 145 if (percentage >= 0 && percentage <= 100) { 146 $('div.filled', this.element).css('width', percentage + '%'); 147 $('div.percentage', this.element).html(percentage + '%'); 148 } 149 $('div.message', this.element).html(message); 150 if (this.updateCallback) { 151 this.updateCallback(percentage, message, this); 152 } 153}; 154 155/** 156 * Start monitoring progress via Ajax. 157 */ 158Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { 159 this.delay = delay; 160 this.uri = uri; 161 this.sendPing(); 162}; 163 164/** 165 * Stop monitoring progress via Ajax. 166 */ 167Drupal.progressBar.prototype.stopMonitoring = function () { 168 clearTimeout(this.timer); 169 // This allows monitoring to be stopped from within the callback. 170 this.uri = null; 171}; 172 173/** 174 * Request progress data from server. 175 */ 176Drupal.progressBar.prototype.sendPing = function () { 177 if (this.timer) { 178 clearTimeout(this.timer); 179 } 180 if (this.uri) { 181 var pb = this; 182 // When doing a post request, you need non-null data. Otherwise a 183 // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. 184 $.ajax({ 185 type: this.method, 186 url: this.uri, 187 data: '', 188 dataType: 'json', 189 success: function (progress) { 190 // Display errors. 191 if (progress.status == 0) { 192 pb.displayError(progress.data); 193 return; 194 } 195 // Update display. 196 pb.setProgress(progress.percentage, progress.message); 197 // Schedule next timer. 198 pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); 199 }, 200 error: function (xmlhttp) { 201 pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); 202 } 203 }); 204 } 205}; 206 207/** 208 * Display errors on the page. 209 */ 210Drupal.progressBar.prototype.displayError = function (string) { 211 var error = $('<div class="messages error"></div>').html(string); 212 $(this.element).before(error).hide(); 213 214 if (this.errorCallback) { 215 this.errorCallback(this); 216 } 217}; 218 219})(jQuery); 220; 221/** 222 * @file 223 * Handles AJAX fetching of views, including filter submission and response. 224 */ 225(function ($) { 226 227 /** 228 * Attaches the AJAX behavior to exposed filter forms and key views links. 229 */ 230 Drupal.behaviors.ViewsAjaxView = {}; 231 Drupal.behaviors.ViewsAjaxView.attach = function () { 232 if (Drupal.settings && Drupal.settings.views && Drupal.settings.views.ajaxViews) { 233 $.each(Drupal.settings.views.ajaxViews, function (i, settings) { 234 Drupal.views.instances[i] = new Drupal.views.ajaxView(settings); 235 }); 236 } 237 }; 238 239 Drupal.views = {}; 240 Drupal.views.instances = {}; 241 242 /** 243 * JavaScript object for a certain view. 244 */ 245 Drupal.views.ajaxView = function (settings) { 246 var selector = '.view-dom-id-' + settings.view_dom_id; 247 this.$view = $(selector); 248 249 // If view is not present return to prevent errors. 250 if (!this.$view.length) { 251 return; 252 } 253 254 // Retrieve the path to use for views' ajax. 255 var ajax_path = Drupal.settings.views.ajax_path; 256 257 // If there are multiple views this might've ended up showing up multiple 258 // times. 259 if (ajax_path.constructor.toString().indexOf("Array") != -1) { 260 ajax_path = ajax_path[0]; 261 } 262 263 // Check if there are any GET parameters to send to views. 264 var queryString = window.location.search || ''; 265 if (queryString !== '') { 266 // Remove the question mark and Drupal path component if any. 267 var queryString = queryString.slice(1).replace(/q=[^&]+&?|&?render=[^&]+/, ''); 268 if (queryString !== '') { 269 // If there is a '?' in ajax_path, clean url are on and & should be 270 // used to add parameters. 271 queryString = ((/\?/.test(ajax_path)) ? '&' : '?') + queryString; 272 } 273 } 274 275 this.element_settings = { 276 url: ajax_path + queryString, 277 submit: settings, 278 setClick: true, 279 event: 'click', 280 selector: selector, 281 progress: { 282 type: 'throbber' 283 } 284 }; 285 286 this.settings = settings; 287
288 // Add the ajax to exposed forms. 289 this.$exposed_form = $('#views-exposed-form-' + settings.view_name.replace(/_/g, '-') + '-' + settings.view_display_id.replace(/_/g, '-')); 290 this.$exposed_form.once(jQuery.proxy(this.attachExposedFormAjax, this)); 291 292 // Store Drupal.ajax objects here for all pager links. 293 this.links = []; 294 295 // Add the ajax to pagers. 296 this.$view 297 .once(jQuery.proxy(this.attachPagerAjax, this)); 298 299 // Add a trigger to update this view specifically. In order to trigger a 300 // refresh use the following code. 301 // 302 // @code 303 // jQuery('.view-name').trigger('RefreshView'); 304 // @endcode 305 // Add a trigger to update this view specifically. 306 var self_settings = this.element_settings; 307 self_settings.event = 'RefreshView'; 308 var self = this; 309 this.$view.once('refresh', function () { 310 self.refreshViewAjax = new Drupal.ajax(self.selector, self.$view, self_settings); 311 }); 312 }; 313 314 Drupal.views.ajaxView.prototype.attachExposedFormAjax = function () { 315 var button = $('input[type=submit], button[type=submit], input[type=image]', this.$exposed_form); 316 button = button[0]; 317 318 // Call the autocomplete submit before doing AJAX. 319 $(button).click(function () { 320 if (Drupal.autocompleteSubmit) { 321 Drupal.autocompleteSubmit(); 322 } 323 }); 324 325 this.exposedFormAjax = new Drupal.ajax($(button).attr('id'), button, this.element_settings); 326 }; 327 328 /** 329 * Attach the ajax behavior to each link. 330 */ 331 Drupal.views.ajaxView.prototype.attachPagerAjax = function () { 332 this.$view.find('ul.pager > li > a, ol.pager > li > a, th.views-field a, .attachment .views-summary a') 333 .each(jQuery.proxy(this.attachPagerLinkAjax, this)); 334 }; 335 336 /** 337 * Attach the ajax behavior to a single link. 338 */ 339 Drupal.views.ajaxView.prototype.attachPagerLinkAjax = function (id, link) { 340 var $link = $(link); 341 var viewData = {}; 342 var href = $link.attr('href'); 343 // Don't attach to pagers inside nested views. 344 if ($link.closest('.view')[0] !== this.$view[0] && 345 $link.closest('.view').parent().hasClass('attachment') === false) { 346 return; 347 } 348 349 // Provide a default page if none has been set. This must be done 350 // prior to merging with settings to avoid accidentally using the 351 // page landed on instead of page 1. 352 if (typeof(viewData.page) === 'undefined') { 353 viewData.page = 0; 354 } 355 356 // Construct an object using the settings defaults and then overriding 357 // with data specific to the link. 358 $.extend( 359 viewData, 360 this.settings, 361 Drupal.Views.parseQueryString(href), 362 // Extract argument data from the URL. 363 Drupal.Views.parseViewArgs(href, this.settings.view_base_path) 364 ); 365 366 // For anchor tags, these will go to the target of the anchor rather 367 // than the usual location. 368 $.extend(viewData, Drupal.Views.parseViewArgs(href, this.settings.view_base_path)); 369 370 // Construct an object using the element settings defaults, 371 // then overriding submit with viewData. 372 var pager_settings = $.extend({}, this.element_settings); 373 pager_settings.submit = viewData; 374 this.pagerAjax = new Drupal.ajax(false, $link, pager_settings); 375 this.links.push(this.pagerAjax); 376 }; 377 378 Drupal.ajax.prototype.commands.viewsScrollTop = function (ajax, response, status) { 379 // Scroll to the top of the view. This will allow users 380 // to browse newly loaded content after e.g. clicking a pager 381 // link. 382 var offset = $(response.selector).offset(); 383 // We can't guarantee that the scrollable object should be 384 // the body, as the view could be embedded in something 385 // more complex such as a modal popup. Recurse up the DOM 386 // and scroll the first element that has a non-zero top. 387 var scrollTarget = response.selector; 388 while ($(scrollTarget).scrollTop() == 0 && $(scrollTarget).parent()) { 389 scrollTarget = $(scrollTarget).parent(); 390 } 391 // Only scroll upward. 392 if (offset.top - 10 < $(scrollTarget).scrollTop()) { 393 $(scrollTarget).animate({scrollTop: (offset.top - 10)}, 500); 394 } 395 }; 396 397})(jQuery); 398; 399(function ($) { 400 401Drupal.googleanalytics = {}; 402 403$(document).ready(function() { 404 405 // Attach mousedown, keyup, touchstart events to document only and catch 406 // clicks on all elements. 407 $(document.body).bind("mousedown keyup touchstart", function(event) { 408 409 // Catch the closest surrounding link of a clicked element. 410 $(event.target).closest("a,area").each(function() { 411 412 // Is the clicked URL internal? 413 if (Drupal.googleanalytics.isInternal(this.href)) { 414 // Skip 'click' tracking, if custom tracking events are bound. 415 if ($(this).is('.colorbox') && (Drupal.settings.googleanalytics.trackColorbox)) {
416 // Do nothing here. The custom event will handle all tracking. 417 //console.info("Click on .colorbox item has been detected."); 418 } 419 // Is download tracking activated and the file extension configured for download tracking? 420 else if (Drupal.settings.googleanalytics.trackDownload && Drupal.googleanalytics.isDownload(this.href)) { 421 // Download link clicked. 422 gtag('event', Drupal.googleanalytics.getDownloadExtension(this.href).toUpperCase(), { 423 event_category: 'Downloads', 424 event_label: Drupal.googleanalytics.getPageUrl(this.href), 425 transport_type: 'beacon' 426 }); 427 } 428 else if (Drupal.googleanalytics.isInternalSpecial(this.href)) { 429 // Keep the internal URL for Google Analytics website overlay intact. 430 // @todo: May require tracking ID 431 var target = this; 432 $.each(Drupal.settings.googleanalytics.account, function () { 433 gtag('config', this, { 434 page_path: Drupal.googleanalytics.getPageUrl(target.href), 435 transport_type: 'beacon' 436 }); 437 }); 438 } 439 } 440 else { 441 if (Drupal.settings.googleanalytics.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 442 // Mailto link clicked. 443 gtag('event', 'Click', { 444 event_category: 'Mails', 445 event_label: this.href.substring(7), 446 transport_type: 'beacon' 447 }); 448 } 449 else if (Drupal.settings.googleanalytics.trackOutbound && this.href.match(/^\w+:\/\//i)) { 450 if (Drupal.settings.googleanalytics.trackDomainMode !== 2 || (Drupal.settings.googleanalytics.trackDomainMode === 2 && !Drupal.googleanalytics.isCrossDomain(this.hostname, Drupal.settings.googleanalytics.trackCrossDomains))) { 451 // External link clicked / No top-level cross domain clicked. 452 gtag('event', 'Click', { 453 event_category: 'Outbound links', 454 event_label: this.href, 455 transport_type: 'beacon' 456 }); 457 } 458 } 459 } 460 }); 461 }); 462 463 // Track hash changes as unique pageviews, if this option has been enabled. 464 if (Drupal.settings.googleanalytics.trackUrlFragments) { 465 window.onhashchange = function() { 466 $.each(Drupal.settings.googleanalytics.account, function () { 467 gtag('config', this, { 468 page_path: location.pathname + location.search + location.hash 469 }); 470 }); 471 }; 472 } 473 474 // Colorbox: This event triggers when the transition has completed and the 475 // newly loaded content has been revealed. 476 if (Drupal.settings.googleanalytics.trackColorbox) { 477 $(document).bind("cbox_complete", function () { 478 var href = $.colorbox.element().attr("href"); 479 if (href) { 480 $.each(Drupal.settings.googleanalytics.account, function () { 481 gtag('config', this, { 482 page_path: Drupal.googleanalytics.getPageUrl(href) 483 }); 484 }); 485 } 486 }); 487 } 488 489}); 490 491/** 492 * Check whether the hostname is part of the cross domains or not. 493 * 494 * @param string hostname 495 * The hostname of the clicked URL. 496 * @param array crossDomains 497 * All cross domain hostnames as JS array. 498 * 499 * @return boolean 500 */ 501Drupal.googleanalytics.isCrossDomain = function (hostname, crossDomains) { 502 /** 503 * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is 504 * `null` or `undefined`, https://bugs.jquery.com/ticket/10076, 505 * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 506 * 507 * @todo: Remove/Refactor in D8 508 */ 509 if (!crossDomains) { 510 return false; 511 } 512 else { 513 return $.inArray(hostname, crossDomains) > -1 ? true : false; 514 } 515}; 516 517/** 518 * Check whether this is a download URL or not. 519 * 520 * @param string url 521 * The web url to check. 522 * 523 * @return boolean 524 */ 525Drupal.googleanalytics.isDownload = function (url) { 526 var isDownload = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 527 return isDownload.test(url); 528}; 529 530/** 531 * Check whether this is an absolute internal URL or not. 532 * 533 * @param string url 534 * The web url to check. 535 * 536 * @return boolean 537 */ 538Drupal.googleanalytics.isInternal = function (url) { 539 var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); 540 return isInternal.test(url); 541}; 542 543/** 544 * Check whether this is a special URL or not. 545 * 546 * URL types: 547 * - gotwo.module /go/* links. 548 * 549 * @param string url 550 * The web url to check. 551 * 552 * @return boolean 553 */ 554Drupal.googleanalytics.isInternalSpecial = function (url) { 555 var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); 556 return isInternalSpecial.test(url); 557}; 558 559/** 560 * Extract the relative internal URL from an absolute internal URL. 561 * 562 * Examples: 563 * - https://mydomain.com/node/1 -> /node/1 564 * - https://example.com/foo/bar -> https://example.com/foo/bar 565 * 566 * @param string url 567 * The web url to check. 568 * 569 * @return string 570 * Internal website URL 571 */ 572Drupal.googleanalytics.getPageUrl = function (url) { 573 var extractInternalUrl = new RegExp("^(https?):\/\/" + window.location.host, "i"); 574 return url.replace(extractInternalUrl, ''); 575}; 576 577/** 578 * Extract the download file extension from the URL. 579 * 580 * @param string url 581 * The web url to check. 582 * 583 * @return string 584 * The file extension of the passed url. e.g. "zip", "txt" 585 */ 586Drupal.googleanalytics.getDownloadExtension = function (url) { 587 var extractDownloadextension = new RegExp("\\.(" + Drupal.settings.googleanalytics.trackDownloadExtensions + ")([\?#].*)?$", "i"); 588 var extension = extractDownloadextension.exec(url); 589 return (extension === null) ? '' : extension[1]; 590}; 591 592})(jQuery); 593;
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.