Merge pull request #386 from glowing-bear/fix-default-embed
Fix default settings for embedding values
This commit is contained in:
commit
9090f50c5d
2 changed files with 14 additions and 9 deletions
|
@ -63,7 +63,7 @@ weechat.factory('handlers', ['$rootScope', '$log', 'models', 'plugins', function
|
|||
buffer.requestedLines++;
|
||||
// Only react to line if its displayed
|
||||
if (message.displayed) {
|
||||
message = plugins.PluginManager.contentForMessage(message, $rootScope.visible);
|
||||
message = plugins.PluginManager.contentForMessage(message);
|
||||
buffer.addLine(message);
|
||||
|
||||
if (manually) {
|
||||
|
@ -881,7 +881,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
}
|
||||
|
||||
// Save setting for displaying embeds in rootScope so it can be used from service
|
||||
$rootScope.visible = $scope.noembed === false;
|
||||
$rootScope.auto_display_embedded_content = $scope.noembed === false;
|
||||
|
||||
$scope.isSidebarVisible = function() {
|
||||
return document.getElementById('sidebar').getAttribute('sidebar-state') === 'visible';
|
||||
|
@ -934,7 +934,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
|
||||
// Watch model and update show setting when it changes
|
||||
$scope.$watch('noembed', function() {
|
||||
$rootScope.visible = $scope.noembed === false;
|
||||
$rootScope.auto_display_embedded_content = $scope.noembed === false;
|
||||
});
|
||||
// Watch model and update channel sorting when it changes
|
||||
$scope.$watch('orderbyserver', function() {
|
||||
|
@ -1300,7 +1300,7 @@ weechat.config(['$routeProvider',
|
|||
]);
|
||||
|
||||
|
||||
weechat.directive('plugin', function() {
|
||||
weechat.directive('plugin', function($rootScope) {
|
||||
/*
|
||||
* Plugin directive
|
||||
* Shows additional plugin content
|
||||
|
@ -1316,6 +1316,8 @@ weechat.directive('plugin', function() {
|
|||
|
||||
$scope.displayedContent = "";
|
||||
|
||||
$scope.plugin.visible = $rootScope.auto_display_embedded_content;
|
||||
|
||||
$scope.hideContent = function() {
|
||||
$scope.plugin.visible = false;
|
||||
};
|
||||
|
@ -1339,6 +1341,10 @@ weechat.directive('plugin', function() {
|
|||
};
|
||||
setTimeout(scroll, 100);
|
||||
};
|
||||
|
||||
if ($scope.plugin.visible) {
|
||||
$scope.showContent();
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
@ -53,7 +53,7 @@ plugins.service('plugins', ['userPlugins', '$sce', function(userPlugins, $sce) {
|
|||
* Iterates through all the registered plugins
|
||||
* and run their contentForMessage function.
|
||||
*/
|
||||
var contentForMessage = function(message, visible) {
|
||||
var contentForMessage = function(message) {
|
||||
|
||||
message.metadata = [];
|
||||
for (var i = 0; i < plugins.length; i++) {
|
||||
|
@ -66,10 +66,9 @@ plugins.service('plugins', ['userPlugins', '$sce', function(userPlugins, $sce) {
|
|||
|
||||
var pluginContent = plugins[i].contentForMessage(message.text);
|
||||
if (pluginContent) {
|
||||
pluginContent = {'visible': visible,
|
||||
'content': $sce.trustAsHtml(pluginContent),
|
||||
'nsfw': nsfw,
|
||||
'name': plugins[i].name };
|
||||
pluginContent = {'content': $sce.trustAsHtml(pluginContent),
|
||||
'nsfw': nsfw,
|
||||
'name': plugins[i].name };
|
||||
|
||||
message.metadata.push(pluginContent);
|
||||
|
||||
|
|
Loading…
Reference in a new issue