1/** 2 * @file 3 * AddThis javascript actions. 4 */ 5 6(function ($) { 7 Drupal.behaviors.addthis = { 8 scriptLoaded: false, 9 10 attach: function(context, settings) { 11 12 // The addthis configuration is not loaded but the settings are passed 13 // to do so. 14 if (!this.isConfigLoaded() && this.isSettingsLoaded()) { 15 // Initialize config. 16 this.initConfig(); 17 18 // Load widget js. 19 if (!this.scriptLoaded) { 20 this.loadDomready(); 21 } 22 } 23 // The addthis configuration is not loaded but no setting are available 24 // to load anything. 25 else if(!this.isConfigLoaded() && !this.isSettingsLoaded()) { 26 // Do nothing 27 } 28 29 // Trigger ready on ajax attach. 30 if (context != window.document) { 31 Drupal.behaviors.addthis.ajaxLoad(context, settings); 32 } 33 34 }, 35 36 // Returns if the settings defined by the addthis module are loaded. 37 isSettingsLoaded: function () { 38 if (typeof Drupal.settings.addthis == 'undefined') { 39 return false; 40 } 41 return true; 42 }, 43 44 // Returns if the configuration variables needed for widget.js are defined. 45 isConfigLoaded: function() { 46 if (typeof addthis_config == 'undefined' || typeof addthis_share == 'undefined') { 47 return false; 48 } 49 return true; 50 }, 51 52 initConfig: function () { 53 addthis_config = Drupal.settings.addthis.addthis_config; 54 addthis_share = Drupal.settings.addthis.addthis_share; 55 }, 56 57 // Load the js library when the dom is ready. 58 loadDomready: function() { 59 // If settings asks for loading the script after the dom is loaded, then 60 // load the script here. 61 if (!this.scriptLoaded && 62 this.isConfigLoaded() && 63 Drupal.settings.addthis.domready) { 64 $.getScript(Drupal.settings.addthis.widget_url, Drupal.behaviors.addthis.scriptReady); 65 } 66 }, 67 68 // Callback for loading the widget.js dynamically. 69 scriptReady: function () { 70 this.scriptLoaded = true; 71 }, 72 73 // Called when a ajax request returned. 74 ajaxLoad: function(context, settings) { 75 if (typeof window.addthis != 'undefined' && 76 typeof window.addthis.toolbox == 'function') 77 { 78 window.addthis.toolbox('.addthis_toolbox'); 79 } 80 } 81 82 }; 83 84 // This load the config in time to run any addthis functionality. 85 if (Drupal.behaviors.addthis.isConfigLoaded()) { 86 addthis_config = Drupal.settings.addthis.addthis_config; 87 addthis_share = Drupal.settings.addthis.addthis_share; 88 } 89 90 // Document ready in case we want to load AddThis into the dom after every 91 // thing is loaded. 92 // 93 // Is executed once after the attach happened. 94 $(document).ready(function() { 95 Drupal.behaviors.addthis.loadDomready(); 96 }); 97 98}(jQuery)); 99 100;/*})'"*/ 101;/*})'"*/ 102/** 103 * @file 104 * bootstrap.js 105 * 106 * Provides general enhancements and fixes to Bootstrap's JS files. 107 */ 108 109var Drupal = Drupal || {}; 110 111(function($, Drupal){ 112 "use strict"; 113 114 var $document = $(document); 115 116 Drupal.behaviors.bootstrap = { 117 attach: function(context) { 118 // Provide some Bootstrap tab/Drupal integration. 119 $(context).find('.tabbable').once('bootstrap-tabs', function () { 120 var $wrapper = $(this); 121 var $tabs = $wrapper.find('.nav-tabs'); 122 var $content = $wrapper.find('.tab-content'); 123 var borderRadius = parseInt($content.css('borderBottomRightRadius'), 10); 124 var bootstrapTabResize = function() { 125 if ($wrapper.hasClass('tabs-left') || $wrapper.hasClass('tabs-right')) { 126 $content.css('min-height', $tabs.outerHeight()); 127 } 128 }; 129 // Add min-height on content for left and right tabs. 130 bootstrapTabResize(); 131 // Detect tab switch. 132 if ($wrapper.hasClass('tabs-left') || $wrapper.hasClass('tabs-right')) { 133 $tabs.on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) { 134 bootstrapTabResize(); 135 if ($wrapper.hasClass('tabs-left')) { 136 if ($(e.target).parent().is(':first-child')) { 137 $content.css('borderTopLeftRadius', '0'); 138 } 139 else { 140 $content.css('borderTopLeftRadius', borderRadius + 'px'); 141 } 142 } 143 else { 144 if ($(e.target).parent().is(':first-child')) { 145 $content.css('borderTopRightRadius', '0'); 146 } 147 else { 148 $content.css('borderTopRightRadius', borderRadius + 'px'); 149 } 150 } 151 }); 152 } 153 }); 154 } 155 }; 156 157 /** 158 * Behavior for . 159 */ 160 Drupal.behaviors.bootstrapFormHasError = { 161 attach: function (context, settings) { 162 if (settings.bootstrap && settings.bootstrap.formHasError) { 163 var $context = $(context); 164 $context.find('.form-item.has-error:not(.form-type-password.has-feedback)').once('error', function () { 165 var $formItem = $(this); 166 var $input = $formItem.find(':input'); 167 $input.on('keyup focus blur', function () { 168 var value = $input.val() || false; 169 $formItem[value ? 'removeClass' : 'addClass']('has-error'); 170 $input[value ? 'removeClass' : 'addClass']('error'); 171 }); 172 }); 173 } 174 } 175 }; 176 177 /** 178 * Bootstrap Popovers. 179 */ 180 Drupal.behaviors.bootstrapPopovers = { 181 attach: function (context, settings) { 182 // Immediately return if popovers are not available.
183 if (!settings.bootstrap || !settings.bootstrap.popoverEnabled || !$.fn.popover) { 184 return; 185 } 186 187 // Popover autoclose. 188 if (settings.bootstrap.popoverOptions.triggerAutoclose) { 189 var $currentPopover = null; 190 $document 191 .on('show.bs.popover', '[data-toggle=popover]', function () { 192 var $trigger = $(this); 193 var popover = $trigger.data('bs.popover'); 194 195 // Only keep track of clicked triggers that we're manually handling. 196 if (popover.options.originalTrigger === 'click') { 197 if ($currentPopover && !$currentPopover.is($trigger)) { 198 $currentPopover.popover('hide'); 199 } 200 $currentPopover = $trigger; 201 } 202 }) 203 .on('click', function (e) { 204 var $target = $(e.target); 205 var popover = $target.is('[data-toggle=popover]') && $target.data('bs.popover'); 206 if ($currentPopover && !$target.is('[data-toggle=popover]') && !$target.closest('.popover.in')[0]) { 207 $currentPopover.popover('hide'); 208 $currentPopover = null; 209 } 210 }) 211 ; 212 } 213 214 var elements = $(context).find('[data-toggle=popover]').toArray(); 215 for (var i = 0; i < elements.length; i++) { 216 var $element = $(elements[i]); 217 var options = $.extend({}, $.fn.popover.Constructor.DEFAULTS, settings.bootstrap.popoverOptions, $element.data()); 218 219 // Store the original trigger. 220 options.originalTrigger = options.trigger; 221 222 // If the trigger is "click", then we'll handle it manually here. 223 if (options.trigger === 'click') { 224 options.trigger = 'manual'; 225 } 226 227 // Retrieve content from a target element. 228 var target = options.target || $element.is('a[href^="#"]') && $element.attr('href'); 229 var $target = $document.find(target).clone(); 230 if (!options.content && $target[0]) { 231 $target.removeClass('element-invisible hidden').removeAttr('aria-hidden'); 232 options.content = $target.wrap('<div/>').parent()[options.html ? 'html' : 'text']() || ''; 233 } 234 235 // Initialize the popover. 236 $element.popover(options); 237 238 // Handle clicks manually. 239 if (options.originalTrigger === 'click') { 240 // To ensure the element is bound multiple times, remove any 241 // previously set event handler before adding another one. 242 $element 243 .off('click.drupal.bootstrap.popover') 244 .on('click.drupal.bootstrap.popover', function (e) { 245 $(this).popover('toggle'); 246 e.preventDefault(); 247 e.stopPropagation(); 248 }) 249 ; 250 } 251 } 252 }, 253 detach: function (context, settings) { 254 // Immediately return if popovers are not available. 255 if (!settings.bootstrap || !settings.bootstrap.popoverEnabled || !$.fn.popover) { 256 return; 257 } 258 259 // Destroy all popovers. 260 $(context).find('[data-toggle="popover"]') 261 .off('click.drupal.bootstrap.popover') 262 .popover('destroy') 263 ; 264 } 265 }; 266 267 /** 268 * Bootstrap Tooltips. 269 */ 270 Drupal.behaviors.bootstrapTooltips = { 271 attach: function (context, settings) { 272 if (settings.bootstrap && settings.bootstrap.tooltipEnabled) { 273 var elements = $(context).find('[data-toggle="tooltip"]').toArray(); 274 for (var i = 0; i < elements.length; i++) { 275 var $element = $(elements[i]); 276 var options = $.extend({}, settings.bootstrap.tooltipOptions, $element.data()); 277 $element.tooltip(options); 278 } 279 } 280 } 281 }; 282 283 /** 284 * Anchor fixes. 285 */ 286 var $scrollableElement = $(); 287 Drupal.behaviors.bootstrapAnchors = { 288 attach: function(context, settings) { 289 var i, elements = ['html', 'body']; 290 if (!$scrollableElement.length) { 291 for (i = 0; i < elements.length; i++) { 292 var $element = $(elements[i]); 293 if ($element.scrollTop() > 0) { 294 $scrollableElement = $element; 295 break; 296 } 297 else { 298 $element.scrollTop(1); 299 if ($element.scrollTop() > 0) { 300 $element.scrollTop(0); 301 $scrollableElement = $element; 302 break; 303 } 304 } 305 } 306 } 307 if (!settings.bootstrap || settings.bootstrap.anchorsFix !== '1') { 308 return; 309 } 310 var anchors = $(context).find('a').toArray(); 311 for (i = 0; i < anchors.length; i++) { 312 if (!anchors[i].scrollTo) {
313 this.bootstrapAnchor(anchors[i]); 314 } 315 } 316 $scrollableElement.once('bootstrap-anchors', function () { 317 $scrollableElement.on('click.bootstrap-anchors', 'a[href*="#"]:not([data-toggle],[data-target],[data-slide])', function(e) { 318 if (this.scrollTo) { 319 this.scrollTo(e); 320 } 321 }); 322 }); 323 }, 324 bootstrapAnchor: function (element) { 325 element.validAnchor = element.nodeName === 'A' && (location.hostname === element.hostname || !element.hostname) && (element.hash.replace(/#/,'').length > 0); 326 element.scrollTo = function(event) { 327 var attr = 'id'; 328 var $target = $(element.hash); 329 // Check for anchors that use the name attribute instead. 330 if (!$target.length) { 331 attr = 'name'; 332 $target = $('[name="' + element.hash.replace('#', '') + '"]'); 333 } 334 // Immediately stop if no anchors are found. 335 if (!this.validAnchor && !$target.length) { 336 return; 337 } 338 // Anchor is valid, continue if there is an offset. 339 var offset = $target.offset().top - parseInt($scrollableElement.css('paddingTop'), 10) - parseInt($scrollableElement.css('marginTop'), 10); 340 if (offset > 0) { 341 if (event) { 342 event.preventDefault(); 343 } 344 var $fakeAnchor = $('<div/>') 345 .addClass('element-invisible') 346 .attr(attr, $target.attr(attr)) 347 .css({ 348 position: 'absolute', 349 top: offset + 'px', 350 zIndex: -1000 351 }) 352 .appendTo($scrollableElement); 353 $target.removeAttr(attr); 354 var complete = function () { 355 location.hash = element.hash; 356 $fakeAnchor.remove(); 357 $target.attr(attr, element.hash.replace('#', '')); 358 }; 359 if (Drupal.settings.bootstrap.anchorsSmoothScrolling) { 360 $scrollableElement.animate({ scrollTop: offset, avoidTransforms: true }, 400, complete); 361 } 362 else { 363 $scrollableElement.scrollTop(offset); 364 complete(); 365 } 366 } 367 }; 368 } 369 }; 370 371 /** 372 * Tabledrag theming elements. 373 */ 374 Drupal.theme.tableDragChangedMarker = function () { 375 return '<span class="tabledrag-changed glyphicon glyphicon-warning-sign text-warning"></span>'; 376 }; 377 378 Drupal.theme.tableDragChangedWarning = function () { 379 return '<div class="tabledrag-changed-warning alert alert-warning messages warning">' + Drupal.theme('tableDragChangedMarker') + ' ' + Drupal.t('Changes made in this table will not be saved until the form is submitted.') + '</div>'; 380 }; 381 382})(jQuery, Drupal); 383 384;/*})'"*/ 385;/*})'"*/
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.