-
Notifications
You must be signed in to change notification settings - Fork 281
/
Copy pathtwitterfeed.tpl
57 lines (44 loc) · 2.07 KB
/
twitterfeed.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<a class="twitter-timeline" href="https://twitter.com/{$twitterusername}" data-height="600" data-chrome="noheader nofooter" data-dnt="true">Tweets by {$twitterusername}</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
{literal}
<script>
var observerConfig = { attributes: true, childList: true, subtree: true },
observerTwitterWidget = new MutationObserver(removeRetweets),
elementsWaitTimeout = null;
function removeRetweets() {
jQuery('#twitter-widget-0')
.contents()
.find('.timeline-Tweet--isRetweet')
.parent('li')
.remove();
}
function addTwitterWidgetObserverWhenNodeAvailable() {
if (elementsWaitTimeout) {
clearTimeout(elementsWaitTimeout);
}
var targetTwitterWidget = document.getElementById('twitter-widget-0');
if (!targetTwitterWidget) {
elementsWaitTimeout = window.setTimeout(addTwitterWidgetObserverWhenNodeAvailable, 500);
return;
}
var targetTimelineTweets = targetTwitterWidget
.contentWindow
.document
.getElementsByClassName('timeline-TweetList')[0];
if (!targetTimelineTweets) {
elementsWaitTimeout = window.setTimeout(addTwitterWidgetObserverWhenNodeAvailable, 500);
return;
}
jQuery('#twitter-widget-0')
.contents()
.find('head')
.append("<style>.timeline-Tweet-text {font-size: 18px !important; line-height: 25px !important; margin-bottom: 0px !important;}</style>");
removeRetweets();
observerTwitterWidget.observe(targetTimelineTweets, observerConfig);
}
addTwitterWidgetObserverWhenNodeAvailable();
</script>
{/literal}
<p>
{$LANG.twitterfollowus} @<a href="https://twitter.com/{$twitterusername}" target="_blank">{$twitterusername}</a> {$LANG.twitterfollowuswhy}
</p>