appypod-rattail/gen/plone25/skin/appy.js

33 lines
1.2 KiB
JavaScript
Raw Normal View History

function cookiesAreEnabled() {
// Test whether cookies are enabled by attempting to set a cookie and then
// change its value
var c = "areYourCookiesEnabled=0";
document.cookie = c;
var dc = document.cookie;
// Cookie not set? Fail
if (dc.indexOf(c) == -1) return 0;
// Change test cookie
c = "areYourCookiesEnabled=1";
document.cookie = c;
dc = document.cookie;
// Cookie not changed? fail
if (dc.indexOf(c) == -1) return 0;
// Delete cookie
document.cookie = "areYourCookiesEnabled=; expires=Thu, 01-Jan-70 00:00:01 GMT";
return 1;
}
function setLoginVars() {
// Indicate if JS is enabled
document.getElementById('js_enabled').value = 1;
// Indicate if cookies are enabled
document.getElementById('cookies_enabled').value = cookiesAreEnabled();
// Copy login and password length to alternative vars since current vars will
// be removed from the request by zope's authentication mechanism.
document.getElementById('login_name').value = document.getElementById('__ac_name').value;
password = document.getElementById('__ac_password');
emptyPassword = document.getElementById('pwd_empty');
if (password.value.length==0) emptyPassword.value = '1';
else emptyPassword.value = '0';
}