////////////////////////////////////////////// 
//          SoundOutTheBox vTicker          // 
//  Copyright © SoundOutTheBox 2012-2013    // 
//           License-CC-BY-NC-ND            // 
////////////////////////////////////////////// 
(function(e){e.widget("mui.vTicker",{options:{publicVariables:{Name:{value:"no name",type:"StringData",dynamic:!1},Left:{value:0,type:"IntegerData",dynamic:!1},Top:{value:0,type:"IntegerData",dynamic:!1},Width:{value:500,type:"IntegerData",dynamic:!1},Height:{value:40,type:"IntegerData",dynamic:!1},Items:{value:"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut;Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor",
type:"StringData",write:!0,dynamic:!0},CurrentItemIndex:{value:0,type:"IntegerData",dynamic:!0},Separator:{value:";",type:"StringData",dynamic:!1},TextColor:{value:"255,255,255",type:"StringData",subtype:"Color",dynamic:!1},TextFont:{value:"Tahoma, 12",type:"StringData",dynamic:!1},Speed:{value:700,type:"IntegerData",dynamic:!1},Pause:{value:4E3,type:"IntegerData",dynamic:!1},ShowItems:{value:1,type:"IntegerData",dynamic:!1},Direction:{value:["up","down"],type:"EnumData",defaultvalue:"up",dynamic:!1},
BackGroundColor:{value:"34,34,34",type:"StringData",subtype:"Color",dynamic:!1},Visible:{value:["no","yes"],type:"EnumData",defaultvalue:"yes",write:!0,dynamic:!0}},privateVariables:{pageNumber:0,motifType:0,userScreen:0,myTicker:null,font:null,interval:null},config:{main:"vTicker.js",description:"vTicker allows to display news vertically as a ticker.",author:"SoundOutTheBox",version:"1.0.0.0.Final",dependencies:["./js/jquery.vticker.js"],widgetID:"666a6469659999989b966a6361656c949668686669699a305d62699666689763",widgetPackages:["626a6768956e669371649e61619765636d6a636570616a66659396659a686a66"]}},
_create:function(){this.options.privateVariables.font=new goFont},_init:function(){},_destroy:function(){},_setOption:function(){e.Widget.prototype._setOption.apply(this,arguments)},_render:function(){var b=this.options.publicVariables,a=this.element,c=b.Top.value,d=b.Height.value,f=b.Left.value,i=b.Width.value,g=b.Items.value,j=b.BackGroundColor.value;console.log("_render()  object="+b.Name.value);UTIL.checkEnum(this.options.publicVariables.Direction);a.disableSelection();a.css({position:"absolute",
overflow:"hidden",left:f+"px",top:c+"px",width:i+"px",height:d+"px",backgroundColor:j,zIndex:10});a.addClass("dynamicObject");e(a).attr("id",this.options.publicVariables.Name.value);dirDependency=UTIL.getDirectoryByScriptFileName("jquery.vticker.js");urlDependency=dirDependency+"jquery.vticker.js";WEBPANEL.addFile(urlDependency,function(a){a.setMyItems(g,!0)},this);this.setVisible(b.Visible.value)},readFromXML:function(b){var a=this.options.publicVariables,c=this.options.privateVariables,b=e(b);a.Name.value=
UTIL.getStringAttr(b,"Name",a.Name.value);a.Items.value=UTIL.getStringAttr(b,"Items",a.Items.value);a.CurrentItemIndex.value=UTIL.getIntAttr(b,"CurrentItemIndex",a.CurrentItemIndex.value);a.Separator.value=UTIL.getStringAttr(b,"Separator",a.Separator.value);a.TextColor.value=UTIL.getColorAttr(b,"TextColor",a.TextColor.value);a.TextFont.value=UTIL.getStringAttr(b,"TextFont",a.TextFont.value);a.Speed.value=UTIL.getIntAttr(b,"Speed",a.Speed.value);a.Pause.value=UTIL.getIntAttr(b,"Pause",a.Pause.value);
a.ShowItems.value=UTIL.getIntAttr(b,"ShowItems",a.ShowItems.value);a.Direction.value=UTIL.getStringAttr(b,"Direction",a.Direction.value);a.BackGroundColor.value=UTIL.getColorAttr(b,"BackGroundColor",a.BackGroundColor.value);a.Visible.value=UTIL.getStringAttr(b,"Visible",a.Visible.value);c.font.readFromText(a.TextFont.value);UTIL.readPositionFromXML(b,a)},setVisible:function(b){var a=this.options.publicVariables,c=this.element;if(b!==a.Visible.value)a.Visible.value=b;a.Visible.value!=="no"?UTIL.setOpacity(c,
1):UTIL.setOpacity(c,0)},setMyItems:function(b,a){var c=this.options.publicVariables,d=this.options.privateVariables,f=this.element,i=c.Height.value,g=c.Speed.value,j=c.Pause.value,l=c.Direction.value,n=c.TextColor.value,o=c.ShowItems.value,h=c.Separator.value;UTIL.isNull(d.interval)||clearInterval(d.interval);if(this.options.publicVariables.Items.value!==b||a===!0){this.options.publicVariables.Items.value=b;c=e("<div></div>");c.appendTo(f);c.css({height:i});f=e("<ul/>");f.appendTo(c);f.css({position:"absolute",
margin:"0px",padding:"0px"});for(var m=b.split(h),h=m.length,k=0;k<h;k++)e("<li>"+m[k]+"</li>").appendTo(f);c.css({overflow:"hidden",position:"relative",color:n,fontFamily:d.font._name,fontSize:d.font._height+"pt",fontStyle:d.font._italic===!1?"normal":"italic",fontWeight:d.font._bold===!1?"normal":"bold",textDecoration:d.font._underline!==!1?"underline":d.font._strikeOut===!1?"none":"line-through"});c.vTicker({handler:this,speed:g,pause:j,direction:l,showItems:o});g=c.height();c.css({top:(i-g)/2+
"px",height:g+"px"});if(!UTIL.isNull(d.myTicker))d.myTicker.remove(),d.myTicker=null;h>0&&(l==="down"?this.setCurrentIndex(h-1):this.setCurrentIndex(0));d.myTicker=c}},setCurrentIndex:function(b){this.options.publicVariables.CurrentItemIndex.value=b+1;this._trigger("propertyChange",null,Object({name:this.options.publicVariables.Name.value+".CurrentItemIndex",property:"CurrentItemIndex",value:this.options.publicVariables.CurrentItemIndex.value}))},onPropertyChange:function(b,a){switch(b){case "Items":this.setMyItems(a);
break;case "Visible":this.setVisible(a)}},onReleaseCapture:function(){}})})(jQuery);
