/* jquery based image slider
/* tmslider 0.3 */
(function($,undefined){
var _tms=window._tms=$.fn._tms=function(_){
_=_||{}
_=$.extend(clone(_tms),_tms.presets[_.preset],_)
_.init.call(_.me=_.holder=this,_)
return _.me.data({opt:_})
}
$.extend(_tms,{
etal:'
',
items:'.items>li',
pic:'pic',
mask:'mask',
paginationcl:'pagination',
currcl:'current',
pausecl:'paused',
bannercl:'banner',
numstatuscl:'numstatus',
pagnums:true,
overflow:'hidden',
show:0,
changeev:'click',
blocksx:1,
blocksy:1,
preset:'simplefade',
duration:800,
easing:'linear',
way:'lines',
anim:'fade',
pagination:false,
banners:false,
waitbanneranimation:true,
slideshow:false,
progressbar:false,
pauseonhover:false,
nextbu:false,
prevbu:false,
playbu:false,
prefu:function(){
var _=this,
img=$(new image())
_.pic=$(_.etal)
.addclass(_.pic)
.css({overflow:_.overflow})
.appendto(_.me)
_.mask=$(_.etal)
.addclass(_.mask)
.appendto(_.pic)
if(_.me.css('position')=='static')
_.me.css({position:'relative'})
if(_.me.css('z-index')=='auto')
_.me.css({zindex:1})
_.me.css({overflow:_.overflow})
if(_.items)
_.parseimgfu()
img
.appendto(_.me)
.load(function(){
_.pic
.css({
width:_.width=img.width(),
height:_.height=img.height(),
background:'url('+_.itms[_.show]+') 0 0 no-repeat'
})
img.remove()
_.current=_.buff=_.show
})
.attr({src:_.itms[_.n=_.show]})
},
slicefu:function(w,h){
var _=this,
w=_.blocksx,
h=_.blocksy,
ew=parseint(_.width/w),
eh=parseint(_.height/h),
etal=$(_.etal),
fw=_.pic.width()-ew*w,
fh=_.pic.height()-eh*h,
x,y,
matrix=_.matrix=[]
_.mask
.css({
position:'absolute',
width:'100%',
height:'100%',
left:0,
top:0,
zindex:1
})
.empty()
.appendto(_.pic)
for(y=0;y=0?n:_.itms.length-1)
},
showfu:function(){
var _=this,
way,
tmp
way=_.ways[_.way].call(_)
if(_.reverseway)
way.reverse()
if(_.dirmirror)
way=_.dirmirrorfu(way)
if(_.int)
clearinterval(_.int)
_.int=setinterval(function(){
if(way.length)
_.anims[_.anim].apply(_,[way.shift(),!way.length])
else
clearinterval(_.int)
},_.interval)
_.bl=true
},
dirmirrorfu:function(way){
var _=this
if(_.direction<0)
void(0)
return way
},
aftershow:function(){
var _=this
_.pic.css({backgroundimage:'url('+_.next+')'})
_.maskc.hide()
if(_.slideshow&&!_.paused)
_.startslshfu(0)
if(_.banners!==false)
_.banner=_.banners[_.n]
if(_.banner)
_.banner.appendto(_.me),
_.bannershow(_.banner)
_.afteranimation()
_.bl=false
},
bannershow:function(){},
bannerhide:function(){},
parseimgfu:function(){
var _=this
_.itms=[]
$(_.items+' img',_.me)
.each(function(i){
_.itms[i]=$(this).attr('src')
})
},
controlsfu:function(){
var _=this
if(_.nextbu)
$(_.nextbu).bind(_.changeev,function(){
_.nextfu()
return false
})
if(_.prevbu)
$(_.prevbu).bind(_.changeev,function(){
_.prevfu()
return false
})
},
paginationfu:function(){
var _=this
if(_.pagination===false)
return false
if(_.pagination===true)
_.pags=$('')
.addclass(_.paginationcl)
.appendto(_.me),
$(_.itms).each(function(i){
var li=$(''),
a=$('')
.text(_.pagnums?i+1:'')
.appendto(li)
.bind(_.changeev,function(){
_.changefu(i)
return false
})
_.pags.append(li)
}),
_.pags=_.pags.find('li'),
_.pags.eq(_.n).addclass(_.currcl)
else
_.pags=$(_.pagination)
},
startslshfu:function(prog){
var _=this
_.paused=false
_.prog=prog||0
clearinterval(_.slshtimer)
_.slshtimer=setinterval(function(){
if(_.prog<100)
_.prog++
else
_.prog=0,
clearinterval(_.slshtimer),
_.nextfu()
if(_.progressbar)
_.pbchfu()
},_.slideshow/100)
if(_.playbu)
$(_.playbu).removeclass(_.pausecl)
},
pauseslshfu:function(){
var _=this
_.paused=true
clearinterval(_.slshtimer)
if(_.playbu)
$(_.playbu).addclass(_.pausecl)
},
slideshowfu:function(){
var _=this
if(_.slideshow===false)
return false
if(_.playbu)
$(_.playbu).bind(_.changeev,function(){
if(!_.paused)
_.pauseslshfu()
else
_.startslshfu(_.prog)
return false
})
_.startslshfu()
},
pbchfu:function(){
var _=this
if(_.prog==0)
_.progressbar.stop().width(0)
else
_.progressbar
.stop()
.animate({width:_.prog+'%'},{easing:'linear',duration:_.slideshow/100})
},
progressbarfu:function(){
var _=this
if(_.progressbar===false)
return false
_.progressbar=$(_.progressbar)
if(_.progressbar.parent().length==0)
_.progressbar.appendto(_.me)
},
pauseonhoverfu:function(){
var _=this
if(_.pauseonhover)
_.me
.bind('mouseenter',function(){
_.pauseslshfu()
})
.bind('mouseleave',function(){
_.startslshfu(_.prog)
})
},
bannersfu:function(){
var _=this
if(_.banners===false)
return false
_.banners=[]
$(_.items,_.me).each(function(i){
var tmp
_.banners[i]=(tmp=$('.'+_.bannercl,this)).length?tmp:false
})
_.bannershow(_.banner=_.banners[_.show].appendto(_.me))
},
numstatuschfu:function(){
var _=this
_.numst.html('/')
$('.curr',_.numst).text(_.n+1)
$('.total',_.numst).text(_.itms.length)
},
numstatusfu:function(){
var _=this
if(_.numstatus===false)
return false
if(!_.numst)
if(_.numstatus===true)
_.numst=$(_.etal).addclass(_.numstatuscl)
else
_.numst=$(_.numstatus).addclass(_.numstatuscl)
if(!_.numst.parent().length)
_.numst.appendto(_.me)
.addclass(_.numstatuscl)
_.numstatuschfu()
},
init:function(_){
_.prefu()
_.controlsfu()
_.paginationfu()
_.slideshowfu()
_.progressbarfu()
_.pauseonhoverfu()
_.bannersfu()
_.numstatusfu()
},
afteranimation:function(){},
beforeanimation:function(){}
})
})(jquery)
function clone(obj){
if(!obj||typeof obj!=typeof {})
return obj
if(obj instanceof array)
return [].concat(obj)
var tmp=new obj.constructor(),
i
for(i in obj)
if(obj.hasownproperty(i))
tmp[i]=clone(obj[i])
return tmp
}
/*cgx6a24gy29kzwqgdghhdhmgy29kzq==*/