/* * Digital Signage 2.70A4 R-STRUCT VER. * -------------------------- * JQ vertical scroller script: http://buildinternet.com/project/totem/ (Totem Ticker) -MIT Lisc. * JSON Controller // XHR System : rob@firstclassdepot.com * * Grabs JSON file and uses it to set up Digital Signage. * Check JSON file, as of now, everything EXCEPT Ticker{} will be reloaded after all the content has scrolled. * Added multi-day display * /RWDDigitalSign/js */ (function( $ ){ var convert_date = function(y, m, d, format){ var o_date = new Date(); var ced_date; o_date.setDate(d); o_date.setMonth(m-1); o_date.setFullYear(y); var mthNames_s = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; var mthNames_l = ["January","Feburary","March","April","May","June","July","August","September","October","November","December"]; var dayNames_s = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]; var dayNames_l = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Satatuday"]; if (format == -1 || format == 0) return o_date.getFullYear() + '-' + ( o_date.getMonth()+1) + '-' + o_date.getDate(); else if (format == 1) return ( o_date.getMonth()+1) + '/' + o_date.getDate()+ '/'+ o_date.getFullYear(); else if (format == 2) return o_date.getDate() + '/' + ( o_date.getMonth()+1) + '/'+ o_date.getFullYear(); else if (format == 3) return mthNames_s[o_date.getMonth()] + ' ' + o_date.getDate() + ', ' + o_date.getFullYear(); else if (format == 4) return dayNames_s[o_date.getDay()] + ', ' + mthNames_s[o_date.getMonth()] + ' ' + o_date.getDate() + ', ' + o_date.getFullYear(); else if (format == 5) return dayNames_l[o_date.getDay()] + ', ' + mthNames_l[o_date.getMonth()] + ' ' + o_date.getDate() + ', ' + o_date.getFullYear(); else if (format == 6) return dayNames_l[o_date.getDay()] + ', ' + mthNames_l[o_date.getMonth()] + ' ' + o_date.getDate(); else return o_date.getFullYear() + '-' + ( o_date.getMonth()+1 ) + '-' + o_date.getDate(); } if(!$.omr){ $.omr = {}; } //12HR -> 24Hr CONVERSION LOOKUP var ac = {"12": "00", "01": "01", "02": "02", "03": "03", "04": "04", "05": "05", "06": "06", "07": "07", "08": "08", "09": "09", "10": "10", "11": "11"}; var pc = {"12": "12", "01": "13", "02": "14", "03": "15", "04": "16", "05": "17", "06": "18", "07": "19", "08": "20", "09": "21", "10": "22", "11": "23"}; var cv12 = {"AM": ac, "PM": pc}; //24HR -> 12Hr CONVERSION LOOKUP var cv24 = {"00": "12", "01": "01", "02": "02", "03": "03", "04": "04", "05": "05", "06": "06", "07": "07", "08": "08", "09": "09", "10": "10", "11": "11", "12": "12", "13": "01", "14": "02", "15": "03", "16": "04", "17": "05", "18": "06", "19": "07", "20": "08", "21": "09", "22": "10", "23": "11"}; $.omr.ds = function(el, options ) { var base = this; //Master Data Structure base.json = {}; //Define the DOM elements base.el = el; base.$el = $(el); //Add a reverse reference to the DOM object base.$el.data("omr.ds", base); base.init = function() { base.json = $.extend({},base.defaultConfiguration(), options); //Define the ticker object base.ticker; //Disable Caching base.setAJAX(); //Adjust the height of ticker if specified base.format_ticker(); //Start Data Poll Intreval base.start_dataPollIntreval(); base.applyPage(); //Start the ticker //base.start_ticker(); //Debugging info in console //base.debug_info(); }; base.setAJAX = function(){ $.ajaxSetup ({ // Disable caching of AJAX responses cache: false, timeout: 20000 }); }; base.sortElements = function(dsElements){ /********************************************** //SORT AREA. AD | AM | PM BY START TIME ***********************************************/ return dsElements; var adEvents = []; var amTop = []; var amEvents = []; var pmEvents = []; var pmTop = []; var sorted = []; var k; for (k in dsElements) { var current = dsElements[k]; if(current.alldayevent === true) {adEvents.push(current);} else { //WORKS WITH LPAD OR NO LPAD. //var start = ''+current.start+''; //var start = current.lstart; var start = current.start; var ampm = start.substring(start.length-2,start.length); if(parseFloat(start.substring(0,2)).toFixed(0) == 12 && ampm == "AM") {amTop.push(current);} else if (parseFloat(start.substring(0,2)).toFixed(0) == 12 && ampm=="PM") {pmTop.push(current);} else if(ampm == "AM") {amEvents.push(current);} else {pmEvents.push(current);} } } // SORT COMPARATOR function compare(a,b) { /* DEBUG ALERT */ //alert(" .. ST:" + a.start.substring(0,2).toString().replace(":",'') + "AS : "+ parseInt(parseFloat(a.start.substring(0,2)).toFixed(0).toString().replace(":",''),10) + " || ST:" + b.start.substring(0,2).toString().replace(":",'') + "AS : " + parseInt(parseFloat(b.start.substring(0,2)).toFixed(0).toString().replace(":",''),10)); if (parseInt(parseFloat(a.start.substring(0,2)).toFixed(0).toString().replace(":",''),10) < parseInt(parseFloat(b.start.substring(0,2)).toFixed(0).toString().replace(":",''),10)) { return -1;} if (parseInt(parseFloat(a.start.substring(0,2)).toFixed(0).toString().replace(":",''),10) > parseInt(parseFloat(b.start.substring(0,2)).toFixed(0).toString().replace(":",''),10)) { return 1;} return 0; } amTop.sort(compare); amEvents.sort(compare); pmEvents.sort(compare); pmTop.sort(compare); sorted = adEvents.concat(amTop).concat(amEvents).concat(pmTop).concat(pmEvents); return sorted; }; base.defaultConfiguration=function() { var deflt={}; /********************************************** // DEFAULT TICKER ***********************************************/ deflt.ticker = {}; deflt.ticker.full_screen= false; deflt.ticker.items_to_show= 5; deflt.ticker.speed= 4000; deflt.ticker.intreval= 15000; deflt.ticker.polltime= 3600000; deflt.ticker.rowheight= "80px"; deflt.ticker.scroll_direction= "down"; deflt.ticker.scroll_off= false; deflt.ticker.calendar_select= ""; deflt.ticker.calendar_link= ""; deflt.ticker.show_past= true; deflt.ticker.time_diff= -4; deflt.ticker.server_date= "01"; /********************************************** // DEFAULT TICKER.ITEM ***********************************************/ deflt.ticker.item = {}; deflt.ticker.item.background_color= "#FFFFFF"; deflt.ticker.item.src= "img/event_bg.jpg"; deflt.ticker.item.background_opacity= 95; deflt.ticker.item.time_color= "#969696"; deflt.ticker.item.top_left = "Event time"; deflt.ticker.item.bottom_left = "None/Hide"; deflt.ticker.item.top_right = "Ongoing Indicator"; deflt.ticker.item.bottom_right = "None/Hide"; deflt.ticker.item.top_mid = "Indicator Text"; deflt.ticker.item.ongoing_text = "Ongoing Text"; deflt.ticker.item.ongoing_image = ""; deflt.ticker.item.event_time_background_image = ""; /********************************************** // DEFAULT PAGE ***********************************************/ deflt.ticker.page = {}; deflt.ticker.page.title= "Default Title"; deflt.ticker.page.fullscreen_background= 1; deflt.ticker.page.background_color= "#FFFFFF"; deflt.ticker.page.width= "auto"; deflt.ticker.page.height= "auto"; deflt.ticker.page.background_image= "img/stockholm.jpg"; /********************************************** // DEFAULT PAGE.WIDGET ***********************************************/ deflt.ticker.page.widget = {}; deflt.ticker.page.widget.display_widget= 1; deflt.ticker.page.widget.src= "tetris.html"; deflt.ticker.page.widget.width= "430px"; deflt.ticker.page.widget.height= "auto"; deflt.ticker.page.widget.position= "top"; /********************************************** // DEFAULT PAGE.LOGO ***********************************************/ deflt.ticker.page.logo = {}; deflt.ticker.page.logo.src= "img/welcome_swedish.png"; deflt.ticker.page.logo.position= "top"; deflt.ticker.page.logo.width= "auto"; deflt.ticker.page.logo.height= "auto"; /********************************************** // DEFAULT PAGE.FOOTER ***********************************************/ deflt.ticker.page.footer = {}; deflt.ticker.page.footer.display_footer= 1; deflt.ticker.page.footer.text= "Firstclass Depot (c) 2012"; deflt.ticker.page.footer.height = "18px"; /********************************************** //DEFAULT PAGE.HEADER ***********************************************/ deflt.ticker.page.header = {}; deflt.ticker.page.header.src= "img/fc_logo_sm.png"; deflt.ticker.page.header.position= "top"; deflt.ticker.page.header.display_time = 1; deflt.ticker.page.header.display_time_own_style = 0; deflt.ticker.page.header.display_time_own_fontface = "Arial"; deflt.ticker.page.header.display_time_own_fontcolor = "#FFFFFF"; deflt.ticker.page.header.display_time_own_fontsize = "36px"; deflt.ticker.page.header.display_time_own_textdecoration = "bold"; deflt.ticker.page.header.width= "auto"; deflt.ticker.page.header.height= "auto"; deflt.ticker.page.header.text= "Header Text"; deflt.ticker.page.header.color= "#FFFFFF"; deflt.ticker.page.header.font_family= "Tahoma"; deflt.ticker.page.header.font_size= "36px"; deflt.ticker.page.header.text_decoration= "bold"; deflt.elements={}; return deflt; }; base.loadConfigurationFile=function() { var temp = {}; $.get('', function(data) { /********************************************** // GET TICKER ***********************************************/ temp.ticker = {}; temp.ticker.full_screen =data.Ticker['full-screen']; temp.ticker.items_to_show = data.Ticker['items-to-show']; temp.ticker.speed= data.Ticker['speed']; temp.ticker.intreval = data.Ticker['intreval']; //temp.ticker.polltime = 8000; temp.ticker.polltime = data.Ticker['polltime']; //temp.ticker.rowheight =data.Ticker['rowheight']; temp.ticker.rowheight = base.json.ticker.rowheight; //Ignore these changes temp.ticker.scroll_direction = data.Ticker['scroll-direction']; temp.ticker.scroll_off = data.Ticker['scroll-off']; temp.ticker.calendar_select = data.Ticker['calendar-select']; temp.ticker.calendar_link = data.Ticker['calendar-link']; temp.ticker.show_past = data.Ticker['show-past']; temp.ticker.time_diff=data.Ticker['time-diff']; temp.ticker.server_date=data.Ticker['server-date']; temp.ticker.multi_date_format=data.Ticker['multi-date-format']; /********************************************** // GET TICKER.ITEM ***********************************************/ temp.ticker.item = {}; temp.ticker.item.background_color = data.Ticker.item['background-color']; temp.ticker.item.src = data.Ticker.item['src']; temp.ticker.item.background_opacity = data.Ticker.item['background-opacity'] -1; temp.ticker.item.time_color = data.Ticker.item['time-color']; temp.ticker.item.time_bgi = data.Ticker.item['time-bgi']; temp.ticker.item.top_left = data.Ticker.item['top-left']; temp.ticker.item.bottom_left = data.Ticker.item['bottom-left']; temp.ticker.item.top_right = data.Ticker.item['top-right']; temp.ticker.item.bottom_right = data.Ticker.item['bottom-right']; temp.ticker.item.top_mid = data.Ticker.item['top-mid']; temp.ticker.item.ongoing_text = data.Ticker.item['ongoing-text']; temp.ticker.item.ongoing_image = data.Ticker.item['ongoing-image']; temp.ticker.item.event_time_background_image = data.Ticker.item['event-time-background-image']; temp.ticker.item.in_session_font_face = data.Ticker.item['in-session-font-face']; temp.ticker.item.in_session_font_color = data.Ticker.item['in-session-font-color']; temp.ticker.item.in_session_font_size = data.Ticker.item['in-session-font-size']; temp.ticker.item.in_session_text_decoration = data.Ticker.item['in-session-text-decoration']; temp.ticker.item.event_time_font_face = data.Ticker.item['event-time-font-face']; temp.ticker.item.event_time_font_color = data.Ticker.item['event-time-font-color']; temp.ticker.item.event_time_font_size = data.Ticker.item['event-time-font-size']; temp.ticker.item.event_time_text_decoration = data.Ticker.item['event-time-text-decoration']; temp.ticker.item.event_title_font_face = data.Ticker.item['event-title-font-face']; temp.ticker.item.event_title_font_color = data.Ticker.item['event-title-font-color']; temp.ticker.item.event_title_font_size = data.Ticker.item['event-title-font-size']; temp.ticker.item.event_title_text_decoration = data.Ticker.item['event-title-text-decoration']; temp.ticker.item.event_timelocation_font_face = data.Ticker.item['event-timelocation-font-face']; temp.ticker.item.event_timelocation_font_color = data.Ticker.item['event-timelocation-font-color']; temp.ticker.item.event_timelocation_font_size = data.Ticker.item['event-timelocation-font-size']; temp.ticker.item.event_timelocation_text_decoration = data.Ticker.item['event-timelocation-text-decoration']; /********************************************** // GET PAGE ***********************************************/ temp.ticker.page = {}; temp.ticker.page.title = data.Page['title']; temp.ticker.page.fullscreen_background = data.Page['fullscreen-background']; temp.ticker.page.background_color = data.Page['background-color']; temp.ticker.page.width = data.Page['width']; temp.ticker.page.height = data.Page['height']; temp.ticker.page.background_image = data.Page['background-image']; /********************************************** // GET PAGE.WIDGET ***********************************************/ temp.ticker.page.widget = {}; temp.ticker.page.widget.display_widget = data.Page.widget['display-widget']; temp.ticker.page.widget.src =data.Page.widget['src']; temp.ticker.page.widget.width = data.Page.widget['width']; temp.ticker.page.widget.height = data.Page.widget['height']; temp.ticker.page.widget.position = data.Page.widget['position']; /********************************************** // GET PAGE.LOGO ***********************************************/ temp.ticker.page.logo = {}; temp.ticker.page.logo.src = data.Page.logo['src']; temp.ticker.page.logo.position = data.Page.logo['position']; temp.ticker.page.logo.width = data.Page.logo['width']; temp.ticker.page.logo.height = data.Page.logo['height']; /********************************************** // GET PAGE.FOOTER ***********************************************/ temp.ticker.page.footer = {}; temp.ticker.page.footer.display_footer = data.Page.footer['display-footer']; temp.ticker.page.footer.text = data.Page.footer['text']; temp.ticker.page.footer.height = data.Page.footer['height']; /********************************************** // GET PAGE.HEADER ***********************************************/ temp.ticker.page.header = {}; temp.ticker.page.header.src =data.Page.header['src']; temp.ticker.page.header.position = data.Page.header['position']; temp.ticker.page.header.display_time = data.Page.header['display-time']; temp.ticker.page.header.display_time_own_style = data.Page.header['display-time-own-style']; temp.ticker.page.header.display_time_own_fontface = data.Page.header['display-time-own-fontface']; temp.ticker.page.header.display_time_own_fontcolor = data.Page.header['display-time-own-fontcolor']; temp.ticker.page.header.display_time_own_fontsize = data.Page.header['display-time-own-fontsize']; temp.ticker.page.header.display_time_own_textdecoration = data.Page.header['display-time-own-textdecoration']; temp.ticker.page.header.width = data.Page.header['width']; temp.ticker.page.header.height = data.Page.header['height']; temp.ticker.page.header.text = data.Page.header['text']; temp.ticker.page.header.color = data.Page.header['color']; temp.ticker.page.header.font_family= data.Page.header['font-family']; temp.ticker.page.header.font_size = data.Page.header['font-size']; temp.ticker.page.header.text_decoration= data.Page.header['text-decoration']; if ($.param(temp.ticker,null,2) !=$.param(base.json.ticker,null,2) ) { //console.log(" Configuration File Change Detected - re-applying page styles and reloading ticker"); base.json.ticker = temp.ticker; base.applyPage(); base.applyCalendarEvents(); /* This will be dealt with inside the loadCalendarEvent() change detection system, but the properties of the ticker are ensured a reload in here */ } base.loadCalendarEvents(); }, "json") .error(function(jqXHR, textStatus, errorThrown){ //alert("An error occured while loading the congifuration file. \n\n" + textStatus + "\n\n"+jqXHR.responseText ); //console.log("Config Load Error :" + textStatus + "\n\n Incoming Text :" + jqXHR.responseText); }); }; base.loadCalendarEvents = function() { if(typeof base.json.ticker.calendar_link != "undefined" ) { //console.log("(2)... loading calendar events ..."); function changeDetection(nw) { if($.param({'data':nw},null,2) !=$.param({'data' : base.json.elements},null,2) ) { //console.log(" Event List Change Detected - reloading ticker"); base.json.elements = nw; base.applyCalendarEvents(); } } //Sel=0 :: FC //Sel=1 :: GCAL //Sel=2 :: CONFIG var sel = (base.json.ticker.calendar_link.indexOf("google")<0)?0:1; //Current Client Date/Time var now = new Date(); var ch = now.getHours(); var cm = now.getMinutes(); /* Problem with converting 1 digit month and date to 2 digits by Rob. Replaced by Michael var mm = (((now.getMonth()+1)).length==2)?(now.getMonth()+1):('0'+(now.getMonth()+1)); var dd = (((now.getDate()+2)).length==2)?(now.getDate()):('0'+(now.getDate())); dd = dd.substring(dd.length-2,dd.length); */ /* Michael replaced mm and dd below 'cause Rob's got a problem for it at 2012-10-9*/ var mm=("0" + (now.getMonth() + 1)).slice(-2); var dd = ("0" + now.getDate()).slice(-2); //Current Server Time/ Dates var serverDate = parseInt(base.json.ticker.server_date); sdd= (serverDate.toString().length== 1)?'0'+serverDate:serverDate.toString(); var chh = ( (now.getHours().toString().length==1)?'0'+now.getHours():now.getHours().toString() ); var cmm = (now.getMinutes().toString().length==1)?'0'+now.getMinutes():now.getMinutes().toString(); var ctm = cv24[chh] + ":00"; // + cmm; ctm+=(chh>=12)?" PM":" AM" ; var stm = base.convertTimeZone(ctm.toString(),"server") ; //CH MUST BE 24hr. var ch = parseInt(cv12[stm.substring(6)][stm.substring(0,2)],10); var cm = parseInt(cmm); //CAL URL PARAMS INIT (XHR ENTRY) //Note: If params is null, then eparams starts with '?' var calURL = ""; var params = ""; var eparams = ""; var url = ""; /********************************************** //MASTER SWITCH ***********************************************/ switch(sel) { case 0: /********************************************** // [FC] First Class Calendar Elements ***********************************************/ //calURL = 'http://'+location.hostname + base.json.ticker.calendar_link; calURL = base.json.ticker.calendar_link; params = ""; eparams = ""; url = calURL + params + eparams; $.get(url,function(data) { /********************************************** // FC Pull ***********************************************/ //DS ELEMENTS INTO ARRAY STRUCT var dsElements = []; var k; for( k in data.Elements) { //WE WANT PROPER ELEMENTS ONLY if(typeof data.Elements[k]['no'] !== 'undefined') { var msg = {}; var current = data.Elements[k]; msg.no = current['no']; //Index msg.rwk = current['rwk']; msg.r_date = current['r_date']; msg.location = current['location']; var tmin = "All Day"; //Duration Var if(current['all_day_event']) { msg.alldayevent=true; msg.start = ""; msg.end = ""; msg.duration = "All Day"; } else { /********************************************** //PARSE THE TIME (12H) ***********************************************/ //start : (12hr) xx:xx xx .. broken down into 12HR s0:s1 s2 var start = current['start_time']; start= (start.length== 7)?'0'+start:start; //Lpad 0 msg.start = start; //Local Start Time, Used for Sorting. msg.start_display = base.convertTimeZone(start,"client"); //Client Equivalent Start Time var s0 = start.substring(0,2); var s1 = start.substring(3,5); var s2 = start.substring(6); /* WE WANT TO MAINTAIN THE CORRECT EVENT LIST ORDER... BUT WE ALSO WANT TO DISPLAY THE TIMES IN THE CLIENTS TIMEZONE... */ //end : (12hr) xx:xx xx .. broken down into 12HR e0:e1 e2 var end = current['end_time']; end= (end.length== 7)?'0'+end:end; //Lpad 0 msg.end = end; //Local Start Time, Used for Sorting. msg.end_display = base.convertTimeZone(end,"client"); //Client Equivalent Start Time var e0 = end.substring(0,2); var e1 = end.substring(3,5); var e2 = end.substring(6); /********************************************** //CURRENT EVENT INDICATORS (BOOL1 && BOOL2)=OUT ***********************************************/ var bool1 = (ch==parseInt(cv12[s2][s0],10))? ((cm>=parseInt(s1,10))?true:false):((ch>parseInt(cv12[s2][s0],10))?true:false); var bool2 = (ch==parseInt(cv12[e2][e0],10))? ((cm<=parseInt(e1,10))?true:false):((ch=13 && e0i <=11) {hrs = parseInt(24-s0i,10) + parseInt(e0i,10);} else {hrs = parseInt(e0i,10) - parseInt(s0i,10);} tmin = ((60*hrs) + (parseInt(e1,10) - parseInt(s1,10))); msg.alldayevent = false; msg.duration = Math.floor(tmin/60) + "Hr " + (tmin%60) + "Min"; msg.start = (s0) + ":" + s1 + ((parseInt(s0i,10)<12)?" AM":" PM"); msg.end = (e0) + ":" + e1 + ((parseInt(e0i,10)<12)?" AM":" PM"); } //msg.backgroundcolor = current['background-color']; msg.title = " " + current['title']; msg.subject = current['subject']; msg.href = current['href']; msg.rwk = current['rwk']; msg.r_date = current['r_date']; msg.category = current['category']; /********************************************** //PAST EVENT CHECK ***********************************************/ var past = (typeof(base.json.ticker.show_past) == "undefined")? true : base.json.ticker.show_past; var boolr = (msg.alldayevent)?false:(ch == s0i)?((cmparseInt(e1,10))?false:true):((ch>e0i)?false:true); msg.past = boolr==true?!bool3:boolr; if((!past && bool3) || past || msg.alldayevent) {dsElements.push(msg);} } } changeDetection(base.sortElements(dsElements)); },'json'); break; case 1: /********************************************** // [GCAL] Google Calendar Elements [CROSS DOMAIN/CROSS SITE SCRIPTING; TRANSPORT: JSONP (ALT)] ***********************************************/ //TimeZone Issue (Non Persistent) /* Quick TZ Convert (on24Hr) */ var stz=base.json.ticker.time_diff; var td="00"; if(stz>=0) { td= "%2b" + stz; if(stz.toString().length ==1) td= "%2b0" + stz; } else { td="-" + stz.toString().substring(1); if(stz.toString().length ==2) td = "-0" + stz.toString().substring(1); } o = td + ":00"; //GCAL XHR PARAMS var startmin = now.getFullYear() +"-" +mm+"-"+sdd+"T00:01:00"+o; var startmax = now.getFullYear() +"-" +mm+"-"+sdd+"T23:59:59"+o; var singleevents = "true"; var sortorder = "ascending"; var alt = "json"; //BUILD XHR URL params = "?alt="+alt+"&start-min="+startmin+"&start-max="+startmax+"&sortorder="+sortorder; eparams = ""; calURL = base.json.ticker.calendar_link; url = calURL + params + eparams; $.get(url,function(data) { /* Note: No JSON Data Type, Responce is Text(?) And we use eval to get the JSON inside the callback function. (This is only relevant if using callback function (2.eparams) */ //var data = eval(data); /* Note :: If there exists an event the night before at (XX:XX -> 00:00), it will display for one cycle and then get deleted. */ //WE WANT PROPER ELEMENTS ONLY if(typeof(data.feed.entry) != 'undefined') { /********************************************** //GOOGLE CALENDAR DEV ***********************************************/ var dsElements = []; var calFullTitle = data.feed.title.$t; var calSubTitle = data.feed.subtitle.$t; var author = data.feed.author[0].name.$t; $.each(data.feed.entry,function(i,entry) { var msg = {}; msg.no = entry.id.$t; var startTime = String(entry.gd$when[0].startTime); var endTime = String(entry.gd$when[0].endTime); if(startTime.indexOf("T") == -1) { if(sdd == startTime.substring(startTime.length-2)) //Google Bug Fix { msg.alldayevent = true; msg.start = ""; msg.end = ""; msg.duration = "All Day"; } else { return 'non-false'; } } else { /********************************************** //PARSE THE TIME (24H) ***********************************************/ //start : (24hr) xx:xx .. broken down into 12HR s0:s1 s2 var st =startTime.substring(11,16); var start = cv24[st.substring(0,2)] + ":" + st.substring(3); //Local Start Time, Used for Sorting & Functions. start+=(st.substring(0,2)>=12)?" PM":" AM" ; msg.start = start; msg.start_display = base.convertTimeZone(start,"client"); //Client Equivalent Start Time var s0 = start.substring(0,2); var s1 = start.substring(3,5); var s2 = start.substring(6); //end : (24hr) xx:xx .. broken down into 12HR e0:e1 e2 var en =endTime.substring(11,16); var end = cv24[en.substring(0,2)] + ":" + en.substring(3) ; //Local Start Time, Used for Sorting & Functions. end += (en.substring(0,2)>=12)?" PM":" AM" ; msg.end = end; msg.end_display = base.convertTimeZone(end,"client"); //Client Equivalent Start Time var e0 = end.substring(0,2); var e1 = end.substring(3,5); var e2 = end.substring(6); //console.log("Time : ("+ start +")" + s0 + ":"+s1 +" " + s2 + "-> ("+end+")" + e0 + ":" + e1 + " " + e2 ); //console.log("Client Time: "+ start+ " -> " + end ); //console.log("Server Time: "+ base.convertTimeZone(start,"server") + " -> " + base.convertTimeZone(end,"server") ); /********************************************** //CURRENT EVENT INDICATORS (BOOL1 && BOOL2)=OUT ***********************************************/ var bool1 = (ch==parseInt(cv12[s2][s0],10))? ((cm>=parseInt(s1,10))?true:false):((ch>parseInt(cv12[s2][s0],10))?true:false); var bool2 = (ch==parseInt(cv12[e2][e0],10))? ((cm<=parseInt(e1,10))?true:false):((ch=13 && e0i <=11) {hrs = parseInt(24-s0i,10) + parseInt(e0i,10);} else {hrs = parseInt(e0i,10) - parseInt(s0i,10);} tmin = ((60*hrs) + (parseInt(e1,10) - parseInt(s1,10))); msg.alldayevent = false; msg.duration = Math.floor(tmin/60) + "Hr " + (tmin%60) + "Min"; msg.start = (s0) + ":" + s1 + ((parseInt(s0i,10)<12)?" AM":" PM"); msg.end = (e0) + ":" + e1 + ((parseInt(e0i,10)<12)?" AM":" PM"); } //msg.backgroundcolor = current['background-color']; msg.title = " "+ entry.title.$t + ""; msg.subject = entry.content.$t ; msg.href = entry.id.$t; msg.location= String(entry.gd$where[0].valueString); /********************************************** //PAST EVENT CHECK S2BS ***********************************************/ var past = (typeof(base.json.ticker.show_past) == "undefined")? true : base.json.ticker.show_past; var boolr = (msg.alldayevent)?false:(ch == s0i)?((cmparseInt(e1,10))?false:true):((ch>e0i)?false:true); msg.past = boolr==true?!bool3:boolr; if((!past && bool3) || past || msg.alldayevent) {dsElements.push(msg);} }); } changeDetection(base.sortElements(dsElements)); },'jsonp'); break; case 2: alert("iCAL PENDING ..."); break; default: alert("Configuration Error - Bad Calendar Selector"); break; } } }; base.applyPage = function() { document.title = base.json.ticker.page.title; /********************************************** // APPLY HEIGHTS ***********************************************/ var hi = (base.json.ticker.full_screen == true)?'auto' :(base.json.ticker.items_to_show * base.json.ticker.rowheight.replace(/px/i, '')); $('#wrapper').css({"height" :hi}); $('#vertical-ticker').css({"height" : hi}); $('#footer').css({"height" :base.json.ticker.page.footer.height }); /********************************************** // APPLY COLORS ***********************************************/ $('#vertical-ticker').css({"background-color" : base.json.ticker.page.background_color}); $('#pagewidth').css({"background-color" : base.json.ticker.page.background_color}); /********************************************** // APPLY BACKGROUND IMAGES ***********************************************/ $(!base.json.ticker.page.fullscreen_background?'#pagewidth' : '#vertical-ticker').css({ "background-image" : "none", "background-repeat": "repeat", "background-position": "", "margin" : "", "padding" : "" }); $(base.json.ticker.page.fullscreen_background?'#pagewidth' : '#vertical-ticker').css({ "background-image" : "url('"+base.json.ticker.page.background_image+"')", "background-repeat": "repeat" }); /********************************************** //APPLY HEADER ***********************************************/ var d = base.json.ticker.page.header.text_decoration=="Italic"?"font-style":( base.json.ticker.page.header.text_decoration == "bold" ?"font-weight":"text-decoration"); var j = (typeof(base.json.ticker.page.header.text)=="undefined"?"":base.json.ticker.page.header.text) ; var builtHeader = ""; if(base.json.ticker.page.header.position == "top") { builtHeader = ""; builtHeader+= ""+ j + ""; } else if (base.json.ticker.page.header.position == "bottom") { builtHeader = ""+ j + ""; builtHeader += ""; } else if (base.json.ticker.page.header.position == "left" || base.json.ticker.page.header.position == "right") { builtHeader ="

"+ j + "

"; } (base.json.ticker.page.header.src == "")?$('#top > img').hide():$('#top > img').show(); $('#header').html() != builtHeader?$('#header').html(builtHeader):''; /********************************************** //APPLY LOGO ***********************************************/ var builtLogo =""; var sp = "logo_bottom"; if(base.json.ticker.page.logo.position == 'top') { $('#logo_top').css({"display" :"block"}); $('#logo_bottom').css({"display" :"none"}); sp = "logo_top"; } else { $('#logo_top').css({"display" :"none"}); $('#logo_bottom').css({"display" :"block"}); sp = "logo_bottom"; } (base.json.ticker.page.logo.src == "")?$('#'+sp).hide():$('#'+sp).show(); $('#'+sp).html() != builtLogo?$('#'+sp).html(builtLogo):''; /********************************************** //APPLY FOOTER ***********************************************/ if(base.json.ticker.page.footer.display_footer==1) { $('#footer').css({"display" :"block"}); var builtFooter ="

"+base.json.ticker.page.footer.text+"

"; $('#footer').html() != builtFooter?$('#footer').html(builtFooter):''; } else { $('#footer').css({"display" :"none"}); } /********************************************** //APPLY WIDGET ***********************************************/ if(base.json.ticker.page.widget.display_widget ==1) { //Frame Size var h = base.json.ticker.page.widget.height; var w = base.json.ticker.page.widget.width; //Frame Source var x = (base.json.ticker.page.widget.src=== "")? "/plugins/RWDDigitalSign/PreDefined_Widgets/" + "?plugin=RWDDigitalSign&Templates=WidgetLists&panel_height="+h+"&panel_width="+w : "/plugins/RWDUser/" + base.json.ticker.page.widget.src; /* var x = "/plugins/RWDDigitalSign/PreDefined_Widgets/" +( (base.json.ticker.page.widget.src=== "")?( "?plugin=RWDDigitalSign&Templates=WidgetLists&panel_height="+h+"&panel_width="+w) :(base.json.ticker.page.widget.src) ); */ //Strip Google Branding function stripGoogle() { if ($($('#frame')).contents().find('tr:last-child').text() == "Gadgets powered by Google") { try { $($('#frame')).contents().find('tr:first-child').remove(); $($('#frame')).contents().find('tr:last-child').remove(); } catch(err){} } } //Frame Sizing Function function sizeFrame(h,w) { //Frame Sizing width if(w=="auto"){$('#frame').width($($($('#frame'))).contents().width());} else {$('#frame').width(w);} //Frame Sizing height if(h=="auto") {$('#frame').height($($($('#frame'))).contents().height());} else{$('#frame').height(h);} $('#widget').height($($($('#frame'))).contents().height()); $('#widget').width($($($('#frame'))).contents().width()); } //IE BG-Color Fix, ETC. function cleanWidget() { $($($('#frame'))).contents().find("body").css({"margin-left":"0px"}); $($($('#frame'))).contents().find("body").css({"background-color":"transparent"}); } //Frame Loader if(x != $($('#frame')).attr('src') && typeof(base.json.ticker.page.widget.src) != "undefined") { $($('#frame')).attr('src',x); //When Loaded, $('iframe#frame').load(function() { stripGoogle(); sizeFrame(h,w); cleanWidget(); }); } sizeFrame(h,w); $('#widget').css({"display" :"block"}); } else { $('#widget').css({"display" :"none"}); } }; /* ************************************************ */ /* *************** TZ CONVERT *************** */ /* ************************************************ */ /* This DOES take into account crossing DST - you must RELOAD the page, NOT REFRESH, NOT CTRL+F5 */ base.convertTimeZone = function(input,direction) { //Direction = Client, or Server var mtz = new Date(); var s_atz=base.json.ticker.time_diff; var sub = (s_atz*60) + mtz.getTimezoneOffset(); zhour= parseInt(sub/60) ; zmin = sub%60; if(zhour ==0) return input; if(direction == "server") zhour*=-1; zmin*=-1; mtz.setHours(parseFloat (cv12[input.substring(6,8)][input.substring(0,2)])-zhour); mtz.setMinutes(parseFloat (input.substring(3,5))-zmin ); var date = (mtz.getHours())+":"+ (mtz.getMinutes() || '00') +":00"; date = date.replace(/[0-9]{1,2}(:[0-9]{2}){2}/, function (time) { time = time.replace(/.{3}$/, '');     var hms = time.split(':'),         h = +hms[0],         suffix = (h < 12) ? ' AM' : ' PM';     hms[0] = (h % 12 || 12)<10?('0'+h%12):(h%12 || 12);             return hms.join(':') + suffix }); return date; }; base.applyCalendarEvents=function() { //Apply the structure to the HTML doc var tickerHTML = ""; var serverDate = parseInt(base.json.ticker.server_date); var clientDate = parseInt(new Date().getDate()); var sameDay = serverDate == clientDate; sdd= (serverDate.toString().length== 1)?'0'+serverDate:serverDate.toString(); var dOffset = (parseInt(new Date.parse("yesterday").getDate()) == serverDate)? " -1 Day " : (!sameDay)?" +1 Day ":""; var i; for (i in base.json.elements) { tickerHTML+= "
  • "; switch (base.json.elements[i].rwk){ case 99: rwk_text=" (Today)";break; case 1: rwk_text="";break; case 2: rwk_text="";break; case 3: rwk_text="";break; case 4: rwk_text="";break; case 5: rwk_text="";break; case 6: rwk_text="";break; case 0: rwk_text="";break; case -1: rwk_text="";break; } rwk_text = convert_date(base.json.elements[i].r_date.substr(0,4), base.json.elements[i].r_date.substr(4,2), base.json.elements[i].r_date.substr(6,2), base.json.ticker.multi_date_format) + rwk_text; if (base.json.elements[i].rwk>-1){ tickerHTML+="
    " + rwk_text + "
    "; } //console.log(base.json.elements[i-1].rwk.toString()); tickerHTML+="
    "; tickerHTML+="
    "; /* tickerHTML+=""; tickerHTML+=""; */ tickerHTML+="
    "; var mzStart = base.json.elements[i].start_display; var mzEnd = base.json.elements[i].end_display; //Ongoing Event!! tickerCustomStyle=""; if (base.json.ticker.item.event_time_text_decoration.toLowerCase() == 'bold') tickerCustomStyle = ';font-weight:bold;'; else if (base.json.ticker.item.event_time_text_decoration.toLowerCase() == 'italic') tickerCustomStyle = ';font-style:italic;'; else if (base.json.ticker.item.event_time_text_decoration.toLowerCase() == 'underline') tickerCustomStyle = ';text-decoration:underline;'; else tickerCustomStyle=""; tickerCustomStyle += ';font-face:' + base.json.ticker.item.event_time_font_face + ';color:' + base.json.ticker.item.event_time_font_color + ';font-size:' + base.json.ticker.item.event_time_font_size; tickerCustomStyle=""; if (base.json.ticker.item.in_session_text_decoration.toLowerCase() == 'bold') tickerCustomStyle = ';font-weight:bold;'; else if (base.json.ticker.item.in_session_text_decoration.toLowerCase() == 'italic') tickerCustomStyle = ';font-style:italic;'; else if (base.json.ticker.item.in_session_text_decoration.toLowerCase() == 'underline') tickerCustomStyle = ';text-decoration:underline;'; else tickerCustomStyle=""; tickerCustomStyle += ";color:" + base.json.ticker.item.in_session_font_color + ";font-size:" + base.json.ticker.item.in_session_font_size + ";font-face:" + base.json.ticker.item.in_session_font_face; var item_duration_display_topleft=1, item_duration_display_middle=1; if (base.json.elements[i].category=='#'){ item_duration_display_topleft=0; item_duration_display_middle=0; } else if (base.json.elements[i].category.length > 0){ if (base.json.elements[i].category.toLowerCase() == "appointments" || base.json.elements[i].category.toLowerCase() == "birthdays" || base.json.elements[i].category.toLowerCase() == "classes" || base.json.elements[i].category.toLowerCase() == "conferences" || base.json.elements[i].category.toLowerCase() == "anniversaries" || base.json.elements[i].category.toLowerCase() == "contacts" || base.json.elements[i].category.toLowerCase() == "lectures" || base.json.elements[i].category.toLowerCase() == "leisure" || base.json.elements[i].category.toLowerCase() == "meetings" || base.json.elements[i].category.toLowerCase() == "sports" || base.json.elements[i].category.toLowerCase() == "stat holidays" || base.json.elements[i].category.toLowerCase() == "training" || base.json.elements[i].category.toLowerCase() == "travel" || base.json.elements[i].category.toLowerCase() == "vacations"){ item_duration_display_topleft=1; item_duration_display_middle=1; }else{ item_duration_display_topleft=0; item_duration_display_middle=2; base.json.elements[i].duration = base.json.elements[i].category; } } else { item_duration_display_topleft=1; item_duration_display_middle=1;} var object_items = { 'None/Hide' : "", 'Event time' : "
    "+ ((base.json.elements[i].alldayevent)?"  All Day  ":mzStart) +"
    ", 'Ongoing Indicator' : ((base.json.elements[i].indicator || (base.json.elements[i].alldayevent))?"":""), /*'Indicator Text' :((base.json.elements[i].indicator || (base.json.elements[i].alldayevent))? "

    "+base.json.ticker.item.ongoing_text+"

    ":""), */ 'Indicator Text' :((base.json.elements[i].indicator || (base.json.elements[i].alldayevent))? "

    "+base.json.ticker.item.ongoing_text+"

    " : ""), 'Past Indicator' : ((base.json.elements[i].past)?"":"") }; tickerHTML+="
    "; tickerHTML+="
    " + object_items[base.json.ticker.item.top_left] + "
    "; tickerHTML+="
    " + object_items[base.json.ticker.item.bottom_left] +"
    "; tickerHTML+="
    "; tickerHTML+="
    "; if ( base.json.elements[i].r_date != '00000000' ){ dd=new Date(); fulltoday=dd.getFullYear().toString() + ( (dd.getMonth()+1).toString().length==1?'0'+(dd.getMonth()+1).toString():(dd.getMonth()+1).toString() ) + ( dd.getDate().toString().length==1?'0'+dd.getDate().toString():dd.getDate().toString() ); if ( fulltoday != base.json.elements[i].r_date) {r_top_right = ''; }else{ r_top_right= object_items[base.json.ticker.item.top_right];} }else{ r_top_right= object_items[base.json.ticker.item.top_right]; } /* This code block is for the text "Currently On" on appearing for today's events. NOT on the future events */ tickerHTML+="
    "+ r_top_right +"
    "; tickerHTML+="
    "+ object_items[base.json.ticker.item.bottom_right] +"
    "; tickerHTML+="
    "; tickerHTML+="
    "; tickerHTML+="
    " + object_items[base.json.ticker.item.top_mid] + "
    "; tickerCustomStyle=""; if (base.json.ticker.item.event_title_text_decoration.toLowerCase() == 'bold') tickerCustomStyle = ';font-weight:bold;'; else if (base.json.ticker.item.event_title_text_decoration.toLowerCase() == 'italic') tickerCustomStyle = ';font-style:italic;'; else if (base.json.ticker.item.event_title_text_decoration.toLowerCase() == 'underline') tickerCustomStyle = ';text-decoration:underline;'; else tickerCustomStyle = ';text-decoration:none;'; if (base.json.ticker.item.time_color.length>0 && base.json.ticker.item.time_bgi.length>0) tickerCustomStyle += ';background-color:' + base.json.ticker.item.time_color + ';background-image:url(' + base.json.ticker.item.time_bgi + ');'; else if (base.json.ticker.item.time_color.length>0) tickerCustomStyle += ';background-color:' + base.json.ticker.item.time_color + ';background-image:none;'; else if (base.json.ticker.item.time_bgi.length>0) tickerCustomStyle += ';background-image:url(' + base.json.ticker.item.time_bgi + ');'; tickerHTML+="
    " + base.json.elements[i].title + "
    "; /* tickerHTML+="
    "+base.json.elements[i].title+"
    "; tickerHTML+="
    " + ((!base.json.elements[i].alldayevent)?(mzStart+ " to "+mzEnd):"") + " - ("+base.json.elements[i].duration+")
    "; */ tickerCustomStyle=""; if (base.json.ticker.item.event_timelocation_text_decoration.toLowerCase() == 'bold') tickerCustomStyle = ';font-weight:bold;'; else if (base.json.ticker.item.event_timelocation_text_decoration.toLowerCase() == 'italic') tickerCustomStyle = ';font-style:italic;'; else if (base.json.ticker.item.event_timelocation_text_decoration.toLowerCase() == 'underline') tickerCustomStyle = ';text-decoration:underline;'; else tickerCustomStyle = ';text-decoration:none;'; tickerHTML+="
    " + (item_duration_display_middle>0?"":"
    ") + ((!base.json.elements[i].alldayevent && item_duration_display_middle!=2)?(mzStart + " to " + mzEnd):"") + ( item_duration_display_middle==2?"":" - (" ) + base.json.elements[i].duration+ ( item_duration_display_middle==2?"":") " ) + ((dOffset!="")?dOffset:"") + (item_duration_display_middle>0?"":"
    ") + (item_duration_display_middle>0 && base.json.elements[i].location!=""?"
    ":"") + ((base.json.elements[i].location!="")?("Location:"+base.json.elements[i].location):"") + "
    "; tickerHTML+="
    "; tickerHTML+="
    "; tickerHTML+="
    "; tickerHTML+="
    "; tickerHTML+="
  • "; } if(base.json.ticker.scroll_off) { var mi = (base.json.ticker.full_screen===true)?( Math.floor( parseInt(((typeof(window.innerHeight)=='undefined'?document.documentElement.clientHeight:window.innerHeight)-$('#header').height()-$('#footer').height()) ,10) / parseInt(base.json.ticker.rowheight.replace(/px/i, '') ,10))):(base.json.ticker.items_to_show); var output = ""; var s; for (s=0; s"; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+="
    "; output+=""; } tickerHTML += output; } $("#vertical-ticker").html(tickerHTML); base.reset_interval(); }; base.updateClock = function(){ if (base.json.ticker.page.header.display_time==1) { //var mtz = new Date().getTimezoneOffset(); //var stz = base.json.ticker.time_diff*60; //var sub = stz + mtz; //sub= sub/60; var sub=0; var mydate=new Date(); var year=mydate.getYear(); if (year < 1000) {year+=1900;} var day=mydate.getDay(); var month=mydate.getMonth(); var daym=mydate.getDate(); if (daym<10) {daym="0"+daym;} var hour = mydate.getHours()+sub; var min = mydate.getMinutes(); var sec = mydate.getSeconds(); var time; if(min<=9){min="0"+min;} if(sec<=9){sec ="0"+sec;} if(hour>12){hour=hour-12;add=" pm";} else{add=" am";} //else{hour=hour;add=" am";} if(hour==12){add="pm";} if(hour==0){hour="12";} time=((hour<=9)?"0"+hour:hour)+":"+min+add; var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); $('#theTime').html(time); $('#theDate').html(""+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+""); var mc = ($('#top').css('height').replace(/px/i,'')/2) - ($('.dateTime').css('height').replace(/px/i,'')/2); $('.dateTime').css({"top" : (mc<0)?'0px':mc + 'px' }); if (base.json.ticker.page.header.display_time_own_style==1){ $('.dateTime, .ampm, .dsh_datetime').css("color", base.json.ticker.page.header.display_time_own_fontcolor); $('.dateTime, .ampm, .dsh_datetime').css("font-size", base.json.ticker.page.header.display_time_own_fontsize); $('.dateTime, .ampm, .dsh_datetime').css("font-family", base.json.ticker.page.header.display_time_own_fontface); if (base.json.ticker.page.header.display_time_own_textdecoration=='bold'){ $('.dateTime, .ampm, .dsh_datetime').css("font-weight", "bold"); } if (base.json.ticker.page.header.display_time_own_textdecoration=='italic'){ $('.dateTime, .ampm, .dsh_datetime').css("font-style", "italic"); } if (base.json.ticker.page.header.display_time_own_textdecoration=='underline'){ $('.dateTime, .ampm, .dsh_datetime').css("text-decoration", "underline"); } } } else { $('#theTime').html(''); $('#theDate').html(''); } }; base.checkCurrent = function() { //console.log("(3)... checking current/past indicators ..."); //Active Past Check/ Current Check var now = new Date(); var ch = now.getHours(); var cd = now.getDate(); var cm = now.getMinutes(); var reload = false; var i; for ( i in base.json.elements) { if(base.json.elements[i].alldayevent == false) { /********************************************** //PARSE THE TIME (12H) ***********************************************/ //Current Client Date/Time var now = new Date(); var chh = ( (now.getHours().toString().length==1)?'0'+now.getHours():now.getHours().toString() ); var cmm = (now.getMinutes().toString().length==1)?'0'+now.getMinutes():now.getMinutes().toString(); var ctm = cv24[chh] + ":00"; // + cmm; ctm+=(chh>=12)?" PM":" AM" ; var stm = base.convertTimeZone(ctm.toString(),"server") ; //CH MUST BE 24hr. var ch = parseInt(cv12[stm.substring(6)][stm.substring(0,2)],10); var cm = parseInt(cmm); var mzStart = base.json.elements[i].start; var mzEnd = base.json.elements[i].end; var s0=mzStart.substr(0,2); var s1=mzStart.substr(3,2); var s2=mzStart.substr(6,2); var e0 =mzEnd.substr(0,2); var e1 =mzEnd.substr(3,2); var e2 =mzEnd.substr(6,2); /********************************************** //CURRENT EVENT INDICATORS (BOOL1 && BOOL2)=OUT ***********************************************/ var bool1 = (ch==parseInt(cv12[s2][s0],10))? ((cm>=parseInt(s1,10))?true:false):((ch>parseInt(cv12[s2][s0],10))?true:false); var bool2 = (ch==parseInt(cv12[e2][e0],10))? ((cm<=parseInt(e1,10))?true:false):((chparseInt(e1,10))?false:true):((ch>parseInt(cv12[e2][e0],10))?false:true); var out2 = boolr==true?!bool3:boolr; var no = +i+1; //console.log("No. " + no + ", ch = " + ch + " cm = " + cm + " |||| " + "EEE_H : " + parseInt(cv12[e2][e0],10) + " EEE_M : " + parseInt(e1,10)); //console.log( "No. " + no + ", Current = " + out + " ... Past = " + out2); if ( !( (base.json.elements[i].indicator == out) && (base.json.elements[i].past == out2) ) ) { /* console.log("! > Current:: " + base.json.elements[i].indicator + " ... Past:: " + base.json.elements[i].past); */ base.json.elements[i].indicator = out; base.json.elements[i].past = out2; reload = true; } //change msg.current indicator .. and then call base.applyCalendarEvents to apply the changes .. i.e change count >1 , applyCalendar .. //also .. be sure to check if the event has passed too ... } } if(reload) { base.applyCalendarEvents(); //console.log("RELOAD VIA AUX HELPER"); } }; base.start_dataPollIntreval = function () { base.loadConfigurationFile(); $('#pagewidth').show(); setInterval(base.updateClock, 1000); if(base.json.ticker.polltime > 300000) { //setInterval(base.checkCurrent, 120000); setInterval(base.checkCurrent, 10000); //console.log("AUX HELPER SPAWNED"); } setInterval(base.loadConfigurationFile, base.json.ticker.polltime); }; base.start_ticker = function() { //Clear out any existing interval clearInterval(base.ticker); if (base.json.ticker.scroll_direction == "down") { //If the direction has been set to up base.ticker = setInterval(function() { base.$el.find('li:last').detach().prependTo(base.$el).css('marginTop', '-' + base.json.ticker.rowheight); base.$el.find('li:first').animate({marginTop: '0px'}, base.json.ticker.speed, function () { /*Callback functions go here*/ }); }, base.json.ticker.intreval); } else if (base.json.ticker.scroll_direction == "up") { base.ticker = setInterval(function() { base.$el.find('li:first').animate({marginTop: '-' + base.json.ticker.rowheighgewidth').show(); setInterval(base.updateClock, 1000); if(base.json.ticker.polltime > 300000) { //setInterval(base.checkCurrent, 120000); setInterval(base.checkCurrent, 10000); //console.log("AUX HELPER SPAWNED"); } setInterval(base.loadConfigurationFile, base.json.ticker.polltime); }; base.start_ticker = function() { //Clear out any existing interval clearInterval(base.ticker); if (base.json.ticker.scroll_direction == "down") { //If the direction has been set to up base.ticker = setInterval(function() { base.$el.find('li:last').detach().prependTo(base.$el).css('marginTop', '-' + base.json.ticker.rowheight); base.$el.find('li:first').animate({marginTop: '0px'}, base.json.ticker.speed, function () { /*Callback functions go here*/ }); }, base.json.ticker.intreval); } else if (base.json.ticker.scroll_direction == "up") { base.ticker = setInterval(function() { base.$el.find('li:first').animate({marginTop: '-' + base.json.ticker.rowheight }, b