Commit 5cc4160f by Wolfgang Berndt

Add font-family to ticker font configuration.

parent 8e174f6d
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "tvlokal.ticker",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-nodeunit": "~0.4.1",
"grunt-contrib-uglify": "~0.5.0"
}
}
......@@ -37,8 +37,9 @@
// Schriftart. Der Oxygen-Player zeigt den Ticker mit IE11 an, das Format muss also EOT, WOFF oder
// TTF sein.
font: {
file: "files/Oswald-Regular.woff",
format: "woff",
file: "files/TitilliumWeb-Black.ttf",
format: "truetype",
name: "Titillium WebBlack"
},
// Styling der Überschrift. Die Werte werden direkt ins CSS der Seite geschrieben, es sind also z.B.
......
......@@ -78,8 +78,10 @@ var ticker = {
this.viewportHeight = $('#viewport').height();
if(this.config.font && this.config.font.file && this.config.font.format) {
$('head').prepend('<style type="text/css">@font-face {font-family: "customfont"; src: url("' + this.config.font.file + '") format("' + this.config.font.format + '");}</style>');
$('body').css('font-family', 'customfont');
var fontFamily = this.config.font.name || "customfont";
$('head').prepend('<style type="text/css">@font-face {font-family: "' + fontFamily + '"; src: url("' + this.config.font.file + '") format("' + this.config.font.format + '");}</style>');
$('body').css('font-family', fontFamily);
}
if(this.config.background.color) {
......
var feedCache={validCacheDuration:3e5,lastRequestDate:null,data:[],getdata:function(t,e,i){var n=this,s=new Date;if(this.lastRequestDate&&s-this.lastRequestDate<this.validCacheDuration)return i(n.data);$.ajax({url:e?"http://proxy.doohmedia.net/get.php?url="+$.base64.encode(t):t,type:"GET",success:function(t){var e=[];return $(t).find("item").each(function(){var t=$(this),i=t.find("title").text(),n=t.find("description").html().replace("<![CDATA[","").replace("\x3c!--[CDATA[<p--\x3e","").replace("]]>","").replace("]]&gt;","");return!(!i&&!n)&&(!(!i&&"<p></p>"===n)&&void e.push({title:i,desc:n}))}),e.length>0&&(n.data=e,n.lastRequestDate=new Date),i(n.data)},error:function(t){return console.log("error while getting feed data: ",t),i(n.data)}})}},ticker={currentFeedData:[],currentFeedIndex:-1,config:null,viewportHeight:null,init:function(t){var e=this;t.url&&(e.config=t,e._setupStyling(),feedCache.getdata(e.config.url,e.config.useproxy,function(t){e.currentFeedData=t,e._setupNewTicker(),window.setInterval(function(){e._updateFeedData()},6e4)}))},_setupStyling:function(){this.viewportHeight=$("#viewport").height(),this.config.font&&this.config.font.file&&this.config.font.format&&($("head").prepend('<style type="text/css">@font-face {font-family: "customfont"; src: url("'+this.config.font.file+'") format("'+this.config.font.format+'");}</style>'),$("body").css("font-family","customfont")),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 t=this;feedCache.getdata(t.config.url,t.config.useproxy,function(e){t.currentFeedData=e})},_setupNewTicker:function(){var t=this;0!==t.currentFeedData.length&&(t._createTicker(),setTimeout(function(){t._createTicker()},500))},_createTicker:function(){var t=this;if(0!==this.currentFeedData.length){var e=$(".tickercontainer:last").get(0),i=e?$(e).offset().top+$(e).height():this.viewportHeight,n=$('<div class="tickercontainer"></div>');$("#viewport").append(n);for(var s=0;s<this.currentFeedData.length;s++){if(this.config.spacer.text.length>0)c=$('<div class="tickeritem"><h1>'+this.currentFeedData[s].title+"</h1>"+this.currentFeedData[s].desc+'</div><div class="spacer">'+this.config.spacer.text+"</div>");else var c=$('<div class="tickeritem"><h1>'+this.currentFeedData[s].title+"</h1>"+this.currentFeedData[s].desc+"</div>");$(c).children("p").addClass("text"),$(n).append(c)}t._styleFonts(),$(n).css("top",i+"px");var a=i+$(n).height()+20,o=Math.round(a/100*this.config.speed);$(n).css("transition","transform "+o+"s linear"),$(n).css("transform","translate3d(0px, -"+a+"px ,0px)"),$(n).on("transitionend",function(){t._createTicker(),$(n).remove()})}}};
\ No newline at end of file
var feedCache={validCacheDuration:3e5,lastRequestDate:null,data:[],getdata:function(a,b,c){var d=this,e=new Date;if(this.lastRequestDate&&e-this.lastRequestDate<this.validCacheDuration)return c(d.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=a.find("title").text(),d=a.find("description").html().replace("<![CDATA[","").replace("\x3c!--[CDATA[<p--\x3e","").replace("]]>","").replace("]]&gt;","");return!(!c&&!d)&&(!(!c&&"<p></p>"===d)&&void b.push({title:c,desc:d}))}),b.length>0&&(d.data=b,d.lastRequestDate=new Date),c(d.data)},error:function(a){return console.log("error while getting feed data: ",a),c(d.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
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