aboutsummaryrefslogtreecommitdiff
path: root/public/js/InputFile.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/InputFile.js')
-rw-r--r--public/js/InputFile.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/public/js/InputFile.js b/public/js/InputFile.js
index f5e450c..e676037 100644
--- a/public/js/InputFile.js
+++ b/public/js/InputFile.js
@@ -35,7 +35,18 @@ class InputFile{
35 .then(data => { 35 .then(data => {
36 if(data.success){ 36 if(data.success){
37 this.parent.querySelector('#' + this.name + '_img').src = data.location; 37 this.parent.querySelector('#' + this.name + '_img').src = data.location;
38 this.close(this.name); 38
39 // cas particulier
40 if(this.name === 'head_favicon'){
41 const link = document.querySelector('link[rel="icon"]');
42 link.type = data.mime_type;
43 link.href = data.location;
44 }
45 else if(this.name === 'header_background'){
46 document.querySelector('header').style.backgroundImage = "url('" + data.location + "')";
47 }
48
49 this.close();
39 } 50 }
40 else{ 51 else{
41 console.error("Erreur: le serveur n'a pas enregistré l'image'."); 52 console.error("Erreur: le serveur n'a pas enregistré l'image'.");
@@ -46,6 +57,6 @@ class InputFile{
46 }); 57 });
47 } 58 }
48 cancel(){ 59 cancel(){
49 this.close(this.name); 60 this.close();
50 } 61 }
51} \ No newline at end of file 62} \ No newline at end of file