-1) {
var s = source.indexOf("", e);
// Add to scripts array
scripts.push(source.substring(s_e+1, e));
// Strip from source
source = source.substring(0, s) + source.substring(e_e+1);
}
// Return the cleaned source
return source;
}
function execScripts() {
// Loop through every script collected and eval it
for(var i=0; i
Rätsel drucken (oder leer drucken)
Rätsel laden
Stand speichern
Stand wiederherstellen
Feld löschen
Rätsel prüfen
Hilfethemen
FAQ";
fillFolder("links", "wwwlinks.php?toc=1");
fillFolder("survey", "survey.php?toc=1");
fillFolder("imprint", "imprint.php");
}
var statusBarBuffer;
function showStatusBar() {
if (statusBarMode == 0 || statusBarMode == 2) {
if (matrixName == "") {
matrixName = document.getElementById("status").innerHTML;
}
else {
statusBarBuffer = document.getElementById("status").innerHTML;
}
document.getElementById("status").innerHTML = matrixName;
}
else if (statusBarMode == 1) {
ajaxFunction("status.php", "status", null);
}
else if (statusBarMode == 3) {
document.getElementById("status").innerHTML = statusBarBuffer;
}
statusBarMode++;
if (statusBarMode > 3) statusBarMode = 2;
setTimeout("document.getElementById('status').style.color='#ddbbbb';", 29500);
setTimeout("document.getElementById('status').style.color='#eedddd';", 29600);
setTimeout("document.getElementById('status').style.color='#ffffff';", 29700);
setTimeout("showStatusBar()", 30000);
setTimeout("document.getElementById('status').style.color='#eedddd';", 30500);
setTimeout("document.getElementById('status').style.color='#ddbbbb';", 30600);
setTimeout("document.getElementById('status').style.color='#993333';", 30700);
}
function loadUIState() {
/* Expand/Collapse state */
var state = GetCookie("cw_acc");
if (state) {
var cnt = 0;
for (var t in accordions) {
if (isAccordionExpanded(t, state)) accordionToggle(t, "expand");
else accordionToggle(t, "collapse");
cnt++;
}
/* Toolbox mode */
if ((state & Math.pow(2,cnt)) == Math.pow(2,cnt))
showToolbox(true);
else
showToolbox(false);
cnt++;
/* Wordlist mode */
if ((state & Math.pow(2,cnt)) == Math.pow(2,cnt))
showWordlist(true);
else
showWordlist(false);
}
}
function init() {
loadUIState();
/* Login state */
if (uid > 0) logIn(uid, uname);
else logOut();
showStatusBar();
openLightbox('shortinfo.php');
setTimeout('refreshActivities()', REFRESHTIME);
detectTouch();
if (isTouch) document.getElementById("touchpad").style.display="";
document.getElementById("print").removeAttribute("style");
}
function isValidEmail(str) {
return (str.indexOf(".") > 0) && (str.indexOf("@") > 0);
}
function validateUserreg() {
re = /^\w+$/;
if(!re.test(document.getElementById('userreg_nick').value)) {
alert("Bitte nur Buchstaben, Zahlen und Unterstrich im Namen.");
document.getElementById('userreg_nick').focus();
return false;
}
if(!re.test(document.getElementById('userreg_nick').value)) {
alert("Bitte nur Buchstaben, Zahlen und Unterstrich im Password.");
document.getElementById('userreg_nick').focus();
return false;
}
if (!isValidEmail(document.getElementById('userreg_email').value)) {
alert("Bitte korrekte E-Mail angeben.");
document.getElementById('userreg_email').focus();
return false;
}
return true;
}
function validateRecommend() {
re = /^\w+$/;
if(!re.test(document.recommend.name.value)) {
alert("Bitte nur Buchstaben, Zahlen und Unterstrich im Namen.");
document.recommend.name.focus();
return false;
}
if (!isValidEmail(document.recommend.email.value)) {
alert("Bitte korrekte E-Mail angeben.");
document.recommend.email.focus();
return false;
}
return true;
}
function resize() {
pageWidth = getPageSize()[0];
matrixWidth = document.getElementById("mtable").offsetWidth;
if (matrixWidth < 300) matrixWidth = 300;
var mwidth = (matrixWidth + 30) + "px";
var amargin = (matrixWidth + 35) + "px";
/* want to have accordion width from 225 to 350 px */
var cwidth = matrixWidth + 65 + 225;
if (cwidth < pageWidth - 30) {
cwidth = matrixWidth + 30 + 350;
if (cwidth > pageWidth - 30) {
cwidth = pageWidth - 30;
}
}
cwidth = cwidth + "px";
//alert(matrixWidth + " - " + pageWidth + " - " + cwidth);
document.getElementById("matrix").style.width = mwidth;
document.getElementById("accordion").style.marginLeft = amargin;
document.getElementById("container").style.width = cwidth;
// set height of wordlist
document.getElementById("wordlist_div").style.height = (getWindowHeight() - 120) + "px";
}
function getWindowHeight() {
var winH = 460;
if (document.body && document.body.offsetWidth) {
winH = document.body.offsetHeight;
}
if (document.compatMode=='CSS1Compat' &&
document.documentElement &&
document.documentElement.offsetWidth ) {
winH = document.documentElement.offsetHeight;
}
if (window.innerWidth && window.innerHeight) {
winH = window.innerHeight;
}
return winH;
}
function show_social() {
var head = document.getElementsByTagName("head")[0];
script = document.createElement('script');
script.id = 'fbScript';
script.type = 'text/javascript';
script.src = "http://connect.facebook.net/en_US/all.js#xfbml=1";
head.appendChild(script);
/*
script = document.createElement('script');
script.id = 'twScript';
script.type = 'text/javascript';
script.src = "http://platform.twitter.com/widgets.js";
head.appendChild(script);
*/
document.getElementById('social_div').innerHTML = " Über das Rätselstudio twittern...";
// document.getElementById('social-content').innerHTML = "
";
}
function setActivitiesMode(mode) {
if (mode==0) {
if (activityMode1==1) activityMode1=0;
else activityMode1=1;
}
if (mode==1) {
if (activityMode2==1) activityMode2=0;
else activityMode2=1;
}
if (mode==2) {
if (activityMode3==1) activityMode3=0;
else activityMode3=1;
}
document.getElementById("activity_div").className = "activity" + activityMode1 + activityMode2 + activityMode3;
}
function refreshActivities() {
fillFolder('messages', 'messages.php');
setTimeout('refreshActivities()', REFRESHTIME);
}
function detectTouch() {
if ("ontouchstart" in document.documentElement) {
isTouch = true;
}
else {
isTouch = false;
}
}
function touch(key) {
if (key == '^' && ld == 1) pass_key = 39;
else if (key == '^' && ld == 0) pass_key = 40;
else if (key == '>' && ld == 1) pass_key = 40;
else if (key == '>' && ld == 0) pass_key = 39;
else {
pass_key = key.charCodeAt(0);
}
keyproc();
}
// get a matrix pos by index
function jumpIdx(idx, dir) {
var x, y;
// check if word exists in given direction
if ((dir == 0 && lh[idx]) || (dir == 1 && lv[idx])) {
for (var property in i) {
if (i.hasOwnProperty(property)) {
// need "==" ...
if (idx == i[property]) {
x = property.substring(0, property.indexOf("_"));
y = property.substring(property.indexOf("_")+1);
break;
}
}
}
if (x && y) {
ld = dir;
jump(x,y);
}
}
}