/[drupal]/contributions/modules/date/date_api.js
ViewVC logotype

Contents of /contributions/modules/date/date_api.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Fri Sep 4 09:52:11 2009 UTC (2 months, 3 weeks ago) by karens
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +21 -0 lines
File MIME type: text/javascript
Prepare HEAD for D7.
1 /**
2 * Show/hide custom format sections on the date-time settings page.
3 */
4 Drupal.behaviors.dateDateTime = function(context) {
5 // Show/hide custom format depending on the select's value.
6 $('select.date-format:not(.date-time-processed)', context).change(function() {
7 $(this).addClass('date-time-processed').parents("div.date-container").children("div.custom-container")[$(this).val() == "custom" ? "show" : "hide"]();
8 });
9
10 // Attach keyup handler to custom format inputs.
11 $('input.custom-format:not(.date-time-processed)', context).addClass('date-time-processed').keyup(function() {
12 var input = $(this);
13 var url = Drupal.settings.dateDateTime.lookup +(Drupal.settings.dateDateTime.lookup.match(/\?q=/) ? "&format=" : "?format=") + Drupal.encodeURIComponent(input.val());
14 $.getJSON(url, function(data) {
15 $("div.description span", input.parent()).html(data);
16 });
17 });
18
19 // Trigger the event handler to show the form input if necessary.
20 $('select.date-format', context).trigger('change');
21 };

  ViewVC Help
Powered by ViewVC 1.1.2