From e204c0f71bc6dbfead9b8248c3e69ef395c16609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Wed, 28 Jan 2015 23:08:02 +0100 Subject: [PATCH] Added some titles, search icon, changed some phrases. Overallhaul --- index.php | 2 +- js/list.js | 16 +++++++++++++--- js/search.js | 18 +++++++++++++----- php/change.php | 6 +++++- php/panel.php | 2 +- static/search.png | Bin 0 -> 418 bytes static/style.css | 3 +++ 7 files changed, 36 insertions(+), 11 deletions(-) create mode 100755 static/search.png diff --git a/index.php b/index.php index 460f04d8..fe6ce857 100755 --- a/index.php +++ b/index.php @@ -17,7 +17,7 @@
Zöff
- +
diff --git a/js/list.js b/js/list.js index f75de410..1fcffdde 100755 --- a/js/list.js +++ b/js/list.js @@ -99,18 +99,28 @@ function updateList() function vote(id, vote){ console.log(adminpass); - console.log($.ajax({ + serverAns = ($.ajax({ type: "GET", url: "php/change.php", async: false, data: "vote="+vote+"&id="+id+"&pass="+adminpass, success: function() { console.log("voted "+vote+" on "+id); - if(vote=="pos"){ $("#playlist").addClass("success");} + /*if(vote=="pos"){ $("#playlist").addClass("success");} else{ $("#playlist").addClass("fadeerror");} - updateList(); + updateList();*/ }, }).responseText); + + if(serverAns == "wrong") + { + alert("Wrong adminpassword!"); + }else{ + if(vote=="pos"){ $("#playlist").addClass("success");} + else{ $("#playlist").addClass("fadeerror");} + updateList(); + } + setTimeout(function(){ $("#playlist").removeClass("success"); $("#playlist").removeClass("fadeerror"); diff --git a/js/search.js b/js/search.js index 8cac5bc4..306260f2 100755 --- a/js/search.js +++ b/js/search.js @@ -100,22 +100,30 @@ function submitAndClose(id,title){ function submit(id,title){ - console.log($.ajax({ + serverAns = $.ajax({ type: "GET", url: "php/change.php", async: false, data: "v="+id+"&n="+title+"&pass="+adminpass, success: function() { - console.log("added "+id); - document.getElementById("search").value = ""; - $("#search").addClass("success"); + + //document.getElementById("search").value = ""; + //$("#search").addClass("success"); }, error: function(){ console.log("error in adding"); document.getElementById("search").value = ""; $("#search").addClass("error"); } - }).responseText); + }).responseText; + + if(serverAns == "wrong") + { + alert("Wrong adminpassword"); + $("#search").addClass("error"); + }else{ + $("#search").addClass("success"); + } $("#search").focus(); diff --git a/php/change.php b/php/change.php index 2940dfd0..6af5de47 100755 --- a/php/change.php +++ b/php/change.php @@ -136,6 +136,8 @@ else if(isset($_GET['v'])){ //if it file_put_contents($list, json_encode($data)); print("added"); //Just telling the javascript that it has been added for some reason... } + }else{ + print("wrong"); } } @@ -184,8 +186,10 @@ else if(isset($_GET['vote'])){ //if th { echo array_key_exists($id, $data["songs"]); //not in use..i think.. } + }else{ + print("wrong"); } - echo $pass."\n".$data['conf']['adminpass']; + } } diff --git a/php/panel.php b/php/panel.php index 36acf3b3..26eda843 100755 --- a/php/panel.php +++ b/php/panel.php @@ -43,5 +43,5 @@
- + diff --git a/static/search.png b/static/search.png new file mode 100755 index 0000000000000000000000000000000000000000..e75848ad0bf97cf6d844cd8729cdbc24cb349194 GIT binary patch literal 418 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgg)9v&VcR;&KZvp`dnJY5_^EKX0o zv{&E7QRLXe^ziL1ym^;_ z6iXaiXVLh4$ytt>2K$b3ihSs7)ndB*Q3o1t#UHqPo8WLbnz-=3OJ%W z&9F23PNMFb+=cS`Q}r%Q{He9+#xad=P8S*888*fCsQx{Y)uSxmsqXZ?&T@qt