1(function ($) { 2 3/** 4 * A progressbar object. Initialized with the given id. Must be inserted into 5 * the DOM afterwards through progressBar.element. 6 * 7 * method is the function which will perform the HTTP request to get the 8 * progress bar state. Either "GET" or "POST". 9 * 10 * e.g. pb = new progressBar('myProgressBar'); 11 * some_element.appendChild(pb.element); 12 */ 13Drupal.progressBar = function (id, updateCallback, method, errorCallback) { 14 var pb = this; 15 this.id = id; 16 this.method = method || 'GET'; 17 this.updateCallback = updateCallback; 18 this.errorCallback = errorCallback; 19 20 // The WAI-ARIA setting aria-live="polite" will announce changes after users 21 // have completed their current activity and not interrupt the screen reader. 22 this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); 23 this.element.html('<div class="bar"><div class="filled"></div></div>' + 24 '<div class="percentage"></div>' + 25 '<div class="message"> </div>'); 26}; 27 28/** 29 * Set the percentage and status message for the progressbar. 30 */ 31Drupal.progressBar.prototype.setProgress = function (percentage, message) { 32 if (percentage >= 0 && percentage <= 100) { 33 $('div.filled', this.element).css('width', percentage + '%'); 34 $('div.percentage', this.element).html(percentage + '%'); 35 } 36 $('div.message', this.element).html(message); 37 if (this.updateCallback) { 38 this.updateCallback(percentage, message, this); 39 } 40}; 41 42/** 43 * Start monitoring progress via Ajax. 44 */ 45Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { 46 this.delay = delay; 47 this.uri = uri; 48 this.sendPing(); 49}; 50 51/** 52 * Stop monitoring progress via Ajax. 53 */ 54Drupal.progressBar.prototype.stopMonitoring = function () { 55 clearTimeout(this.timer); 56 // This allows monitoring to be stopped from within the callback. 57 this.uri = null; 58}; 59 60/** 61 * Request progress data from server. 62 */ 63Drupal.progressBar.prototype.sendPing = function () { 64 if (this.timer) { 65 clearTimeout(this.timer); 66 } 67 if (this.uri) { 68 var pb = this; 69 // When doing a post request, you need non-null data. Otherwise a 70 // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. 71 $.ajax({ 72 type: this.method, 73 url: this.uri, 74 data: '', 75 dataType: 'json', 76 success: function (progress) { 77 // Display errors. 78 if (progress.status == 0) { 79 pb.displayError(progress.data); 80 return; 81 } 82 // Update display. 83 pb.setProgress(progress.percentage, progress.message); 84 // Schedule next timer. 85 pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); 86 }, 87 error: function (xmlhttp) { 88 pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); 89 } 90 }); 91 } 92}; 93 94/** 95 * Display errors on the page. 96 */ 97Drupal.progressBar.prototype.displayError = function (string) { 98 var error = $('<div class="messages error"></div>').html(string); 99 $(this.element).before(error).hide(); 100 101 if (this.errorCallback) { 102 this.errorCallback(this); 103 } 104}; 105 106})(jQuery); 107; 108/** 109 * @file 110 * Linkit ckeditor dialog helper. 111 */ 112(function ($) { 113 114// Abort if Drupal.linkit is not defined. 115if (typeof Drupal.linkit === 'undefined') { 116 return ; 117} 118 119Drupal.linkit.registerDialogHelper('ckeditor', { 120 init : function() {}, 121 122 /** 123 * Prepare the dialog after init. 124 */ 125 afterInit : function () { 126 var editor = Drupal.settings.linkit.currentInstance.editor; 127 var element = CKEDITOR.plugins.link.getSelectedLink( editor ); 128 129 // If we have selected a link element, lets populate the fields in the 130 // modal with the values from that link element. 131 if (element) { 132 link = { 133 path: element.data('cke-saved-href') || element.getAttribute('href') || '', 134 attributes: {} 135 }, 136 // Get all attributes that have fields in the modal. 137 additionalAttributes = Drupal.linkit.additionalAttributes(); 138 139 for (var i = 0; i < additionalAttributes.length; i++) { 140 link.attributes[additionalAttributes[i]] = element.getAttribute(additionalAttributes[i]); 141 } 142 143 // Populate the fields. 144 Drupal.linkit.populateFields(link); 145 } 146 }, 147 148 /** 149 * Insert the link into the editor. 150 * 151 * @param {Object} link 152 * The link object. 153 */ 154 insertLink : function(link) { 155 var editor = Drupal.settings.linkit.currentInstance.editor; 156 CKEDITOR.tools.callFunction(editor._.linkitFnNum, link, editor); 157 } 158}); 159 160})(jQuery);; 161(function ($) { 162 163$(document).ready(function() { 164 165 // Attach mousedown, keyup, touchstart events to document only and catch 166 // clicks on all elements. 167 $(document.body).bind("mousedown keyup touchstart", function(event) { 168 169 // Catch the closest surrounding link of a clicked element. 170 $(event.target).closest("a,area").each(function() { 171 172 if (Drupal.settings.matomo.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 173 // Mailto link clicked. 174 _paq.push(["trackEvent", "Mails", "Click", this.href.substring(7)]); 175 } 176 177 }); 178 }); 179 180 // Colorbox: This event triggers when the transition has completed and the 181 // newly loaded content has been revealed. 182 if (Drupal.settings.matomo.trackColorbox) { 183 $(document).bind("cbox_complete", function () {
184 var href = $.colorbox.element().attr("href"); 185 if (href) { 186 _paq.push(["setCustomUrl", href]); 187 _paq.push(["trackPageView"]); 188 } 189 }); 190 } 191 192}); 193 194})(jQuery); 195;
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.