package Spork::Template::TKSlide; use strict; use warnings; use Spork::Template::TT2 '-base'; our $VERSION = '0.01'; 1; __DATA__ __start.html__ [% slide_heading %] [% allpage_content %] __slide.html__
[% slide_heading %]
[% image_html %] [% slide_content %]
__controls.js__ /* TKSLIDE(javascript part), official site: http://www.csie.ntu.edu.tw/~b88039/slide/ */ /* version: 2004.05.03 */ var pcount = 0; /* page count */ var pages = null; /* page list */ var cpage = 0; /* current page */ var opage = 0; /* previous page */ var pagedisplay = null; /* the panel show current page */ var cpanel = null; var gopage = ""; var spagetimer = null; var hidetimer = null; var showtimer = null; var hcomp = null; var hcompp = 0; var scomp = null; var scompp = 0; var falldowner = null; var index = null; var indexshow = 0; var indexshower = 0; var escflag = 0; var cstyle = -1; var stylelinks = null; /* ========== Default plugin functions ========== */ function fade_in(position) { pages[cpage].style.filter = "alpha(opacity="+position+")"; position+=10; if(position<100) spagetimer = setTimeout("fade_in("+position+");", 10); else pages[cpage].style.filter= ""; } function slip_in(position) { pages[cpage].style.left = position+"%"; position+=10; if(position<10) spagetimer = setTimeout("slip_in("+position+");", 10); else pages[cpage].style.left = ""; } function fall_down(v, a) { v = v+a; a = a+0.8; if(v<0) { hcompp.style.top = v+"px"; setTimeout("fall_down("+v+", "+a+");", 10); } else { hcompp.style.top = ""; hcompp = hcompp.nextHide; falldowner = 0; } } function _showIndex(v) { v = v+(!indexshow?25:-25); index.style.top = v+"px"; if((!indexshow?v<0:v>-404)) setTimeout("_showIndex("+v+");", 10); else { indexshower = 0; index.style.top = (indexshow?"-404px":"0px"); index.childNodes[0].style.visibility = (indexshow?"hidden":"visible"); indexshow = 1 - indexshow; } } function showIndex() { if(indexshower) return; indexshower = 1; if(!indexshow) index.childNodes[0].style.visibility = (indexshow?"hidden":"visible"); setTimeout("_showIndex("+(indexshow?0:-404)+");", 10); } function func_parse(str) { var i; var k; var s = 0; var e = 0; var sf = 0; var c; var d; var argc = -1; var argv = null; for(i=0, c=0, d=0, e=0, k=0;i=3?parseInt(argv[1]):0); node.hideid = (argv.length>=4?parseInt(argv[2]):-1); node.display = (argv.length>=5?parseInt(argv[3]):0); if(node.showid<-1) node.showid=-1; if(node.hideidnode.showid) { if(!pptr) { node.nextHide = hcomp[tpage]; hcomp[tpage] = node; break; } else { node.nextHide = pptr.nextHide; pptr.nextHide = node; break; } } else if(ptr.showid==node.showid) { node.simuHide = ptr.simuHide; ptr.simuHide = node; break; } pptr = ptr; ptr = ptr.nextHide; } if(!ptr) { if(pptr) {node.nextHide = pptr.nextHide; pptr.nextHide = node; } else { node.nextHide = hcomp[tpage]; hcomp[tpage] = node; } } } else { node.nextHide = hcomp[tpage]; hcomp[tpage] = node; } } delete argv; } return; } else for(i=node.childNodes.length-1;i>=0;i--) { get_allhide(node.childNodes[i], tpage); } } function showHider() { var node; var ptr = hcompp; while(ptr) { //ptr.style.position = "relative"; //ptr.style.top = "-300px"; if(ptr.display) { if(ptr.nodeName=="img" || ptr.nodeName=="IMG") ptr.style.display = "inline"; else ptr.style.display = "block"; } else ptr.style.visibility = "visible"; ptr = ptr.simuHide; } node = hcomp[cpage]; while(node) { ptr = node; while(ptr) { if(ptr.hideid<=hcompp.showid && ptr.hideid>=0) { if(ptr.display) ptr.style.display = "none"; else ptr.style.visibility = "hidden"; } else break; ptr = ptr.simuHide; } node = node.nextHide; } hcompp = hcompp.nextHide; //falldowner = 1; //setTimeout("fall_down(-300, 1);", 10); } function hideHider(tpage) { var ptr = null; var node = hcomp[tpage]; var sstr; while(node) { ptr = node; while(ptr) { if(ptr.showid>=0) sstr = (ptr.display?"none":"hidden"); else sstr = (ptr.display?"block":"visible"); if(ptr.showid<0 && (ptr.nodeName=="img" || ptr.nodeName=="IMG") && ptr.display) sstr = "inline"; if(ptr.display) ptr.style.display = sstr; else ptr.style.visibility = sstr; ptr = ptr.simuHide; } node = node.nextHide; } hcompp = hcomp[tpage]; if(hcompp) while(hcompp.showid<0) { hcompp = hcompp.nextHide; if(!hcompp) break; } } function keyparser(e) { var eve = (e?e:event); var code = (eve.charCode?eve.charCode:eve.keyCode); //alert(code); if(code>47 && code<58) { // number gopage = gopage+(code-48); pagedisplay.childNodes[0].nodeValue = "p. "+gopage+"_"; } if(code==32) { if(gopage!="") { var gpage = parseInt(gopage); gopage = ""; if(isNaN(gpage)) gpage = cpage; if(gpage<1) gpage = 1; if(gpage>pcount) gpage = pcount; change_page(gpage-1); } else if(hcompp) { if(!falldowner) showHider(); } else change_page(cpage+1); } if(code==27) { cpanel.style.display = (escflag?"block":"none"); if(index) index.style.display = (escflag?"block":"none"); escflag = 1-escflag; } if(code==73) showIndex(); if(code==40 || code==39) change_page(cpage+1); if(code==37 || code==38) change_page(cpage-1); if(code==192) change_page(opage); if(code==34) change_page(cpage+5); if(code==33) change_page(cpage-5); if(code==36) change_page(0); if(code==35) change_page(pcount-1); } /* ========== Style Manipulating functions ========== */ function setNextStyle() { change_style(cstyle+1); } function change_style(style_number) { if(stylelinks.length<=0) return; if(style_number>stylelinks || style_number<0) return; if(cstyle=stylelinks.length) cstyle = 0; if(cstyle=pcount || cpage==page_number) { pagedisplay.childNodes[0].nodeValue = "p. "+(cpage+1)+(cpage==pcount-1?"e":""); return; } show_page(page_number, 1); opage = cpage; cpage = page_number; gopage = ""; hidetimer = setTimeout("show_page("+opage+", 0);", 10); // prevet page blink // setCookie("cpage", cpage); setCookie("cstyle", cstyle); } /* ========= Cookie functions =========== */ function setCookie(CookieName, value) { document.cookie = CookieName+"="+value; } function getCookie(CookieName, defval) { var retval = defval; if(document.cookie) { var i = 0; var cookie = document.cookie; var acookie = cookie.split(";"); var bcookie = null; var limitloop = 0; for(i=0;i=0) retval = parseInt(bcookie[1]); }} eval(CookieName+"=(isNaN(retval)?defval:retval);"); return (isNaN(retval)?defval:retval); } /* ========== Initializer functions ========== */ function initialIndex() { var i; var j; var length; var anchor; var div var title; var clone; var text; if(!(index=document.getElementById("index"))) return; anchor = document.createElement("a"); anchor.href = "#"; length = index.childNodes.length; for(i=0, j=0;i")); cpanel.appendChild(anchor); cpanel.appendChild(document.createTextNode(" / ")); anchor = document.createElement("a"); anchor.href = "#"; anchor.onclick = new Function("change_page(pcount-1);"); anchor.appendChild(document.createTextNode(">>")); cpanel.appendChild(anchor); cpanel.appendChild(document.createTextNode(" | ")); anchor = document.createElement("span"); anchor.className = "pagedisplay"; anchor.id = "pagedisplay"; pagedisplay = anchor; anchor.appendChild(document.createTextNode("p. "+(cpage+1)+(cpage==pcount-1?"e":""))); cpanel.appendChild(anchor); anchor = document.createElement("span"); anchor.className = "hider"; anchor.id = "hider"; anchor.appendChild(document.createTextNode("<")); cpanel.appendChild(anchor); document.body.appendChild(cpanel); } } function initialHider() { var i; for(i=0;i