From 569182c88eeae87c25a0d385c0bb9828cd63c7d7 Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 13 May 2013 23:12:21 +0200 Subject: [PATCH] datenspuren: rm derbug.js --- .../static/datenspuren/2013/script/derbug.js | 128 ------------------ xsl/datenspuren/xhtml5.xsl | 3 - 2 files changed, 131 deletions(-) delete mode 100644 content/static/datenspuren/2013/script/derbug.js diff --git a/content/static/datenspuren/2013/script/derbug.js b/content/static/datenspuren/2013/script/derbug.js deleted file mode 100644 index b87da50a6..000000000 --- a/content/static/datenspuren/2013/script/derbug.js +++ /dev/null @@ -1,128 +0,0 @@ -var MOUSE_TIMEOUT = 1000; -var mouseTimeout; - -$('body').mousemove(function() { - hideAll(); - - if (mouseTimeout) - clearTimeout(mouseTimeout); - mouseTimeout = setTimeout(onMouseTimeout, MOUSE_TIMEOUT); -}); - -function onMouseTimeout() { - canSpawn(); -} - - -var MAX_BUGS = 5; -var bugs = []; -var SPAWN_INTERVAL = 2000; -var spawnInterval; -function canSpawn() { - if (!spawnInterval) - spawnInterval = setInterval(spawn, SPAWN_INTERVAL); -} - -function spawn() { - bugs = bugs.filter(function(bug) { - return !bug.shouldHide; - }); - /*console.log("spawn", bugs.length, "/", MAX_BUGS);*/ - if (bugs.length >= MAX_BUGS) - return; - - bugs.push(new Bug()); -} - -function hideAll() { - if (spawnInterval) { - clearInterval(spawnInterval); - spawnInterval = null; - hideAll(); - } - - for(var i = 0; i < bugs.length; i++) { - bugs[i].shouldHide = true; - } - bugs = []; -} - -function Bug() { - this.alpha = 0; - this.rotation = 0; - this.x = $('body').scrollLeft() + Math.floor(window.innerWidth * Math.random()); - this.y = $('body').scrollTop() + Math.floor(window.innerHeight * Math.random()); - this.selectTarget(); - - this.el = $(''); - this.el.css({ position: 'absolute', - width: "28px", - height: "28px" - }); - $('body').append(this.el); - /*console.log("new bug", this, this.x, this.y);*/ - - this.think(); -} -Bug.prototype = { - update: function() { - this.el.css({ left: Math.floor(this.x) + "px", - top: Math.floor(this.y) + "px", - opacity: this.alpha, - transform: "rotate(" + this.rotation + "rad)", - '-webkitTransform': "rotate(" + this.rotation + "rad)", - '-mozTransform': "rotate(" + this.rotation + "rad)" - }); - }, - selectTarget: function() { - this.targetRotation = 2 * Math.PI * (Math.random() - 0.5); - this.targetSteps = 5 + Math.ceil(10 * Math.random()); - }, - think: function() { - if (this.shouldHide && this.alpha > 0) { - /* fading out */ - this.alpha -= 0.1; - } else if (this.shouldHide) { - this.el.remove(); - /* destroy - * HACK: Avoid nextTick() */ - return; - } else if (this.alpha < 1) { - /* fading in */ - this.alpha += 0.1; - } - - var dr = this.targetRotation - this.rotation; - if (Math.abs(dr) > 1) { - this.rotation += Math.random() * dr / 10; - } - if (this.targetSteps > 0) { - this.targetSteps--; - this.x += Math.sin(this.rotation); - this.y -= Math.cos(this.rotation); - - /* Emergency suicide: */ - if (this.x < 16 || - this.x > $('body').innerWidth() - 16 || - this.y < 16 || - this.y > $('body').innerHeight() - 16) { - this.shouldHide = true; - } - } else { - this.selectTarget(); - } - - this.update(); - nextTick(this.think.bind(this)); - } -}; - -var nextTick = - window.requestAnimationFrame || - window.webkitRequestAnimationFrame || - window.mozRequestAnimationFrame || - window.msRequestAnimationFrame || - window.oRequestAnimationFrame || - function(f) { - window.setTimeout(f, 40); - }; diff --git a/xsl/datenspuren/xhtml5.xsl b/xsl/datenspuren/xhtml5.xsl index e0098a7ae..05a3a0922 100644 --- a/xsl/datenspuren/xhtml5.xsl +++ b/xsl/datenspuren/xhtml5.xsl @@ -258,9 +258,6 @@ -