added tiblus ep_prefs_different_cookie_for_different_protocol
This commit is contained in:
parent
76f211b0bf
commit
30400509ba
|
@ -453,7 +453,7 @@ var pad = {
|
|||
// This will check if the prefs-cookie is set.
|
||||
// Otherwise it shows up a message to the user.
|
||||
padcookie.init();
|
||||
if (!readCookie("prefs"))
|
||||
if (!padcookie.isCookiesEnabled())
|
||||
{
|
||||
$('#loading').hide();
|
||||
$('#noCookie').show();
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
var padcookie = (function()
|
||||
{
|
||||
var cookieName = isHttpsScheme() ? "prefs" : "prefsHttp";
|
||||
|
||||
function getRawCookie()
|
||||
{
|
||||
// returns null if can't get cookie text
|
||||
|
@ -31,7 +33,7 @@ var padcookie = (function()
|
|||
return null;
|
||||
}
|
||||
// look for (start of string OR semicolon) followed by whitespace followed by prefs=(something);
|
||||
var regexResult = document.cookie.match(/(?:^|;)\s*prefs=([^;]*)(?:;|$)/);
|
||||
var regexResult = document.cookie.match(new RegExp("(?:^|;)\s*" + cookieName + "=([^;]*)(?:;|$)"));
|
||||
if ((!regexResult) || (!regexResult[1]))
|
||||
{
|
||||
return null;
|
||||
|
@ -44,7 +46,7 @@ var padcookie = (function()
|
|||
var expiresDate = new Date();
|
||||
expiresDate.setFullYear(3000);
|
||||
var secure = isHttpsScheme() ? ";secure" : "";
|
||||
document.cookie = ('prefs=' + safeText + ';expires=' + expiresDate.toGMTString() + secure);
|
||||
document.cookie = (cookieName + "=" + safeText + ";expires=" + expiresDate.toGMTString() + secure);
|
||||
}
|
||||
|
||||
function parseCookie(text)
|
||||
|
@ -122,6 +124,9 @@ var padcookie = (function()
|
|||
{
|
||||
return wasNoCookie;
|
||||
},
|
||||
isCookiesEnabled: function() {
|
||||
return !!getRawCookie();
|
||||
},
|
||||
getPref: function(prefName)
|
||||
{
|
||||
return cookieData[prefName];
|
||||
|
|
Loading…
Reference in New Issue