/[drupal]/contributions/modules/carbon/carbon.js
ViewVC logotype

Contents of /contributions/modules/carbon/carbon.js

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


Revision 1.4 - (show annotations) (download) (as text)
Tue Apr 28 13:00:55 2009 UTC (6 months, 3 weeks ago) by johnackers
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, HEAD
Changes since 1.3: +9 -4 lines
File MIME type: text/javascript
Ensure that default scope value set correctly and corresponding text is shown.
1 /**
2 * $Id: carbon.js,v 1.3 2009/04/20 14:34:40 johnackers Exp $
3 *
4 * Drupal carbon module
5 *
6 * Basic javascript functions
7 */
8
9
10 Drupal.behaviors.carbon_scope = function ()
11 {
12 $("input:checked.scope").each(function () {
13 scope_change(this.value, "fast");
14 });
15
16 $('input:radio.scope').bind("change", function () {
17 scope_change(this.value, "slow")
18 });
19 }
20
21 /**
22 * the function is used to swap the help text around on a carbon stamp form
23 * as the user switches from one type (scope) to another.
24 *
25 * @param scope_id
26 * @param speed
27 * @return
28 */
29
30 function scope_change(scope_id, speed) {
31
32 if (speed == null)
33 speed = "slow";
34
35 switch (scope_id) {
36 case "0":
37 $("div.scope-0").show(speed);
38 $("div.scope-1").hide(speed);
39 $("div.scope-2").hide(speed);
40 $("div.startdate").show(speed);
41 break;
42
43 case "1":
44 $("div.scope-0").hide(speed);
45 $("div.scope-1").show(speed);
46 $("div.scope-2").hide(speed);
47 $("div.startdate").hide(speed);
48 break;
49
50 case "2":
51 $("div.scope-0").hide(speed);
52 $("div.scope-1").hide(speed);
53 $("div.scope-2").show(speed);
54 $("div.startdate").show(speed);
55 break;
56 }
57 }

  ViewVC Help
Powered by ViewVC 1.1.2