Commit d9c535e3 by Wolfgang Berndt

Try to remove font-tag.

parent fd225bc2
...@@ -18,7 +18,13 @@ ...@@ -18,7 +18,13 @@
ticker.init({ ticker.init({
// URL zum RSS-Feed. Der Feed wird vom Ticker automatisch alle 5 Minuten refreshed, ein Reload der Seite // URL zum RSS-Feed. Der Feed wird vom Ticker automatisch alle 5 Minuten refreshed, ein Reload der Seite
// ist nicht notwendig. // ist nicht notwendig.
url: "http://www.tvlokal.de/customer/rss2files/630rss.xml", //
// Testfeeds:
// http://www.tvlokal.de/customer/rss2files/630rss.xml
// https://git.doohcorp.net/wberndt/tvlokal.ticker/raw/master/demodata/5rss/5rss.xml
//
url: "https://git.doohcorp.net/wberndt/tvlokal.ticker/raw/master/demodata/5rss/5rss.xml",
// Proxy benutzen, falls das RSS von einem anderen Server kommt und dieser keinen // Proxy benutzen, falls das RSS von einem anderen Server kommt und dieser keinen
// "Access-Control-Allow-Origin"-Header gesetzt hat. Kann auf *.tvlokal.de vermutlich deaktivert werden. // "Access-Control-Allow-Origin"-Header gesetzt hat. Kann auf *.tvlokal.de vermutlich deaktivert werden.
useproxy: true, useproxy: true,
......
...@@ -15,9 +15,10 @@ var feedCache = { ...@@ -15,9 +15,10 @@ var feedCache = {
// try to get some sensible data from this xml-"html"-mess // try to get some sensible data from this xml-"html"-mess
return jqueryEl.html() return jqueryEl.html()
.replace("<![CDATA[", "") .replace("<![CDATA[", "")
.replace("<!--[CDATA[<p-->", "") .replace("<!--[CDATA[<p-->", "<p>")
.replace("]]>", "") .replace("]]>", "")
.replace("]]&gt;", ""); .replace("]]&gt;", "")
.replace(/<\/?font[^>]*>/gi, "");
} }
// renew cache otherwise // renew cache otherwise
......
var feedCache={validCacheDuration:3e5,lastRequestDate:null,data:[],getdata:function(a,b,c){function d(a){return a.html().replace("<![CDATA[","").replace("\x3c!--[CDATA[<p--\x3e","").replace("]]>","").replace("]]&gt;","")}var e=this,f=new Date;if(this.lastRequestDate&&f-this.lastRequestDate<this.validCacheDuration)return c(e.data);$.ajax({url:b?"http://proxy.doohmedia.net/get.php?url="+$.base64.encode(a):a,type:"GET",success:function(a){var b=[];return $(a).find("item").each(function(){var a=$(this),c=d(a.find("title")),e=d(a.find("description"));return!(!c&&!e)&&(!(!c&&"<p></p>"===e)&&void b.push({title:c,desc:e}))}),b.length>0&&(e.data=b,e.lastRequestDate=new Date),c(e.data)},error:function(a){return console.log("error while getting feed data: ",a),c(e.data)}})}},ticker={currentFeedData:[],currentFeedIndex:-1,config:null,viewportHeight:null,init:function(a){var b=this;a.url&&(b.config=a,b._setupStyling(),feedCache.getdata(b.config.url,b.config.useproxy,function(a){b.currentFeedData=a,b._setupNewTicker(),window.setInterval(function(){b._updateFeedData()},6e4)}))},_setupStyling:function(){if(this.viewportHeight=$("#viewport").height(),this.config.font&&this.config.font.file&&this.config.font.format){var a=this.config.font.name||"customfont";$("head").prepend('<style type="text/css">@font-face {font-family: "'+a+'"; src: url("'+this.config.font.file+'") format("'+this.config.font.format+'");}</style>'),$("body").css("font-family",a)}this.config.background.color&&$("body").css("background-color",this.config.background.color),this.config.background.image&&$("body").css("background",'url("'+this.config.background.image+'") no-repeat center fixed').css("background-size","cover"),this._styleFonts()},_styleFonts:function(){this.config.text.size&&$("p").css("font-size",this.config.text.size),this.config.text.color&&$("p").css("color",this.config.text.color),this.config.text.align&&$("p").css("text-align",this.config.text.align),this.config.headline.size&&$("h1").css("font-size",this.config.headline.size),this.config.headline.color&&$("h1").css("color",this.config.headline.color),this.config.spacer.color&&$(".spacer").css("color",this.config.spacer.color),this.config.spacer.size&&$(".spacer").css("font-size",this.config.spacer.size)},_updateFeedData:function(){var a=this;feedCache.getdata(a.config.url,a.config.useproxy,function(b){a.currentFeedData=b})},_setupNewTicker:function(){var a=this;0!==a.currentFeedData.length&&(a._createTicker(),setTimeout(function(){a._createTicker()},500))},_createTicker:function(){var a=this;if(0!==this.currentFeedData.length){var b=$(".tickercontainer:last").get(0),c=b?$(b).offset().top+$(b).height():this.viewportHeight,d=$('<div class="tickercontainer"></div>');$("#viewport").append(d);for(var e=0;e<this.currentFeedData.length;e++){if(this.config.spacer.text.length>0)var f=$('<div class="tickeritem"><h1>'+this.currentFeedData[e].title+"</h1>"+this.currentFeedData[e].desc+'</div><div class="spacer">'+this.config.spacer.text+"</div>");else var f=$('<div class="tickeritem"><h1>'+this.currentFeedData[e].title+"</h1>"+this.currentFeedData[e].desc+"</div>");$(f).children("p").addClass("text"),$(d).append(f)}a._styleFonts(),$(d).css("top",c+"px");var g=c+$(d).height()+20,h=Math.round(g/100*this.config.speed);$(d).css("transition","transform "+h+"s linear"),$(d).css("transform","translate3d(0px, -"+g+"px ,0px)"),$(d).on("transitionend",function(){a._createTicker(),$(d).remove()})}}}; var feedCache={validCacheDuration:3e5,lastRequestDate:null,data:[],getdata:function(a,b,c){function d(a){return a.html().replace("<![CDATA[","").replace("\x3c!--[CDATA[<p--\x3e","<p>").replace("]]>","").replace("]]&gt;","").replace(/<\/?font[^>]*>/gi,"")}var e=this,f=new Date;if(this.lastRequestDate&&f-this.lastRequestDate<this.validCacheDuration)return c(e.data);$.ajax({url:b?"http://proxy.doohmedia.net/get.php?url="+$.base64.encode(a):a,type:"GET",success:function(a){var b=[];return $(a).find("item").each(function(){var a=$(this),c=d(a.find("title")),e=d(a.find("description"));return!(!c&&!e)&&(!(!c&&"<p></p>"===e)&&void b.push({title:c,desc:e}))}),b.length>0&&(e.data=b,e.lastRequestDate=new Date),c(e.data)},error:function(a){return console.log("error while getting feed data: ",a),c(e.data)}})}},ticker={currentFeedData:[],currentFeedIndex:-1,config:null,viewportHeight:null,init:function(a){var b=this;a.url&&(b.config=a,b._setupStyling(),feedCache.getdata(b.config.url,b.config.useproxy,function(a){b.currentFeedData=a,b._setupNewTicker(),window.setInterval(function(){b._updateFeedData()},6e4)}))},_setupStyling:function(){if(this.viewportHeight=$("#viewport").height(),this.config.font&&this.config.font.file&&this.config.font.format){var a=this.config.font.name||"customfont";$("head").prepend('<style type="text/css">@font-face {font-family: "'+a+'"; src: url("'+this.config.font.file+'") format("'+this.config.font.format+'");}</style>'),$("body").css("font-family",a)}this.config.background.color&&$("body").css("background-color",this.config.background.color),this.config.background.image&&$("body").css("background",'url("'+this.config.background.image+'") no-repeat center fixed').css("background-size","cover"),this._styleFonts()},_styleFonts:function(){this.config.text.size&&$("p").css("font-size",this.config.text.size),this.config.text.color&&$("p").css("color",this.config.text.color),this.config.text.align&&$("p").css("text-align",this.config.text.align),this.config.headline.size&&$("h1").css("font-size",this.config.headline.size),this.config.headline.color&&$("h1").css("color",this.config.headline.color),this.config.spacer.color&&$(".spacer").css("color",this.config.spacer.color),this.config.spacer.size&&$(".spacer").css("font-size",this.config.spacer.size)},_updateFeedData:function(){var a=this;feedCache.getdata(a.config.url,a.config.useproxy,function(b){a.currentFeedData=b})},_setupNewTicker:function(){var a=this;0!==a.currentFeedData.length&&(a._createTicker(),setTimeout(function(){a._createTicker()},500))},_createTicker:function(){var a=this;if(0!==this.currentFeedData.length){var b=$(".tickercontainer:last").get(0),c=b?$(b).offset().top+$(b).height():this.viewportHeight,d=$('<div class="tickercontainer"></div>');$("#viewport").append(d);for(var e=0;e<this.currentFeedData.length;e++){if(this.config.spacer.text.length>0)var f=$('<div class="tickeritem"><h1>'+this.currentFeedData[e].title+"</h1>"+this.currentFeedData[e].desc+'</div><div class="spacer">'+this.config.spacer.text+"</div>");else var f=$('<div class="tickeritem"><h1>'+this.currentFeedData[e].title+"</h1>"+this.currentFeedData[e].desc+"</div>");$(f).children("p").addClass("text"),$(d).append(f)}a._styleFonts(),$(d).css("top",c+"px");var g=c+$(d).height()+20,h=Math.round(g/100*this.config.speed);$(d).css("transition","transform "+h+"s linear"),$(d).css("transform","translate3d(0px, -"+g+"px ,0px)"),$(d).on("transitionend",function(){a._createTicker(),$(d).remove()})}}};
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment