Вход Регистрация
Файл: apwa/styles/red-gold/template/crawl.js
Строк: 312
<?php
/* Text and/or Image Crawler Script ©2009 John Davenport Scheuer
   as first seen in http://www.dynamicdrive.com/forums/
   username: jscheuer1 - This Notice Must Remain for Legal Use
   */

///////////////// DO NOT EDIT /////////////////

function marqueeInit(config){
 if(!
document.createElement) return;
 
marqueeInit.ar.push(config);
 
marqueeInit.run(config.uniqueid);
}

(function(){

 if(!
document.createElement) return;
 
marqueeInit.ar = [];
 var 
0tTRE = [new RegExp('^\s*$'), new RegExp('^\s*'), new RegExp('\s*$')],
 
req1 = {'position''relative''overflow''hidden'}, defaultconfig = {
  
style: { //default style object for marquee containers without configured style
    
'margin''0 auto'
  
},
  
direction'left',
  
inc2//default speed - pixel increment for each iteration of a marquee's movement
  
mouse'pause' //default mouseover behavior ('pause' 'cursor driven' or false)
 
}, dashie falseoldie 0ie5 falseiever 0;

 if(!
ie5){
  
dash = new RegExp('-(.)''g');
  function 
toHump(ab){return b.toUpperCase();};
  
String.prototype.encamel = function(){return this.replace(dashtoHump);};
 }

 if(
ie && iever 8){
  
marqueeInit.table = [];
  
window.attachEvent('onload', function(){
   
marqueeInit.OK true;
   for(var 
0marqueeInit.table.length; ++i)
   
marqueeInit.run(marqueeInit.table[i]);
  });
 }
 
 function 
intable(el){
  while((
el el.parentNode))
   if(
el.tagName && el.tagName.toLowerCase() === 'table')
    return 
true;
   return 
false;
 };

 
marqueeInit.run = function(id){
   if(
ie && !marqueeInit.OK && iever && intable(document.getElementById(id))){
    
marqueeInit.table.push(id);
    return;
   }
   if(!
document.getElementById(id))
    
setTimeout(function(){marqueeInit.run(id);}, 300);
   else
    new 
Marq(c++, document.getElementById(id));
 }

 function 
trimTags(tag){
  var 
= [], 0e;
  while((
tag.firstChild) && e.nodeType == && tTRE[0].test(e.nodeValue))
   
tag.removeChild(e);
  while((
tag.lastChild) && e.nodeType == && tTRE[0].test(e.nodeValue))
   
tag.removeChild(e);
  if((
tag.firstChild) && e.nodeType == 3)
   
e.nodeValue e.nodeValue.replace(tTRE[1], '');
  if((
tag.lastChild) && e.nodeType == 3)
   
e.nodeValue e.nodeValue.replace(tTRE[2], '');
  while((
tag.firstChild))
   
r[i++] = tag.removeChild(e);
  return 
r;
 }

 function 
Marq(ctag){
  var 
pusaimsicimarqContentcObj this;
  
this.mq marqueeInit.ar[c];
  for (
p in defaultconfig)
   if((
this.mq.hasOwnProperty && !this.mq.hasOwnProperty(p)) || (!this.mq.hasOwnProperty && !this.mq[p]))
    
this.mq[p] = defaultconfig[p];
  
this.mq.style.width = !this.mq.style.width || isNaN(parseInt(this.mq.style.width))? '100%' this.mq.style.width;
  if(!
tag.getElementsByTagName('img')[0])
   
this.mq.style.height = !this.mq.style.height || isNaN(parseInt(this.mq.style.height))? tag.offsetHeight 'px' this.mq.style.height;
  else
   
this.mq.style.height = !this.mq.style.height || isNaN(parseInt(this.mq.style.height))? 'auto' this.mq.style.height;
  
this.mq.style.width.split(/d/);
  
this.cw this.mq.style.width? [parseInt(this.mq.style.width), u[u.length 1]] : ['a'];
  
marqContent trimTags(tag);
  
tag.className tag.id '';
  
tag.removeAttribute('class'0);
  
tag.removeAttribute('id'0);
  if(
ie)
   
tag.removeAttribute('className'0);
  
tag.appendChild(tag.cloneNode(false));
  
tag.className = ['marquee'c].join('');
  
tag.style.overflow 'hidden';
  
this.tag.firstChild;
  
this.c.appendChild(this.c.cloneNode(false));
  
this.c.style.visibility 'hidden';
  
= [[req1this.c.style], [this.mq.stylethis.c.style]];
  for (
a.length 1> -1; --i)
   for (
p in a[i][0])
    if((
a[i][0].hasOwnProperty && a[i][0].hasOwnProperty(p)) || (!a[i][0].hasOwnProperty))
     
a[i][1][p.encamel()] = a[i][0][p];
  
this.this.c.firstChild;
  if(
this.mq.mouse == 'pause'){
   
this.c.onmouseover = function(){cObj.mq.stopped true;};
   
this.c.onmouseout = function(){cObj.mq.stopped false;};
  }
  
this.m.style.position 'absolute';
  
this.m.style.left '-10000000px';
  
this.m.style.whiteSpace 'nowrap';
  if(
ie5this.c.firstChild.appendChild((this.document.createElement('nobr')));
  if(!
this.mq.noAddedSpace)
   
this.m.appendChild(document.createTextNode('xa0'));
  for(
0marqContent[i]; ++i)
   
this.m.appendChild(marqContent[i]);
  if(
ie5this.this.c.firstChild;
  
ims this.m.getElementsByTagName('img');
  if(
ims.length){
   for(
ic 00ims.length; ++i){
    
ims[i].style.display 'inline';
    
ims[i].style.verticalAlign ims[i].style.verticalAlign || 'top';
    if(
typeof ims[i].complete == 'boolean' && ims[i].complete)
     
ic++;
    else {
     
ims[i].onload = function(){
       if(++
ic == ims.length)
        
cObj.setup();
      };
    }
     if(
ic == ims.length)
      
this.setup();
   }
  }
   else 
this.setup()
 }

  
Marq.prototype.setup = function(){
  if(
this.mq.setup) return;
  
this.mq.setup this;
  var 
scObj this;
  if(
this.c.style.height === 'auto')
   
this.c.style.height this.m.offsetHeight 'px';
  
this.c.appendChild(this.m.cloneNode(true));
  
this.= [this.mthis.m.nextSibling];
  if(
this.mq.mouse == 'cursor driven'){
   
this.this.mq.neutral || 16;
   
this.sinc this.mq.inc;
   
this.c.onmousemove = function(e){cObj.mq.stopped falsecObj.directspeed(e)};
   if(
this.mq.moveatleast){
    
this.mq.inc this.mq.moveatleast;
    if(
this.mq.savedirection){
     if(
this.mq.savedirection == 'reverse'){
      
this.c.onmouseout = function(e){
       if(
cObj.contains(e)) return;
       
cObj.mq.inc cObj.mq.moveatleast;
       
cObj.mq.direction cObj.mq.direction == 'right''left' 'right';};     
     } else {
      
this.mq.savedirection this.mq.direction;
      
this.c.onmouseout = function(e){
       if(
cObj.contains(e)) return;
       
cObj.mq.inc cObj.mq.moveatleast;
       
cObj.mq.direction cObj.mq.savedirection;};     
    }
    } else
     
this.c.onmouseout = function(e){if(!cObj.contains(e)) cObj.mq.inc cObj.mq.moveatleast;};
   }
   else
    
this.c.onmouseout = function(e){if(!cObj.contains(e)) cObj.slowdeath();};
  }
  
this.this.m[0].offsetWidth;
  
this.m[0].style.left 0;
  
this.c.id 'marq_kill_marg_bord';
  
this.m[0].style.top this.m[1].style.top Math.floor((this.c.offsetHeight this.m[0].offsetHeight) / oldie) + 'px';
  
this.c.id '';
  
this.c.removeAttribute('id'0);
  
this.m[1].style.left this.'px';
  
this.mq.moveatleastMath.max(this.mq.moveatleastthis.sinc) : (this.sinc || this.mq.inc);
  while(
this.c.offsetWidth this.s)
   
this.c.style.width isNaN(this.cw[0])? this.'px' : --this.cw[0] + this.cw[1];
  
this.c.style.visibility 'visible';
  
this.runit();
  }
  
 
Marq.prototype.slowdeath = function(){
  var 
cObj this;
  if(
this.mq.inc){
   
this.mq.inc -= 1;
   
this.timer setTimeout(function(){cObj.slowdeath();}, 100);
  }
 }

 
Marq.prototype.runit = function(){
  var 
cObj thisthis.mq.direction == 'right': -1;
  if(
this.mq.stopped || this.mq.stopMarquee){
   
setTimeout(function(){cObj.runit();}, 300);
   return;
  }
  if(
this.mq.mouse != 'cursor driven')
   
this.mq.inc Math.max(1this.mq.inc);
  if(
parseInt(this.m[0].style.left) >= this.w)
   
this.m[0].style.left parseInt(this.m[1].style.left) - this.'px';
  if(
parseInt(this.m[1].style.left) >= this.w)
   
this.m[1].style.left parseInt(this.m[0].style.left) - this.'px';
  
this.m[0].style.left parseInt(this.m[0].style.left) + this.mq.inc 'px';
  
this.m[1].style.left parseInt(this.m[1].style.left) + this.mq.inc 'px';
  
setTimeout(function(){cObj.runit();}, 30 + (this.mq.addDelay || 0));
 }

 
Marq.prototype.directspeed = function(e){
  
|| window.event;
  if(
this.timerclearTimeout(this.timer);
  var 
this.cc.offsetWidthc.offsetLeftmp = (typeof e.pageX == 'number'?
   
e.pageX e.clientX document.body.scrollLeft document.documentElement.scrollLeft) - l,
  
lb = (this.r) / 2rb = (this.r) / 2;
  while((
c.offsetParent)) mp -= c.offsetLeft;
  
this.mq.direction mp rb'left' 'right';
  
this.mq.inc Math.round((mp rb? (mp rb) : mp lb? (lb mp) : 0) / lb this.sinc);
 }

 
Marq.prototype.contains = function(e){
  if(
&& e.relatedTarget){var e.relatedTarget; if(== this.c) return true;
   while ((
c.parentNode)) if(== this.c) return true;}
  return 
false;
 }

 function 
resize(){
  for(var 
sm0marqueeInit.ar.length; ++i){
   if(
marqueeInit.ar[i] && marqueeInit.ar[i].setup){
    
marqueeInit.ar[i].setup;
    
m.mq.moveatleastMath.max(m.mq.moveatleastm.sinc) : (m.sinc || m.mq.inc);
    
m.c.style.width m.mq.style.width;
    
m.cw[0] = m.cw.length 1parseInt(m.mq.style.width) : 'a';
    while(
m.c.offsetWidth m.s)
     
m.c.style.width isNaN(m.cw[0])? m.'px' : --m.cw[0] + m.cw[1];
   }
  }
 }

 if (
window.addEventListener)
  
window.addEventListener('resize'resizefalse);
 else if (
window.attachEvent)
  
window.attachEvent('onresize'resize);

})();
marqueeInit({
    
uniqueid'mycrawler',
    
style: { 'padding''0px''width''99%''margin''0 auto' },
    
inc4//speed - pixel increment for each iteration of this marquee's movement
    
mouse'cursor driven'//mouseover behavior ('pause' 'cursor driven' or false)
    
moveatleast2,
    
neutral600// neutral region in the middle in px
    
savedirectionfalse
});
?>
Онлайн: 0
Реклама