Vasilis Daloukas
9 years ago
18 changed files with 632 additions and 1483 deletions
@ -1,40 +1,37 @@ |
|||
.nodis |
|||
{ |
|||
list-style-type:none; |
|||
} |
|||
|
|||
#cont |
|||
{ |
|||
position:relative; |
|||
display:none; |
|||
} |
|||
|
|||
|
|||
|
|||
.img1 |
|||
{ |
|||
position:absolute; |
|||
display:none; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
#dicecont |
|||
{ |
|||
float:right; |
|||
width:250px; |
|||
background-image: url(../images/meter.png); |
|||
background-repeat: repeat; |
|||
font-family: Arial, Helvetica, sans-serif; |
|||
font-weight: normal; |
|||
/*font-variant: small-caps;*/ |
|||
color: #FFFFFF; |
|||
border: 0.5em solid #333333; |
|||
top: 30px; |
|||
position: absolute; |
|||
left: 500px; |
|||
font-size: 14px; |
|||
padding: 10px; |
|||
} |
|||
|
|||
.nodis |
|||
{ |
|||
list-style-type:none; |
|||
} |
|||
|
|||
#cont |
|||
{ |
|||
position:relative; |
|||
display:none; |
|||
} |
|||
|
|||
|
|||
|
|||
.img1 |
|||
{ |
|||
position:absolute; |
|||
display:none; |
|||
} |
|||
|
|||
|
|||
#dicecont |
|||
{ |
|||
float:right; |
|||
width:250px; |
|||
background-image: url(../images/meter.png); |
|||
background-repeat: repeat; |
|||
font-family: Arial, Helvetica, sans-serif; |
|||
font-weight: normal; |
|||
/*font-variant: small-caps;*/ |
|||
color: #FFFFFF; |
|||
border: 0.5em solid #333333; |
|||
top: 30px; |
|||
position: absolute; |
|||
left: 500px; |
|||
font-size: 14px; |
|||
padding: 10px; |
|||
} |
|||
|
@ -1,41 +1,39 @@ |
|||
@charset "utf-8"; |
|||
#fade { /*--Transparent background layer--*/ |
|||
display: none; /*--hidden by default--*/ |
|||
background: #000; |
|||
position: fixed; left: 0; top: 0; |
|||
width: 100%; height: 100%; |
|||
opacity: .80; |
|||
z-index: 9999; |
|||
} |
|||
.popup_block{ |
|||
display: none; /*--hidden by default--*/ |
|||
background: #fff; |
|||
padding: 20px; |
|||
border: 20px solid #ddd; |
|||
float: left; |
|||
font-size: 1.2em; |
|||
position: fixed; |
|||
top: 50%; left: 50%; |
|||
z-index: 99999; |
|||
/*--CSS3 Box Shadows--*/ |
|||
-webkit-box-shadow: 0px 0px 20px #000; |
|||
-moz-box-shadow: 0px 0px 20px #000; |
|||
box-shadow: 0px 0px 20px #000; |
|||
/*--CSS3 Rounded Corners--*/ |
|||
-webkit-border-radius: 10px; |
|||
-moz-border-radius: 10px; |
|||
border-radius: 10px; |
|||
} |
|||
img.btn_close { |
|||
float: right; |
|||
margin: -55px -55px 0 0; |
|||
} |
|||
/*--Making IE6 Understand Fixed Positioning--*/ |
|||
*html #fade { |
|||
position: absolute; |
|||
} |
|||
*html .popup_block { |
|||
position: absolute; |
|||
} |
|||
|
|||
|
|||
@charset "utf-8"; |
|||
#fade { /*--Transparent background layer--*/ |
|||
display: none; /*--hidden by default--*/ |
|||
background: #000; |
|||
position: fixed; left: 0; top: 0; |
|||
width: 100%; height: 100%; |
|||
opacity: .80; |
|||
z-index: 9999; |
|||
} |
|||
.popup_block{ |
|||
display: none; /*--hidden by default--*/ |
|||
background: #fff; |
|||
padding: 20px; |
|||
border: 20px solid #ddd; |
|||
float: left; |
|||
font-size: 1.2em; |
|||
position: fixed; |
|||
top: 50%; left: 50%; |
|||
z-index: 99999; |
|||
/*--CSS3 Box Shadows--*/ |
|||
-webkit-box-shadow: 0px 0px 20px #000; |
|||
-moz-box-shadow: 0px 0px 20px #000; |
|||
box-shadow: 0px 0px 20px #000; |
|||
/*--CSS3 Rounded Corners--*/ |
|||
-webkit-border-radius: 10px; |
|||
-moz-border-radius: 10px; |
|||
border-radius: 10px; |
|||
} |
|||
img.btn_close { |
|||
float: right; |
|||
margin: -55px -55px 0 0; |
|||
} |
|||
/*--Making IE6 Understand Fixed Positioning--*/ |
|||
*html #fade { |
|||
position: absolute; |
|||
} |
|||
*html .popup_block { |
|||
position: absolute; |
|||
} |
|||
|
@ -1,134 +1,131 @@ |
|||
/*This Code is a sole propritary of |
|||
Husain Limdiyawala(MSc IT DA-IICT) |
|||
Any Duplication of this code should be avoided*/ |
|||
|
|||
|
|||
|
|||
.blocks |
|||
{ |
|||
font-family: Arial, Helvetica, sans-serif; |
|||
/*color: #FFFFFF;*/ |
|||
margin-left: 5px; |
|||
margin-top:2px; |
|||
margin-bottom:2px; |
|||
padding: 0px; |
|||
float:left; |
|||
height: 52px; |
|||
width: 52px; |
|||
display:block; |
|||
position:relative; |
|||
background-image: url(../square52.png); |
|||
} |
|||
|
|||
.nodis |
|||
{ |
|||
list-style-type:none; |
|||
} |
|||
|
|||
#cont |
|||
{ |
|||
position:relative; |
|||
display:none; |
|||
} |
|||
|
|||
#diceimg |
|||
{ |
|||
display:none; |
|||
width:45px; |
|||
height:44px; |
|||
|
|||
} |
|||
|
|||
.img1 |
|||
{ |
|||
position:absolute; |
|||
display:none; |
|||
|
|||
} |
|||
|
|||
body |
|||
{ |
|||
background:#CCCCCC; |
|||
} |
|||
|
|||
#player |
|||
{ |
|||
display:none; |
|||
z-index:5; |
|||
position:absolute; |
|||
} |
|||
|
|||
#players |
|||
{ |
|||
margin-top: 0.3em; |
|||
margin-bottom: 1em; |
|||
} |
|||
|
|||
#dicecont |
|||
{ |
|||
float:right; |
|||
width:170px; |
|||
background-image: url(../images/meter.png); |
|||
background-repeat: repeat; |
|||
font-family: Arial, Helvetica, sans-serif; |
|||
font-weight: bold; |
|||
/*font-variant: small-caps;*/ |
|||
color: #FFFFFF; |
|||
border: 0.5em solid #333333; |
|||
top: 30px; |
|||
position: absolute; |
|||
right: 880px; |
|||
} |
|||
|
|||
#playbtn |
|||
{ |
|||
margin-left:0.5em; |
|||
font-family: Arial, Helvetica, sans-serif; |
|||
font-weight: bold; |
|||
/*font-variant: small-caps;*/ |
|||
color: #000000; |
|||
background-color: #FC0; |
|||
padding: 1em; |
|||
} |
|||
|
|||
/*-- from modal window coding --*/ |
|||
|
|||
#fade { /*--Transparent background layer--*/ |
|||
display: none; /*--hidden by default--*/ |
|||
background: #000; |
|||
position: fixed; left: 0; top: 0; |
|||
width: 100%; height: 100%; |
|||
opacity: .80; |
|||
z-index: 9999; |
|||
} |
|||
.popup_block{ |
|||
display: none; /*--hidden by default--*/ |
|||
background: #fff; |
|||
padding: 20px; |
|||
border: 20px solid #ddd; |
|||
float: left; |
|||
font-size: 1.2em; |
|||
position: fixed; |
|||
top: 50%; left: 50%; |
|||
z-index: 99999; |
|||
/*--CSS3 Box Shadows--*/ |
|||
-webkit-box-shadow: 0px 0px 20px #000; |
|||
-moz-box-shadow: 0px 0px 20px #000; |
|||
box-shadow: 0px 0px 20px #000; |
|||
/*--CSS3 Rounded Corners--*/ |
|||
-webkit-border-radius: 10px; |
|||
-moz-border-radius: 10px; |
|||
border-radius: 10px; |
|||
} |
|||
img.btn_close { |
|||
float: right; |
|||
margin: -55px -55px 0 0; |
|||
border: 0; |
|||
} |
|||
/*--Making IE6 Understand Fixed Positioning--*/ |
|||
*html #fade { |
|||
position: absolute; |
|||
} |
|||
*html .popup_block { |
|||
position: absolute; |
|||
} |
|||
/*This Code is a sole propritary of |
|||
Husain Limdiyawala(MSc IT DA-IICT) |
|||
Any Duplication of this code should be avoided*/ |
|||
|
|||
|
|||
.blocks |
|||
{ |
|||
font-family: Arial, Helvetica, sans-serif; |
|||
/*color: #FFFFFF;*/ |
|||
margin-left: 5px; |
|||
margin-top:2px; |
|||
margin-bottom:2px; |
|||
padding: 0px; |
|||
float:left; |
|||
height: 52px; |
|||
width: 52px; |
|||
display:block; |
|||
position:relative; |
|||
background-image: url(../square52.png); |
|||
} |
|||
|
|||
.nodis |
|||
{ |
|||
list-style-type:none; |
|||
} |
|||
|
|||
#cont |
|||
{ |
|||
position:relative; |
|||
display:none; |
|||
} |
|||
|
|||
#diceimg |
|||
{ |
|||
display:none; |
|||
width:45px; |
|||
height:44px; |
|||
} |
|||
|
|||
.img1 |
|||
{ |
|||
position:absolute; |
|||
display:none; |
|||
} |
|||
|
|||
body |
|||
{ |
|||
background:#CCCCCC; |
|||
} |
|||
|
|||
#player |
|||
{ |
|||
display:none; |
|||
z-index:5; |
|||
position:absolute; |
|||
} |
|||
|
|||
#players |
|||
{ |
|||
margin-top: 0.3em; |
|||
margin-bottom: 1em; |
|||
} |
|||
|
|||
#dicecont |
|||
{ |
|||
float:right; |
|||
width:170px; |
|||
background-image: url(../images/meter.png); |
|||
background-repeat: repeat; |
|||
font-family: Arial, Helvetica, sans-serif; |
|||
font-weight: bold; |
|||
/*font-variant: small-caps;*/ |
|||
color: #FFFFFF; |
|||
border: 0.5em solid #333333; |
|||
top: 30px; |
|||
position: absolute; |
|||
right: 880px; |
|||
} |
|||
|
|||
#playbtn |
|||
{ |
|||
margin-left:0.5em; |
|||
font-family: Arial, Helvetica, sans-serif; |
|||
font-weight: bold; |
|||
/*font-variant: small-caps;*/ |
|||
color: #000000; |
|||
background-color: #FC0; |
|||
padding: 1em; |
|||
} |
|||
|
|||
/*-- from modal window coding --*/ |
|||
|
|||
#fade { /*--Transparent background layer--*/ |
|||
display: none; /*--hidden by default--*/ |
|||
background: #000; |
|||
position: fixed; left: 0; top: 0; |
|||
width: 100%; height: 100%; |
|||
opacity: .80; |
|||
z-index: 9999; |
|||
} |
|||
.popup_block{ |
|||
display: none; /*--hidden by default--*/ |
|||
background: #fff; |
|||
padding: 20px; |
|||
border: 20px solid #ddd; |
|||
float: left; |
|||
font-size: 1.2em; |
|||
position: fixed; |
|||
top: 50%; left: 50%; |
|||
z-index: 99999; |
|||
/*--CSS3 Box Shadows--*/ |
|||
-webkit-box-shadow: 0px 0px 20px #000; |
|||
-moz-box-shadow: 0px 0px 20px #000; |
|||
box-shadow: 0px 0px 20px #000; |
|||
/*--CSS3 Rounded Corners--*/ |
|||
-webkit-border-radius: 10px; |
|||
-moz-border-radius: 10px; |
|||
border-radius: 10px; |
|||
} |
|||
img.btn_close { |
|||
float: right; |
|||
margin: -55px -55px 0 0; |
|||
border: 0; |
|||
} |
|||
/*--Making IE6 Understand Fixed Positioning--*/ |
|||
*html #fade { |
|||
position: absolute; |
|||
} |
|||
*html .popup_block { |
|||
position: absolute; |
|||
} |
|||
|
@ -1,69 +1,69 @@ |
|||
/** |
|||
* POPUP CONTAINER STYLES |
|||
*/ |
|||
#popupMask { |
|||
position: absolute; |
|||
z-index: 200; |
|||
top: 0px; |
|||
left: 0px; |
|||
width: 100%; |
|||
height: 100%; |
|||
opacity: .4; |
|||
filter: alpha(opacity=50); |
|||
/* this hack is so it works in IE |
|||
* I find setting the color in the css gives me more flexibility |
|||
* than the PNG solution. |
|||
*/ |
|||
background-color:transparent !important; |
|||
background-color: #333333; |
|||
/* this hack is for opera support |
|||
* you can uncomment the background-image if you don't care about opera. |
|||
* this gives you the flexibility to use any bg color that you want, instead of the png |
|||
*/ |
|||
background-image/**/: url("../images/maskBG.png") !important; // For browsers Moz, Opera, etc. |
|||
background-image:none; |
|||
background-repeat: repeat; |
|||
display:none; |
|||
} |
|||
#popupContainer { |
|||
position: absolute; |
|||
z-index: 201; |
|||
top: 0px; |
|||
left: 0px; |
|||
display:none; |
|||
padding: 0px; |
|||
} |
|||
#popupInner { |
|||
border: 2px solid #000000; |
|||
background-color: #ffffff; |
|||
} |
|||
|
|||
#popupFrame { |
|||
margin: 0px; |
|||
width: 100%; |
|||
height: 100%; |
|||
position: relative; |
|||
z-index: 202; |
|||
} |
|||
#popupTitleBar { |
|||
background-color: #090; |
|||
color: # 000; |
|||
font-weight: bold; |
|||
height: 1.3em; |
|||
padding: 5px; |
|||
border-bottom: 2px solid #000000; |
|||
border-top: 1px solid #78A3F2; |
|||
border-left: 1px solid #78A3F2; |
|||
border-right: 1px solid #204095; |
|||
position: relative; |
|||
z-index: 203; |
|||
} |
|||
#popupTitle { |
|||
float:left; |
|||
font-size: 1.1em; |
|||
} |
|||
#popupControls { |
|||
float: right; |
|||
cursor: pointer; |
|||
cursor: hand; |
|||
} |
|||
/** |
|||
* POPUP CONTAINER STYLES |
|||
*/ |
|||
#popupMask { |
|||
position: absolute; |
|||
z-index: 200; |
|||
top: 0px; |
|||
left: 0px; |
|||
width: 100%; |
|||
height: 100%; |
|||
opacity: .4; |
|||
filter: alpha(opacity=50); |
|||
/* this hack is so it works in IE |
|||
* I find setting the color in the css gives me more flexibility |
|||
* than the PNG solution. |
|||
*/ |
|||
background-color:transparent !important; |
|||
background-color: #333333; |
|||
/* this hack is for opera support |
|||
* you can uncomment the background-image if you don't care about opera. |
|||
* this gives you the flexibility to use any bg color that you want, instead of the png |
|||
*/ |
|||
background-image/**/: url("../images/maskBG.png") !important; // For browsers Moz, Opera, etc. |
|||
background-image:none; |
|||
background-repeat: repeat; |
|||
display:none; |
|||
} |
|||
#popupContainer { |
|||
position: absolute; |
|||
z-index: 201; |
|||
top: 0px; |
|||
left: 0px; |
|||
display:none; |
|||
padding: 0px; |
|||
} |
|||
#popupInner { |
|||
border: 2px solid #000000; |
|||
background-color: #ffffff; |
|||
} |
|||
|
|||
#popupFrame { |
|||
margin: 0px; |
|||
width: 100%; |
|||
height: 100%; |
|||
position: relative; |
|||
z-index: 202; |
|||
} |
|||
#popupTitleBar { |
|||
background-color: #090; |
|||
color: # 000; |
|||
font-weight: bold; |
|||
height: 1.3em; |
|||
padding: 5px; |
|||
border-bottom: 2px solid #000000; |
|||
border-top: 1px solid #78A3F2; |
|||
border-left: 1px solid #78A3F2; |
|||
border-right: 1px solid #204095; |
|||
position: relative; |
|||
z-index: 203; |
|||
} |
|||
#popupTitle { |
|||
float:left; |
|||
font-size: 1.1em; |
|||
} |
|||
#popupControls { |
|||
float: right; |
|||
cursor: pointer; |
|||
cursor: hand; |
|||
} |
|||
|
@ -1,78 +0,0 @@ |
|||
function addEvent(obj, evType, fn){ |
|||
if (obj.addEventListener){ |
|||
obj.addEventListener(evType, fn, false); |
|||
return true; |
|||
} else if (obj.attachEvent){ |
|||
var r = obj.attachEvent("on"+evType, fn); |
|||
return r; |
|||
} else { |
|||
return false; |
|||
} |
|||
} |
|||
function removeEvent(obj, evType, fn, useCapture){ |
|||
if (obj.removeEventListener){ |
|||
obj.removeEventListener(evType, fn, useCapture); |
|||
return true; |
|||
} else if (obj.detachEvent){ |
|||
var r = obj.detachEvent("on"+evType, fn); |
|||
return r; |
|||
} else { |
|||
alert("Handler could not be removed"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Code below taken from - http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/
|
|||
* |
|||
* Modified 4/22/04 to work with Opera/Moz (by webmaster at subimage dot com) |
|||
* |
|||
* Gets the full width/height because it's different for most browsers. |
|||
*/ |
|||
function getViewportHeight() { |
|||
if (window.innerHeight!=window.undefined) return window.innerHeight; |
|||
if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight; |
|||
if (document.body) return document.body.clientHeight; |
|||
|
|||
return window.undefined; |
|||
} |
|||
function getViewportWidth() { |
|||
var offset = 17; |
|||
var width = null; |
|||
if (window.innerWidth!=window.undefined) return window.innerWidth; |
|||
if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; |
|||
if (document.body) return document.body.clientWidth; |
|||
} |
|||
|
|||
/** |
|||
* Gets the real scroll top |
|||
*/ |
|||
function getScrollTop() { |
|||
if (self.pageYOffset) // all except Explorer
|
|||
{ |
|||
return self.pageYOffset; |
|||
} |
|||
else if (document.documentElement && document.documentElement.scrollTop) |
|||
// Explorer 6 Strict
|
|||
{ |
|||
return document.documentElement.scrollTop; |
|||
} |
|||
else if (document.body) // all other Explorers
|
|||
{ |
|||
return document.body.scrollTop; |
|||
} |
|||
} |
|||
function getScrollLeft() { |
|||
if (self.pageXOffset) // all except Explorer
|
|||
{ |
|||
return self.pageXOffset; |
|||
} |
|||
else if (document.documentElement && document.documentElement.scrollLeft) |
|||
// Explorer 6 Strict
|
|||
{ |
|||
return document.documentElement.scrollLeft; |
|||
} |
|||
else if (document.body) // all other Explorers
|
|||
{ |
|||
return document.body.scrollLeft; |
|||
} |
|||
} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1,473 +1,317 @@ |
|||
/*This code was originally based on code by |
|||
Husain Limdiyawala(MSc IT DA-IICT)*/ |
|||
|
|||
|
|||
|
|||
$(document).ready(function () { |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
//Global Variables
|
|||
var totblocks=0; |
|||
var data=""; |
|||
var currentblock=0; |
|||
var position=0; |
|||
var lastposition = new Array(); |
|||
var randomno=0; |
|||
var tots= new Array(); |
|||
var l=0; |
|||
var srcsnake=new Array(4); |
|||
var destsnake=new Array(4); |
|||
|
|||
var ladsrc = new Array(3); |
|||
var laddest = new Array(3); |
|||
var quest = new Array(); //available questions along with multiple answers
|
|||
var COR_answered = new Array(); //record all questions (along with answers) the user responded CORRECTLY
|
|||
var WRO_answered = new Array(); //record all questions (along with answers) the user responded WRONGLY
|
|||
|
|||
|
|||
|
|||
//var door = new Array(1)
|
|||
|
|||
var user = new Array(); |
|||
|
|||
//var pythons = new Array(1);
|
|||
|
|||
//Constract table with questions and answers and pick question to display
|
|||
|
|||
quest[0]="Spell 1"; |
|||
quest[1]="one"; |
|||
quest[2]="two"; |
|||
quest[3]="three"; |
|||
quest[4]="Spell 2"; |
|||
quest[5]="two"; |
|||
quest[6]="three"; |
|||
quest[7]="four"; |
|||
quest[8]="Spell 3"; |
|||
quest[9]="three"; |
|||
quest[10]="two"; |
|||
quest[11]="four"; |
|||
quest[12]="Spell 4"; |
|||
quest[13]="four"; |
|||
quest[14]="three"; |
|||
quest[15]="one"; |
|||
z=0; |
|||
for (z=0;quest[z]!=null;z++); |
|||
allQuest=z/4; |
|||
|
|||
|
|||
function selectQuest(all) |
|||
{ |
|||
pickOne = Math.floor((Math.random() * all)); |
|||
return pickOne; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
//The Below Function will hide all the snakes
|
|||
|
|||
function hideAll() |
|||
{ |
|||
document.getElementById("img1").style.display = "none"; |
|||
document.getElementById("img2").style.display = "none"; |
|||
document.getElementById("img3").style.display = "none"; |
|||
document.getElementById("img4").style.display = "none"; |
|||
|
|||
document.getElementById("lad1").style.display = "none"; |
|||
document.getElementById("lad2").style.display = "none"; |
|||
document.getElementById("lad3").style.display = "none"; |
|||
} |
|||
|
|||
|
|||
//The Below Function will Render The Main Board
|
|||
|
|||
function paintBoard(a) |
|||
{ |
|||
totblocks = (a*a); |
|||
if((a*a) % 2 == 0) |
|||
{ |
|||
currentblock = (a*a) - a + 1; |
|||
for(j=0;j<(a/2);j++) |
|||
{ |
|||
|
|||
for(i=0;i<a;i++) |
|||
{ |
|||
data += "<div class='blocks' id='" + currentblock + "'>" + currentblock + "</div>"; |
|||
currentblock++; |
|||
} |
|||
currentblock -= (a+1); |
|||
|
|||
for(i=0;i<a;i++) |
|||
{ |
|||
data += "<div id='" + currentblock + "' class ='blocks'>" + currentblock + "</div>"; |
|||
currentblock--; |
|||
} |
|||
currentblock -= (a-1); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
|
|||
currentblock = (a*a); |
|||
for(j=0;j<(a/2);j++) |
|||
{ |
|||
|
|||
|
|||
for(i=0;i<a;i++) |
|||
{ |
|||
data += "<div class='blocks' id='" + currentblock + "'>" + currentblock + "</div>"; |
|||
currentblock--; |
|||
} |
|||
|
|||
currentblock -= (a-1); |
|||
|
|||
if(currentblock < 2) |
|||
break; |
|||
|
|||
for(i=0;i<a;i++) |
|||
{ |
|||
data += "<div id='" + currentblock + "' class ='blocks'>" + currentblock + "</div>"; |
|||
currentblock++; |
|||
} |
|||
currentblock -= (a+1); |
|||
} |
|||
} |
|||
document.getElementById("cont").style.width = (a*52+52) + "px" |
|||
|
|||
|
|||
document.getElementById("cont").innerHTML = data; |
|||
$("#cont").slideDown("slow"); |
|||
$("#cont").effect("shake",3000); |
|||
$("img:hidden").fadeIn(5000); |
|||
|
|||
if(a == 6) |
|||
{ |
|||
|
|||
|
|||
registerSnake(158,196,"img1",14,3,0); |
|||
registerSnake(62,183,"img2",27,24,1); |
|||
registerSnake(175,18,"img3",18,4,2); |
|||
registerSnake(10,45,"img4",32,23,3); |
|||
|
|||
registerLadder(27,132,"lad1",28,34,0); |
|||
registerLadder(90,22,"lad2",19,30,1); |
|||
registerLadder(179,137,"lad3",2,16,2); |
|||
|
|||
//registerDoor("5",5,0);
|
|||
//registerDoor("21",21,1)
|
|||
|
|||
//registerPython("15",15,0)
|
|||
} |
|||
|
|||
|
|||
else if(a == 8) |
|||
{ |
|||
|
|||
|
|||
registerSnake(300,380,"img1",44,29,0); |
|||
registerSnake(180,550,"img2",51,46,1); |
|||
registerSnake(290,50,"img3",41,40,2); |
|||
registerSnake(500,280,"img4",27,22,3); |
|||
|
|||
registerLadder(350,515,"lad1",19,35,0); |
|||
registerLadder(180,230,"lad2",43,54,1); |
|||
registerLadder(80,350,"lad3",53,60,2); |
|||
|
|||
//registerDoor("14",14,0);
|
|||
//registerDoor("26",26,1)
|
|||
|
|||
//registerPython("32",32,0)
|
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
//The below Function will simulate throwing of a dice
|
|||
|
|||
function throwDice(i) |
|||
{ |
|||
|
|||
randomno = Math.floor((Math.random() * 6)) + 1; |
|||
document.getElementById("diceimg").src = "images/dice_" + randomno + ".PNG"; |
|||
document.getElementById("diceimg").style.display = "block"; |
|||
if(lastposition[i]>0) |
|||
{ |
|||
document.getElementById(lastposition[i]).style.background = "url(images/square52.png)"; |
|||
|
|||
} |
|||
tots[i] += randomno; |
|||
|
|||
if(totblocks - tots[i] >= 0) |
|||
{ |
|||
|
|||
lastposition[i] = tots[i]; |
|||
document.getElementById(tots[i]).style.background = "url(images/pawn1.png)"; |
|||
} |
|||
else |
|||
{ |
|||
|
|||
tots[i] -= randomno; |
|||
document.getElementById(tots[i]).style.background = "url(images/pawn1.png)"; |
|||
} |
|||
|
|||
} |
|||
|
|||
//The below Function Checks The Snake Biting for a user
|
|||
|
|||
function snakescheck(k) |
|||
{ |
|||
i=0; |
|||
|
|||
for(i=0;i<=srcsnake.length;i++) |
|||
{ |
|||
|
|||
if(srcsnake[i] == tots[k]) |
|||
{ |
|||
alert("Ωχ! Σε τσίμπησε φίδι στο τετράγωνο " + srcsnake[i] + " και θα πρέπει να γυρίσεις στο τετράγωνο " + destsnake[i] + ", εκτός κι αν απαντήσεις σωστά στην ερώτηση που ακολουθεί."); |
|||
document.getElementById(destsnake[i]).style.background = "url(images/pawn1.png)"; |
|||
document.getElementById(tots[k]).style.background = "url(images/square52.png)"; |
|||
lastposition[k] = destsnake[i]; |
|||
tots[k] = destsnake[i]; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
if(!checkWin(k)) |
|||
alert("???d?se?!S???a??t???a!"); |
|||
} |
|||
|
|||
//The below function checks the ladders for a user
|
|||
|
|||
function laddercheck(k) |
|||
{ |
|||
i=0; |
|||
|
|||
for(i=0;i<=ladsrc.length;i++) |
|||
{ |
|||
|
|||
if(ladsrc[i] == tots[k]) |
|||
{ |
|||
alert("Υπάρχει μια σκάλα στο τετράγωνο " + ladsrc[i] + " και θα σας οδηγήσει κατευθείαν στο τετράγωνο " + laddest[i] +"αν απαντήσεις σωστά στην ερώτηση που ακολουθεί."); |
|||
document.getElementById(laddest[i]).style.background = "url(images/pawn1.png)"; |
|||
document.getElementById(tots[k]).style.background = "url(images/square52.png)"; |
|||
lastposition[k] = laddest[i]; |
|||
tots[k] = laddest[i]; |
|||
break; |
|||
} |
|||
} |
|||
if(!checkWin(k)) |
|||
alert("You have won!"); |
|||
} |
|||
|
|||
//The below function checks the existence of doors
|
|||
|
|||
/*function doorcheck(k) |
|||
{ |
|||
i=0; |
|||
|
|||
for(i=0;i<=door.length;i++) |
|||
{ |
|||
|
|||
if(door[i] == tots[k]) |
|||
{ |
|||
|
|||
|
|||
var randomdoor = Math.floor((Math.random() * totblocks)) + 1; |
|||
alert("Magic Door Entered!! You are redirected to " + randomdoor); |
|||
document.getElementById(randomdoor).style.background = "url(images/pawn.png) #000000"; |
|||
document.getElementById(tots[k]).style.background = "url(images/door.png) #000000"; |
|||
lastposition[k] = randomdoor; |
|||
tots[k] = randomdoor; |
|||
|
|||
} |
|||
} |
|||
if(!checkWin(k)) |
|||
alert("You Have Won!!"); |
|||
} */ |
|||
|
|||
//The below Function checks for pythons
|
|||
|
|||
function pythoncheck(k) |
|||
{ |
|||
i=0; |
|||
|
|||
for(i=0;i<pythons.length;i++) |
|||
{ |
|||
|
|||
if(pythons[i] == tots[k]) |
|||
{ |
|||
|
|||
|
|||
alert("You have been eaten up by a python.Your game is over"); |
|||
document.getElementById(tots[k]).style.background = "url(images/csnake.gif) #000000"; |
|||
lastposition[k] = null; |
|||
tots[k] = null; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
//The below function will register a snake
|
|||
|
|||
function registerSnake(tp,lft,dv,src,dest,i) |
|||
{ |
|||
document.getElementById(dv).style.top = tp + "px"; |
|||
document.getElementById(dv).style.left = lft + "px"; |
|||
srcsnake[i] = src; |
|||
destsnake[i] = dest; |
|||
} |
|||
|
|||
//The below function will register a ladder.
|
|||
|
|||
function registerLadder(tp,lft,dv,src,dest,i) |
|||
{ |
|||
document.getElementById(dv).style.top = tp + "px"; |
|||
document.getElementById(dv).style.left = lft + "px"; |
|||
ladsrc[i] = src; |
|||
laddest[i] = dest; |
|||
} |
|||
|
|||
//The below function will register a door.
|
|||
|
|||
/*function registerDoor(dv,srcc,i) |
|||
{ |
|||
document.getElementById(dv).style.background = "url(images/door.png) #000000"; |
|||
door[i] = srcc; |
|||
|
|||
} |
|||
|
|||
//The below function will register a python.
|
|||
function registerPython(dv,srcc,i) |
|||
{ |
|||
document.getElementById(dv).style.background = "url(images/csnake.gif) #000000"; |
|||
pythons[i] = srcc; |
|||
|
|||
} |
|||
*/ |
|||
|
|||
|
|||
//The below function checks the change in the boardtype selection combobox
|
|||
|
|||
function selectBoard() |
|||
{ |
|||
totblocks=0; |
|||
data=""; |
|||
currentblock=0; |
|||
position=0; |
|||
|
|||
hideAll(); |
|||
if(document.getElementById("boardtype").value != null) |
|||
{ |
|||
paintBoard(parseInt(document.getElementById("boardtype").value)); |
|||
} |
|||
} |
|||
|
|||
//The below function checks the change in the player selection combobox
|
|||
|
|||
function selectPlayer() |
|||
{ |
|||
|
|||
if(document.getElementById("players").value != null) |
|||
{ |
|||
|
|||
user[document.getElementById("players").value-1] = 0; |
|||
tots[document.getElementById("players").value-1] = 0; |
|||
lastposition[document.getElementById("players").value-1] = 0; |
|||
for(var j=0;j < lastposition.length;j++) |
|||
{ |
|||
lastposition[j] = 0; |
|||
tots[j] = 0; |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
|
|||
//The below function starts the play
|
|||
|
|||
function play() |
|||
{ |
|||
if(tots[l] != null) |
|||
{ |
|||
//...&&(quest[0]!=NULL)
|
|||
disableField(); |
|||
document.getElementById("status").innerHTML = "<ul class='nodis'><li>O Paiktis " + (l+1) + " </li><li>brisketai sto tetragwno " + tots[l] + "</li><li></li></ul>"; |
|||
//
|
|||
Question(); |
|||
document.getElementById("status").innerHTML = "<ul class='nodis'><li>O Paiktis " + (l+1) + " </li><li>vrisketai sto tetragwno " + tots[l] + "</li></ul>"; |
|||
} |
|||
else |
|||
document.getElementById("status").innerHTML = "<ul class='nodis'><li>Molis exases...</li></ul>"; |
|||
|
|||
if(l == lastposition.length-1) |
|||
l = 0; |
|||
else |
|||
l++; |
|||
|
|||
|
|||
} |
|||
|
|||
//The below function regulates the play
|
|||
|
|||
function doit(i) |
|||
{ |
|||
|
|||
throwDice(i); |
|||
|
|||
if(checkWin(i)) |
|||
{ |
|||
|
|||
//doorcheck(i);
|
|||
snakescheck(i); |
|||
laddercheck(i); |
|||
//pythoncheck(i);
|
|||
} |
|||
else |
|||
alert("ÏëïêëÞñùóåò ôçí ðßóôá, óõã÷áñçôÞñéá!!!"); |
|||
} |
|||
|
|||
//The below function checks whether the player has won or not
|
|||
|
|||
function checkWin(i) |
|||
{ |
|||
if(tots[i] == totblocks) |
|||
return false; |
|||
else |
|||
return true; |
|||
|
|||
} |
|||
|
|||
//The below function will disable both the combobox
|
|||
|
|||
function disableField() |
|||
{ |
|||
document.getElementById("players").disabled = "disabled"; |
|||
document.getElementById("boardtype").disabled = "disabled"; |
|||
|
|||
} |
|||
|
|||
function Question() |
|||
{ |
|||
picked=selectQuest(allQuest); |
|||
alert("Randomly selected number:" +picked); |
|||
Q1=prompt(quest[picked*4],"Απάντηση"); |
|||
if (Q1==quest[picked*4+1]) |
|||
{ |
|||
alert("Σωστά!") |
|||
doit(l); |
|||
|
|||
COR_answered.concat(quest.splice(picked*4,4)); |
|||
} |
|||
else |
|||
{ |
|||
alert("Η απάντηση δεν ήταν σωστή. Χάνεις τη σειρά σου για αυτό το γύρο!") |
|||
//document.getElementById("playbtn").disabled = "disabled";
|
|||
WRO_answered.concat(quest.splice(picked*4,4)); |
|||
} |
|||
//remove question and answers from available questions - (thus not allowing to have a Repeated question) ---XOXOXO
|
|||
allQuest--; |
|||
} |
|||
/*This code was originally based on code by |
|||
Husain Limdiyawala(MSc IT DA-IICT)*/ |
|||
|
|||
$(document).ready(function () { |
|||
|
|||
}); |
|||
|
|||
|
|||
//Global Variables
|
|||
var totblocks = 0; |
|||
var data = ""; |
|||
var currentblock = 0; |
|||
var position = 0; |
|||
var lastposition = new Array(); |
|||
var randomno = 0; |
|||
var tots = new Array(); |
|||
var l = 0; |
|||
var srcsnake = new Array(4); |
|||
var destsnake = new Array(4); |
|||
|
|||
var ladsrc = new Array(3); |
|||
var laddest = new Array(3); |
|||
var quest = new Array(); //available questions along with multiple answers
|
|||
var COR_answered = new Array(); //record all questions (along with answers) the user responded CORRECTLY
|
|||
var WRO_answered = new Array(); //record all questions (along with answers) the user responded WRONGLY
|
|||
var user = new Array(); |
|||
|
|||
//Constract table with questions and answers and pick question to display
|
|||
|
|||
quest[0] = "Spell 1"; |
|||
quest[1] = "one"; |
|||
quest[2] = "two"; |
|||
quest[3] = "three"; |
|||
quest[4] = "Spell 2"; |
|||
quest[5] = "two"; |
|||
quest[6] = "three"; |
|||
quest[7] = "four"; |
|||
quest[8] = "Spell 3"; |
|||
quest[9] = "three"; |
|||
quest[10] = "two"; |
|||
quest[11] = "four"; |
|||
quest[12] = "Spell 4"; |
|||
quest[13] = "four"; |
|||
quest[14] = "three"; |
|||
quest[15] = "one"; |
|||
z = 0; |
|||
for (z = 0; quest[z] != null; z++) { |
|||
// Do nothing
|
|||
} |
|||
allQuest = z / 4; |
|||
|
|||
function selectQuest(all) |
|||
{ |
|||
pickOne = Math.floor((Math.random() * all)); |
|||
return pickOne; |
|||
} |
|||
|
|||
//The Below Function will hide all the snakes
|
|||
|
|||
function hideAll() { |
|||
document.getElementById("img1").style.display = "none"; |
|||
document.getElementById("img2").style.display = "none"; |
|||
document.getElementById("img3").style.display = "none"; |
|||
document.getElementById("img4").style.display = "none"; |
|||
|
|||
document.getElementById("lad1").style.display = "none"; |
|||
document.getElementById("lad2").style.display = "none"; |
|||
document.getElementById("lad3").style.display = "none"; |
|||
} |
|||
|
|||
//The Below Function will Render The Main Board
|
|||
|
|||
function paintBoard(a) { |
|||
totblocks = (a * a); |
|||
if ((a * a) % 2 == 0) { |
|||
currentblock = (a * a) - a + 1; |
|||
for (j = 0; j < (a / 2); j++) { |
|||
for (i = 0; i < a; i++) { |
|||
data += "<div class='blocks' id='" + currentblock + "'>" + currentblock + "</div>"; |
|||
currentblock++; |
|||
} |
|||
currentblock -= (a + 1); |
|||
|
|||
for (i = 0; i < a; i++) { |
|||
data += "<div id='" + currentblock + "' class ='blocks'>" + currentblock + "</div>"; |
|||
currentblock--; |
|||
} |
|||
currentblock -= (a - 1); |
|||
} |
|||
} else { |
|||
currentblock = (a * a); |
|||
for (j = 0; j < (a / 2); j++) { |
|||
for (i = 0; i < a; i++) { |
|||
data += "<div class='blocks' id='" + currentblock + "'>" + currentblock + "</div>"; |
|||
currentblock--; |
|||
} |
|||
|
|||
currentblock -= (a - 1); |
|||
|
|||
if (currentblock < 2) { |
|||
break; |
|||
} |
|||
|
|||
for (i = 0; i < a; i++) { |
|||
data += "<div id='" + currentblock + "' class ='blocks'>" + currentblock + "</div>"; |
|||
currentblock++; |
|||
} |
|||
currentblock -= (a + 1); |
|||
} |
|||
} |
|||
document.getElementById("cont").style.width = (a * 52 + 52) + "px" |
|||
|
|||
document.getElementById("cont").innerHTML = data; |
|||
$("#cont").slideDown("slow"); |
|||
$("#cont").effect("shake",3000); |
|||
$("img:hidden").fadeIn(5000); |
|||
|
|||
if (a == 6) { |
|||
registerSnake(158, 196, "img1", 14, 3, 0); |
|||
registerSnake(62, 183, "img2", 27, 24, 1); |
|||
registerSnake(175, 18, "img3", 18, 4, 2); |
|||
registerSnake(10, 45, "img4", 32, 23, 3); |
|||
|
|||
registerLadder(27, 132, "lad1", 28, 34, 0); |
|||
registerLadder(90, 22, "lad2", 19, 30, 1); |
|||
registerLadder(179, 137, "lad3", 2, 16, 2); |
|||
} else if (a == 8) { |
|||
registerSnake(300, 380, "img1", 44, 29, 0); |
|||
registerSnake(180, 550, "img2", 51, 46, 1); |
|||
registerSnake(290, 50, "img3", 41, 40, 2); |
|||
registerSnake(500, 280, "img4", 27, 22, 3); |
|||
|
|||
registerLadder(350, 515, "lad1", 19, 35, 0); |
|||
registerLadder(180, 230, "lad2", 43, 54, 1); |
|||
registerLadder(80, 350, "lad3", 53, 60, 2); |
|||
} |
|||
} |
|||
|
|||
//The below Function will simulate throwing of a dice
|
|||
function throwDice(i) { |
|||
randomno = Math.floor((Math.random() * 6)) + 1; |
|||
document.getElementById("diceimg").src = "images/dice_" + randomno + ".PNG"; |
|||
document.getElementById("diceimg").style.display = "block"; |
|||
if (lastposition[i] > 0) { |
|||
document.getElementById(lastposition[i]).style.background = "url(images/square52.png)"; |
|||
} |
|||
tots[i] += randomno; |
|||
|
|||
if (totblocks - tots[i] >= 0) { |
|||
lastposition[i] = tots[i]; |
|||
document.getElementById(tots[i]).style.background = "url(images/pawn1.png)"; |
|||
} else { |
|||
tots[i] -= randomno; |
|||
document.getElementById(tots[i]).style.background = "url(images/pawn1.png)"; |
|||
} |
|||
} |
|||
|
|||
// The below Function Checks The Snake Biting for a user.
|
|||
function snakescheck(k) { |
|||
i = 0; |
|||
|
|||
for(i = 0; i <= srcsnake.length; i++) { |
|||
if (srcsnake[i] == tots[k]) { |
|||
alert("Ωχ! Σε τσίμπησε φίδι στο τετράγωνο " + srcsnake[i] + " και θα πρέπει να γυρίσεις στο τετράγωνο " + destsnake[i] + ", εκτός κι αν απαντήσεις σωστά στην ερώτηση που ακολουθεί."); |
|||
document.getElementById(destsnake[i]).style.background = "url(images/pawn1.png)"; |
|||
document.getElementById(tots[k]).style.background = "url(images/square52.png)"; |
|||
lastposition[k] = destsnake[i]; |
|||
tots[k] = destsnake[i]; |
|||
break; |
|||
} |
|||
} |
|||
|
|||
if (!checkWin(k)) { |
|||
alert("???d?se?!S???a??t???a!"); |
|||
} |
|||
} |
|||
|
|||
//The below function checks the ladders for a user
|
|||
function laddercheck(k) { |
|||
i = 0; |
|||
|
|||
for(i = 0; i <= ladsrc.length; i++) { |
|||
if (ladsrc[i] == tots[k]) { |
|||
alert("Υπάρχει μια σκάλα στο τετράγωνο " + ladsrc[i] + " και θα σας οδηγήσει κατευθείαν στο τετράγωνο " + laddest[i] + "αν απαντήσεις σωστά στην ερώτηση που ακολουθεί."); |
|||
document.getElementById(laddest[i]).style.background = "url(images/pawn1.png)"; |
|||
document.getElementById(tots[k]).style.background = "url(images/square52.png)"; |
|||
lastposition[k] = laddest[i]; |
|||
tots[k] = laddest[i]; |
|||
break; |
|||
} |
|||
} |
|||
if(!checkWin(k)) { |
|||
alert("You have won!"); |
|||
} |
|||
} |
|||
|
|||
//The below Function checks for pythons
|
|||
|
|||
function pythoncheck(k) { |
|||
i = 0; |
|||
|
|||
for (i = 0; i < pythons.length; i++) { |
|||
|
|||
if (pythons[i] == tots[k]) { |
|||
alert("You have been eaten up by a python.Your game is over"); |
|||
document.getElementById(tots[k]).style.background = "url(images/csnake.gif) #000000"; |
|||
lastposition[k] = null; |
|||
tots[k] = null; |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// The below function will register a snake.
|
|||
function registerSnake(tp, lft, dv, src, dest, i) { |
|||
document.getElementById(dv).style.top = tp + "px"; |
|||
document.getElementById(dv).style.left = lft + "px"; |
|||
srcsnake[i] = src; |
|||
destsnake[i] = dest; |
|||
} |
|||
|
|||
// The below function will register a ladder..
|
|||
function registerLadder(tp, lft, dv, src, dest, i) { |
|||
document.getElementById(dv).style.top = tp + "px"; |
|||
document.getElementById(dv).style.left = lft + "px"; |
|||
ladsrc[i] = src; |
|||
laddest[i] = dest; |
|||
} |
|||
|
|||
//The below function checks the change in the boardtype selection combobox
|
|||
function selectBoard() { |
|||
totblocks = 0; |
|||
data = ""; |
|||
currentblock = 0; |
|||
position = 0; |
|||
|
|||
hideAll(); |
|||
if (document.getElementById("boardtype").value != null) { |
|||
paintBoard(parseInt(document.getElementById("boardtype").value)); |
|||
} |
|||
} |
|||
|
|||
// The below function checks the change in the player selection combobox.
|
|||
function selectPlayer() { |
|||
if (document.getElementById("players").value != null) { |
|||
user[document.getElementById("players").value - 1] = 0; |
|||
tots[document.getElementById("players").value - 1] = 0; |
|||
lastposition[document.getElementById("players").value - 1] = 0; |
|||
for(var j = 0; j < lastposition.length; j++) { |
|||
lastposition[j] = 0; |
|||
tots[j] = 0; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// The below function starts the play.
|
|||
function play() { |
|||
if (tots[l] != null) { |
|||
disableField(); |
|||
document.getElementById("status").innerHTML = "<ul class='nodis'><li>O Paiktis " + (l + 1) + " </li><li>brisketai sto tetragwno " + tots[l] + "</li><li></li></ul>"; |
|||
|
|||
Question(); |
|||
document.getElementById("status").innerHTML = "<ul class='nodis'><li>O Paiktis " + (l + 1) + " </li><li>vrisketai sto tetragwno " + tots[l] + "</li></ul>"; |
|||
} else { |
|||
document.getElementById("status").innerHTML = "<ul class='nodis'><li>Molis exases...</li></ul>"; |
|||
} |
|||
|
|||
if( l == lastposition.length - 1) { |
|||
l = 0; |
|||
} else { |
|||
l++; |
|||
} |
|||
} |
|||
|
|||
// The below function regulates the play.
|
|||
function doit(i) { |
|||
throwDice(i); |
|||
if (checkWin(i)) { |
|||
snakescheck(i); |
|||
laddercheck(i); |
|||
} else { |
|||
alert("ÏëïêëÞñùóåò ôçí ðßóôá, óõã÷áñçôÞñéá!!!"); |
|||
} |
|||
} |
|||
|
|||
// The below function checks whether the player has won or not.
|
|||
function checkWin(i) { |
|||
if( tots[i] == totblocks) { |
|||
return false; |
|||
} else { |
|||
return true; |
|||
} |
|||
} |
|||
|
|||
// The below function will disable both the combobox .
|
|||
function disableField() { |
|||
document.getElementById("players").disabled = "disabled"; |
|||
document.getElementById("boardtype").disabled = "disabled"; |
|||
} |
|||
|
|||
function Question() { |
|||
picked = selectQuest(allQuest); |
|||
alert("Randomly selected number:" + picked); |
|||
Q1 = prompt(quest[picked * 4], "Απάντηση"); |
|||
if (Q1 == quest[picked * 4 + 1]) { |
|||
alert("Σωστά!") |
|||
doit(l); |
|||
|
|||
COR_answered.concat(quest.splice(picked * 4, 4)); |
|||
} else { |
|||
alert("Η απάντηση δεν ήταν σωστή. Χάνεις τη σειρά σου για αυτό το γύρο!") |
|||
WRO_answered.concat(quest.splice(picked * 4, 4)); |
|||
} |
|||
|
|||
// Remove question and answers from available questions - (thus not allowing to have a Repeated question) ---XOXOXO
|
|||
allQuest--; |
|||
} |
|||
|
@ -1,295 +0,0 @@ |
|||
var gPopupMask = null; |
|||
var gPopupContainer = null; |
|||
var gPopFrame = null; |
|||
var gReturnFunc; |
|||
var gPopupIsShown = false; |
|||
var gDefaultPage = "/loading.html"; |
|||
var gHideSelects = false; |
|||
var gReturnVal = null; |
|||
|
|||
var gTabIndexes = new Array(); |
|||
// Pre-defined list of tags we want to disable/enable tabbing into
|
|||
var gTabbableTags = new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME"); |
|||
|
|||
// If using Mozilla or Firefox, use Tab-key trap.
|
|||
if (!document.all) { |
|||
document.onkeypress = keyDownHandler; |
|||
} |
|||
|
|||
/** |
|||
* Initializes popup code on load. |
|||
*/ |
|||
function initPopUp() { |
|||
// Add the HTML to the body
|
|||
theBody = document.getElementsByTagName('BODY')[0]; |
|||
popmask = document.createElement('div'); |
|||
popmask.id = 'popupMask'; |
|||
popcont = document.createElement('div'); |
|||
popcont.id = 'popupContainer'; |
|||
popcont.innerHTML = '' + |
|||
'<div id="popupInner">' + |
|||
'<div id="popupTitleBar">' + |
|||
'<div id="popupTitle"></div>' + |
|||
'<div id="popupControls">' + |
|||
'<img src="close.gif" onclick="hidePopWin(false);" id="popCloseBox" />' + |
|||
'</div>' + |
|||
'</div>' + |
|||
'<iframe src="'+ gDefaultPage +'" style="width:100%;height:100%;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="100%" height="100%"></iframe>' + |
|||
'</div>'; |
|||
theBody.appendChild(popmask); |
|||
theBody.appendChild(popcont); |
|||
|
|||
gPopupMask = document.getElementById("popupMask"); |
|||
gPopupContainer = document.getElementById("popupContainer"); |
|||
gPopFrame = document.getElementById("popupFrame"); |
|||
|
|||
// check to see if this is IE version 6 or lower. hide select boxes if so
|
|||
// maybe they'll fix this in version 7?
|
|||
var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); |
|||
if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) { |
|||
gHideSelects = true; |
|||
} |
|||
|
|||
// Add onclick handlers to 'a' elements of class submodal or submodal-width-height
|
|||
var elms = document.getElementsByTagName('a'); |
|||
for (i = 0; i < elms.length; i++) { |
|||
if (elms[i].className.indexOf("submodal") == 0) { |
|||
// var onclick = 'function (){showPopWin(\''+elms[i].href+'\','+width+', '+height+', null);return false;};';
|
|||
// elms[i].onclick = eval(onclick);
|
|||
elms[i].onclick = function(){ |
|||
// default width and height
|
|||
var width = 400; |
|||
var height = 200; |
|||
// Parse out optional width and height from className
|
|||
params = this.className.split('-'); |
|||
if (params.length == 3) { |
|||
width = parseInt(params[1]); |
|||
height = parseInt(params[2]); |
|||
} |
|||
showPopWin(this.href,width,height,null); return false; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
addEvent(window, "load", initPopUp); |
|||
|
|||
/** |
|||
* @argument width - int in pixels |
|||
* @argument height - int in pixels |
|||
* @argument url - url to display |
|||
* @argument returnFunc - function to call when returning true from the window. |
|||
* @argument showCloseBox - show the close box - default true |
|||
*/ |
|||
function showPopWin(url, width, height, returnFunc, showCloseBox) { |
|||
// show or hide the window close widget
|
|||
if (showCloseBox == null || showCloseBox == true) { |
|||
document.getElementById("popCloseBox").style.display = "block"; |
|||
} else { |
|||
document.getElementById("popCloseBox").style.display = "none"; |
|||
} |
|||
gPopupIsShown = true; |
|||
disableTabIndexes(); |
|||
gPopupMask.style.display = "block"; |
|||
gPopupContainer.style.display = "block"; |
|||
// calculate where to place the window on screen
|
|||
centerPopWin(width, height); |
|||
|
|||
var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10); |
|||
|
|||
|
|||
gPopupContainer.style.width = width + "px"; |
|||
gPopupContainer.style.height = (height+titleBarHeight) + "px"; |
|||
|
|||
setMaskSize(); |
|||
|
|||
// need to set the width of the iframe to the title bar width because of the dropshadow
|
|||
// some oddness was occuring and causing the frame to poke outside the border in IE6
|
|||
gPopFrame.style.width = parseInt(document.getElementById("popupTitleBar").offsetWidth, 10) + "px"; |
|||
gPopFrame.style.height = (height) + "px"; |
|||
|
|||
// set the url
|
|||
gPopFrame.src = url; |
|||
|
|||
gReturnFunc = returnFunc; |
|||
// for IE
|
|||
if (gHideSelects == true) { |
|||
hideSelectBoxes(); |
|||
} |
|||
|
|||
window.setTimeout("setPopTitle();", 600); |
|||
} |
|||
|
|||
//
|
|||
var gi = 0; |
|||
function centerPopWin(width, height) { |
|||
if (gPopupIsShown == true) { |
|||
if (width == null || isNaN(width)) { |
|||
width = gPopupContainer.offsetWidth; |
|||
} |
|||
if (height == null) { |
|||
height = gPopupContainer.offsetHeight; |
|||
} |
|||
|
|||
//var theBody = document.documentElement;
|
|||
var theBody = document.getElementsByTagName("BODY")[0]; |
|||
//theBody.style.overflow = "hidden";
|
|||
var scTop = parseInt(getScrollTop(),10); |
|||
var scLeft = parseInt(theBody.scrollLeft,10); |
|||
|
|||
setMaskSize(); |
|||
|
|||
//window.status = gPopupMask.style.top + " " + gPopupMask.style.left + " " + gi++;
|
|||
|
|||
var titleBarHeight = parseInt(document.getElementById("popupTitleBar").offsetHeight, 10); |
|||
|
|||
var fullHeight = getViewportHeight(); |
|||
var fullWidth = getViewportWidth(); |
|||
|
|||
gPopupContainer.style.top = (scTop + ((fullHeight - (height+titleBarHeight)) / 2)) + "px"; |
|||
gPopupContainer.style.left = (scLeft + ((fullWidth - width) / 2)) + "px"; |
|||
//alert(fullWidth + " " + width + " " + gPopupContainer.style.left);
|
|||
} |
|||
} |
|||
addEvent(window, "resize", centerPopWin); |
|||
addEvent(window, "scroll", centerPopWin); |
|||
window.onscroll = centerPopWin; |
|||
|
|||
|
|||
/** |
|||
* Sets the size of the popup mask. |
|||
* |
|||
*/ |
|||
function setMaskSize() { |
|||
var theBody = document.getElementsByTagName("BODY")[0]; |
|||
|
|||
var fullHeight = getViewportHeight(); |
|||
var fullWidth = getViewportWidth(); |
|||
|
|||
// Determine what's bigger, scrollHeight or fullHeight / width
|
|||
if (fullHeight > theBody.scrollHeight) { |
|||
popHeight = fullHeight; |
|||
} else { |
|||
popHeight = theBody.scrollHeight; |
|||
} |
|||
|
|||
if (fullWidth > theBody.scrollWidth) { |
|||
popWidth = fullWidth; |
|||
} else { |
|||
popWidth = theBody.scrollWidth; |
|||
} |
|||
|
|||
gPopupMask.style.height = popHeight + "px"; |
|||
gPopupMask.style.width = popWidth + "px"; |
|||
} |
|||
|
|||
/** |
|||
* @argument callReturnFunc - bool - determines if we call the return function specified |
|||
* @argument returnVal - anything - return value |
|||
*/ |
|||
function hidePopWin(callReturnFunc) { |
|||
gPopupIsShown = false; |
|||
var theBody = document.getElementsByTagName("BODY")[0]; |
|||
theBody.style.overflow = ""; |
|||
restoreTabIndexes(); |
|||
if (gPopupMask == null) { |
|||
return; |
|||
} |
|||
gPopupMask.style.display = "none"; |
|||
gPopupContainer.style.display = "none"; |
|||
if (callReturnFunc == true && gReturnFunc != null) { |
|||
// Set the return code to run in a timeout.
|
|||
// Was having issues using with an Ajax.Request();
|
|||
gReturnVal = window.frames["popupFrame"].returnVal; |
|||
window.setTimeout('gReturnFunc(gReturnVal);', 1); |
|||
} |
|||
gPopFrame.src = gDefaultPage; |
|||
// display all select boxes
|
|||
if (gHideSelects == true) { |
|||
displaySelectBoxes(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Sets the popup title based on the title of the html document it contains. |
|||
* Uses a timeout to keep checking until the title is valid. |
|||
*/ |
|||
function setPopTitle() { |
|||
return; |
|||
if (window.frames["popupFrame"].document.title == null) { |
|||
window.setTimeout("setPopTitle();", 10); |
|||
} else { |
|||
document.getElementById("popupTitle").innerHTML = window.frames["popupFrame"].document.title; |
|||
} |
|||
} |
|||
|
|||
// Tab key trap. iff popup is shown and key was [TAB], suppress it.
|
|||
// @argument e - event - keyboard event that caused this function to be called.
|
|||
function keyDownHandler(e) { |
|||
if (gPopupIsShown && e.keyCode == 9) return false; |
|||
} |
|||
|
|||
// For IE. Go through predefined tags and disable tabbing into them.
|
|||
function disableTabIndexes() { |
|||
if (document.all) { |
|||
var i = 0; |
|||
for (var j = 0; j < gTabbableTags.length; j++) { |
|||
var tagElements = document.getElementsByTagName(gTabbableTags[j]); |
|||
for (var k = 0 ; k < tagElements.length; k++) { |
|||
gTabIndexes[i] = tagElements[k].tabIndex; |
|||
tagElements[k].tabIndex="-1"; |
|||
i++; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
function returnRefresh() |
|||
{ |
|||
//alert("I am active!");
|
|||
window.location.reload(); |
|||
} |
|||
|
|||
// For IE. Restore tab-indexes.
|
|||
function restoreTabIndexes() { |
|||
if (document.all) { |
|||
var i = 0; |
|||
for (var j = 0; j < gTabbableTags.length; j++) { |
|||
var tagElements = document.getElementsByTagName(gTabbableTags[j]); |
|||
for (var k = 0 ; k < tagElements.length; k++) { |
|||
tagElements[k].tabIndex = gTabIndexes[i]; |
|||
tagElements[k].tabEnabled = true; |
|||
i++; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
/** |
|||
* Hides all drop down form select boxes on the screen so they do not appear above the mask layer. |
|||
* IE has a problem with wanted select form tags to always be the topmost z-index or layer |
|||
* |
|||
* Thanks for the code Scott! |
|||
*/ |
|||
function hideSelectBoxes() { |
|||
var x = document.getElementsByTagName("SELECT"); |
|||
|
|||
for (i=0;x && i < x.length; i++) { |
|||
x[i].style.visibility = "hidden"; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Makes all drop down form select boxes on the screen visible so they do not |
|||
* reappear after the dialog is closed. |
|||
* |
|||
* IE has a problem with wanting select form tags to always be the |
|||
* topmost z-index or layer. |
|||
*/ |
|||
function displaySelectBoxes() { |
|||
var x = document.getElementsByTagName("SELECT"); |
|||
|
|||
for (i=0;x && i < x.length; i++){ |
|||
x[i].style.visibility = "visible"; |
|||
} |
|||
} |
@ -1,14 +1,18 @@ |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1253" /> |
|||
<title>ÏëïêëÞñùóç ðáé÷íéäéïý</title> |
|||
<link rel="stylesheet" type="text/css" href="style.css" /> |
|||
<link rel="stylesheet" type="text/css" href="css/subModal.css" /> |
|||
|
|||
</head> |
|||
<body bgcolor="#CCFF66" style="font-family: Arial, Helvetica, sans-serif; font-weight: normal; font-size:13px;"> |
|||
<h2>Óõã÷áñçôÞñéá! </h2>Ìüëéò ïëïêëÞñùóåò ìå åðéôõ÷ßá ôï ðáé÷íßäé.<p>Ôï óêïñ óïõ äåß÷íåé ôï <strong>ðïóïóôü % ôùí óùóôþí áðáíôÞóåùí</strong>, óôï óýíïëï ôùí åñùôÞóåùí ðïõ óïõ Ýãéíáí.</p><p>Èá Þèåëåò íá îáíáäïêéìÜóåéò;</p> <button onclick="window.top.hidePopWin(true)">Íáé, èá ðáßîù îáíÜ!</button> <button onclick="window.top.hidePopWin()">¼÷é, åõ÷áñéóôþ</button> |
|||
|
|||
</body> |
|||
</html> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1253" /> |
|||
<title>ÏëïêëÞñùóç ðáé÷íéäéïý</title> |
|||
<link rel="stylesheet" type="text/css" href="style.css" /> |
|||
<link rel="stylesheet" type="text/css" href="css/subModal.css" /> |
|||
|
|||
</head> |
|||
<body bgcolor="#CCFF66" style="font-family: Arial, Helvetica, sans-serif; font-weight: normal; font-size:13px;"> |
|||
<h2>Óõã÷áñçôÞñéá! </h2>Ìüëéò ïëïêëÞñùóåò ìå åðéôõ÷ßá ôï ðáé÷íßäé. |
|||
<p>Ôï óêïñ óïõ äåß÷íåé ôï <strong>ðïóïóôü % ôùí óùóôþí áðáíôÞóåùí</strong>, óôï óýíïëï ôùí åñùôÞóåùí ðïõ óïõ Ýãéíáí.</p> |
|||
<p>Èá Þèåëåò íá îáíáäïêéìÜóåéò;</p> |
|||
<button onclick="window.top.hidePopWin(true)">Íáé, èá ðáßîù îáíÜ!</button> |
|||
<button onclick="window.top.hidePopWin()">¼÷é, åõ÷áñéóôþ</button> |
|||
|
|||
</body> |
|||
</html> |
|||
|
@ -1,3 +1,3 @@ |
|||
encoding=el_utf8 |
|||
exit=Έξοδος |
|||
keyboardletters=2:ΑΒΓ#3:ΔΕΖ#4:ΗΘΙ#5:ΚΛΜ#6:ΝΞΟ#7:ΠΡΣ#8:ΤΥΦ#9:ΧΨΩ# |
|||
encoding=el_utf8 |
|||
exit=Έξοδος |
|||
keyboardletters=2:ΑΒΓ#3:ΔΕΖ#4:ΗΘΙ#5:ΚΛΜ#6:ΝΞΟ#7:ΠΡΣ#8:ΤΥΦ#9:ΧΨΩ# |
|||
|
@ -1,4 +1,3 @@ |
|||
encoding=en_utf8 |
|||
exit=Exit |
|||
keyboardletters=2:ABC#3:DEF#4:GHI#5:JKL#6:MNO#7:PQRS#8:TUV#9:WXYZ# |
|||
|
|||
encoding=en_utf8 |
|||
exit=Exit |
|||
keyboardletters=2:ABC#3:DEF#4:GHI#5:JKL#6:MNO#7:PQRS#8:TUV#9:WXYZ# |
|||
|
@ -1,4 +1,3 @@ |
|||
encoding=es_utf8 |
|||
exit=Salir |
|||
keyboardletters=2:ABC2ÁªÀÇ#3:DEF3ÉÈ#4:GHI4ÍÌ#5:JKL5#6:MNÑO6ÓÒº#7:PQRS7#8:TUV8ÚÜÙ#9:WXYZ9# |
|||
|
|||
encoding=es_utf8 |
|||
exit=Salir |
|||
keyboardletters=2:ABC2ÁªÀÇ#3:DEF3ÉÈ#4:GHI4ÍÌ#5:JKL5#6:MNÑO6ÓÒº#7:PQRS7#8:TUV8ÚÜÙ#9:WXYZ9# |
|||
|
@ -1,3 +1,3 @@ |
|||
encoding=el_utf8 |
|||
exit=Έξοδος |
|||
keyboardletters=2:ΑΒΓ#3:ΔΕΖ#4:ΗΘΙ#5:ΚΛΜ#6:ΝΞΟ#7:ΠΡΣ#8:ΤΥΦ#9:ΧΨΩ# |
|||
encoding=el_utf8 |
|||
exit=Έξοδος |
|||
keyboardletters=2:ΑΒΓ#3:ΔΕΖ#4:ΗΘΙ#5:ΚΛΜ#6:ΝΞΟ#7:ΠΡΣ#8:ΤΥΦ#9:ΧΨΩ# |
|||
|
@ -1,4 +1,3 @@ |
|||
encoding=en_utf8 |
|||
exit=Exit |
|||
keyboardletters=2:ABC#3:DEF#4:GHI#5:JKL#6:MNO#7:PQRS#8:TUV#9:WXYZ# |
|||
|
|||
encoding=en_utf8 |
|||
exit=Exit |
|||
keyboardletters=2:ABC#3:DEF#4:GHI#5:JKL#6:MNO#7:PQRS#8:TUV#9:WXYZ# |
|||
|
@ -1,4 +1,3 @@ |
|||
encoding=es_utf8 |
|||
exit=Salir |
|||
keyboardletters=2:ABC2ÁªÀÇ#3:DEF3ÉÈ#4:GHI4ÍÌ#5:JKL5#6:MNÑO6ÓÒº#7:PQRS7#8:TUV8ÚÜÙ#9:WXYZ9# |
|||
|
|||
encoding=es_utf8 |
|||
exit=Salir |
|||
keyboardletters=2:ABC2ÁªÀÇ#3:DEF3ÉÈ#4:GHI4ÍÌ#5:JKL5#6:MNÑO6ÓÒº#7:PQRS7#8:TUV8ÚÜÙ#9:WXYZ9# |
|||
|
Loading…
Reference in new issue