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/*jshint forin:false, jquery:true, browser:true, indent:2, trailing:true, unused:false */ 109/*global Drupal */ 110 111(function ($) { 112 "use strict"; 113 114 $(function (evt) { 115 var element = document.createElement('x'); 116 element.style.cssText = 'pointer-events:auto'; 117 if (!(element.style.pointerEvents === 'auto')) { 118 $('html').addClass('no-pointer-events'); 119 } 120 }); 121 122 // 123 Drupal.behaviors.video = { 124 attach: function(context, settings) { 125 126 // When a video i clicked from frontpage 127/* 128 $('.front .video .preview.use-ajax', context).unbind('click').bind('click', function (evt) { 129 evt.preventDefault(); 130 var $url = $(this).closest('.node.movie').find('.link a').attr('href') + '?play'; 131 window.location = $url; 132 console.log($url); 133 //$(this).closest('.video').addClass('loading'); 134 }); 135*/ 136 // When a preview using ajax is clicked, change it's class. 137 // This will act as kind of a loader. 138 $('.video .preview.use-ajax', context).bind('click', function (evt) { 139 var $this = $(this); 140 $this.closest('.video').addClass('loading'); 141 setTimeout(function () { 142 $this.unbind('click').bind('click', function (evt) { evt.preventDefault(); }); 143 }, 16); 144 145 }); 146 } 147 }; 148 149 // We use this instead of the ajax_command_insert() function. 150 // This way the default ways of inserting wont clutter up the HTML with extra 151 // not needed <div /> elements. 152 $.fn.replace_video = function (video_data) { 153 return this.each(function (delta, element) { 154 var 155 $element = $(element), 156 $video = $(video_data); 157 158 $video 159 .bind('load', function (evt) { 160 $element 161 .removeClass('loading') 162 .addClass('ready'); 163 }); 164 165 if(!$element.find('iframe').length) { 166 $('.full', element).append($video); 167 } 168 169 Drupal.attachBehaviors($element, Drupal.settings); 170 $(window).triggerHandler('resize.video'); 171 }); 172 }; 173 174 // Autoplay video if ?play is in URL / when video is clicked from front page 175 if (window.location.search.indexOf('play') > -1) { 176 $( document ).ready(function() { 177 setTimeout(function () { 178 $('.not-front .video .preview.use-ajax').trigger( "click" ); 179 }, 200); 180 }); 181 } 182 183 // We need to set height and width for video contianer for iphone, ipad... 184 $(window).bind('resize.video', function (evt) {
185 $('.field-video .video .full').each(function (delta, element) { 186 $(element).css({ 187 width: $(element).parent().width(), 188 height: $(element).parent().height(), 189 }); 190 }); 191 }).triggerHandler('resize.video'); 192 setTimeout(function () { 193 $(window).triggerHandler('resize.video'); 194 }, 500); 195 196}(jQuery)); 197 198; 199 200(function($) { 201 202/** 203 * Drupal FieldGroup object. 204 */ 205Drupal.FieldGroup = Drupal.FieldGroup || {}; 206Drupal.FieldGroup.Effects = Drupal.FieldGroup.Effects || {}; 207Drupal.FieldGroup.groupWithfocus = null; 208 209Drupal.FieldGroup.setGroupWithfocus = function(element) { 210 element.css({display: 'block'}); 211 Drupal.FieldGroup.groupWithfocus = element; 212} 213 214/** 215 * Implements Drupal.FieldGroup.processHook(). 216 */ 217Drupal.FieldGroup.Effects.processFieldset = { 218 execute: function (context, settings, type) { 219 if (type == 'form') { 220 // Add required fields mark to any fieldsets containing required fields 221 $('fieldset.fieldset', context).once('fieldgroup-effects', function(i) { 222 if ($(this).is('.required-fields') && $(this).find('.form-required').length > 0) { 223 $('legend span.fieldset-legend', $(this)).eq(0).append(' ').append($('.form-required').eq(0).clone()); 224 } 225 if ($('.error', $(this)).length) { 226 $('legend span.fieldset-legend', $(this)).eq(0).addClass('error'); 227 Drupal.FieldGroup.setGroupWithfocus($(this)); 228 } 229 }); 230 } 231 } 232} 233 234/** 235 * Implements Drupal.FieldGroup.processHook(). 236 */ 237Drupal.FieldGroup.Effects.processAccordion = { 238 execute: function (context, settings, type) { 239 $('div.field-group-accordion-wrapper', context).once('fieldgroup-effects', function () { 240 var wrapper = $(this); 241 242 wrapper.accordion({ 243 autoHeight: false, 244 active: '.field-group-accordion-active', 245 collapsible: true, 246 changestart: function(event, ui) { 247 if ($(this).hasClass('effect-none')) { 248 ui.options.animated = false; 249 } 250 else { 251 ui.options.animated = 'slide'; 252 } 253 } 254 }); 255 256 if (type == 'form') { 257 258 var $firstErrorItem = false; 259 260 // Add required fields mark to any element containing required fields 261 wrapper.find('div.field-group-accordion-item').each(function(i) { 262 263 if ($(this).is('.required-fields') && $(this).find('.form-required').length > 0) { 264 $('h3.ui-accordion-header a').eq(i).append(' ').append($('.form-required').eq(0).clone()); 265 } 266 if ($('.error', $(this)).length) { 267 // Save first error item, for focussing it. 268 if (!$firstErrorItem) { 269 $firstErrorItem = $(this).parent().accordion("activate" , i); 270 } 271 $('h3.ui-accordion-header').eq(i).addClass('error'); 272 } 273 }); 274 275 // Save first error item, for focussing it. 276 if (!$firstErrorItem) { 277 $('.ui-accordion-content-active', $firstErrorItem).css({height: 'auto', width: 'auto', display: 'block'}); 278 } 279 280 } 281 }); 282 } 283} 284 285/** 286 * Implements Drupal.FieldGroup.processHook(). 287 */ 288Drupal.FieldGroup.Effects.processHtabs = { 289 execute: function (context, settings, type) { 290 if (type == 'form') { 291 // Add required fields mark to any element containing required fields 292 $('fieldset.horizontal-tabs-pane', context).once('fieldgroup-effects', function(i) { 293 if ($(this).is('.required-fields') && $(this).find('.form-required').length > 0) { 294 $(this).data('horizontalTab').link.find('strong:first').after($('.form-required').eq(0).clone()).after(' '); 295 } 296 if ($('.error', $(this)).length) { 297 $(this).data('horizontalTab').link.parent().addClass('error'); 298 Drupal.FieldGroup.setGroupWithfocus($(this)); 299 $(this).data('horizontalTab').focus(); 300 } 301 }); 302 } 303 } 304} 305 306/** 307 * Implements Drupal.FieldGroup.processHook(). 308 */ 309Drupal.FieldGroup.Effects.processTabs = { 310 execute: function (context, settings, type) { 311 if (type == 'form') { 312 // Add required fields mark to any fieldsets containing required fields 313 $('fieldset.vertical-tabs-pane', context).once('fieldgroup-effects', function(i) { 314 if ($(this).is('.required-fields') && $(this).find('.form-required').length > 0) { 315 $(this).data('verticalTab').link.find('strong:first').after($('.form-required').eq(0).clone()).after(' '); 316 } 317 if ($('.error', $(this)).length) { 318 $(this).data('verticalTab').link.parent().addClass('error'); 319 Drupal.FieldGroup.setGroupWithfocus($(this)); 320 $(this).data('verticalTab').focus(); 321 } 322 }); 323 } 324 } 325} 326 327/** 328 * Implements Drupal.FieldGroup.processHook(). 329 * 330 * TODO clean this up meaning check if this is really 331 * necessary. 332 */ 333Drupal.FieldGroup.Effects.processDiv = { 334 execute: function (context, settings, type) { 335 336 $('div.collapsible', context).once('fieldgroup-effects', function() { 337 var $wrapper = $(this); 338 339 // Turn the legend into a clickable link, but retain span.field-group-format-toggler 340 // for CSS positioning. 341 342 var $toggler = $('span.field-group-format-toggler:first', $wrapper); 343 var $link = $('<a class="field-group-format-title" href="#"></a>'); 344 $link.prepend($toggler.contents()); 345 346 // Add required field markers if needed 347 if ($(this).is('.required-fields') && $(this).find('.form-required').length > 0) { 348 $link.append(' ').append($('.form-required').eq(0).clone()); 349 } 350 351 $link.appendTo($toggler); 352 353 // .wrapInner() does not retain bound events. 354 $link.click(function () { 355 var wrapper = $wrapper.get(0); 356 // Don't animate multiple times. 357 if (!wrapper.animating) { 358 wrapper.animating = true; 359 var speed = $wrapper.hasClass('speed-fast') ? 300 : 1000; 360 if ($wrapper.hasClass('effect-none') && $wrapper.hasClass('speed-none')) { 361 $('> .field-group-format-wrapper', wrapper).toggle(); 362 } 363 else if ($wrapper.hasClass('effect-blind')) { 364 $('> .field-group-format-wrapper', wrapper).toggle('blind', {}, speed); 365 } 366 else { 367 $('> .field-group-format-wrapper', wrapper).toggle(speed); 368 } 369 wrapper.animating = false;
370 } 371 $wrapper.toggleClass('collapsed'); 372 return false; 373 }); 374 375 }); 376 } 377}; 378 379/** 380 * Behaviors. 381 */ 382Drupal.behaviors.fieldGroup = { 383 attach: function (context, settings) { 384 settings.field_group = settings.field_group || Drupal.settings.field_group; 385 if (settings.field_group == undefined) { 386 return; 387 } 388 389 // Execute all of them. 390 $.each(Drupal.FieldGroup.Effects, function (func) { 391 // We check for a wrapper function in Drupal.field_group as 392 // alternative for dynamic string function calls. 393 var type = func.toLowerCase().replace("process", ""); 394 if (settings.field_group[type] != undefined && $.isFunction(this.execute)) { 395 this.execute(context, settings, settings.field_group[type]); 396 } 397 }); 398 399 // Fixes css for fieldgroups under vertical tabs. 400 $('.fieldset-wrapper .fieldset > legend').css({display: 'block'}); 401 $('.vertical-tabs fieldset.fieldset').addClass('default-fallback'); 402 403 404 // Add a new ID to each fieldset. 405 $('.group-wrapper fieldset').each(function() { 406 // Tats bad, but we have to keep the actual id to prevent layouts to break. 407 var fieldgorupID = 'field_group-' + $(this).attr('id') + ' ' + $(this).attr('id'); 408 $(this).attr('id', fieldgorupID); 409 }) 410 // Set the hash in url to remember last userselection. 411 $('.group-wrapper ul li').each(function() { 412 var fieldGroupNavigationListIndex = $(this).index(); 413 $(this).children('a').click(function() { 414 var fieldset = $('.group-wrapper fieldset').get(fieldGroupNavigationListIndex); 415 // Grab the first id, holding the wanted hashurl. 416 var hashUrl = $(fieldset).attr('id').replace(/^field_group-/, '').split(' ')[0]; 417 window.location.hash = hashUrl; 418 }); 419 }); 420 } 421}; 422 423})(jQuery);;
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.