Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tvlokal.ticker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wolfgang Berndt
tvlokal.ticker
Commits
d9c535e3
Commit
d9c535e3
authored
Mar 01, 2018
by
Wolfgang Berndt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to remove font-tag.
parent
fd225bc2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
index.html
src/index.html
+7
-1
ticker.js
src/ticker.js
+3
-2
ticker.min.js
src/ticker.min.js
+2
-2
No files found.
src/index.html
View file @
d9c535e3
...
...
@@ -18,7 +18,13 @@
ticker
.
init
({
// URL zum RSS-Feed. Der Feed wird vom Ticker automatisch alle 5 Minuten refreshed, ein Reload der Seite
// 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
// "Access-Control-Allow-Origin"-Header gesetzt hat. Kann auf *.tvlokal.de vermutlich deaktivert werden.
useproxy
:
true
,
...
...
src/ticker.js
View file @
d9c535e3
...
...
@@ -15,9 +15,10 @@ var feedCache = {
// try to get some sensible data from this xml-"html"-mess
return
jqueryEl
.
html
()
.
replace
(
"<![CDATA["
,
""
)
.
replace
(
"<!--[CDATA[<p-->"
,
""
)
.
replace
(
"<!--[CDATA[<p-->"
,
"
<p>
"
)
.
replace
(
"]]>"
,
""
)
.
replace
(
"]]>"
,
""
);
.
replace
(
"]]>"
,
""
)
.
replace
(
/<
\/?
font
[^
>
]
*>/gi
,
""
);
}
// renew cache otherwise
...
...
src/ticker.min.js
View file @
d9c535e3
var
feedCache
=
{
validCacheDuration
:
3
e5
,
lastRequestDate
:
null
,
data
:[],
getdata
:
function
(
a
,
b
,
c
){
function
d
(
a
){
return
a
.
html
().
replace
(
"<![CDATA["
,
""
).
replace
(
"
\
x3c!--[CDATA[<p--
\
x3e"
,
""
).
replace
(
"]]>"
,
""
).
replace
(
"]]>"
,
""
)}
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
()},
6
e4
)}))},
_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
var
feedCache
=
{
validCacheDuration
:
3
e5
,
lastRequestDate
:
null
,
data
:[],
getdata
:
function
(
a
,
b
,
c
){
function
d
(
a
){
return
a
.
html
().
replace
(
"<![CDATA["
,
""
).
replace
(
"
\
x3c!--[CDATA[<p--
\
x3e"
,
"<p>"
).
replace
(
"]]>"
,
""
).
replace
(
"]]>"
,
""
).
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
()},
6
e4
)}))},
_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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment