From 537625c60ce43a9a12416ffbcbfaad738f5d4682 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 20 Aug 2007 05:57:01 +0100 Subject: [PATCH] piggification updates --- functions.js | 29 ++++++++++++++++++++++++++ prefs.js | 59 ++++------------------------------------------------ prefs.php | 2 +- tt-rss.css | 14 ------------- 4 files changed, 34 insertions(+), 70 deletions(-) diff --git a/functions.js b/functions.js index b5b8f7b6..e9c14b63 100644 --- a/functions.js +++ b/functions.js @@ -1892,3 +1892,32 @@ function openArticleInNewWindow(id) { } } +/* http://textsnippets.com/posts/show/835 */ + +Position.GetWindowSize = function(w) { + w = w ? w : window; + var width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth); + var height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight); + return [width, height] +} + +/* http://textsnippets.com/posts/show/836 */ + +Position.Center = function(element, parent) { + var w, h, pw, ph; + var d = Element.getDimensions(element); + w = d.width; + h = d.height; + Position.prepare(); + if (!parent) { + var ws = Position.GetWindowSize(); + pw = ws[0]; + ph = ws[1]; + } else { + pw = parent.offsetWidth; + ph = parent.offsetHeight; + } + element.style.top = (ph/2) - (h/2) - Position.deltaY + "px"; + element.style.left = (pw/2) - (w/2) - Position.deltaX + "px"; +} + diff --git a/prefs.js b/prefs.js index a3012d11..0debf270 100644 --- a/prefs.js +++ b/prefs.js @@ -5,9 +5,6 @@ var active_label = false; var active_tab = false; var feed_to_expand = false; -var piggie_top = -400; -var piggie_fwd = true; - var xmlhttp = Ajax.getTransport(); var init_params = new Array(); @@ -1131,63 +1128,15 @@ function editSelectedFeedCat() { } -function piggie_callback() { - var piggie = document.getElementById("piggie"); - - piggie.style.top = piggie_top; - piggie.style.backgroundColor = "white"; - piggie.style.borderWidth = "1px"; - - if (piggie_fwd && piggie_top < 0) { - setTimeout("piggie_callback()", 50); - piggie_top = piggie_top + 10; - } else if (piggie_fwd && piggie_top >= 0) { - piggie_fwd = false; - setTimeout("piggie_callback()", 50); - } else if (!piggie_fwd && piggie_top > -400) { - setTimeout("piggie_callback()", 50); - piggie_top = piggie_top - 10; - } else if (!piggie_fwd && piggie_top <= -400) { - piggie.style.display = "none"; - piggie_fwd = true; - } -} - -var piggie_opacity = 0; - -function piggie2_callback() { - var piggie = document.getElementById("piggie"); - piggie.style.top = 0; - piggie.style.opacity = piggie_opacity; - piggie.style.backgroundColor = "transparent"; - piggie.style.borderWidth = "0px"; - - if (piggie_fwd && piggie_opacity < 1) { - setTimeout("piggie2_callback()", 50); - piggie_opacity = piggie_opacity + 0.03; - } else if (piggie_fwd && piggie_opacity >= 1) { - piggie_fwd = false; - setTimeout("piggie2_callback()", 50); - } else if (!piggie_fwd && piggie_opacity > 0) { - setTimeout("piggie2_callback()", 50); - piggie_opacity = piggie_opacity - 0.03; - } else if (!piggie_fwd && piggie_opacity <= 0) { - piggie.style.display = "none"; - piggie_fwd = true; - } -} - function localPiggieFunction(enable) { if (enable) { debug("I LOVEDED IT!"); var piggie = document.getElementById("piggie"); - piggie.style.display = "block"; - if (navigator.userAgent.match("Gecko") && Math.random(1) > 0.5) { - piggie2_callback(); - } else { - piggie_callback(); - } + Element.show(piggie); + Position.Center(piggie); + Effect.Puff(piggie); + } } diff --git a/prefs.php b/prefs.php index 5a31d94c..1c81b470 100644 --- a/prefs.php +++ b/prefs.php @@ -68,7 +68,7 @@ -
 
+