mirror of
https://github.com/php/web-pres2.git
synced 2026-03-23 23:12:07 +01:00
we now have sliding bullets. see the intro third slide for example.
still needs some work, but working in mozilla for now.
This commit is contained in:
17
1k.js
Normal file
17
1k.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// 1k DOM API - http://timmorgan.info/1k/
|
||||
d=document;
|
||||
function gE(e){return d.getElementById(e)};
|
||||
function cE(t){return d.createElement(t||'div')};
|
||||
function aC(e,p){return (p||d.body).appendChild(e)};
|
||||
function sE(e){e.style.visibility='visible'};
|
||||
function hE(e){e.style.visibility='hidden'};
|
||||
function sZ(e,z){e.style.zIndex=z};
|
||||
function sX(e,x){e.style.left=px(x)};
|
||||
function sY(e,y){e.style.top=px(y)};
|
||||
function sW(e,w){e.style.width=px(w)};
|
||||
function sH(e,h){e.style.height=px(h)};
|
||||
function sC(e,t,r,b,l){e.style.clip='rect('+t+' '+r+' '+b+' '+l+')'};
|
||||
function wH(e,h){e.innerHTML=h};
|
||||
function sB(e,b){e.style.background=b};
|
||||
function aE(e,ev,f){ev=ev.replace(/^(on)?/,'on');if(!e[ev+'c'])e[ev+'c']=[];e[ev+'c'][e[ev+'c'].length]=f;if(!e[ev])e[ev]=function(v){v=v||event;if(!v.currentTarget)v.currentTarget=e;if(!v.target)v.target=v.currentTarget;for(i=0;i<e[ev+'c'].length;i++)e[ev+'c'][i](v)}};
|
||||
function px(n){return(typeof n=='string')?n:n+'px'};
|
||||
@@ -1,3 +1,5 @@
|
||||
<script type="text/javascript" language="javascript" src="1k.js"></script>
|
||||
<script type="text/javascript" language="javascript" src="slide.js"></script>
|
||||
<script language="JavaScript1.2">
|
||||
<!--
|
||||
if(!document.all){
|
||||
@@ -12,11 +14,46 @@ function keypressHandler(e){
|
||||
}else{
|
||||
e = e.which;
|
||||
}
|
||||
if (e == 39 && <?php echo $nextSlideNum; ?>) /* right arrow */
|
||||
if (e == 39) /* right arrow */
|
||||
{
|
||||
if (sliders.length > 0 && currentSlider < sliders.length) {
|
||||
try {
|
||||
slide(sliders[currentSlider], sliders[currentSlider].getAttribute('gotox'), 0, 0) ;
|
||||
} catch (e) { alert(e);}
|
||||
currentSlider = currentSlider+1;
|
||||
} else if (<?php echo $nextSlideNum; ?>) {
|
||||
top.location='<?php echo "http://$_SERVER[HTTP_HOST]$baseDir$showScript/$currentPres/$nextSlideNum"; ?>';
|
||||
}
|
||||
}
|
||||
if (e == 37 && <?php echo $prevSlideNum+1; ?>) /* left arrow */
|
||||
top.location='<?php echo "http://$_SERVER[HTTP_HOST]$baseDir$showScript/$currentPres/$prevSlideNum"; ?>';
|
||||
}
|
||||
window.onkeyup = keypressHandler;
|
||||
|
||||
var sliders = [];
|
||||
var currentSlider = 0;
|
||||
|
||||
onload = function() {
|
||||
// find any objects with attribute slide
|
||||
var sliderdiv = document.getElementsByTagName('div');
|
||||
for (var i=0; i < sliderdiv.length; i++) {
|
||||
if (sliderdiv[i].hasAttribute('slide')) {
|
||||
// ok, add this to our slider array
|
||||
//alert("slide "+sliderdiv[i].id+" at "+sliderdiv[i].offsetLeft+","+sliderdiv[i].offsetTop+"\n");
|
||||
sliderdiv[i].setAttribute('gotox',sliderdiv[i].offsetLeft);
|
||||
sliderdiv[i].setAttribute('gotoy',sliderdiv[i].offsetTop);
|
||||
sliderdiv[i].style.left = -1024;
|
||||
sliderdiv[i].style.top = sliderdiv[i].offsetTop;
|
||||
sliders[sliders.length] = sliderdiv[i];
|
||||
}
|
||||
}
|
||||
for (i=0; i< sliders.length; i++) {
|
||||
//alert(sliders[i].id);
|
||||
}
|
||||
//example = gE( "EXAMPLE" ) ;
|
||||
//sX( example, -100 ) ; // some browsers won't automatically populate the...
|
||||
//sY( example, -100 ) ; // ...position properties from the style sheet
|
||||
//slide( example, 200, 200, 3 ) ;
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
|
||||
10
objects.php
10
objects.php
@@ -42,6 +42,7 @@ function getFlashDimensions($font,$title,$size) {
|
||||
$this->shadowbackground = '#777777';
|
||||
$this->stylesheet = 'css.php';
|
||||
$this->logoimage1url = 'http://' . $HTTP_HOST . $baseDir . '/index.php';
|
||||
$this->animate=false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,6 +420,8 @@ type=\"application/x-shockwave-flash\" width=$this->iwidth height=$this->iheight
|
||||
function _bullet() {
|
||||
$this->mode = 'html';
|
||||
$this->text = '';
|
||||
$this->slide = '';
|
||||
$this->id = '';
|
||||
}
|
||||
|
||||
function display() {
|
||||
@@ -440,7 +443,14 @@ type=\"application/x-shockwave-flash\" width=$this->iwidth height=$this->iheight
|
||||
if(!empty($this->padding)) $style .= "padding: ".$this->padding.';';
|
||||
else if(!empty($objs[$coid]->padding)) $style .= "padding: ".$objs[$coid]->padding.';';
|
||||
|
||||
if ($this->slide) {
|
||||
// we put the slide info in as an attribute to js can get it
|
||||
echo "<div id='$this->id' slide='true' style='position:relative;'>";
|
||||
}
|
||||
echo "<li style=\"$style\">".$this->text."</li>\n";
|
||||
if ($this->slide) {
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
9
show.php
9
show.php
@@ -115,14 +115,15 @@ get_dims();
|
||||
|
||||
/* default is css.php */
|
||||
include $pres[1]->stylesheet;
|
||||
|
||||
/* the following includes scripts necessary for various animations */
|
||||
if($pres[1]->animate || $pres[1]->jskeyboard) {
|
||||
include 'keyboard.js.php';
|
||||
}
|
||||
?>
|
||||
</head>
|
||||
<body onResize="get_dims();" style="<?=$body_style?>">
|
||||
<?
|
||||
if(isset($pres[1]->jskeyboard) && $pres[1]->jskeyboard) {
|
||||
include 'keyboard.js.php';
|
||||
}
|
||||
|
||||
while(list($coid,$obj) = each($objs)) {
|
||||
$obj->display();
|
||||
}
|
||||
|
||||
23
slide.js
Normal file
23
slide.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// 1k SLIDE EXT
|
||||
function slide(e,x,y,sp,funcCall,xNow,yNow){
|
||||
var num;
|
||||
if(typeof e!='object'){num=e;e=slide.all[num];e.sliding=true;}
|
||||
else{if(e.sliding)return}
|
||||
xNow=xNow||parseInt(e.left||e.style.left||e.style.pixelLeft||e.offsetLeft);
|
||||
yNow=yNow||parseInt(e.top||e.style.top||e.style.pixelTop||e.offsetTop);
|
||||
distX=Math.abs(xNow-x);
|
||||
distY=Math.abs(yNow-y);
|
||||
if(Math.round(xNow)!=x)xNow+=(distX/(11-sp)*sign(xNow,x));
|
||||
if(Math.round(yNow)!=y)yNow+=(distY/(11-sp)*sign(yNow,y));
|
||||
sX(e,px(Math.round(xNow)));
|
||||
sY(e,px(Math.round(yNow)));
|
||||
if(num==null){num=slide.all.length;slide.all[num]=e;}
|
||||
if(Math.round(xNow)!=x||Math.round(yNow)!=y)setTimeout('slide('+num+','+x+','+y+','+sp+',"'+funcCall+'",'+xNow+','+yNow+')', 30);
|
||||
else{
|
||||
e.sliding=false;
|
||||
if(funcCall!='')eval(funcCall);
|
||||
}
|
||||
};
|
||||
slide.all=[];
|
||||
function sign(x,y){return(x<y)?1:-1};
|
||||
function px(n){return n; /*+(!l&&!op?'px':0)*/};
|
||||
Reference in New Issue
Block a user