piggification updates

This commit is contained in:
Andrew Dolgov 2007-08-20 05:57:01 +01:00
parent 91d64fb808
commit 537625c60c
4 changed files with 34 additions and 70 deletions

View File

@ -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";
}

View File

@ -5,9 +5,6 @@ var active_label = false;
var active_tab = false; var active_tab = false;
var feed_to_expand = false; var feed_to_expand = false;
var piggie_top = -400;
var piggie_fwd = true;
var xmlhttp = Ajax.getTransport(); var xmlhttp = Ajax.getTransport();
var init_params = new Array(); 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) { function localPiggieFunction(enable) {
if (enable) { if (enable) {
debug("I LOVEDED IT!"); debug("I LOVEDED IT!");
var piggie = document.getElementById("piggie"); var piggie = document.getElementById("piggie");
piggie.style.display = "block";
if (navigator.userAgent.match("Gecko") && Math.random(1) > 0.5) { Element.show(piggie);
piggie2_callback(); Position.Center(piggie);
} else { Effect.Puff(piggie);
piggie_callback();
}
} }
} }

View File

@ -68,7 +68,7 @@
<body> <body>
<div id="piggie">&nbsp;</div> <img id="piggie" src="images/piggie.png" style="display : none" alt="piggie">
<script type="text/javascript"> <script type="text/javascript">
if (document.addEventListener) { if (document.addEventListener) {

View File

@ -193,22 +193,8 @@ a:hover {
} }
#piggie { #piggie {
width : 400;
height : 400;
right : 0;
top : -400;
background-color : white;
display : none;
z-index : 999; z-index : 999;
background-image : url("images/piggie.png");
background-position : center center;
background-repeat : no-repeat;
position : absolute; position : absolute;
border : 1px solid pink;
margin-left : auto;
margin-right : auto;
-moz-border-radius : 10px;
opacity : 0.8;
} }
#iedit_title, #iedit_link, #iedit_regexp, #iedit_descr, #iedit_expr, #iedit_updintl, #iedit_title, #iedit_link, #iedit_regexp, #iedit_descr, #iedit_expr, #iedit_updintl,