#360081 by quicksketch: Stop using global variables for JavaScript settings.
parent
35794257c3
commit
b77475baf5
|
|
@ -17,10 +17,10 @@
|
||||||
* Attaches the ahah behavior to each ahah form element.
|
* Attaches the ahah behavior to each ahah form element.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.ahah = {
|
Drupal.behaviors.ahah = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
for (var base in Drupal.settings.ahah) {
|
for (var base in settings.ahah) {
|
||||||
if (!$('#'+ base + '.ahah-processed').size()) {
|
if (!$('#'+ base + '.ahah-processed').size()) {
|
||||||
var element_settings = Drupal.settings.ahah[base];
|
var element_settings = settings.ahah[base];
|
||||||
|
|
||||||
$(element_settings.selector).each(function() {
|
$(element_settings.selector).each(function() {
|
||||||
element_settings.element = this;
|
element_settings.element = this;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* Attaches the autocomplete behavior to all required fields.
|
* Attaches the autocomplete behavior to all required fields.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.autocomplete = {
|
Drupal.behaviors.autocomplete = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
var acdb = [];
|
var acdb = [];
|
||||||
$('input.autocomplete:not(.autocomplete-processed)', context).each(function () {
|
$('input.autocomplete:not(.autocomplete-processed)', context).each(function () {
|
||||||
var uri = this.value;
|
var uri = this.value;
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,16 @@
|
||||||
* Attaches the batch behavior to progress bars.
|
* Attaches the batch behavior to progress bars.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.batch = {
|
Drupal.behaviors.batch = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
// This behavior attaches by ID, so is only valid once on a page.
|
// This behavior attaches by ID, so is only valid once on a page.
|
||||||
if ($('#progress.batch-processed').size()) {
|
if ($('#progress.batch-processed').size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$('#progress', context).addClass('batch-processed').each(function () {
|
$('#progress', context).addClass('batch-processed').each(function () {
|
||||||
var holder = this;
|
var holder = this;
|
||||||
var uri = Drupal.settings.batch.uri;
|
var uri = settings.batch.uri;
|
||||||
var initMessage = Drupal.settings.batch.initMessage;
|
var initMessage = settings.batch.initMessage;
|
||||||
var errorMessage = Drupal.settings.batch.errorMessage;
|
var errorMessage = settings.batch.errorMessage;
|
||||||
|
|
||||||
// Success: redirect to the summary.
|
// Success: redirect to the summary.
|
||||||
var updateCallback = function (progress, status, pb) {
|
var updateCallback = function (progress, status, pb) {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ Drupal.collapseScrollIntoView = function (node) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Drupal.behaviors.collapse = {
|
Drupal.behaviors.collapse = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
$('fieldset.collapsible > legend:not(.collapse-processed)', context).each(function() {
|
$('fieldset.collapsible > legend:not(.collapse-processed)', context).each(function() {
|
||||||
var fieldset = $(this.parentNode);
|
var fieldset = $(this.parentNode);
|
||||||
// Expand if there are errors inside
|
// Expand if there are errors inside
|
||||||
|
|
|
||||||
|
|
@ -51,13 +51,17 @@ Drupal.jsEnabled = document.getElementsByTagName && document.createElement && do
|
||||||
* @param context
|
* @param context
|
||||||
* An element to attach behaviors to. If none is given, the document element
|
* An element to attach behaviors to. If none is given, the document element
|
||||||
* is used.
|
* is used.
|
||||||
|
* @param settings
|
||||||
|
* An object containing settings for the current context. If none given, the
|
||||||
|
* global Drupal.settings object is used.
|
||||||
*/
|
*/
|
||||||
Drupal.attachBehaviors = function(context) {
|
Drupal.attachBehaviors = function(context, settings) {
|
||||||
context = context || document;
|
context = context || document;
|
||||||
|
settings = settings || Drupal.settings;
|
||||||
// Execute all of them.
|
// Execute all of them.
|
||||||
$.each(Drupal.behaviors, function() {
|
$.each(Drupal.behaviors, function() {
|
||||||
if ($.isFunction(this.attach)) {
|
if ($.isFunction(this.attach)) {
|
||||||
this.attach(context);
|
this.attach(context, settings);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -81,12 +85,13 @@ Drupal.attachBehaviors = function(context) {
|
||||||
*
|
*
|
||||||
* @see Drupal.attachBehaviors
|
* @see Drupal.attachBehaviors
|
||||||
*/
|
*/
|
||||||
Drupal.detachBehaviors = function(context) {
|
Drupal.detachBehaviors = function(context, settings) {
|
||||||
context = context || document;
|
context = context || document;
|
||||||
|
settings = settings || Drupal.settings;
|
||||||
// Execute all of them.
|
// Execute all of them.
|
||||||
$.each(Drupal.behaviors, function() {
|
$.each(Drupal.behaviors, function() {
|
||||||
if ($.isFunction(this.detach)) {
|
if ($.isFunction(this.detach)) {
|
||||||
this.detach(context);
|
this.detach(context, settings);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -320,7 +325,7 @@ if (Drupal.jsEnabled) {
|
||||||
document.cookie = 'has_js=1; path=/';
|
document.cookie = 'has_js=1; path=/';
|
||||||
// Attach all behaviors.
|
// Attach all behaviors.
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
Drupal.attachBehaviors(this);
|
Drupal.attachBehaviors(this, Drupal.settings);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
Drupal.behaviors.multiselectSelector = {
|
Drupal.behaviors.multiselectSelector = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
// Automatically selects the right radio button in a multiselect control.
|
// Automatically selects the right radio button in a multiselect control.
|
||||||
$('.multiselect select:not(.multiselectSelector-processed)', context)
|
$('.multiselect select:not(.multiselectSelector-processed)', context)
|
||||||
.addClass('multiselectSelector-processed').change(function() {
|
.addClass('multiselectSelector-processed').change(function() {
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@
|
||||||
* See blocks.js for an example of adding additional functionality to tableDrag.
|
* See blocks.js for an example of adding additional functionality to tableDrag.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.tableDrag = {
|
Drupal.behaviors.tableDrag = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
for (var base in Drupal.settings.tableDrag) {
|
for (var base in settings.tableDrag) {
|
||||||
if (!$('#' + base + '.tabledrag-processed', context).size()) {
|
if (!$('#' + base + '.tabledrag-processed', context).size()) {
|
||||||
var tableSettings = Drupal.settings.tableDrag[base];
|
var tableSettings = settings.tableDrag[base];
|
||||||
|
|
||||||
$('#' + base).filter(':not(.tabledrag-processed)').each(function() {
|
$('#' + base).filter(':not(.tabledrag-processed)').each(function() {
|
||||||
// Create the new tableDrag instance. Save in the Drupal variable
|
// Create the new tableDrag instance. Save in the Drupal variable
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ Drupal.tableHeaderDoScroll = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
Drupal.behaviors.tableHeader = {
|
Drupal.behaviors.tableHeader = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
// This breaks in anything less than IE 7. Prevent it from running.
|
// This breaks in anything less than IE 7. Prevent it from running.
|
||||||
if ($.browser.msie && parseInt($.browser.version, 10) < 7) {
|
if ($.browser.msie && parseInt($.browser.version, 10) < 7) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
Drupal.behaviors.tableSelect = {
|
Drupal.behaviors.tableSelect = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
$('form table:has(th.select-all):not(.tableSelect-processed)', context).each(Drupal.tableSelect);
|
$('form table:has(th.select-all):not(.tableSelect-processed)', context).each(Drupal.tableSelect);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,13 @@
|
||||||
* Note: depends on resizable textareas.
|
* Note: depends on resizable textareas.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.teaser = {
|
Drupal.behaviors.teaser = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
$('textarea.teaser:not(.teaser-processed)', context).each(function() {
|
$('textarea.teaser:not(.teaser-processed)', context).each(function() {
|
||||||
var teaser = $(this).addClass('teaser-processed');
|
var teaser = $(this).addClass('teaser-processed');
|
||||||
|
|
||||||
// Move teaser textarea before body, and remove its form-item wrapper.
|
// Move teaser textarea before body, and remove its form-item wrapper.
|
||||||
var body = $('#'+ Drupal.settings.teaser[this.id]);
|
var body = $('#'+ settings.teaser[this.id]);
|
||||||
var checkbox = $('#'+ Drupal.settings.teaserCheckbox[this.id]).parent();
|
var checkbox = $('#'+ settings.teaserCheckbox[this.id]).parent();
|
||||||
var checked = $(checkbox).children('input').attr('checked') ? true : false;
|
var checked = $(checkbox).children('input').attr('checked') ? true : false;
|
||||||
var parent = teaser[0].parentNode;
|
var parent = teaser[0].parentNode;
|
||||||
$(body).before(teaser);
|
$(body).before(teaser);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
Drupal.behaviors.textarea = {
|
Drupal.behaviors.textarea = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
$('textarea.resizable:not(.textarea-processed)', context).each(function() {
|
$('textarea.resizable:not(.textarea-processed)', context).each(function() {
|
||||||
// Avoid non-processed teasers.
|
// Avoid non-processed teasers.
|
||||||
if ($(this).is(('textarea.teaser:not(.teaser-processed)'))) {
|
if ($(this).is(('textarea.teaser:not(.teaser-processed)'))) {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* Set the client's system time zone as default values of form fields.
|
* Set the client's system time zone as default values of form fields.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.setTimezone = {
|
Drupal.behaviors.setTimezone = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
$('select.timezone-detect:not(.timezone-processed)', context).addClass('timezone-processed').each(function() {
|
$('select.timezone-detect:not(.timezone-processed)', context).addClass('timezone-processed').each(function() {
|
||||||
var dateString = Date();
|
var dateString = Date();
|
||||||
// In some client environments, date strings include a time zone
|
// In some client environments, date strings include a time zone
|
||||||
|
|
@ -51,7 +51,7 @@ Drupal.behaviors.setTimezone = {
|
||||||
var element = this;
|
var element = this;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
async: false,
|
async: false,
|
||||||
url: Drupal.settings.basePath,
|
url: settings.basePath,
|
||||||
data: { q: path, date: dateString },
|
data: { q: path, date: dateString },
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
* objects initialized in that behavior to update the row.
|
* objects initialized in that behavior to update the row.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.blockDrag = {
|
Drupal.behaviors.blockDrag = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
var table = $('table#blocks');
|
var table = $('table#blocks');
|
||||||
var tableDrag = Drupal.tableDrag.blocks; // Get the blocks tableDrag object.
|
var tableDrag = Drupal.tableDrag.blocks; // Get the blocks tableDrag object.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
Drupal.behaviors.color = {
|
Drupal.behaviors.color = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
// This behavior attaches by ID, so is only valid once on a page.
|
// This behavior attaches by ID, so is only valid once on a page.
|
||||||
if ($('#color_scheme_form .color-form.color-processed').size()) {
|
if ($('#color_scheme_form .color-form.color-processed').size()) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -18,7 +18,7 @@ Drupal.behaviors.color = {
|
||||||
var farb = $.farbtastic('#placeholder');
|
var farb = $.farbtastic('#placeholder');
|
||||||
|
|
||||||
// Decode reference colors to HSL.
|
// Decode reference colors to HSL.
|
||||||
var reference = Drupal.settings.color.reference;
|
var reference = settings.color.reference;
|
||||||
for (i in reference) {
|
for (i in reference) {
|
||||||
reference[i] = farb.RGBToHSL(farb.unpack(reference[i]));
|
reference[i] = farb.RGBToHSL(farb.unpack(reference[i]));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
Drupal.behaviors.comment = {
|
Drupal.behaviors.comment = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
var parts = new Array("name", "homepage", "mail");
|
var parts = new Array("name", "homepage", "mail");
|
||||||
var cookie = '';
|
var cookie = '';
|
||||||
for (i=0;i<3;i++) {
|
for (i=0;i<3;i++) {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
* a warning message when removing the last field from a profile category.
|
* a warning message when removing the last field from a profile category.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.profileDrag = {
|
Drupal.behaviors.profileDrag = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
var table = $('#profile-fields');
|
var table = $('#profile-fields');
|
||||||
var tableDrag = Drupal.tableDrag['profile-fields']; // Get the profile tableDrag object.
|
var tableDrag = Drupal.tableDrag['profile-fields']; // Get the profile tableDrag object.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,18 +5,18 @@
|
||||||
* Add the cool table collapsing on the testing overview page.
|
* Add the cool table collapsing on the testing overview page.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.simpleTestMenuCollapse = {
|
Drupal.behaviors.simpleTestMenuCollapse = {
|
||||||
attach: function() {
|
attach: function(context, settings) {
|
||||||
var timeout = null;
|
var timeout = null;
|
||||||
// Adds expand-collapse functionality.
|
// Adds expand-collapse functionality.
|
||||||
$('div.simpletest-image').each(function() {
|
$('div.simpletest-image').each(function() {
|
||||||
direction = Drupal.settings.simpleTest[$(this).attr('id')].imageDirection;
|
direction = settings.simpleTest[$(this).attr('id')].imageDirection;
|
||||||
$(this).html(Drupal.settings.simpleTest.images[direction]);
|
$(this).html(settings.simpleTest.images[direction]);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Adds group toggling functionality to arrow images.
|
// Adds group toggling functionality to arrow images.
|
||||||
$('div.simpletest-image').click(function() {
|
$('div.simpletest-image').click(function() {
|
||||||
var trs = $(this).parents('tbody').children('.' + Drupal.settings.simpleTest[this.id].testClass);
|
var trs = $(this).parents('tbody').children('.' + settings.simpleTest[this.id].testClass);
|
||||||
var direction = Drupal.settings.simpleTest[this.id].imageDirection;
|
var direction = settings.simpleTest[this.id].imageDirection;
|
||||||
var row = direction ? trs.size() - 1 : 0;
|
var row = direction ? trs.size() - 1 : 0;
|
||||||
|
|
||||||
// If clicked in the middle of expanding a group, stop so we can switch directions.
|
// If clicked in the middle of expanding a group, stop so we can switch directions.
|
||||||
|
|
@ -48,8 +48,8 @@ Drupal.behaviors.simpleTestMenuCollapse = {
|
||||||
rowToggle();
|
rowToggle();
|
||||||
|
|
||||||
// Toggle the arrow image next to the test group title.
|
// Toggle the arrow image next to the test group title.
|
||||||
$(this).html(Drupal.settings.simpleTest.images[(direction ? 0 : 1)]);
|
$(this).html(settings.simpleTest.images[(direction ? 0 : 1)]);
|
||||||
Drupal.settings.simpleTest[this.id].imageDirection = !direction;
|
settings.simpleTest[this.id].imageDirection = !direction;
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -60,9 +60,9 @@ Drupal.behaviors.simpleTestMenuCollapse = {
|
||||||
* selected/deselected.
|
* selected/deselected.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.simpleTestSelectAll = {
|
Drupal.behaviors.simpleTestSelectAll = {
|
||||||
attach: function() {
|
attach: function(context, settings) {
|
||||||
$('td.simpletest-select-all').each(function() {
|
$('td.simpletest-select-all').each(function() {
|
||||||
var testCheckboxes = Drupal.settings.simpleTest['simpletest-test-group-' + $(this).attr('id')].testNames;
|
var testCheckboxes = settings.simpleTest['simpletest-test-group-' + $(this).attr('id')].testNames;
|
||||||
var groupCheckbox = $('<input type="checkbox" class="form-checkbox" id="' + $(this).attr('id') + '-select-all" />');
|
var groupCheckbox = $('<input type="checkbox" class="form-checkbox" id="' + $(this).attr('id') + '-select-all" />');
|
||||||
|
|
||||||
// Each time a single-test checkbox is checked or unchecked, make sure
|
// Each time a single-test checkbox is checked or unchecked, make sure
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,14 @@
|
||||||
* are currently enabled.
|
* are currently enabled.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.cleanURLsSettingsCheck = {
|
Drupal.behaviors.cleanURLsSettingsCheck = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
// This behavior attaches by ID, so is only valid once on a page.
|
// This behavior attaches by ID, so is only valid once on a page.
|
||||||
// Also skip if we are on an install page, as Drupal.cleanURLsInstallCheck will handle
|
// Also skip if we are on an install page, as Drupal.cleanURLsInstallCheck will handle
|
||||||
// the processing.
|
// the processing.
|
||||||
if ($("#clean-url.clean-url-processed, #clean-url.install").size()) {
|
if ($("#clean-url.clean-url-processed, #clean-url.install").size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var url = Drupal.settings.basePath +"admin/settings/clean-urls/check";
|
var url = settings.basePath +"admin/settings/clean-urls/check";
|
||||||
$("#clean-url .description span").html('<div id="testing">'+ Drupal.t('Testing clean URLs...') +"</div>");
|
$("#clean-url .description span").html('<div id="testing">'+ Drupal.t('Testing clean URLs...') +"</div>");
|
||||||
$("#clean-url p").hide();
|
$("#clean-url p").hide();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
@ -77,10 +77,10 @@ Drupal.cleanURLsInstallCheck = function() {
|
||||||
* administrator e-mail address with the same value as the site e-mail address.
|
* administrator e-mail address with the same value as the site e-mail address.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.copyFieldValue = {
|
Drupal.behaviors.copyFieldValue = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
for (var sourceId in Drupal.settings.copyFieldValue) {
|
for (var sourceId in settings.copyFieldValue) {
|
||||||
// Get the list of target fields.
|
// Get the list of target fields.
|
||||||
targetIds = Drupal.settings.copyFieldValue[sourceId];
|
targetIds = settings.copyFieldValue[sourceId];
|
||||||
if (!$('#'+ sourceId + '.copy-field-values-processed', context).size()) {
|
if (!$('#'+ sourceId + '.copy-field-values-processed', context).size()) {
|
||||||
// Add the behavior to update target fields on blur of the primary field.
|
// Add the behavior to update target fields on blur of the primary field.
|
||||||
sourceField = $('#' + sourceId);
|
sourceField = $('#' + sourceId);
|
||||||
|
|
@ -102,7 +102,7 @@ Drupal.behaviors.copyFieldValue = {
|
||||||
* Show/hide custom format sections on the date-time settings page.
|
* Show/hide custom format sections on the date-time settings page.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.dateTime = {
|
Drupal.behaviors.dateTime = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
// Show/hide custom format depending on the select's value.
|
// Show/hide custom format depending on the select's value.
|
||||||
$('select.date-format:not(.date-time-processed)', context).change(function() {
|
$('select.date-format:not(.date-time-processed)', context).change(function() {
|
||||||
$(this).addClass('date-time-processed').parents("div.date-container").children("div.custom-container")[$(this).val() == "custom" ? "show" : "hide"]();
|
$(this).addClass('date-time-processed').parents("div.date-container").children("div.custom-container")[$(this).val() == "custom" ? "show" : "hide"]();
|
||||||
|
|
@ -111,7 +111,7 @@ Drupal.behaviors.dateTime = {
|
||||||
// Attach keyup handler to custom format inputs.
|
// Attach keyup handler to custom format inputs.
|
||||||
$('input.custom-format:not(.date-time-processed)', context).addClass('date-time-processed').keyup(function() {
|
$('input.custom-format:not(.date-time-processed)', context).addClass('date-time-processed').keyup(function() {
|
||||||
var input = $(this);
|
var input = $(this);
|
||||||
var url = Drupal.settings.dateTime.lookup +(Drupal.settings.dateTime.lookup.match(/\?q=/) ? "&format=" : "?format=") + Drupal.encodeURIComponent(input.val());
|
var url = settings.dateTime.lookup +(settings.dateTime.lookup.match(/\?q=/) ? "&format=" : "?format=") + Drupal.encodeURIComponent(input.val());
|
||||||
$.getJSON(url, function(data) {
|
$.getJSON(url, function(data) {
|
||||||
$("div.description span", input.parent()).html(data);
|
$("div.description span", input.parent()).html(data);
|
||||||
});
|
});
|
||||||
|
|
@ -126,9 +126,9 @@ Drupal.behaviors.dateTime = {
|
||||||
* Show the powered by Drupal image preview
|
* Show the powered by Drupal image preview
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.poweredByPreview = {
|
Drupal.behaviors.poweredByPreview = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
$('#edit-color, #edit-size').change(function() {
|
$('#edit-color, #edit-size').change(function() {
|
||||||
var path = Drupal.settings.basePath + 'misc/' + $('#edit-color').val() + '-' + $('#edit-size').val() + '.png';
|
var path = settings.basePath + 'misc/' + $('#edit-color').val() + '-' + $('#edit-size').val() + '.png';
|
||||||
$('img.powered-by-preview').attr('src', path);
|
$('img.powered-by-preview').attr('src', path);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
* objects initialized in that behavior to update the row.
|
* objects initialized in that behavior to update the row.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.termDrag = {
|
Drupal.behaviors.termDrag = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
var table = $('#taxonomy', context);
|
var table = $('#taxonomy', context);
|
||||||
var tableDrag = Drupal.tableDrag.taxonomy; // Get the blocks tableDrag object.
|
var tableDrag = Drupal.tableDrag.taxonomy; // Get the blocks tableDrag object.
|
||||||
var rows = $('tr', table).size();
|
var rows = $('tr', table).size();
|
||||||
|
|
@ -19,20 +19,20 @@ Drupal.behaviors.termDrag = {
|
||||||
$('tr.taxonomy-term-divider-top', table).removeClass('taxonomy-term-divider-top');
|
$('tr.taxonomy-term-divider-top', table).removeClass('taxonomy-term-divider-top');
|
||||||
$('tr.taxonomy-term-divider-bottom', table).removeClass('taxonomy-term-divider-bottom');
|
$('tr.taxonomy-term-divider-bottom', table).removeClass('taxonomy-term-divider-bottom');
|
||||||
|
|
||||||
if (Drupal.settings.taxonomy.backPeddle) {
|
if (settings.taxonomy.backPeddle) {
|
||||||
for (var n = 0; n < Drupal.settings.taxonomy.backPeddle; n++) {
|
for (var n = 0; n < settings.taxonomy.backPeddle; n++) {
|
||||||
$(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
|
$(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
|
||||||
}
|
}
|
||||||
$(table[0].tBodies[0].rows[Drupal.settings.taxonomy.backPeddle - 1]).addClass('taxonomy-term-divider-top');
|
$(table[0].tBodies[0].rows[settings.taxonomy.backPeddle - 1]).addClass('taxonomy-term-divider-top');
|
||||||
$(table[0].tBodies[0].rows[Drupal.settings.taxonomy.backPeddle]).addClass('taxonomy-term-divider-bottom');
|
$(table[0].tBodies[0].rows[settings.taxonomy.backPeddle]).addClass('taxonomy-term-divider-bottom');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Drupal.settings.taxonomy.forwardPeddle) {
|
if (settings.taxonomy.forwardPeddle) {
|
||||||
for (var n = rows - Drupal.settings.taxonomy.forwardPeddle - 1; n < rows - 1; n++) {
|
for (var n = rows - settings.taxonomy.forwardPeddle - 1; n < rows - 1; n++) {
|
||||||
$(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
|
$(table[0].tBodies[0].rows[n]).addClass('taxonomy-term-preview');
|
||||||
}
|
}
|
||||||
$(table[0].tBodies[0].rows[rows - Drupal.settings.taxonomy.forwardPeddle - 2]).addClass('taxonomy-term-divider-top');
|
$(table[0].tBodies[0].rows[rows - settings.taxonomy.forwardPeddle - 2]).addClass('taxonomy-term-divider-top');
|
||||||
$(table[0].tBodies[0].rows[rows - Drupal.settings.taxonomy.forwardPeddle - 1]).addClass('taxonomy-term-divider-bottom');
|
$(table[0].tBodies[0].rows[rows - settings.taxonomy.forwardPeddle - 1]).addClass('taxonomy-term-divider-bottom');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
* that its confirmation is correct.
|
* that its confirmation is correct.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.password = {
|
Drupal.behaviors.password = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
var translate = Drupal.settings.password;
|
var translate = settings.password;
|
||||||
$("input.password-field:not(.password-processed)", context).each(function() {
|
$("input.password-field:not(.password-processed)", context).each(function() {
|
||||||
var passwordInput = $(this).addClass('password-processed');
|
var passwordInput = $(this).addClass('password-processed');
|
||||||
var innerWrapper = $(this).parent();
|
var innerWrapper = $(this).parent();
|
||||||
|
|
@ -34,7 +34,7 @@ Drupal.behaviors.password = {
|
||||||
var passwordCheck = function () {
|
var passwordCheck = function () {
|
||||||
|
|
||||||
// Evaluate the password strength.
|
// Evaluate the password strength.
|
||||||
var result = Drupal.evaluatePasswordStrength(passwordInput.val());
|
var result = Drupal.evaluatePasswordStrength(passwordInput.val(), settings.password);
|
||||||
|
|
||||||
// Update the suggestions for how to improve the password.
|
// Update the suggestions for how to improve the password.
|
||||||
if (passwordDescription.html() != result.message) {
|
if (passwordDescription.html() != result.message) {
|
||||||
|
|
@ -92,8 +92,8 @@ Drupal.behaviors.password = {
|
||||||
*
|
*
|
||||||
* Returns the estimated strength and the relevant output message.
|
* Returns the estimated strength and the relevant output message.
|
||||||
*/
|
*/
|
||||||
Drupal.evaluatePasswordStrength = function (password) {
|
Drupal.evaluatePasswordStrength = function (password, translate) {
|
||||||
var weaknesses = 0, strength = 100, msg = [], translate = Drupal.settings.password;
|
var weaknesses = 0, strength = 100, msg = [];
|
||||||
|
|
||||||
var hasLowercase = password.match(/[a-z]+/);
|
var hasLowercase = password.match(/[a-z]+/);
|
||||||
var hasUppercase = password.match(/[A-Z]+/);
|
var hasUppercase = password.match(/[A-Z]+/);
|
||||||
|
|
@ -166,7 +166,7 @@ Drupal.evaluatePasswordStrength = function (password) {
|
||||||
* "Picture support" radio buttons.
|
* "Picture support" radio buttons.
|
||||||
*/
|
*/
|
||||||
Drupal.behaviors.userSettings = {
|
Drupal.behaviors.userSettings = {
|
||||||
attach: function(context) {
|
attach: function(context, settings) {
|
||||||
$('div.user-admin-picture-radios input[type=radio]:not(.userSettings-processed)', context).addClass('userSettings-processed').click(function () {
|
$('div.user-admin-picture-radios input[type=radio]:not(.userSettings-processed)', context).addClass('userSettings-processed').click(function () {
|
||||||
$('div.user-admin-picture-settings', context)[['hide', 'show'][this.value]]();
|
$('div.user-admin-picture-settings', context)[['hide', 'show'][this.value]]();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue