зеркало из https://github.com/mozilla/popcorn-js.git
Merge commit 'a131fcceab7' into 0.2
This commit is contained in:
Коммит
e06cf709d6
|
@ -4,10 +4,7 @@
|
|||
<title>Popcorn Twitter Plug-in Demo</title>
|
||||
|
||||
<script src="../../popcorn.js"></script>
|
||||
<!--
|
||||
script "http://widgets.twimg.com/j/2/widget.js" is needed for the Twitter widget
|
||||
-->
|
||||
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
|
||||
|
||||
<script src="popcorn.twitter.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
|
@ -33,7 +30,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">Popcorn Twitter Plug-in Demo</h1>
|
||||
<p>A script src="http://widgets.twimg.com/j/2/widget.js" must be loaded before popcorn.twitter.js</p>
|
||||
<p>Twitter profile '@stevesong' widget will appear at 5 seconds and disappear at 15 seconds.</p>
|
||||
<p>More Twitter hash '#oilspill' widget will appear at 20 seconds and disappear at 45 seconds.</p>
|
||||
<div>
|
||||
|
|
|
@ -29,6 +29,16 @@
|
|||
} )
|
||||
*
|
||||
*/
|
||||
|
||||
if ( !window.TWTR ) {
|
||||
var head = document.getElementsByTagName("head")[0] || document.documentElement,
|
||||
script = document.createElement("script");
|
||||
|
||||
script.src = "http://widgets.twimg.com/j/2/widget.js";
|
||||
|
||||
head.insertBefore( script, head.firstChild );
|
||||
}
|
||||
|
||||
Popcorn.plugin( "twitter" , {
|
||||
|
||||
manifest: {
|
||||
|
@ -93,21 +103,31 @@
|
|||
};
|
||||
|
||||
// create widget
|
||||
if ( profile ) {
|
||||
var isReady = function( that ) {
|
||||
if ( window.TWTR ) {
|
||||
if ( profile ) {
|
||||
|
||||
widgetOptions.type = "profile";
|
||||
widgetOptions.type = "profile";
|
||||
|
||||
new TWTR.Widget( widgetOptions ).render().setUser( src ).start();
|
||||
new TWTR.Widget( widgetOptions ).render().setUser( src ).start();
|
||||
|
||||
} else if ( hash ) {
|
||||
} else if ( hash ) {
|
||||
|
||||
widgetOptions.type = "search";
|
||||
widgetOptions.search = src;
|
||||
widgetOptions.subject = src;
|
||||
widgetOptions.type = "search";
|
||||
widgetOptions.search = src;
|
||||
widgetOptions.subject = src;
|
||||
|
||||
new TWTR.Widget( widgetOptions ).render().start();
|
||||
new TWTR.Widget( widgetOptions ).render().start();
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setTimeout( function() {
|
||||
isReady( that );
|
||||
}, 1);
|
||||
}
|
||||
};
|
||||
|
||||
isReady( this );
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче