|
/* Copyright Jürgen Reule 2010-2023 */ |
|
|
|
|
|
|
function error() { |
|
|
|
return true; |
|
|
} |
|
|
function mousedown() { |
|
|
|
return false; |
|
|
} |
|
|
function sparkle() { |
|
|
|
|
|
|
|
index = 1; |
|
|
|
maxIndex = 9; |
|
|
|
img = new Array(maxIndex); |
|
|
|
div = new Array(maxIndex); |
|
|
|
timeout = new Array(maxIndex); |
|
|
|
posx = new Array(maxIndex); |
|
|
|
posy = new Array(maxIndex); |
|
|
|
|
|
|
|
for (i = index; i <= maxIndex; i++) { |
|
|
|
|
|
|
|
img[i] = document.createElement('img'); |
|
|
|
div[i] = document.createElement('div'); |
|
|
|
timeout[i] = window.setTimeout('', 0); |
|
|
|
|
|
|
|
img[i].alt = ''; |
|
|
|
img[i].src = scriptname + i + '.gif'; |
|
|
|
img[i].onmousedown = mousedown; |
|
|
|
|
|
|
|
div[i].style.top = '0px'; |
|
|
|
div[i].style.left = '0px'; |
|
|
|
div[i].style.width = '0px'; |
|
|
|
div[i].style.height = '0px'; |
|
|
|
div[i].style.position = 'absolute'; |
|
|
|
div[i].style.overflow = 'hidden'; |
|
|
|
div[i].style.visibility = 'hidden'; |
|
|
|
div[i].style.pointerEvents = 'none'; |
|
|
|
img[i].style.pointerEvents = 'none'; |
|
|
|
posx[i] = 0; |
|
|
|
posy[i] = 0; |
|
|
|
|
|
|
|
div[i].appendChild(img[i]); |
|
|
|
document.body.appendChild(div[i]); |
|
|
|
} |
|
|
|
if (isTouch()) |
|
|
|
document.body.onclick = click; |
|
|
|
else document.onclick = click; |
|
|
} |
|
|
function isTouch() { |
|
|
|
|
|
|
return (navigator.userAgent.indexOf('Mobile') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('Android') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('PlayBook') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('BlackBerry') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('Opera Mobi') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('Opera Mini') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('IEMobile') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('Tablet') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('Phone') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('iPhone') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('iPod') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('iPad') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('webOS') >= 0 |
|
|
|
|| navigator.userAgent.indexOf('wOS') >= 0); |
|
|
} |
|
|
function click(e) { |
|
|
|
|
|
|
|
x = clickX(e); |
|
|
|
y = clickY(e); |
|
|
|
|
|
|
|
if (x <= 0 |
|
|
|
|| y <= 0) return; |
|
|
|
|
|
|
|
oldIndex = index; |
|
|
|
|
|
|
|
if (posx[index] != x |
|
|
|
|| posy[index] != y) index++; |
|
|
|
|
|
|
|
while (index > maxIndex) |
|
|
|
index -= maxIndex; |
|
|
|
|
|
|
|
maxWidth = scrollWidth(); |
|
|
|
maxHeight = scrollHeight(); |
|
|
|
|
|
|
|
divWidth = img[index].width; |
|
|
|
divHeight = img[index].height; |
|
|
|
|
|
|
|
divTop = y - (divHeight / 2); |
|
|
|
divLeft = x - (divWidth / 2); |
|
|
|
|
|
|
|
if (divWidth > maxWidth - divLeft) |
|
|
|
divWidth = maxWidth - divLeft; |
|
|
|
|
|
|
|
if (divHeight > maxHeight - divTop) |
|
|
|
divHeight = maxHeight - divTop; |
|
|
|
|
|
|
|
if (divWidth < 0) |
|
|
|
divWidth = 0; |
|
|
|
|
|
|
|
if (divHeight < 0) |
|
|
|
divHeight = 0; |
|
|
|
|
|
|
|
if (oldIndex != index) { |
|
|
|
div[index].style.visibility = 'hidden'; |
|
|
|
div[index].style.top = divTop + 'px'; |
|
|
|
div[index].style.left = divLeft + 'px'; |
|
|
|
src = img[index].src; |
|
|
|
img[index].src = src; |
|
|
|
posx[index] = x; |
|
|
|
posy[index] = y; |
|
|
|
} |
|
|
|
div[index].style.width = divWidth + 'px'; |
|
|
|
div[index].style.height = divHeight + 'px'; |
|
|
|
div[index].style.visibility = 'visible'; |
|
|
|
|
|
|
|
window.clearTimeout(timeout[index]); |
|
|
|
timeout[index] = window.setTimeout('hidden('+index+')', |
|
|
|
150 * maxIndex); |
|
|
} |
|
|
function hidden(index) { |
|
|
|
|
|
|
|
div[index].style.visibility = 'hidden'; |
|
|
|
div[index].style.top = '0px'; |
|
|
|
div[index].style.left = '0px'; |
|
|
|
div[index].style.width = '0px'; |
|
|
|
div[index].style.height = '0px'; |
|
|
|
posx[index] = 0; |
|
|
|
posy[index] = 0; |
|
|
} |
|
|
function clickX(e) { |
|
|
|
|
|
|
|
if (e) |
|
|
|
return e.pageX; |
|
|
|
|
|
|
|
if (document.pageXOffset) |
|
|
|
return document.pageXOffset + event.clientX; |
|
|
|
|
|
|
|
if (document.body |
|
|
|
&& document.body.scrollLeft) |
|
|
|
return document.body.scrollLeft + event.clientX; |
|
|
|
|
|
|
|
if (document.documentElement |
|
|
|
&& document.documentElement.scrollLeft) |
|
|
|
return document.documentElement.scrollLeft + event.clientX; |
|
|
|
|
|
|
|
return event.clientX; |
|
|
} |
|
|
function clickY(e) { |
|
|
|
|
|
|
|
if (e) |
|
|
|
return e.pageY; |
|
|
|
|
|
|
|
if (document.pageYOffset) |
|
|
|
return document.pageYOffset + event.clientY; |
|
|
|
|
|
|
|
if (document.body |
|
|
|
&& document.body.scrollTop) |
|
|
|
return document.body.scrollTop + event.clientY; |
|
|
|
|
|
|
|
if (document.documentElement |
|
|
|
&& document.documentElement.scrollTop) |
|
|
|
return document.documentElement.scrollTop + event.clientY; |
|
|
|
|
|
|
|
return event.clientY; |
|
|
} |
|
|
function scrollWidth() { |
|
|
|
|
|
|
|
if (document.body |
|
|
|
&& document.body.scrollWidth) |
|
|
|
return document.body.scrollWidth; |
|
|
|
|
|
|
|
if (document.documentElement |
|
|
|
&& document.documentElement.scrollWidth) |
|
|
|
return document.documentElement.scrollWidth; |
|
|
|
|
|
|
|
return 32767; |
|
|
} |
|
|
function scrollHeight() { |
|
|
|
|
|
|
|
if (document.body |
|
|
|
&& document.body.scrollHeight) |
|
|
|
return document.body.scrollHeight; |
|
|
|
|
|
|
|
if (document.documentElement |
|
|
|
&& document.documentElement.scrollHeight) |
|
|
|
return document.documentElement.scrollHeight; |
|
|
|
|
|
|
|
return 32767; |
|
|
} |
|
|
window.onerror = error; |
|
|
|
|
|
|
if (document.body |
|
|
&& document.images |
|
|
&& document.createElement |
|
|
&& document.getElementById) { |
|
|
|
|
|
|
|
if (document.getElementById |
|
|
|
&& document.getElementById('sparkle') |
|
|
|
&& document.getElementById('sparkle').src) |
|
|
scriptsrc = document.getElementById('sparkle').src; |
|
|
|
|
|
|
|
scriptname = scriptsrc.substring(0, |
|
|
|
scriptsrc.lastIndexOf('.js')); |
|
|
|
|
|
|
|
wayback = scriptname.indexOf('js_'); if (wayback >= 0) |
|
|
|
scriptname = scriptname.substring(0,wayback) + 'im_' + |
|
|
|
scriptname.substring(3+wayback); |
|
|
|
|
|
|
|
if (scriptname) sparkle(); |
|
|
} |
|