2014-02-02 21:00:05 +00:00
|
|
|
define([
|
|
|
|
"jquery",
|
|
|
|
"underscore",
|
|
|
|
"constants",
|
|
|
|
"utils",
|
|
|
|
"classes/Extension",
|
2014-02-02 22:00:28 +00:00
|
|
|
], function($, _, constants, utils, Extension) {
|
2014-02-02 21:00:05 +00:00
|
|
|
|
|
|
|
var twitter = new Extension("twitter", "Twitter", false, true);
|
|
|
|
|
|
|
|
var isLoaded = false;
|
|
|
|
var isOffline = false;
|
|
|
|
|
|
|
|
var init = function() {
|
|
|
|
if(isLoaded === false && isOffline === false) {
|
|
|
|
$.ajax({
|
2014-02-02 22:07:38 +00:00
|
|
|
url: 'https://platform.twitter.com/widgets.js',
|
2014-02-02 21:00:05 +00:00
|
|
|
dataType: "script"
|
|
|
|
}).done(function() {
|
|
|
|
isLoaded = true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
twitter.onReady = function() {
|
|
|
|
init();
|
|
|
|
};
|
|
|
|
twitter.onOfflineChanged = function(isOfflineParam) {
|
|
|
|
isOffline = isOfflineParam;
|
|
|
|
init();
|
|
|
|
};
|
|
|
|
twitter.onTweet = function() {
|
|
|
|
isLoaded && window.twttr.widgets.load();
|
|
|
|
};
|
|
|
|
|
|
|
|
return twitter;
|
|
|
|
});
|