content switching
*/
/* INTERNAL: the switchdiv run-time information */
var switchdiv = new Array();
/* INTERNAL: on mouse over events */
function switchdiv_over(event) {
var id = this;
switchdiv[id]["suspend"] = 1;
return;
}
/* INTERNAL: on mouse out events */
function switchdiv_out(event) {
var id = this;
switchdiv[id]["suspend"] = 0;
return;
}
/* INTERNAL: update the switchdiv effect on a DOM node */
function switchdiv_update (id) {
/* check for suspend mode first */
if (switchdiv[id]["suspend"] == 1) {
/* reschedule after 1s */
defer_schedule("switchdiv_update_"+id, "switchdiv_update('"+id+"')", 1000);
return;
}
/* determine message nodes */
var divs = switchdiv[id]["divs"];
var div = divs[switchdiv[id]["current"]];
/* switching to next message */
div.style.display = "none";
switchdiv[id]["current"] = ((switchdiv[id]["current"] + 1) % divs.length);
div = divs[switchdiv[id]["current"]];
div.style.display = "block";
t = switchdiv[id]["keep"];
/* re-schedule switchdiv rendering */
defer_schedule("switchdiv_update_"+id, "switchdiv_update('"+id+"')", t);
return;
}
/* EXTERNAL: apply a switchdiv effect to a DOM node */
function switchdiv_apply (id, root_select, div_select, keep) {
/* determine DOM root node */
var root = DOM.getNode(root_select);
/* initially do not display any message */
var divs = DOM.getNode(div_select, root);
if (divs.length < 2) {
alert("switchdiv
'"+id+"' does not contain at least 2 message
elements!");
return;
}
for (var i = 0; i < divs.length; i++)
divs[i].style.display = "none";
/* remember switchdiv run-time information */
switchdiv[id] = new Array();
switchdiv[id]["divs"] = divs;
switchdiv[id]["current"] = divs.length-1;
switchdiv[id]["keep"] = keep;
switchdiv[id]["suspend"] = 0;
/* grab mouse over/out events */
DOM.setEvent(root, "mouseover", switchdiv_over, id, true);
DOM.setEvent(root, "mouseout", switchdiv_out, id, true);
/* schedule switchdiv rendering */
defer_schedule("switchdiv_update_"+id, "switchdiv_update('"+id+"')", 1000);
return;
}
/* INTERNAL: toggle classes */
function toggleclass_update (id, nodes_selector, class1, class2, delay) {
var nodes = DOM.getNode(nodes_selector);
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].className == class1)
nodes[i].className = class2;
else if (nodes[i].className == class2)
nodes[i].className = class1;
}
defer_schedule("toggleclass_update_"+id, "toggleclass_update('"+id+"', '"+nodes_selector+"', '"+class1+"', '"+class2+"', '"+delay+"')", delay);
return;
}
/* EXTERNAL: apply a class toggling effect to DOM nodes */
function toggleclass_apply (id, nodes_selector, class1, class2, delay) {
var nodes = DOM.getNode(nodes_selector);
if (nodes.length < 1) {
alert("no elements found via '"+nodes_selector+"' for class toggling!");
return;
}
defer_schedule("toggleclass_update_"+id, "toggleclass_update('"+id+"', '"+nodes_selector+"', '"+class1+"', '"+class2+"', '"+delay+"')", delay);
return;
}
@
1.10
log
@flush all pending changes to meta.openpkg.org
@
text
@d32 6
@
1.9
log
@upgrade to the latest Yahoo widget library world order now that openpkg.org runs OpenPKG 2.20060622
@
text
@d34 4
a37 3
d50 4
d78 1
a78 1
return [ YAHOO.util.Dom.getClientWidth(), YAHOO.util.Dom.getClientHeight() ];
d183 24
@
1.8
log
@fix special case of initial start: make sure we start with first message
@
text
@d34 3
a36 3
@
1.7
log
@establish news ticker and feeds
@
text
@d164 1
a164 1
switchdiv[id]["current"] = 0;
@
1.6
log
@the new title page
@
text
@d130 3
a132 6
/* determine DOM node */
var node = switchdiv[id]["node"];
/* determine message node */
var divs = node.getElementsByTagName("div");
var div = divs[switchdiv[id]["div"]];
d136 2
a137 2
switchdiv[id]["div"] = ((switchdiv[id]["div"] + 1) % divs.length);
div = divs[switchdiv[id]["div"]];
d148 3
a150 3
function switchdiv_apply (id, keep) {
/* determine DOM node */
var node = document.getElementById(id);
d153 1
a153 1
var divs = node.getElementsByTagName("div");
d163 2
a164 2
switchdiv[id]["node"] = node;
switchdiv[id]["div"] = 0;
d169 2
a170 2
DOM.setEvent(node, "mouseover", switchdiv_over, id, true);
DOM.setEvent(node, "mouseout", switchdiv_out, id, true);
@
1.5
log
@code cosmetics
@
text
@d89 1
a89 1
defer_handle[id] = setTimeout("defer_scheduled["+id+"] = 0; " + cmd, delay);
d100 81
@
1.4
log
@switch to global configuration array variables instead of a dozend individual variables
@
text
@d24 1
a24 1
## canvas-js.php: javascript reuseable components
d38 1
a38 1
d42 13
a54 2
d80 19
a98 6
@
1.3
log
@reference dhtml stuff via a local symlink so the consumer fetches it via meta and not locally
@
text
@d34 3
a36 3
d40 1
a40 1
d74 1
a74 1
@
1.2
log
@use remaining parts from dhtml package, too
@
text
@d34 3
a36 3
d40 1
a40 1
d74 1
a74 1
@
1.1
log
@flush all other pending changes to improve the website layout
@
text
@d40 1
a40 1
canvas-js.d/cssquery.js" type="text/javascript">
d74 1
a74 1
canvas-js.d/ie7.js" type="text/javascript">
@