")
.addClass(sig+"-base")
.css({
"background-image":"url('img/"+rec["img"]+"')",
"background-color":rec["bg-color"],
"background-size":rec["bg-size"],
"background-position":rec["bg-pos"],
"background-repeat":"no-repeat"
});
},
};
var CPBar = {
abort : function() {
sshow.jqo_info
.find("."+sig+"-progressbar")
.remove();
},
run : function(pbtype,rec,b_reverse) {
if ( b_reverse == undefined ) {
b_reverse = false;
}
this.abort();
var css = {
opacity:0.5
};
var pos = "top";
var height = 10;
var color = "red";
var dura,pos,height,color;
switch( pbtype ) {
case "t":
dura = rec["ttime"];
pos = "top";
height = 10;
color = "red";
break;
case "p":
dura = rec["ptime"];
pos = "bottom";
height = 14;
color = "yellow";
break;
}
switch ( pos ) {
case "top": css.top = 0; break;
case "bottom": css.bottom = 0; break;
}
$("
")
.attr("class",sig+"-progressbar")
.css(css)
.html($("
")
.css({
width:0,
height:height+"px",
"background-color":color
})
.css({
"animation-name":sig+"-kf-progressbar",
"animation-duration":dura+"s",
"animation-timing-function":"ease",
"animation-iteration-count":1,
"animation-fill-mode":"none",
"animation-direction":!b_reverse?"normal":"reverse"
})
)
.appendTo(sshow.jqo_info);
}
};
var CTfxMan = {
run : function(idx_tfx,idx_f,idx_t,b_reverse) {
var tfx = {
idx:{
"f":idx_f,
"t":idx_t
},
init:{},
kf:{},
b_reverse:b_reverse
};
var rec = CSlideMan.getSlide(idx_tfx);
for ( var key in rec ) {
tfx[key] = rec[key];
}
var tfx_func_run = tfx_handlers[rec["verb"]];
tfx_func_run.call(tfx);
CPBar.run("t",rec,b_reverse);
return rec;
}
};
var sshow = {
getSlideSize : function() {
return {
w:this.jqo_warea.width(),
h:this.jqo_warea.height()
};
},
show : function() {
this.jqo_warea.html(CSlideMan.create(this.cidx));
},
clear : function() {
this.jqo_warea.html("");
},
doTrans : function(idx_t_inp) {
var _this = this;
if ( !this.max_slide ) {
return;
}
var b_reverse = false;
var idx_f = this.cidx;
if ( idx_t_inp === true ) {
idx_t = idx_f+1;
if ( idx_t >= this.max_slide ) {
idx_t = 0;
}
} else if ( idx_t_inp === false ) {
b_reverse = true;
idx_t = idx_f-1;
if ( idx_t < 0 ) {
idx_t = this.max_slide-1;
}
} else {
idx_t = idx_t_inp % this.max_slide;
if ( idx_t == this.cidx ) {
return;
}
}
var idx_next = idx_t;
if ( b_reverse ) {
var idx_tfx = idx_f;
var temp = idx_f;
idx_f = idx_t;
idx_t = temp;
} else {
var idx_tfx = idx_t;
}
this.abort();
this.cidx = idx_next;
this.tfx_rec = CTfxMan.run(idx_tfx,idx_f,idx_t,b_reverse);
},
setTransFlag : function(ttime_id) {
this.ttime_id = ttime_id;
console.log("ttime_id",ttime_id);
},
isInTrans : function() {
return ( this.ttime_id != null );
},
setPauseFlag : function(ptime_id) {
this.ptime_id = ptime_id;
console.log("ptime_id",ptime_id);
},
isInPause : function() {
return ( this.ptime_id != null );
},
abort : function() {
if ( this.isInPause() ) {
clearTimeout(this.ptime_id);
this.setPauseFlag(null);
}
if ( this.isInTrans() ) {
clearTimeout(this.ttime_id);
this.setTransFlag(null);
}
this.clear();
CPBar.abort();
},
shouldRun : function() {
//return true;
return false;
},
onPauseBegin : function() {
this.show();
if ( this.shouldRun() ) {
this.tfx_rec = CSlideMan.getSlide(this.cidx);
CPBar.run("p",this.tfx_rec);
var _this = this;
this.setPauseFlag(setTimeout(function(){
_this.onPauseEnd();
},this.tfx_rec["ptime"]*1000));
}
},
onPauseEnd : function() {
this.setPauseFlag(null);
this.onTransBegin();
},
onTransBegin : function(idx) {
if ( idx == undefined ) { idx = true; }
this.doTrans(idx);
CPBar.run("t",this.tfx_rec);
var _this = this;
this.setTransFlag(setTimeout(function(){
_this.onTransEnd();
},this.tfx_rec["ttime"]*1000));
},
onTransEnd : function() {
this.setTransFlag(null);
this.onPauseBegin();
},
onResized : function() {
this.abort();
this.onPauseBegin();
console.log("onResized");
},
goto : function(idx) {
this.onTransBegin(idx);
},
setup : function() {
var _this = this;
this.cidx = 0;
this.setPauseFlag(null);
this.setTransFlag(null);
this.id = appcfg.id;
this.jqo_ctar = $("."+sig+"-ctar-"+appcfg.id),
this.jqo_info = this.jqo_ctar.find("."+sig+"-info");
this.jqo_warea = this.jqo_ctar.find("."+sig+"-warea");
this.jqo_pagebtn = this.jqo_ctar.find("."+sig+"-pagebtn");
this.jqo_ctrl = this.jqo_ctar.find("."+sig+"-ctrl");
this.jqo_btn_next = this.jqo_ctrl.find("."+sig+"-btn-next");
this.jqo_btn_prev = this.jqo_ctrl.find("."+sig+"-btn-prev");
this.max_slide = CSlideMan.getCount();
for(var i=0; i")
.attr("class",sig+"-btn-page")
.attr("data-idx",i)
.appendTo(this.jqo_pagebtn)
.click(function(){
_this.goto(parseInt($(this).attr("data-idx")));
});
}
this.jqo_btn_next.click(function(){
_this.goto(true);
});
this.jqo_btn_prev.click(function(){
_this.goto(false);
});
$( window ).bind( "resize", function() {
_this.onResized();
});
//this.jqo_ctrl.bind("mouseenter",function(){
// _this.abort();
// _this.onPauseBegin();
//});
this.onPauseBegin();
}
};