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 + '"');
}
}
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);
-// 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