diff options
Diffstat (limited to 'modules/system/system.js')
-rw-r--r-- | modules/system/system.js | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/modules/system/system.js b/modules/system/system.js index 808dac7f5..3e0e3a501 100644 --- a/modules/system/system.js +++ b/modules/system/system.js @@ -7,7 +7,13 @@ * This function is not used to verify whether or not clean URLs * are currently enabled. */ -Drupal.cleanURLsSettingsCheck = function() { +Drupal.behaviors.cleanURLsSettingsCheck = function(context) { + // 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 + // the processing. + if ($("#clean-url.clean-url-processed, #clean-url.install").size()) { + return; + } var url = location.pathname +"admin/settings/clean-urls"; $("#clean-url .description span").html('<div id="testing">'+ Drupal.t('Testing clean URLs...') +"</div>"); $("#clean-url p").hide(); @@ -23,6 +29,7 @@ Drupal.cleanURLsSettingsCheck = function() { $("#clean-url .description span").append('<div class="warning">'+ Drupal.t('Your system configuration does not currently support this feature. The <a href="http://drupal.org/node/15365">handbook page on Clean URLs</a> has additional troubleshooting information.') +"</div>"); } }}); + $("#clean-url").addClass('clean-url-processed'); }; /** @@ -50,6 +57,7 @@ Drupal.cleanURLsInstallCheck = function() { $("#clean-url .description span").append('<div class="warning">'+ Drupal.settings.cleanURL.failure +"</div>"); } }}); + $("#clean-url").addClass('clean-url-processed'); }; Drupal.installDefaultTimezone = function() { @@ -60,14 +68,14 @@ Drupal.installDefaultTimezone = function() { /** * Show/hide custom format sections on the date-time settings page. */ -Drupal.dateTimeAutoAttach = function() { +Drupal.behaviors.dateTime = function(context) { // Show/hide custom format depending on the select's value. - $("select.date-format").change(function() { - $(this).parents("div.date-container").children("div.custom-container")[$(this).val() == "custom" ? "show" : "hide"](); + $('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"](); }); // Attach keyup handler to custom format inputs. - $("input.custom-format").keyup(function() { + $('input.custom-format:not(.date-time-processed)', context).addClass('date-time-processed').keyup(function() { var input = $(this); var url = Drupal.settings.dateTime.lookup +(Drupal.settings.dateTime.lookup.match(/\?q=/) ? "&format=" : "?format=") + Drupal.encodeURIComponent(input.val()); $.getJSON(url, function(data) { @@ -76,5 +84,5 @@ Drupal.dateTimeAutoAttach = function() { }); // Trigger the event handler to show the form input if necessary. - $("select.date-format").trigger("change"); -} + $('select.date-format', context).trigger('change'); +};
\ No newline at end of file |