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 @@ - +