From 0f94dd2a5ba0fa235dfc17c8aa384e27905e6bf8 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Thu, 16 Sep 2010 15:14:39 +0000 Subject: [PATCH] Machi-chara appearance improved --- static/js/machichara/simple.js | 12 +++++++++--- templates/Full/elems/Main.xslt | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/static/js/machichara/simple.js b/static/js/machichara/simple.js index be768ab..db1c96b 100644 --- a/static/js/machichara/simple.js +++ b/static/js/machichara/simple.js @@ -1,10 +1,15 @@ +function simpleMachicharaUpdater(element) { + return function() { + simpleMachicharaUpdate(element); + } +} + function simpleMachicharaUpdate(element) { + clearTimeout(element.interval); element.style.top = Math.floor(Math.random()*90) + "%"; element.style.left = Math.floor(Math.random()*90) + "%"; - window.setTimeout(function() { - simpleMachicharaUpdate(element); - }, 5000+Math.floor(Math.random()*25000)); + element.interval = window.setTimeout(simpleMachicharaUpdater(element), 5000+Math.floor(Math.random()*25000)); } function simpleMachichara(imageUrl) { @@ -18,5 +23,6 @@ function simpleMachichara(imageUrl) { machicharaSimpleImageElement.src = imageUrl; machicharaSimpleImageElement.style.border = "none"; machicharaSimpleElement.appendChild(machicharaSimpleImageElement); + machicharaSimpleElement.onmouseover = simpleMachicharaUpdater(machicharaSimpleElement); simpleMachicharaUpdate(machicharaSimpleElement); } \ No newline at end of file diff --git a/templates/Full/elems/Main.xslt b/templates/Full/elems/Main.xslt index 4288041..a5aba1b 100644 --- a/templates/Full/elems/Main.xslt +++ b/templates/Full/elems/Main.xslt @@ -11,7 +11,7 @@ - + <xsl:call-template name="specificTitle"/> <xsl:text> - </xsl:text>