DELETE FROM KEYWORDS WHERE ID_DOMAINE=28774261DoneDoneDone
URL:ox.no
Connection: keep-alive
Date: Tue, 05 Nov 2024 03:10:00 GMT
Via: 1.1 webcache1 (Varnish/trunk)
Content-Length: 15895
Content-Type: text/html
Last-Modified: Wed, 20 Oct 2021 18:21:15 GMT
Accept-Ranges: bytes
Age: 2143
ETag: W/"3e17-5ceccd7f78203-gzip"
Server: Apache
Vary: Accept-Encoding
X-Onecom-Cluster-Name:
X-Varnish: 234258815 115293458
Status => 200
<!DOCTYPE html>
<html>
<head>
<title>Circles & Crosses</title>
<meta name="verify-v1" content="u/u22u63B8T/9qn6aQsqGrAY8igQcR7kDb8cMiE40js=" />
<link rel="shortcut icon" href="https://ox.no/favicon.ico">
<style type="text/css">
.board { position: absolute; background-color: #999; }
.cell { position: absolute; background-color: #FFF; }
.symbol { position: absolute; font-family: Arial, sans-serif; }
.text { position: absolute; font-family: Verdana, Arial, sans-serif; }
.button { position: absolute; font-family: Verdana, Arial, sans-serif; color: #999; cursor: pointer; }
.about { position: absolute; text-align: center; font-family: Verdana, Arial, sans-serif; color: #999; padding: 1em; background-color: #fff; border: 1px solid #999; z-index: 10; }
</style>
<script type="text/javascript">
var about = null;
var board = null;
var loading = null;
function Player(symbol, color)
{
this.color = color;
this.symbol = symbol;
}
Player.prototype.getSymbol = function()
{
return this.symbol;
}
Player.prototype.getColor = function()
{
return this.color;
}
function Board(players, rows, maxSize, gridColor, cellColor)
{
this.disabled = false;
this.players = players;
this.moves = 0;
this.rows = rows;
this.maxSize = maxSize;
this.size = Math.min(this.maxSize, ((typeof(window.innerHeight) != 'undefined') ? window.innerHeight : document.body.clientHeight) - 20);
this.rowsize = this.size / this.rows;
this.state = [];
this.board = document.createElement('div');
this.board.id = 'board';
this.board.className = 'board';
this.board.style.backgroundColor = gridColor;
document.body.appendChild(this.board);
var flipper = this.createFlipper(this.rowsize);
for (var i = 0; i < this.rows; ++i) {
this.state[i] = [];
for (var j = 0; j < this.rows; ++j) {
var cell = document.createElement('div');
cell.id = 'cell_' + i + '_' + j;
cell.className = 'cell';
var t = (this.rowsize * i);
var l = (this.rowsize * j);
cell.style.top = t + 'px';
cell.style.left = l + 'px';
cell.style.width = (this.rowsize - 2) + 'px';
cell.style.height = (this.rowsize - 2) + 'px';
cell.style.backgroundColor = cellColor;
cell.onclick = flipper;
this.board.appendChild(cell);
symbol = document.createElement('span');
symbol.className = 'symbol';
symbol.style.fontSize = Math.floor(this.rowsize * 0.8) + 'px';
symbol.style.fontWeight = 'bold';
symbol.innerHTML = ' ';
cell.appendChild(symbol);
symbol.style.left = ((this.rowsize - symbol.clientWidth) / 2) + 'px';
this.state[i].push(symbol);
}
}
this.resize();
}
Board.prototype.getRows = function () {
return this.rows;
}
Board.prototype.createFlipper = function () {
return function(e) {
if (board.isDisabled()) {
return false;
}
showLoading();
rowsize = board.getRowSize();
if (!e) {
e = window.event;
}
cell = typeof(e.srcElement) != 'undefined' ? e.srcElement : e.target;
symbol = cell.childNodes[0];
player = board.getPlayer();
symbol.innerHTML = player.getSymbol();
symbol.style.color = player.getColor();
symbol.style.left = ((rowsize - symbol.clientWidth) / 2) + 'px';
if (board.checkWinner()) {
board.disable();
board.fade();
}
else if(board.isDone()) {
board.disable();
board.fade();
}
else {
board.nextPlayer();
}
hideLoading();
return false;
}
}
Board.prototype.fade = function (steps) {
if (typeof(steps) == 'undefined') {
steps = 12;
}
var colorsteps = [];
if (steps == 0) {
board.showWinner();
return;
}
for (var idx in this.board.childNodes) {
var cell = this.board.childNodes[idx];
if(typeof(cell.childNodes) == 'undefined' || cell.childNodes.length == 0)
continue;
symbol = cell.childNodes[0];
col = new RGBColor(symbol.style.color);
if(16777215 - parseInt(col.toHex().substring(1), 16) > 5460) // Magic numbers simply to make sure we're not too close to white
{
col.uniformAdd(20);
symbol.style.color = col.toHex();
}
}
setTimeout(function () {
board.fade(steps - 1);
}, 10);
}
Board.prototype.resize = function() {
var w = (typeof(window.innerWidth) != 'undefined') ? window.innerWidth : document.body.clientWidth;
var h = (typeof(window.innerHeight) != 'undefined') ? window.innerHeight : document.body.clientHeight;
this.size = Math.min(this.maxSize, ((typeof(window.innerHeight) != 'undefined') ? window.innerHeight : document.body.clientHeight) - 20);
this.rowsize = this.size / this.rows;
this.board.style.left = ((w - this.size) / 2) + 'px';
this.board.style.top = ((h - this.size) / 2) + 'px';
this.board.style.width = this.size - ((typeof(window.innerWidth) != 'undefined') ? 2 : 3) + 'px';
this.board.style.height = this.size - ((typeof(window.innerWidth) != 'undefined') ? 2 : 3) + 'px';
for(var idx in this.board.childNodes) {
cell = this.board.childNodes[idx];
if(typeof(cell.childNodes) == 'undefined' || cell.childNodes.length == 0)
continue;
symbol = cell.childNodes[0];
symbol.style.left = ((this.rowsize - symbol.clientWidth) / 2) + 'px';
}
}
Board.prototype.getRowSize = function () {
return this.rowsize;
}
Board.prototype.nextPlayer = function () {
this.moves++;
return this.getPlayer();
}
Board.prototype.getPlayer = function () {
return this.players[this.moves % this.players.length];
}
Board.prototype.isDone = function () {
return this.moves + 1 >= (this.rows * this.rows);
}
Board.prototype.checkWinner = function () {
var s = this.getPlayer().getSymbol();
var dlr = true, drl = true, h = true, v = true;
for(var i = 0; i < this.rows; ++i) {
h = v = true;
for(var j = 0; j < this.rows; ++j) {
if(this.state[i][j].innerHTML != s) {
h = false;
if(i == j) {
dlr = false;
}
if(i + j == this.rows - 1) {
drl = false;
}
}
if(this.state[j][i].innerHTML != s) {
v = false;
}
}
if(h || v) {
return true;
}
}
if(dlr || drl) {
return true;
}
return false;
}
Board.prototype.disable = function()
{
this.disabled = true;
}
Board.prototype.isDisabled = function()
{
return this.disabled;
}
Board.prototype.showWinner = function()
{
var maxHeight = ((typeof(window.innerHeight) != 'undefined') ? window.innerHeight : document.body.clientHeight) - 20;
var maxWidth = ((typeof(window.innerWidth) != 'undefined') ? window.innerWidth : document.body.clientWidth) - 20;
var w = document.createElement('span');
var won = document.createElement('span');
w.className = 'symbol';
var h = Math.floor(maxHeight / 2);
w.style.fontSize = Math.floor(maxHeight / 2) + 'px';
w.style.fontWeight = 'bold';
var winner = this.checkWinner() ? this.getPlayer() : null;
w.innerHTML = winner != null ? winner.getSymbol() : '?';
w.style.color = winner != null ? winner.getColor() : '#000';
w.onclick = function (e) {
document.body.removeChild(w);
document.body.removeChild(won);
load();
return false;
}
document.body.appendChild(w);
won.className = 'text';
won.style.color = '#fff';
won.style.fontSize = Math.floor(maxHeight / 10) + 'px';
won.innerHTML = winner != null ? 'is the winner' : "it's a tie";
won.onclick = function (e) {
document.body.removeChild(w);
document.body.removeChild(won);
load();
return false;
}
document.body.appendChild(won);
w.style.top = Math.floor((maxHeight / 2) - ((w.clientHeight + won.clientHeight) / 2)) + 'px';
w.style.left = Math.floor((maxWidth / 2) - (w.clientWidth / 2)) + 'px';
won.style.top = Math.floor((maxHeight / 2) - ((w.clientHeight + won.clientHeight) / 2) + w.clientHeight) + 'px';
won.style.left = Math.floor((maxWidth / 2) - (won.clientWidth / 2)) + 'px';
won.style.color = '#000';
}
function showLoading () {
loading.style.visibility = 'visible';
}
function hideLoading () {
loading.style.visibility = 'hidden';
}
function reloadBoard (rows) {
clearPage();
showLoading();
setTimeout(function () {
board = new Board(
new Array(new Player('X', '#00f'), new Player('O', '#f00')),
rows,
300,
'#999',
'#fff');
hideLoading();
}, 1);
}
function clearPage () {
while (document.body.hasChildNodes())
{
document.body.removeChild(document.body.firstChild);
}
about = null;
loading = document.createElement('span');
loading.innerHTML = 'Working...';
loading.className = 'button';
loading.style.fontSize = '15px';
loading.style.top = '5px';
loading.style.right = '5px';
document.body.appendChild(loading);
minus = document.createElement('span');
minus.className = 'button';
minus.innerHTML = '-';
minus.style.left = '5px';
minus.style.top = '5px';
minus.style.fontSize = '15px';
minus.style.width = '20px';
minus.style.height = '20px';
minus.onclick = function (e) {
if(board.getRows() > 2) {
return false;
}
reloadBoard(board.getRows() - 1);
return false;
}
document.body.appendChild(minus);
plus = document.createElement('span');
plus.className = 'button';
plus.innerHTML = '+';
plus.style.fontSize = '15px';
plus.style.left = '25px';
plus.style.top = '5px';
plus.style.width = '20px';
plus.style.height = '20px';
plus.onclick = function (e) {
if(board.getRows() >= 20)
return false;
reloadBoard(board.getRows() + 1);
return false;
}
document.body.appendChild(plus);
restart = document.createElement('span');
restart.className = 'button';
restart.innerHTML = 'r';
restart.style.left = '45px';
restart.style.top = '5px';
restart.style.fontSize = '15px';
restart.style.width = '20px';
restart.style.height = '20px';
restart.onclick = function (e) {
load();
return false;
}
document.body.appendChild(restart);
aboutbtn = document.createElement('span');
aboutbtn.className = 'button';
aboutbtn.innerHTML = '?';
aboutbtn.style.left = '65px';
aboutbtn.style.top = '5px';
aboutbtn.style.fontSize = '15px';
aboutbtn.style.width = '20px';
aboutbtn.style.height = '20px';
aboutbtn.onclick = function (e) {
if(about == null) {
showAbout();
}
else {
document.body.removeChild(about);
about = null;
}
return false;
}
document.body.appendChild(aboutbtn);
// Disable select
document.onmousedown = function() { return false; }
document.onselectstart = function() { return false; }
}
function load() {
clearPage();
showLoading();
board = new Board(
new Array(new Player('X', '#00f'), new Player('O', '#f00')),
3,
300,
'#999',
'#fff');
hideLoading();
}
function showAbout() {
about = document.createElement('div');
about.className = 'about';
about.innerHTML = '<span style="font-weight: bold;">Circles & Crosses</span><br /><br />This is a Tic-tac-toe board. Play against yourself or a friend. If you do not know the rules, <a href="http://en.wikipedia.org/wiki/Tictactoe">read this</a>.<br /><br /><span style="font-size: 10px;">© ' + new Date().getFullYear() + ' Håvard Stranden. All rights reserved.</span>';
document.body.appendChild(about);
var maxHeight = ((typeof(window.innerHeight) != 'undefined') ? window.innerHeight : document.body.clientHeight) - 20;
var maxWidth = ((typeof(window.innerWidth) != 'undefined') ? window.innerWidth : document.body.clientWidth) - 20;
about.style.left = Math.floor((maxWidth / 2) - (about.clientWidth / 2)) + 'px';
about.style.top = Math.floor((maxHeight / 2) - (about.clientHeight / 2)) + 'px';
about.onclick = function(){if(about != null){document.body.removeChild(about); about = null;} }
}
window.onresize = function(e) {
if(board != null)
board.resize();
}
function RGBColor(color_string)
{
this.ok = false;
// strip any leading #
if (color_string.charAt(0) == '#') { // remove # if any
color_string = color_string.substr(1,6);
}
color_string = color_string.replace(/ /g,'');
color_string = color_string.toLowerCase();
// array of color definition objects
var color_defs = [
{
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
process: function (bits){
return [
parseInt(bits[1]),
parseInt(bits[2]),
parseInt(bits[3])
];
}
},
{
re: /^(\w{2})(\w{2})(\w{2})$/,
example: ['#00ff00', '336699'],
process: function (bits){
return [
parseInt(bits[1], 16),
parseInt(bits[2], 16),
parseInt(bits[3], 16)
];
}
},
{
re: /^(\w{1})(\w{1})(\w{1})$/,
example: ['#fb0', 'f0f'],
process: function (bits){
return [
parseInt(bits[1] + bits[1], 16),
parseInt(bits[2] + bits[2], 16),
parseInt(bits[3] + bits[3], 16)
];
}
}
];
// search through the definitions to find a match
for (var i = 0; i < color_defs.length; i++) {
var re = color_defs[i].re;
var processor = color_defs[i].process;
var bits = re.exec(color_string);
if (bits) {
channels = processor(bits);
this.r = channels[0];
this.g = channels[1];
this.b = channels[2];
this.ok = true;
}
}
// validate/cleanup values
this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);
this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);
this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);
// some getters
this.toRGB = function () {
return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')';
}
this.toHex = function () {
var r = this.r.toString(16);
var g = this.g.toString(16);
var b = this.b.toString(16);
if (r.length == 1) r = '0' + r;
if (g.length == 1) g = '0' + g;
if (b.length == 1) b = '0' + b;
return '#' + r + g + b;
}
this.uniformAdd = function (n) {
if(this.r + n < 255)
this.r += n;
if(this.g + n < 255)
this.g += n;
if(this.b + n < 255)
this.b += n;
}
}
</script>
</head>
<!DOCTYPE html>
<html>
<head>
<title>Circles & Crosses</title>
<meta name="verify-v1" content="u/u22u63B8T/9qn6aQsqGrAY8igQcR7kDb8cMiE40js=" />
<link rel="shortcut icon" href="https://ox.no/favicon.ico">
<style type="text/css">
.board { position: absolute; background-color: #999; }
.cell { position: absolute; background-color: #FFF; }
.symbol { position: absolute; font-family: Arial, sans-serif; }
.text { position: absolute; font-family: Verdana, Arial, sans-serif; }
.button { position: absolute; font-family: Verdana, Arial, sans-serif; color: #999; cursor: pointer; }
.about { position: absolute; text-align: center; font-family: Verdana, Arial, sans-serif; color: #999; padding: 1em; background-color: #fff; border: 1px solid #999; z-index: 10; }
</style>
<script type="text/javascript">
var about = null;
var board = null;
var loading = null;
function Player(symbol, color)
{
this.color = color;
this.symbol = symbol;
}
Player.prototype.getSymbol = function()
{
return this.symbol;
}
Player.prototype.getColor = function()
{
return this.color;
}
function Board(players, rows, maxSize, gridColor, cellColor)
{
this.disabled = false;
this.players = players;
this.moves = 0;
this.rows = rows;
this.maxSize = maxSize;
this.size = Math.min(this.maxSize, ((typeof(window.innerHeight) != 'undefined') ? window.innerHeight : document.body.clientHeight) - 20);
this.rowsize = this.size / this.rows;
this.state = [];
this.board = document.createElement('div');
this.board.id = 'board';
this.board.className = 'board';
this.board.style.backgroundColor = gridColor;
document.body.appendChild(this.board);
var flipper = this.createFlipper(this.rowsize);
for (var i = 0; i < this.rows; ++i) {
this.state[i] = [];
for (var j = 0; j < this.rows; ++j) {
var cell = document.createElement('div');
cell.id = 'cell_' + i + '_' + j;
cell.className = 'cell';
var t = (this.rowsize * i);
var l = (this.rowsize * j);
cell.style.top = t + 'px';
cell.style.left = l + 'px';
cell.style.width = (this.rowsize - 2) + 'px';
cell.style.height = (this.rowsize - 2) + 'px';
cell.style.backgroundColor = cellColor;
cell.onclick = flipper;
this.board.appendChild(cell);
symbol = document.createElement('span');
symbol.className = 'symbol';
symbol.style.fontSize = Math.floor(this.rowsize * 0.8) + 'px';
symbol.style.fontWeight = 'bold';
symbol.innerHTML = ' ';
cell.appendChild(symbol);
symbol.style.left = ((this.rowsize - symbol.clientWidth) / 2) + 'px';
this.state[i].push(symbol);
}
}
this.resize();
}
Board.prototype.getRows = function () {
return this.rows;
}
Board.prototype.createFlipper = function () {
return function(e) {
if (board.isDisabled()) {
return false;
}
showLoading();
rowsize = board.getRowSize();
if (!e) {
e = window.event;
}
cell = typeof(e.srcElement) != 'undefined' ? e.srcElement : e.target;
symbol = cell.childNodes[0];
player = board.getPlayer();
symbol.innerHTML = player.getSymbol();
symbol.style.color = player.getColor();
symbol.style.left = ((rowsize - symbol.clientWidth) / 2) + 'px';
if (board.checkWinner()) {
board.disable();
board.fade();
}
else if(board.isDone()) {
board.disable();
board.fade();
}
else {
board.nextPlayer();
}
hideLoading();
return false;
}
}
Board.prototype.fade = function (steps) {
if (typeof(steps) == 'undefined') {
steps = 12;
}
var colorsteps = [];
if (steps == 0) {
board.showWinner();
return;
}
for (var idx in this.board.childNodes) {
var cell = this.board.childNodes[idx];
if(typeof(cell.childNodes) == 'undefined' || cell.childNodes.length == 0)
continue;
symbol = cell.childNodes[0];
col = new RGBColor(symbol.style.color);
if(16777215 - parseInt(col.toHex().substring(1), 16) > 5460) // Magic numbers simply to make sure we're not too close to white
{
col.uniformAdd(20);
symbol.style.color = col.toHex();
}
}
setTimeout(function () {
board.fade(steps - 1);
}, 10);
}
Board.prototype.resize = function() {
var w = (typeof(window.innerWidth) != 'undefined') ? window.innerWidth : document.body.clientWidth;
var h = (typeof(window.innerHeight) != 'undefined') ? window.innerHeight : document.body.clientHeight;
this.size = Math.min(this.maxSize, ((typeof(window.innerHeight) != 'undefined') ? window.innerHeight : document.body.clientHeight) - 20);
this.rowsize = this.size / this.rows;
this.board.style.left = ((w - this.size) / 2) + 'px';
this.board.style.top = ((h - this.size) / 2) + 'px';
this.board.style.width = this.size - ((typeof(window.innerWidth) != 'undefined') ? 2 : 3) + 'px';
this.board.style.height = this.size - ((typeof(window.innerWidth) != 'undefined') ? 2 : 3) + 'px';
for(var idx in this.board.childNodes) {
cell = this.board.childNodes[idx];
if(typeof(cell.childNodes) == 'undefined' || cell.childNodes.length == 0)
continue;
symbol = cell.childNodes[0];
symbol.style.left = ((this.rowsize - symbol.clientWidth) / 2) + 'px';
}
}
Board.prototype.getRowSize = function () {
return this.rowsize;
}
Board.prototype.nextPlayer = function () {
this.moves++;
return this.getPlayer();
}
Board.prototype.getPlayer = function () {
return this.players[this.moves % this.players.length];
}
Board.prototype.isDone = function () {
return this.moves + 1 >= (this.rows * this.rows);
}
Board.prototype.checkWinner = function () {
var s = this.getPlayer().getSymbol();
var dlr = true, drl = true, h = true, v = true;
for(var i = 0; i < this.rows; ++i) {
h = v = true;
for(var j = 0; j < this.rows; ++j) {
if(this.state[i][j].innerHTML != s) {
h = false;
if(i == j) {
dlr = false;
}
if(i + j == this.rows - 1) {
drl = false;
}
}
if(this.state[j][i].innerHTML != s) {
v = false;
}
}
if(h || v) {
return true;
}
}
if(dlr || drl) {
return true;
}
return false;
}
Board.prototype.disable = function()
{
this.disabled = true;
}
Board.prototype.isDisabled = function()
{
return this.disabled;
}
Board.prototype.showWinner = function()
{
var maxHeight = ((typeof(window.innerHeight) != 'undefined') ? window.innerHeight : document.body.clientHeight) - 20;
var maxWidth = ((typeof(window.innerWidth) != 'undefined') ? window.innerWidth : document.body.clientWidth) - 20;
var w = document.createElement('span');
var won = document.createElement('span');
w.className = 'symbol';
var h = Math.floor(maxHeight / 2);
w.style.fontSize = Math.floor(maxHeight / 2) + 'px';
w.style.fontWeight = 'bold';
var winner = this.checkWinner() ? this.getPlayer() : null;
w.innerHTML = winner != null ? winner.getSymbol() : '?';
w.style.color = winner != null ? winner.getColor() : '#000';
w.onclick = function (e) {
document.body.removeChild(w);
document.body.removeChild(won);
load();
return false;
}
document.body.appendChild(w);
won.className = 'text';
won.style.color = '#fff';
won.style.fontSize = Math.floor(maxHeight / 10) + 'px';
won.innerHTML = winner != null ? 'is the winner' : "it's a tie";
won.onclick = function (e) {
document.body.removeChild(w);
document.body.removeChild(won);
load();
return false;
}
document.body.appendChild(won);
w.style.top = Math.floor((maxHeight / 2) - ((w.clientHeight + won.clientHeight) / 2)) + 'px';
w.style.left = Math.floor((maxWidth / 2) - (w.clientWidth / 2)) + 'px';
won.style.top = Math.floor((maxHeight / 2) - ((w.clientHeight + won.clientHeight) / 2) + w.clientHeight) + 'px';
won.style.left = Math.floor((maxWidth / 2) - (won.clientWidth / 2)) + 'px';
won.style.color = '#000';
}
function showLoading () {
loading.style.visibility = 'visible';
}
function hideLoading () {
loading.style.visibility = 'hidden';
}
function reloadBoard (rows) {
clearPage();
showLoading();
setTimeout(function () {
board = new Board(
new Array(new Player('X', '#00f'), new Player('O', '#f00')),
rows,
300,
'#999',
'#fff');
hideLoading();
}, 1);
}
function clearPage () {
while (document.body.hasChildNodes())
{
document.body.removeChild(document.body.firstChild);
}
about = null;
loading = document.createElement('span');
loading.innerHTML = 'Working...';
loading.className = 'button';
loading.style.fontSize = '15px';
loading.style.top = '5px';
loading.style.right = '5px';
document.body.appendChild(loading);
minus = document.createElement('span');
minus.className = 'button';
minus.innerHTML = '-';
minus.style.left = '5px';
minus.style.top = '5px';
minus.style.fontSize = '15px';
minus.style.width = '20px';
minus.style.height = '20px';
minus.onclick = function (e) {
if(board.getRows() > 2) {
return false;
}
reloadBoard(board.getRows() - 1);
return false;
}
document.body.appendChild(minus);
plus = document.createElement('span');
plus.className = 'button';
plus.innerHTML = '+';
plus.style.fontSize = '15px';
plus.style.left = '25px';
plus.style.top = '5px';
plus.style.width = '20px';
plus.style.height = '20px';
plus.onclick = function (e) {
if(board.getRows() >= 20)
return false;
reloadBoard(board.getRows() + 1);
return false;
}
document.body.appendChild(plus);
restart = document.createElement('span');
restart.className = 'button';
restart.innerHTML = 'r';
restart.style.left = '45px';
restart.style.top = '5px';
restart.style.fontSize = '15px';
restart.style.width = '20px';
restart.style.height = '20px';
restart.onclick = function (e) {
load();
return false;
}
document.body.appendChild(restart);
aboutbtn = document.createElement('span');
aboutbtn.className = 'button';
aboutbtn.innerHTML = '?';
aboutbtn.style.left = '65px';
aboutbtn.style.top = '5px';
aboutbtn.style.fontSize = '15px';
aboutbtn.style.width = '20px';
aboutbtn.style.height = '20px';
aboutbtn.onclick = function (e) {
if(about == null) {
showAbout();
}
else {
document.body.removeChild(about);
about = null;
}
return false;
}
document.body.appendChild(aboutbtn);
// Disable select
document.onmousedown = function() { return false; }
document.onselectstart = function() { return false; }
}
function load() {
clearPage();
showLoading();
board = new Board(
new Array(new Player('X', '#00f'), new Player('O', '#f00')),
3,
300,
'#999',
'#fff');
hideLoading();
}
function showAbout() {
about = document.createElement('div');
about.className = 'about';
about.innerHTML = '<span style="font-weight: bold;">Circles & Crosses</span><br /><br />This is a Tic-tac-toe board. Play against yourself or a friend. If you do not know the rules, <a href="http://en.wikipedia.org/wiki/Tictactoe">read this</a>.<br /><br /><span style="font-size: 10px;">© ' + new Date().getFullYear() + ' Håvard Stranden. All rights reserved.</span>';
document.body.appendChild(about);
var maxHeight = ((typeof(window.innerHeight) != 'undefined') ? window.innerHeight : document.body.clientHeight) - 20;
var maxWidth = ((typeof(window.innerWidth) != 'undefined') ? window.innerWidth : document.body.clientWidth) - 20;
about.style.left = Math.floor((maxWidth / 2) - (about.clientWidth / 2)) + 'px';
about.style.top = Math.floor((maxHeight / 2) - (about.clientHeight / 2)) + 'px';
about.onclick = function(){if(about != null){document.body.removeChild(about); about = null;} }
}
window.onresize = function(e) {
if(board != null)
board.resize();
}
function RGBColor(color_string)
{
this.ok = false;
// strip any leading #
if (color_string.charAt(0) == '#') { // remove # if any
color_string = color_string.substr(1,6);
}
color_string = color_string.replace(/ /g,'');
color_string = color_string.toLowerCase();
// array of color definition objects
var color_defs = [
{
re: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,
example: ['rgb(123, 234, 45)', 'rgb(255,234,245)'],
process: function (bits){
return [
parseInt(bits[1]),
parseInt(bits[2]),
parseInt(bits[3])
];
}
},
{
re: /^(\w{2})(\w{2})(\w{2})$/,
example: ['#00ff00', '336699'],
process: function (bits){
return [
parseInt(bits[1], 16),
parseInt(bits[2], 16),
parseInt(bits[3], 16)
];
}
},
{
re: /^(\w{1})(\w{1})(\w{1})$/,
example: ['#fb0', 'f0f'],
process: function (bits){
return [
parseInt(bits[1] + bits[1], 16),
parseInt(bits[2] + bits[2], 16),
parseInt(bits[3] + bits[3], 16)
];
}
}
];
// search through the definitions to find a match
for (var i = 0; i < color_defs.length; i++) {
var re = color_defs[i].re;
var processor = color_defs[i].process;
var bits = re.exec(color_string);
if (bits) {
channels = processor(bits);
this.r = channels[0];
this.g = channels[1];
this.b = channels[2];
this.ok = true;
}
}
// validate/cleanup values
this.r = (this.r < 0 || isNaN(this.r)) ? 0 : ((this.r > 255) ? 255 : this.r);
this.g = (this.g < 0 || isNaN(this.g)) ? 0 : ((this.g > 255) ? 255 : this.g);
this.b = (this.b < 0 || isNaN(this.b)) ? 0 : ((this.b > 255) ? 255 : this.b);
// some getters
this.toRGB = function () {
return 'rgb(' + this.r + ', ' + this.g + ', ' + this.b + ')';
}
this.toHex = function () {
var r = this.r.toString(16);
var g = this.g.toString(16);
var b = this.b.toString(16);
if (r.length == 1) r = '0' + r;
if (g.length == 1) g = '0' + g;
if (b.length == 1) b = '0' + b;
return '#' + r + g + b;
}
this.uniformAdd = function (n) {
if(this.r + n < 255)
this.r += n;
if(this.g + n < 255)
this.g += n;
if(this.b + n < 255)
this.b += n;
}
}
</script>
</head>
Circles & Crosses
Recherche META Description de la page
Recherche META Keywords de la page
UPDATE DOMAINES SET server='Apache',redirection='',Status='200',err='',[TITRE]=N'Circles & Crosses',[DESCRIPTION]=N'',[KEYWORDS]=N'' WHERE id=28774261
0 Circles & Crosses
0. Circles (7)--------->0
1. & (5)--------->0
2. Crosses (7)--------->0
INSERT INTO KEYWORDS (keyword,id_domaine) VALUES (N'Circles',28774261),(N'&',28774261),(N'Crosses',28774261)