changeset 340:87e57f0aa0e5

Use a wrapper function for alert(), we might be changing the functionality of this later on.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 30 Nov 2013 22:12:23 +0200
parents 9dd87c8de942
children eaf435c99fe4
files admin.php majax.php vote.inc.php
diffstat 3 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/admin.php	Fri Nov 29 07:42:57 2013 +0200
+++ b/admin.php	Sat Nov 30 22:12:23 2013 +0200
@@ -182,7 +182,7 @@
           switchActiveTab("CM", activeTabs["CM"]);
       }
       catch (err) {
-        alert("JSON.parse("+ txt +") failure: "+ err);
+        messageBox("JSON.parse("+ txt +") failure: "+ err);
       }
     }
   }
--- a/majax.php	Fri Nov 29 07:42:57 2013 +0200
+++ b/majax.php	Sat Nov 30 22:12:23 2013 +0200
@@ -12,6 +12,12 @@
   echo "<script type=\"text/javascript\">\n";
 
 ?>
+function messageBox(msg)
+{
+  alert(msg);
+}
+
+
 function statusMsg(msg)
 {
   document.getElementById("nstatus").innerHTML = msg;
@@ -69,7 +75,7 @@
       if (req.status == 902)
       {
         statusMsg(req.statusText);
-        alert(req.responseText);
+        messageBox(req.responseText);
       }
       else
       if (req.status == 200)
@@ -114,7 +120,7 @@
     var elem = document.getElementById(elname);
     if (!elem)
     {
-      alert("No such DOM element '"+ elname +"'.");
+      messageBox("No such DOM element '"+ elname +"'.");
       return "";
     }
 
@@ -138,7 +144,7 @@
         break;
 
       default:
-        alert("Unsupported field type in "+ elname);
+        messageBox("Unsupported field type in "+ elname);
         return "";
     }
   }
--- a/vote.inc.php	Fri Nov 29 07:42:57 2013 +0200
+++ b/vote.inc.php	Sat Nov 30 22:12:23 2013 +0200
@@ -88,7 +88,7 @@
 
   var mfail = function(txt)
   {
-    alert("Something went wrong. :(");
+    messageBox("Something went wrong. :(");
   }
 
   sendPOSTRequest("action=set&entry_id="+eid+"&vote="+value, msuccess, mfail);