1(function ($) { 2Drupal.behaviors.lang_dropdown = { 3 attach: function (context, settings) { 4 var settings = settings || Drupal.settings; 5 6 if (settings.lang_dropdown) { 7 var flags, msddSettings; 8 for (key in settings.lang_dropdown) { 9 msddSettings = settings.lang_dropdown[key].jsWidget; 10 flags = msddSettings.languageicons; 11 if (flags) { 12 $.each(flags, function(index, value) { 13 if (msddSettings.widget == "msdropdown") { 14 $('select#lang-dropdown-select-' + key + ' option[value="' + index + '"]', context).attr('data-image', value); 15 } 16 else if (msddSettings.widget == "ddslick" && Boolean(msddSettings.showSelectedHTML)) { 17 $('select#lang-dropdown-select-' + key + ' option[value="' + index + '"]', context).attr('data-imagesrc', value); 18 } 19 }); 20 } 21 22 if (msddSettings.widget == "msdropdown") { 23 try { 24 $('select#lang-dropdown-select-' + key, context).msDropDown({ 25 visibleRows: msddSettings.visibleRows, 26 roundedCorner: Boolean(msddSettings.roundedCorner), 27 animStyle: msddSettings.animStyle, 28 event: msddSettings.event, 29 mainCSS: msddSettings.mainCSS 30 }); 31 } 32 catch (e) { 33 if (console) { console.log(e); } 34 } 35 } 36 else if (msddSettings.widget == "chosen") { 37 $('select#lang-dropdown-select-' + key, context).chosen({ 38 disable_search: msddSettings.disable_search, 39 no_results_text: msddSettings.no_results_text 40 }); 41 } 42 else if (msddSettings.widget == "ddslick") { 43 $('select#lang-dropdown-select-' + key, context).ddslick({ 44 width: (msddSettings.width == 0) ? null : msddSettings.width, 45 height: (msddSettings.height == 0) ? null : msddSettings.height, 46 showSelectedHTML: Boolean(msddSettings.showSelectedHTML), 47 imagePosition: msddSettings.imagePosition, 48 onSelected: function(data) { 49 // ddselect also fires this function on initialization, so we have 50 // to make sure this select has already been initialized. 51 if (!data.selectedItem.parent().data('ddslick-has-been-initialized')) { 52 data.selectedItem.parent().data('ddslick-has-been-initialized', true); 53 return; 54 } 55 56 var lang = data.selectedData.value; 57 var href = $('#lang-dropdown-select-'+key, context).parents('form').find('input[name="' + lang + '"]').val(); 58 window.location.href = href; 59 } 60 }); 61 } 62 } 63 } 64 65 $('select.lang-dropdown-select-element', context).change(function() { 66 var lang = this.options[this.selectedIndex].value; 67 var href = $(this).closest('form').find('input[name="' + lang + '"]').val(); 68 window.location.href = href; 69 }); 70 71 $('form.lang-dropdown-form', context).after('<div style="clear:both;"></div>'); 72 } 73}; 74})(jQuery); 75; 76/** 77 * @file 78 * A JavaScript file for the theme. 79 * This file should be used as a template for your other js files. 80 * It defines a drupal behavior the "Drupal way". 81 * 82 */ 83 84// JavaScript should be made compatible with libraries other than jQuery by 85// wrapping it with an "anonymous closure". See: 86// - https://drupal.org/node/1446420 87// - http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth 88 89(function ($, Drupal, window, document, undefined) { 90 'use strict'; 91 92 // To understand behaviors, see https://drupal.org/node/756722#behaviors 93 Drupal.behaviors.hideSubmitBlockit = { 94 attach: function(context) { 95 var timeoutId = null; 96 $('form', context).once('hideSubmitButton', function () { 97 var $form = $(this); 98 99 // Bind to input elements. 100 if (Drupal.settings.hide_submit.hide_submit_method === 'indicator') { 101 // Replace input elements with buttons. 102 $('input.form-submit', $form).each(function(index, el) { 103 var attrs = {}; 104 105 $.each($(this)[0].attributes, function(idx, attr) { 106 attrs[attr.nodeName] = attr.nodeValue; 107 }); 108 109 $(this).replaceWith(function() { 110 return $("<button/>", attrs).append($(this).attr('value')); 111 }); 112 }); 113 // Add needed attributes to the submit buttons. 114 $('button.form-submit', $form).each(function(index, el) { 115 $(this).addClass('ladda-button button').attr({ 116 'data-style': Drupal.settings.hide_submit.hide_submit_indicator_style, 117 'data-spinner-color': Drupal.settings.hide_submit.hide_submit_spinner_color, 118 'data-spinner-lines': Drupal.settings.hide_submit.hide_submit_spinner_lines 119 }); 120 }); 121 Ladda.bind('.ladda-button', $form, { 122 timeout: Drupal.settings.hide_submit.hide_submit_reset_time 123 }); 124 } 125 else { 126 $('input.form-submit, button.form-submit', $form).click(function (e) { 127 var el = $(this); 128 el.after('<input type="hidden" name="' + el.attr('name') + '" value="' + el.attr('value') + '" />'); 129 return true; 130 }); 131 } 132 133 // Bind to form submit. 134 $('form', context).submit(function (e) { 135 var $inp; 136 if (!e.isPropagationStopped()) { 137 if (Drupal.settings.hide_submit.hide_submit_method === 'disable') { 138 $('input.form-submit, button.form-submit', $form).attr('disabled', 'disabled').each(function (i) { 139 var $button = $(this); 140 if (Drupal.settings.hide_submit.hide_submit_css) { 141 $button.addClass(Drupal.settings.hide_submit.hide_submit_css); 142 } 143 if (Drupal.settings.hide_submit.hide_submit_abtext) { 144 $button.val($button.val() + ' ' + Drupal.settings.hide_submit.hide_submit_abtext); 145 } 146 $inp = $button; 147 }); 148 149 if ($inp && Drupal.settings.hide_submit.hide_submit_atext) { 150 $inp.after('<span class="hide-submit-text">' + Drupal.checkPlain(Drupal.settings.hide_submit.hide_submit_atext) + '</span>'); 151 } 152 } 153 else if (Drupal.settings.hide_submit.hide_submit_method !== 'indicator'){ 154 var pdiv = '<div class="hide-submit-text' + (Drupal.settings.hide_submit.hide_submit_hide_css ? ' ' + Drupal.checkPlain(Drupal.settings.hide_submit.hide_submit_hide_css) + '"' : '') + '>
154' + Drupal.checkPlain(Drupal.settings.hide_submit.hide_submit_hide_text) + '</div>'; 155 if (Drupal.settings.hide_submit.hide_submit_hide_fx) { 156 $('input.form-submit, button.form-submit', $form).addClass(Drupal.settings.hide_submit.hide_submit_css).fadeOut(100).eq(0).after(pdiv); 157 $('input.form-submit, button.form-submit', $form).next().fadeIn(100); 158 } 159 else { 160 $('input.form-submit, button.form-submit', $form).addClass(Drupal.settings.hide_submit.hide_submit_css).hide().eq(0).after(pdiv); 161 } 162 } 163 // Add a timeout to reset the buttons (if needed). 164 if (Drupal.settings.hide_submit.hide_submit_reset_time) { 165 timeoutId = window.setTimeout(function() { 166 hideSubmitResetButtons(null, $form); 167 }, Drupal.settings.hide_submit.hide_submit_reset_time); 168 } 169 } 170 return true; 171 }); 172 }); 173 174 // Bind to clientsideValidationFormHasErrors to support clientside validation. 175 // $(document).bind('clientsideValidationFormHasErrors', function(event, form) { 176 //hideSubmitResetButtons(event, form.form); 177 // }); 178 179 // Reset all buttons. 180 function hideSubmitResetButtons(event, form) { 181 // Clear timer. 182 window.clearTimeout(timeoutId); 183 timeoutId = null; 184 switch (Drupal.settings.hide_submit.hide_submit_method) { 185 case 'disable': 186 $('input.' + Drupal.checkPlain(Drupal.settings.hide_submit.hide_submit_css) + ', button.' + Drupal.checkPlain(Drupal.settings.hide_submit.hide_submit_css), form) 187 .each(function (i, el) { 188 $(el).removeClass(Drupal.checkPlain(Drupal.settings.hide_submit.hide_submit_hide_css)) 189 .removeAttr('disabled'); 190 }); 191 $('.hide-submit-text', form).remove(); 192 break; 193 194 case 'indicator': 195 Ladda.stopAll(); 196 break; 197 198 default: 199 $('input.' + Drupal.checkPlain(Drupal.settings.hide_submit.hide_submit_css) + ', button.' + Drupal.checkPlain(Drupal.settings.hide_submit.hide_submit_css), form) 200 .each(function (i, el) { 201 $(el).stop() 202 .removeClass(Drupal.checkPlain(Drupal.settings.hide_submit.hide_submit_hide_css)) 203 .show(); 204 }); 205 $('.hide-submit-text', form).remove(); 206 } 207 } 208 } 209 }; 210 211})(jQuery, Drupal, window, this.document); 212;
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.