Changeset 5887 in spip-zone
- Timestamp:
- Oct 4, 2006, 8:25:32 PM (15 years ago)
- Location:
- _plugins_/_dev_/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/_dev_/widgets/action/widgets_html.php
r5882 r5887 56 56 echo $n->code(); 57 57 echo $n->input($type); 58 echo '<input type="submit" value="ok" />'."\n".'</form>'."\n"; 58 echo '<input type="submit" value="ok" />'."\n"; 59 echo '<input class="cancel_widget" type="button" value="cancel" />'."\n".'</form>'."\n"; 59 60 } 60 61 } -
_plugins_/_dev_/widgets/widgets.js
r5878 r5887 1 // TODO: passer la valeur a afficher pour pouvoir faire CANCEL2 // en cliquant sur un bouton, ou hors de la div, ou en tapant ESC3 1 4 2 url_widgets_html = 'spip.php?action=widgets_html&class='; 5 3 6 $.setupwidget = function( ){4 $.setupwidget = function(e){ 7 5 var me = this; 8 6 var me_orig = me.innerHTML; 9 7 // reglages de taille mini/maxi; pas tres beau 10 8 var w,h; … … 20 18 $(me) 21 19 .unclick() 20 .click(function(e){e.stopPropagation();}) //avoid cancelling on click 22 21 .html(c) 23 22 .find('form') … … 25 24 $(me) 26 25 .html(c.responseText) 26 .unclick() //remove the trap to avoid cancel onclick 27 27 .click($.setupwidget); // recursif 28 28 }) … … 37 37 .each(function(){this.focus();}) 38 38 .end() 39 .find(".cancel_widget") 40 .click(cancel_widget) 41 .end() 39 42 .end() 40 43 ; 44 $("html").keypress(exit_on_esc).click(cancel_widget); 41 45 } 42 46 ); 47 48 function cancel_widget() { 49 $(me).html(me_orig) //restore original html 50 .unclick() //remove the trap to avoid cancel onclick 51 .click($.setupwidget); 52 return false; 53 } 54 function exit_on_esc(e) { 55 if(e.keyCode==27) { 56 $("html").unkeypress(exit_on_esc); 57 return cancel_widget(); 58 } 59 } 60 e.stopPropagation(); //do not cancel widgets when creating another one 43 61 } 44 62
Note: See TracChangeset
for help on using the changeset viewer.