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:29] – avillepreux | js:clicktoedit [2023/01/15 18:19] (Version actuelle) – avillepreux | ||
---|---|---|---|
Ligne 4: | Ligne 4: | ||
jQuery(document).ready(function() | jQuery(document).ready(function() | ||
{ | { | ||
- | // CTRL+ALT+Clic pour éditer le texte a l' | + | // CTRL+ALT+Clic pour éditer le texte a l' |
if (typeof(click_to_edit) === ' | if (typeof(click_to_edit) === ' | ||
Ligne 22: | Ligne 22: | ||
jQuery(' | jQuery(' | ||
{ | { | ||
- | | + | |
if (evt.ctrlKey / | 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 48: | 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(); |