diff options
Diffstat (limited to 'public/js')
| -rw-r--r-- | public/js/Input.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/public/js/Input.js b/public/js/Input.js index be7cd8d..6c5af10 100644 --- a/public/js/Input.js +++ b/public/js/Input.js | |||
| @@ -54,7 +54,7 @@ class InputText extends InputToggler{ | |||
| 54 | .then(response => response.json()) | 54 | .then(response => response.json()) |
| 55 | .then(data => { | 55 | .then(data => { |
| 56 | if(data.success){ | 56 | if(data.success){ |
| 57 | this.content_elem.innerHTML = this.input_elem.value; | 57 | this.onSuccess(data); |
| 58 | this.close(); | 58 | this.close(); |
| 59 | } | 59 | } |
| 60 | else{ | 60 | else{ |
| @@ -65,12 +65,25 @@ class InputText extends InputToggler{ | |||
| 65 | console.error('Erreur:', error); | 65 | console.error('Erreur:', error); |
| 66 | }); | 66 | }); |
| 67 | } | 67 | } |
| 68 | onSuccess(data){ | ||
| 69 | this.content_elem.innerHTML = this.input_elem.value; | ||
| 70 | } | ||
| 68 | cancel(){ | 71 | cancel(){ |
| 69 | this.input_elem.value = this.content_elem.innerHTML; | 72 | this.input_elem.value = this.content_elem.innerHTML; |
| 70 | super.cancel(); | 73 | super.cancel(); |
| 71 | } | 74 | } |
| 72 | } | 75 | } |
| 73 | 76 | ||
| 77 | class InputTextSocialNetwork extends InputText{ | ||
| 78 | open(){ | ||
| 79 | this.input_elem.value = this.content_elem.parentNode.href; | ||
| 80 | super.open(); | ||
| 81 | } | ||
| 82 | onSuccess(data){ | ||
| 83 | this.content_elem.parentNode.href = this.input_elem.value; | ||
| 84 | } | ||
| 85 | } | ||
| 86 | |||
| 74 | class InputFile extends InputToggler{ | 87 | class InputFile extends InputToggler{ |
| 75 | constructor(name, options = {}){ | 88 | constructor(name, options = {}){ |
| 76 | super(name, options); | 89 | super(name, options); |
