Changeset 10060 for extensions/edit_gmaps/admin/js/fieldset.js
- Timestamp:
- Apr 5, 2011, 12:45:03 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/edit_gmaps/admin/js/fieldset.js
r8501 r10060 1 if (typeof ef_animate_fast == "undefined") 2 var ef_animate_fast =true;1 if (typeof ef_animate_fast == "undefined") 2 var ef_animate_fast = true; 3 3 4 // Smart Fieldsets initialization/ 5 if (typeof ef_plus_bullet_path == "undefined") 6 { 7 var ef_plus_bullet_path = './plugins/edit_gmaps/admin/icon/plus.png'; 8 var ef_minus_bullet_path = './plugins/edit_gmaps/admin/icon/minus.png'; 9 10 } 4 // Smart Fieldsets initialization/ 5 if (typeof ef_plus_bullet_path == "undefined") { 6 var ef_plus_bullet_path = './plugins/edit_gmaps/admin/icon/plus.png'; 7 var ef_minus_bullet_path = './plugins/edit_gmaps/admin/icon/minus.png'; 11 8 12 if (typeof ef_separator == "undefined") 13 var ef_separator = ' : '; 9 } 14 10 15 function ef_reduce(fieldset_id, fast) { 16 var l_m = jQuery('#' + fieldset_id + ' legend'); 17 if (ef_reduce.arguments.length < 2) fast = ef_animate_fast; 18 if (!l_m.is('.ef_command')) l_m.addClass('ef_command'); 19 if (!jQuery('#' + fieldset_id).is(':hidden')) 20 l_m.trigger('ef_reduce_private', fast); 21 l_m.removeClass('ef_command'); 11 if (typeof ef_separator == "undefined") 12 var ef_separator = ' : '; 22 13 23 } 14 function ef_reduce(fieldset_id, fast) { 15 l_m = jQuery('#' + fieldset_id + ' legend'); 16 if (ef_reduce.arguments.length < 2) fast = ef_animate_fast; 17 if (!l_m.is('.ef_command')) l_m.addClass('ef_command'); 18 if (!jQuery('#' + fieldset_id).is(':hidden')) 19 l_m.trigger('ef_reduce_private', fast.fast,this); 20 l_m.removeClass('ef_command'); 24 21 25 function ef_maximize(fieldset_id, fast) { 26 var l_r = jQuery('#' + fieldset_id + '_reduced_legend'); 27 if (ef_maximize.arguments.length < 2) fast = ef_animate_fast; 28 if (!l_r.is('.ef_command')) l_r.addClass('ef_command'); 29 if (jQuery('#' + fieldset_id).is(':hidden')) 30 l_r.trigger('ef_maximize_private', fast); 31 l_r.removeClass('ef_command'); 32 } 22 } 33 23 34 35 function ef_init(fieldset_id, cache_id) { 36 jQuery(document).ready(function () { 37 var f_m = jQuery('#' + fieldset_id); 38 var l_m = jQuery('#' + fieldset_id + ' legend'); 39 var l_txt = l_m.text(); 40 var f_r = f_m; 41 var l_r = l_m; 24 function ef_maximize(fieldset_id, fast) { 25 l_r = jQuery('#' + fieldset_id + '_reduced_legend'); 26 if (ef_maximize.arguments.length < 2) fast = ef_animate_fast; 27 if (!l_r.is('.ef_command')) l_r.addClass('ef_command'); 28 if (jQuery('#' + fieldset_id).is(':hidden')) 29 l_r.trigger('ef_maximize_private', fast); 30 l_r.removeClass('ef_command'); 31 32 } 42 33 43 if (ef_minus_bullet_path != '') l_m.prepend( 34 var l_m, l_r; 35 function ef_init(fieldset_id, cache_id) { 36 jQuery(document).ready(function () { 37 var f_m = jQuery('#' + fieldset_id); 38 l_m = jQuery('#' + fieldset_id + ' legend'); 39 var l_txt = l_m.text(); 40 var f_r = f_m; 41 l_r = l_m; 42 43 if (ef_minus_bullet_path != '') l_m.prepend( 44 44 '<img alt = "" title = ""' + 45 45 'src = "' + ef_minus_bullet_path + '"' + '> ' 46 46 ); 47 l_m.addClass('ef_legends'); 48 l_m.addClass('ef_click_ok'); 49 47 l_m.addClass('ef_legends'); 48 l_m.addClass('ef_click_ok'); 50 49 51 f_r = jQuery('#' + fieldset_id + " ").clone();52 l_r = jQuery('#' + fieldset_id + " LEGEND").clone();53 f_r.empty();54 l_r.appendTo(f_r);55 56 f_r.attr('id', fieldset_id + '_reduced');57 f_r.insertAfter(f_m);58 f_r.css({display: 'none' });59 60 61 l_r.attr('id', fieldset_id + '_reduced_legend');62 l_r.addClass('ef_legends');63 l_r.addClass('ef_click_ok');64 50 65 51 f_r = jQuery('#' + fieldset_id + " ").clone(); 52 l_r = jQuery('#' + fieldset_id + " LEGEND").clone(); 53 f_r.empty(); 54 l_r.appendTo(f_r); 66 55 67 l_r.css({ 68 outlineColor: "invert", 69 opacity: 0 70 }); 71 72 if (ef_plus_bullet_path == '') 73 l_r.append( 56 f_r.attr('id', fieldset_id + '_reduced'); 57 f_r.insertAfter(f_m); 58 f_r.css({ display: 'none' }); 59 60 61 l_r.attr('id', fieldset_id + '_reduced_legend'); 62 l_r.addClass('ef_legends'); 63 l_r.addClass('ef_click_ok'); 64 65 66 67 l_r.css({ 68 outlineColor: "invert", 69 opacity: 0 70 }); 71 72 if (ef_plus_bullet_path == '') 73 l_r.append( 74 74 '<span style = "padding-left:' + l_m.css('padding-left') + ';">' + 75 75 l_txt + '</' + 'span>' + ef_separator 76 76 ); 77 else 78 { 77 else { 79 78 80 lg= jQuery(l_r).find("img");81 if(lg.length>0)82 lg.get(0).src = ef_plus_bullet_path;79 lg = jQuery(l_r).find("img"); 80 if (lg.length > 0) 81 lg.get(0).src = ef_plus_bullet_path; 83 82 84 l_r.append(' ' + ef_separator);85 83 l_r.append(' ' + ef_separator); 84 } 86 85 87 f_r.append('<span id="' + cache_id +'" > </span>');88 89 l_m.bind('ef_reduce_private', function (event, fast) { // Reduce 90 91 if (l_m.is('.ef_command, .ef_click_ok')) { 92 if (fast) {93 f_m.hide();94 f_r.show();95 f_r.find('*').css({opacity: 1});96 }97 else {98 f_m.find('*').not('.ef_legends, img').animate(99 {opacity: 0} ,100 200,86 f_r.append('<span id="' + cache_id + '" > </span>'); 87 jQuery('.ef_legends').css('cursor', 'pointer'); 88 89 l_m.bind('ef_reduce_private', function (event, fast) { // Reduce 90 91 if (l_m.is('.ef_command, .ef_click_ok')) { 92 if (fast) { 93 f_m.hide(); 94 f_r.show(); 95 f_r.find('*').css({ opacity: 1 }); 96 } 97 else { 98 f_m.find('*').not('.ef_legends, img').animate( 99 { opacity: 0 }, 200, 101 100 function () { 102 103 104 f_r.find('*').css({opacity: 1});105 101 f_m.slideUp(400); 102 f_r.slideDown(400, function () { 103 f_r.find('*').css({ opacity: 1 }); 104 }); 106 105 } 107 106 ); 108 } 109 } 110 }); 111 l_r.bind('ef_maximize_private', function (event, fast) { // Maximize 112 if (l_r.is('.ef_command, .ef_click_ok')) { 113 if (fast) { 114 f_r.hide(); 115 f_m.show(); 116 } else { 117 f_r.find('*').css({opacity: 0}); 118 f_r.slideUp(400); 119 f_m.slideDown(400, function () { 120 f_m.find('*').not('.ef_legends, img').animate( 121 {opacity: 1}, 122 200 123 ); 124 }); 125 } 126 } 127 }); 128 l_m.click(function () { // Reduce 129 l_m.trigger('ef_reduce_private', ef_animate_fast); 130 }); 131 l_r.click(function () { // Maximize 132 l_r.trigger('ef_maximize_private', ef_animate_fast); 133 }); 107 } 108 } 109 }); 110 111 l_r.bind('ef_maximize_private', function (event, fast) { // Maximize 112 if (l_r.is('.ef_command, .ef_click_ok')) { 113 if (fast) { 114 f_r.hide(); 115 f_m.show(); 116 } else { 117 f_r.find('*').css({ opacity: 0 }); 118 f_r.slideUp(400); 119 f_m.slideDown(400, function () { 120 f_m.find('*').not('.ef_legends, img').animate({ opacity: 1 },200 ); 134 121 }); 122 } 135 123 } 124 }); 125 126 l_m.click(function () { // Reduce 127 l_m.trigger('ef_reduce_private', ef_animate_fast); 128 }); 129 130 l_r.click(function () { // Maximize 131 l_r.trigger('ef_maximize_private', ef_animate_fast); 132 }); 133 if (no_affiche!="true") { 134 ef_reduce("geoposition", { fast: true }) 135 // jQuery("#Envoie").trigger("submit"); 136 } else { 137 ef_reduce("Elements", { fast: true }) 138 } 139 }); 140 } 136 141 137 142 138 139 140 143 jQuery(document).ready(function () { 144 if (jQuery(".fieldset").length >= 1) 145 jQuery(".fieldset").each( 141 146 function (i) { 142 143 144 145 146 147 148 147 id0 = jQuery(this).attr("id"); 148 if (id0 == "") jQuery(this).attr("id", "Cadre_" + i); 149 id0 = jQuery(this).attr("id"); 150 // Update of the '#cache' value when changing the selected value in the fieldset 151 jQuery("#" + id0 + ' .inputs').click(function () { 152 jQuery("#" + id0).text(jQuery("#" + id0 + ' .inputs:checked').next().text()); 153 }); 149 154 }); 150 151 152 153 154 155 // Some changes of the defaults, nothing to see with Smart Fieldsets 156 // jQuery('input').attr('checked', 'true'); 157 jQuery('code').css('font-size', 'larger'); 158 jQuery('#ef_presentation label, #ef_presentation input').css('cursor', 'pointer'); 159 }); 155 160 156 161 157 162 158 159 160 163 jQuery(document).ready(function () { 164 if (jQuery(".fieldset").length >= 1) { 165 jQuery(".fieldset").each( 161 166 function (i) { 162 163 167 id0 = jQuery(this).attr("id"); 168 ef_init(id0, 'cache' + i); 164 169 165 170 }) 166 }167 if (no_affiche) {168 ef_reduce("geoposition", true)169 } else {170 ef_reduce("Elements", true)171 }172 171 173 }) 172 } 173 174 }) 174 175 175 176
Note: See TracChangeset
for help on using the changeset viewer.