Changeset 5893 in spip-zone
- Timestamp:
- Oct 4, 2006, 10:38:24 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/_dev_/widgets/widgets.js
r5888 r5893 2 2 url_widgets_html = 'spip.php?action=widgets_html&class='; 3 3 4 $.cancelwidgets = function(e){ 5 $(".widget").each(function(){ 6 var html = $(this).attr('orig_html'); 7 if (html != '<>') 8 $(this).html(html); 9 }).attr('orig_html', '<>'); 10 } 11 4 12 $.setupwidget = function(e){ 5 13 var me = this; 14 e.stopPropagation(); // avoid sending a global click to the body onclick 15 16 // si je suis en mode "widget" 17 if ($(me).attr('orig_html') == '<>') { 18 $(me).attr('orig_html', $(me).html()); 19 } else { 20 return; 21 } 6 22 7 23 // reglages de taille mini/maxi; pas tres beau … … 16 32 $.get(url_widgets_html+encodeURIComponent(this.className), 17 33 function (c) { 18 var me_orig = $(me).html();19 34 $(me) 20 .unclick()21 35 .html(c) 22 36 .find('form') … … 24 38 $(me) 25 39 .html(c.responseText) 26 . click($.setupwidget); // recursif40 .attr('orig_html','<>'); 27 41 }) 28 42 .find(".widget-active") … … 37 51 .keypress(function(e){ 38 52 if (e.keyCode == 27) { 39 $(me).html(me_orig).click($.setupwidget); 53 $(me) 54 .html($(me).attr('orig_html')) 55 .attr('orig_html','<>'); 40 56 } 41 57 }) … … 44 60 .click(function(){ 45 61 $(me) 46 .html( me_orig)//restore original html47 .click($.setupwidget);62 .html($(me).attr('orig_html')); //restore original html 63 $(me).attr('orig_html', '<>'); 48 64 return false; 49 65 }) … … 56 72 57 73 $(function() { 58 $(".widget").click($.setupwidget); 74 $(".widget") 75 .attr('orig_html', '<>') 76 .click($.setupwidget); 77 $("body") 78 .click($.cancelwidgets); 59 79 }); 60 80
Note: See TracChangeset
for help on using the changeset viewer.