Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| js:clicktoedit [2020/02/25 10:27] – avillepreux | js:clicktoedit [2023/01/15 18:19] (Version actuelle) – avillepreux | ||
|---|---|---|---|
| Ligne 4: | Ligne 4: | ||
| jQuery(document).ready(function() | jQuery(document).ready(function() | ||
| { | { | ||
| - | // ALT+Clic pour éditer le texte a l' | + | // |
| - | + | ||
| - | var key_modifier_pressed = false; | + | |
| - | jQuery(document).keydown( function(event) { if (event.which == " | + | |
| - | jQuery(document).keyup( | + | |
| if (typeof(click_to_edit) === ' | if (typeof(click_to_edit) === ' | ||
| Ligne 26: | Ligne 22: | ||
| jQuery(' | jQuery(' | ||
| { | { | ||
| - | | + | |
| - | if (evt.ctrlKey && evt.shiftKey && evt.altKey) | + | if (evt.ctrlKey |
| { | { | ||
| - | console.log(evt.detail); | + | |
| | | ||
| - | // find the closest edit button form to the element double clicked (downwards) and submit the form | + | // find string |
| | | ||
| s = window.getSelection(); | s = window.getSelection(); | ||
| Ligne 52: | Ligne 48: | ||
| var str = range.toString().trim(); | var str = range.toString().trim(); | ||
| | | ||
| - | console.log(str); | + | console.log("EDIT string", |
| + | |||
| + | // find the closest anchor link to the element double clicked (upwards) | ||
| + | |||
| + | var a = jQuery(this).prevAll(' | ||
| + | console.log(" | ||
| + | |||
| + | var b = a.prevAll(' | ||
| + | console.log(" | ||
| + | |||
| + | var c = a.prevAll(' | ||
| + | console.log(" | ||
| + | |||
| + | var d = a.prevAll(' | ||
| + | console.log(" | ||
| + | |||
| + | // find the closest edit button form to the element double clicked (downwards) and submit the form | ||
| + | | ||
| var e = jQuery(this).nextAll(' | var e = jQuery(this).nextAll(' | ||
| + | console.log(" | ||
| + | | ||
| e.append("< | e.append("< | ||
| e.submit(); | e.submit(); | ||