Merge pull request #548 from glowing-bear/fix-async-autoembed

Fix automatic embedding of asynchronous plugins (jsonp)
This commit is contained in:
David Cormier 2015-02-12 16:08:51 -05:00
commit 091e235f19

View file

@ -47,8 +47,12 @@ weechat.directive('plugin', ['$rootScope', 'settings', function($rootScope, sett
// TODO store the result between channel switches
if ($scope.plugin.content instanceof Function){
// Don't rerun if the result is already there
if (embed.innerHTML === "") {
$scope.plugin.content();
if (!embed || embed.innerHTML === "") {
// if we're autoshowing, the element doesn't exist yet, and we need
// to do this async (wrapped in a setTimeout)
setTimeout(function() {
$scope.plugin.content();
});
}
} else {
$scope.displayedContent = $scope.plugin.content;