Permanent cookie for version
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1340 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
b681dfbbff
commit
8338ec9a0f
|
@ -388,12 +388,10 @@ function schemaMouseup(ev) {
|
||||||
ev = ev || event;
|
ev = ev || event;
|
||||||
tablePos[that.firstChild.firstChild.firstChild.data] = [ (ev.clientY - y) / em, (ev.clientX - x) / em ];
|
tablePos[that.firstChild.firstChild.firstChild.data] = [ (ev.clientY - y) / em, (ev.clientX - x) / em ];
|
||||||
that = undefined;
|
that = undefined;
|
||||||
var date = new Date();
|
|
||||||
date.setMonth(date.getMonth() + 1);
|
|
||||||
var s = '';
|
var s = '';
|
||||||
for (var key in tablePos) {
|
for (var key in tablePos) {
|
||||||
s += '_' + key + ':' + Math.round(tablePos[key][0] * 10000) / 10000 + 'x' + Math.round(tablePos[key][1] * 10000) / 10000;
|
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 + '"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,21 @@ function toggle(id) {
|
||||||
return true;
|
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
|
/** Verify current Adminer version
|
||||||
*/
|
*/
|
||||||
function verifyVersion() {
|
function verifyVersion() {
|
||||||
document.cookie = 'adminer_version=0';
|
cookie('adminer_version=0', 1);
|
||||||
var script = document.createElement('script');
|
var script = document.createElement('script');
|
||||||
script.src = 'https://adminer.svn.sourceforge.net/svnroot/adminer/trunk/version.js';
|
script.src = 'https://adminer.svn.sourceforge.net/svnroot/adminer/trunk/version.js';
|
||||||
document.body.appendChild(script);
|
document.body.appendChild(script);
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
// downloaded from repository by version_checker()
|
// downloaded from repository by verifyVersion()
|
||||||
document.cookie = 'adminer_version=2.3.0'; // last released version
|
cookie('adminer_version=2.3.0', 7); // last released version, valid for 7 days
|
||||||
|
|
Loading…
Reference in a new issue