]> git.joonet.de Git - adminer.git/commitdiff
Permanent cookie for version
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 5 Mar 2010 16:22:54 +0000 (16:22 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 5 Mar 2010 16:22:54 +0000 (16:22 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1340 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/static/editing.js
adminer/static/functions.js
version.js

index 75fc26abc14a5e8d0f400376c8acccdd19947b69..f38dad78ca7e4dc300a88affbf47c0cbc68770c2 100644 (file)
@@ -388,12 +388,10 @@ function schemaMouseup(ev) {
                ev = ev || event;
                tablePos[that.firstChild.firstChild.firstChild.data] = [ (ev.clientY - y) / em, (ev.clientX - x) / em ];
                that = undefined;
-               var date = new Date();
-               date.setMonth(date.getMonth() + 1);
                var s = '';
                for (var key in tablePos) {
                        s += '_' + key + ':' + Math.round(tablePos[key][0] * 10000) / 10000 + 'x' + Math.round(tablePos[key][1] * 10000) / 10000;
                }
-               document.cookie = 'adminer_schema=' + encodeURIComponent(s.substr(1)) + '; expires=' + date + '; path="' + location.pathname + location.search + '"';
+               cookie('adminer_schema=' + encodeURIComponent(s.substr(1)), 30, '; path="' + location.pathname + location.search + '"');
        }
 }
index dd31d83d03ac53e160edca128a869f13a98ef283..fa7de73ea10da2a632677f521e1dc606e5b856d7 100644 (file)
@@ -11,10 +11,21 @@ function toggle(id) {
        return true;
 }
 
+/** Set permanent cookie
+* @param string
+* @param number
+* @param string optional
+*/
+function cookie(assign, days, params) {
+       var date = new Date();
+       date.setDate(date.getDate() + days);
+       document.cookie = assign + '; expires=' + date + (params || '');
+}
+
 /** Verify current Adminer version
 */
 function verifyVersion() {
-       document.cookie = 'adminer_version=0';
+       cookie('adminer_version=0', 1);
        var script = document.createElement('script');
        script.src = 'https://adminer.svn.sourceforge.net/svnroot/adminer/trunk/version.js';
        document.body.appendChild(script);
index 07ab198bf579e79691fb9186e1bfef7195f18354..7d3eb2f6bde9f3b89a4bb1712ab8272fcd1c3d1e 100644 (file)
@@ -1,2 +1,2 @@
-// downloaded from repository by version_checker()
-document.cookie = 'adminer_version=2.3.0'; // last released version
+// downloaded from repository by verifyVersion()
+cookie('adminer_version=2.3.0', 7); // last released version, valid for 7 days