「Widget:Tweet」の版間の差分

提供: 理科教育wiki
ナビゲーションに移動検索に移動
(ページの作成:「{{Widget |description=Allows to embed a single tweet. |author=Pablog |provider=Twitter |providerurl=https://dev.twitter.com/web/embedded-tweets |status=active |security=u…」)
 
 
1行目: 1行目:
{{Widget
+
<noinclude>__NOTOC__
|description=Allows to embed a single tweet.
+
This widget allows you to '''[https://dev.twitter.com/docs/embedded-tweets embed a tweet]''' on your wiki page.
|author=Pablog
 
|provider=Twitter
 
|providerurl=https://dev.twitter.com/web/embedded-tweets
 
|status=active
 
|security=unknown
 
}}
 
This widget allows you to [https://dev.twitter.com/web/embedded-tweets embed a tweet] to your wiki page. It was created by [[User:Pablog|Pablo Castellano]].
 
  
== Usage ==
+
Created by [https://www.mediawikiwidgets.org/User:Pablog Pablo Castellano].
To insert this widget, use the following code:
 
  
<nowiki>{{#widget:Tweet
+
== Using this widget ==
|id=226413520412090368
+
For information on how to use this widget, see [https://www.mediawikiwidgets.org/Tweet widget description page on MediaWikiWidgets.org].
}}</nowiki>
 
  
You can use some parameters to customize the style of the tweet box, like:
+
== Copy to your site ==
 
+
To use this widget on your site, just install [https://www.mediawiki.org/wiki/Extension:Widgets MediaWiki Widgets extension] and copy the [{{fullurl:{{FULLPAGENAME}}|action=edit}} full source code] of this page to your wiki as page '''{{FULLPAGENAME}}'''.
<nowiki>{{#widget:Tweet
+
</noinclude><includeonly>
|id=226413520412090368
+
<!--{if isset($id)}-->
|linkColor=#cc0000
+
    <!--{counter name="tweetcounter" assign="tweetincluded"}-->
|theme=dark
+
    <div id="twitter-<!--{$tweetincluded}-->-<!--{$id}-->"></div>
}}</nowiki>
+
    <!--{if $tweetincluded eq 1}-->
 
+
    <script>
For more information about customization parameters, have a look at the Twitter documentation available at [https://dev.twitter.com/web/javascript/creating-widgets#create-tweet https://dev.twitter.com/web/javascript/creating-widgets#create-tweet].
+
    if (typeof window.twttr === 'undefined') {
 
+
        window.twttr = (function (d,s,id) {
 
+
            var t, js, fjs = d.getElementsByTagName(s)[0];
== Parameters ==
+
            if (d.getElementById(id)) return; js=d.createElement(s); js.id=id;
 
+
            js.src="//platform.twitter.com/widgets.js";
=== Mandatory ===
+
            fjs.parentNode.insertBefore(js, fjs);
* '''id''' - tweet id
+
            return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } });
 
+
        }(document, "script", "twitter-wjs"));
=== Optional ===
+
    }
* '''align''' - ''left'', ''right'', ''center''. (Default: ''undefined'')
+
    </script>
* '''conversation''' - ''none'', ''all''. (Default: ''all'')
+
    <!--{/if}-->
* '''cards''' - ''hidden'', ''visible''. (Default: ''visible'')
+
    <script>
* '''width''' - ''numeric value''. (Default: ''auto'')
+
    twttr.ready(function (twttr) {
* '''linkColor''' - ''hexadecimal color value'' (Default: ''blue'')
+
        twttr.widgets.createTweet(
* '''theme''' - ''dark'', ''light''. (Default: ''light'')
+
            "<!--{$id}-->",
 
+
            document.getElementById("twitter-<!--{$tweetincluded}-->-<!--{$id}-->"),
== Examples ==
+
            {
=== Single post ===
+
                align: <!--{if $align}-->'<!--{$align}-->'<!--{else}-->undefined<!--{/if}-->,
{{#widget:Tweet|id=226413520412090368}}
+
                conversation: '<!--{if $conversation}--><!--{$conversation}--><!--{else}-->all<!--{/if}-->',
 
+
                cards: '<!--{if $cards}--><!--{$cards}--><!--{else}-->visible<!--{/if}-->',
=== Single post enhanced with further options ===
+
                width: <!--{if $width}-->'<!--{$width}-->'<!--{else}-->undefined<!--{/if}-->,
{{#widget:Tweet|id=226413520412090368|linkColor=#cc0000|theme=dark}}
+
                linkColor: '<!--{if $linkColor}--><!--{$linkColor}--><!--{else}-->blue<!--{/if}-->',
{{Comments}}
+
                theme: '<!--{if $theme}--><!--{$theme}--><!--{else}-->light<!--{/if}-->'
 +
            }
 +
        );
 +
    });
 +
    </script>
 +
<!--{else}-->
 +
    <b style="color:red">No id supplied for Tweet!</b>
 +
<!--{/if}-->
 +
</includeonly>

2022年9月11日 (日) 12:53時点における最新版

This widget allows you to embed a tweet on your wiki page.

Created by Pablo Castellano.

Using this widget

For information on how to use this widget, see widget description page on MediaWikiWidgets.org.

Copy to your site

To use this widget on your site, just install MediaWiki Widgets extension and copy the full source code of this page to your wiki as page Widget:Tweet.