changeset 160:0b247e2afdfa

Moved javascript code out of list.html and into a new file, media/js/personas.js.
author Atul Varma <varmaa@toolness.com>
date Fri, 04 Apr 2008 15:37:03 -0700
parents 62659c78b809
children a2ec4d3c59e8
files media/js/personas.js personasbackend/personas/templates/personas/base.html personasbackend/personas/templates/personas/list.html
diffstat 3 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/media/js/personas.js	Fri Apr 04 15:37:03 2008 -0700
@@ -0,0 +1,18 @@
+function dispatchPersonaEvent(aType, aNode, aUrl) {
+    if (aUrl) {
+        /* TODO: We should only do this if the Persona is successfully
+           set, i.e. if the user actually has Personas installed, etc. */
+        /* TODO: We should probably just use a library like jQuery to
+           do this for us. */
+        var request = new XMLHttpRequest();
+        /* TODO: Be reasonable and make this a POST, as this 'ping' will
+           change the server's state. */
+        request.open( "GET", aUrl, true );
+        request.onreadystatechange = function() {}
+        request.send(null);
+    }
+
+    var event = document.createEvent("Events");
+    event.initEvent(aType, true, false);
+    aNode.dispatchEvent(event);
+}
--- a/personasbackend/personas/templates/personas/base.html	Fri Apr 04 15:12:13 2008 -0700
+++ b/personasbackend/personas/templates/personas/base.html	Fri Apr 04 15:37:03 2008 -0700
@@ -9,6 +9,8 @@
           href="{{ MEDIA_URL }}css/otherpages.css" />
     <link rel="shortcut icon" href="{{ MEDIA_URL }}img/favicon.ico"
           type="image/x-icon" />
+    <script type="text/javascript"
+            src="{{ MEDIA_URL }}js/personas.js"></script>
   </head>
 <body>
   <div id="content">
--- a/personasbackend/personas/templates/personas/list.html	Fri Apr 04 15:12:13 2008 -0700
+++ b/personasbackend/personas/templates/personas/list.html	Fri Apr 04 15:37:03 2008 -0700
@@ -9,26 +9,6 @@
 <p>If you like the Persona, you can click on the preview image to set it
 as your current Persona.</p>
 <p>Enjoy!</p>
-<script>
-function dispatchPersonaEvent(aType, aNode, aUrl) {
-    if (aUrl) {
-        /* TODO: We should only do this if the Persona is successfully
-           set, i.e. if the user actually has Personas installed, etc. */
-        /* TODO: We should probably just use a library like jQuery to
-           do this for us. */
-        var request = new XMLHttpRequest();
-        /* TODO: Be reasonable and make this a POST, as this 'ping' will
-           change the server's state. */
-        request.open( "GET", aUrl, true );
-        request.onreadystatechange = function() {}
-        request.send(null);
-    }
-
-    var event = document.createEvent("Events");
-    event.initEvent(aType, true, false);
-    aNode.dispatchEvent(event);
-}
-</script>
 {% for persona in personas %}
 <div class="corner-box">
   <div onclick="dispatchPersonaEvent('SelectPersona',