source: extensions/set_plugins/js/field_set.js @ 11462

Last change on this file since 11462 was 11462, checked in by cljosse, 13 years ago

[extensions] set_plugins save/restore list to file

File size: 5.7 KB
Line 
1function raffraichir() {
2  n = 1;
3 // jQuery("#form_set_plugins").submit();
4}
5
6
7jQuery().ready(function () {
8  jQuery('.cluetip').tipTip({  maxWidth:'600px' ,'delay': 0, 'fadeIn': 200, 'fadeOut': 200 }); 
9  jQuery('.cluetip0').cluetip({ 
10    width: 300,
11    splitTitle: '|'    ,
12    clickThrough: true
13  });
14
15
16
17
18});
19
20
21
22
23
24jQuery("fieldset").hide();
25jQuery(document).ready(function () {
26  jQuery(window).unload(function () {
27    // jQuery("#form_set_plugins").submit();
28  });
29
30  if (typeof plus_path == "undefined") {
31    var plus_path = './plugins/set_plugins/js/icon/plus.png';
32    var minus_path = './plugins/set_plugins/js/icon/minus.png';
33  }
34  var h_min = 0;
35  var liste_des_plugins = {};
36  jQuery(window).load(function () {
37    if (jQuery(".titrePage").length >= 1) {
38      if (jQuery("span.sort").length >= 1)
39        jQuery("#titrePage").before(jQuery("span.sort"));
40      jQuery(".titrePage ").hide();
41    }
42
43    if (jQuery("fieldset").length >= 1) {
44      var reg = new RegExp("[,]", "g");
45      liste_visible = jQuery("input[name=list_visible]").val();
46      if (typeof liste_visible == "undefined") {
47        liste_visible = "on,on,on,on";
48        jQuery("input[name=list_visible]").val(liste_visible);
49      }
50      liste = liste_visible.split(reg);
51      reg = new RegExp("['off']", "g");
52      h_min = jQuery("fieldset legend").height();
53      h_min = 0;
54      jQuery("fieldset").each(
55        function (i) {
56
57          id0 = jQuery(this).attr("id");
58          if (id0 == "") jQuery(this).attr("id", "fieldset_" + i);
59          jQuery(this).attr("rel", i);
60
61          if (!jQuery(this).hasClass("field_set"))
62            jQuery(this).addClass("field_set");
63
64
65          if (liste[i] == "off") {
66            liste[i] = "off";
67
68
69            jQuery(this).height(h_min + 0);
70
71            jQuery("#" + this.id + ' legend').prepend(
72          '<img alt = "" title = ""' +
73          'src = "' + plus_path + '"' + '>&nbsp;'
74        );
75          } else {
76            liste[i] = "on";
77            jQuery(this).addClass("visible");
78            jQuery("#" + this.id + ' legend').prepend(
79          '<img alt = "" title = ""' +
80          'src = "' + minus_path + '"' + '>&nbsp;'
81        );
82          }
83
84          jQuery("#" + this.id + ' legend').css('cursor', 'pointer');
85
86
87          id0 = jQuery(this).attr("id");
88          jQuery("#" + id0 + ' legend').click(function (event) {
89
90            n = jQuery(this).parent().hasClass("visible");
91            //   jQuery(this).css("color", "red");
92
93            i = jQuery(jQuery(this).parent()).attr("rel");
94            liste_visible = jQuery("input[name=list_visible]").val();
95            if (typeof liste_visible == "undefined") {
96              liste_visible = "on,on,on,on";
97              jQuery("input[name=list_visible]").val(liste_visible);
98            }
99            // src = jQuery(this).find("img").attr("src");
100            if (n) {
101              jQuery(this).parent().height(h_min + 0);
102              jQuery(this).parent().removeClass("visible");
103              liste[i] = "off";
104              jQuery(this).find("img").attr({
105                src: plus_path
106
107              });
108            }
109            else {
110              jQuery(this).parent().css("height", "auto");
111              jQuery(this).parent().addClass("visible");
112              liste[i] = "on";
113              jQuery(this).find("img").attr({
114                src: minus_path
115
116              });
117            }
118            val = liste.join(",");
119            jQuery("input[name=list_visible]").val(val);
120            jQuery('#set').val("true");
121
122            jQuery.ajax({
123              type: "POST",
124              async: true,
125              data: { list_visible: val, set: "true" },
126              success: function (msg) {
127                // jQuery("#form_set_plugins").submit();
128              }
129            });
130
131          }); // click
132
133
134        }); //each
135      var liste_action = { active: "", deactive: "" };
136
137      jQuery(".pluginBox a").each(
138        function (i) {
139          jQuery(this).click(function (event) {
140            jQuery(this).css("color", "red");
141            jQuery('#set').val("true");
142          }); // click
143
144        }); //each
145      jQuery("input[name=list_visible]").val(liste.join(","));
146      jQuery("fieldset").show();
147    } // fielset
148    //====================================================================
149
150    jQuery("input").each(
151        function (i) {
152          jQuery(this).click(function (event) {
153            jQuery(this).css("color", "red");
154            jQuery('#set').val("true");
155            jQuery.ajax({
156              type: "POST",
157              async: true,
158              data: {
159                set: "true"
160              }
161           ,
162              success: function (data) {
163                //  jQuery("#form_set_plugins").submit();
164
165              }
166            });
167          }); // click
168
169        }); //each
170    jQuery(".pluginBox a").click(function (event) {
171      var link = event.target.href;
172      if (link.indexOf("?") != -1) {
173        var query = link.split("?")[1];
174        eval("query = {" + query.replace(/&/ig, "\",").replace(/=/ig, ":\"") + "\"};");
175        jQuery('#add_plugins').val(query.plugin);
176        jQuery('#set').val("true");
177        val = liste.join(",");
178
179        jQuery.ajax({
180          type: "POST",
181          async: true,
182          data: { add_plugins: query.plugin,
183            set: "true",
184            list_visible: val
185          }
186           ,
187          success: function (data) {
188            //  jQuery("#form_set_plugins").submit();
189
190          }
191        });
192
193      }
194
195    })
196
197  }); // load
198});                                                                //ready           
199           
Note: See TracBrowser for help on using the repository browser.