getCookie & default username

This commit is contained in:
oc committed 2019-01-06 02:40:41 +08:00
1 parent 11efdc6417
commit b75b7421e1
3 files changed
+10 -1

No files matched your search

+4
View File
@@ -1403,6 +1403,10 @@ core.prototype.clamp = function (x, a, b) {
return core.utils.clamp(x, a, b);
}
core.prototype.getCookie = function (name) {
return core.utils.getCookie(name);
}
////// Base64加密 //////
core.prototype.encodeBase64 = function (str) {
return core.utils.encodeBase64(str);
+1 -1
View File
@@ -301,7 +301,7 @@ events.prototype.gameOver = function (ending, fromReplay, norank) {
doUpload("");
}
else {
doUpload(prompt("请输入你的ID:"));
doUpload(prompt("请输入你的ID:", core.getCookie('id')));
}
}, function () {
if (main.isCompetition)
+5
View File
@@ -520,6 +520,11 @@ utils.prototype.clamp = function (x, a, b) {
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加密 //////
utils.prototype.encodeBase64 = function (str) {
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {