Add media provider for Twitter Tweets
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 23 Aug 2018 14:37:22 +0000 (16:37 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 23 Aug 2018 14:37:22 +0000 (16:37 +0200)
Closes #2690

com.woltlab.wcf/mediaProvider.xml

index a31b2c27b400209c6d19e68ceae9c93a14abd111..1186163035173446bc887fd8fc201fb1ffb6a11a 100644 (file)
@@ -94,6 +94,14 @@ https?://open.spotify.com/(?<TYPE>[a-zA-Z]+)/(?<ID>[0-9a-zA-Z]+)]]></regex>
 https?://www.twitch.tv/[a-zA-Z0-9]+/v/(?<ID>[0-9]+)]]></regex>
                        <html><![CDATA[<div class="videoContainer"><iframe src="https://player.twitch.tv/?video=v{$ID}&autoplay=false" frameborder="0" scrolling="no" allowfullscreen></iframe></div>]]></html>
                </provider>
+               
+               <provider name="twitter-tweet">
+                       <title>Twitter Tweet</title>
+                       <regex><![CDATA[https://twitter.com/(?<USERNAME>[0-9a-zA-Z_]+)/status/(?<ID>[0-9]+)]]></regex>
+                       <html><![CDATA[<script>window.twttr=function(t,e,r){var n,i=t.getElementsByTagName(e)[0],w=window.twttr||{};return t.getElementById(r)?w:((n=t.createElement(e)).id=r,n.src="https://platform.twitter.com/widgets.js",i.parentNode.insertBefore(n,i),w._e=[],w.ready=function(t){w._e.push(t)},w)}(document,"script","twitter-wjs");</script>
+<div data-wsc-twitter-tweet="{$ID}"></div>
+<script>twttr.ready(function(t){elBySelAll("[data-wsc-twitter-tweet]",void 0,function(t){elData(t,"wsc-twitter-tweet")&&(twttr.widgets.createTweet(elData(t,"wsc-twitter-tweet"),t,{dnt:!0}),elData(t,"wsc-twitter-tweet",""))})});</script>]]></html>
+               </provider>
        </import>
        
        <delete>