getCookie & default username
This commit is contained in:
parent
11efdc6417
commit
b75b7421e1
@ -1403,6 +1403,10 @@ core.prototype.clamp = function (x, a, b) {
|
|||||||
return core.utils.clamp(x, a, b);
|
return core.utils.clamp(x, a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
core.prototype.getCookie = function (name) {
|
||||||
|
return core.utils.getCookie(name);
|
||||||
|
}
|
||||||
|
|
||||||
////// Base64加密 //////
|
////// Base64加密 //////
|
||||||
core.prototype.encodeBase64 = function (str) {
|
core.prototype.encodeBase64 = function (str) {
|
||||||
return core.utils.encodeBase64(str);
|
return core.utils.encodeBase64(str);
|
||||||
|
|||||||
@ -301,7 +301,7 @@ events.prototype.gameOver = function (ending, fromReplay, norank) {
|
|||||||
doUpload("");
|
doUpload("");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
doUpload(prompt("请输入你的ID:"));
|
doUpload(prompt("请输入你的ID:", core.getCookie('id')));
|
||||||
}
|
}
|
||||||
}, function () {
|
}, function () {
|
||||||
if (main.isCompetition)
|
if (main.isCompetition)
|
||||||
|
|||||||
@ -520,6 +520,11 @@ utils.prototype.clamp = function (x, a, b) {
|
|||||||
return Math.min(Math.max(x||0, min), max);
|
return Math.min(Math.max(x||0, min), max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utils.prototype.getCookie = function (name) {
|
||||||
|
var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
|
||||||
|
return match?match[2]:null;
|
||||||
|
}
|
||||||
|
|
||||||
////// Base64加密 //////
|
////// Base64加密 //////
|
||||||
utils.prototype.encodeBase64 = function (str) {
|
utils.prototype.encodeBase64 = function (str) {
|
||||||
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
|
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user