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++;
|
buffer.requestedLines++;
|
||||||
// Only react to line if its displayed
|
// Only react to line if its displayed
|
||||||
if (message.displayed) {
|
if (message.displayed) {
|
||||||
message = plugins.PluginManager.contentForMessage(message, $rootScope.visible);
|
message = plugins.PluginManager.contentForMessage(message);
|
||||||
buffer.addLine(message);
|
buffer.addLine(message);
|
||||||
|
|
||||||
if (manually) {
|
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
|
// 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() {
|
$scope.isSidebarVisible = function() {
|
||||||
return document.getElementById('sidebar').getAttribute('sidebar-state') === 'visible';
|
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
|
// Watch model and update show setting when it changes
|
||||||
$scope.$watch('noembed', function() {
|
$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
|
// Watch model and update channel sorting when it changes
|
||||||
$scope.$watch('orderbyserver', function() {
|
$scope.$watch('orderbyserver', function() {
|
||||||
|
@ -1300,7 +1300,7 @@ weechat.config(['$routeProvider',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
weechat.directive('plugin', function() {
|
weechat.directive('plugin', function($rootScope) {
|
||||||
/*
|
/*
|
||||||
* Plugin directive
|
* Plugin directive
|
||||||
* Shows additional plugin content
|
* Shows additional plugin content
|
||||||
|
@ -1316,6 +1316,8 @@ weechat.directive('plugin', function() {
|
||||||
|
|
||||||
$scope.displayedContent = "";
|
$scope.displayedContent = "";
|
||||||
|
|
||||||
|
$scope.plugin.visible = $rootScope.auto_display_embedded_content;
|
||||||
|
|
||||||
$scope.hideContent = function() {
|
$scope.hideContent = function() {
|
||||||
$scope.plugin.visible = false;
|
$scope.plugin.visible = false;
|
||||||
};
|
};
|
||||||
|
@ -1339,6 +1341,10 @@ weechat.directive('plugin', function() {
|
||||||
};
|
};
|
||||||
setTimeout(scroll, 100);
|
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
|
* Iterates through all the registered plugins
|
||||||
* and run their contentForMessage function.
|
* and run their contentForMessage function.
|
||||||
*/
|
*/
|
||||||
var contentForMessage = function(message, visible) {
|
var contentForMessage = function(message) {
|
||||||
|
|
||||||
message.metadata = [];
|
message.metadata = [];
|
||||||
for (var i = 0; i < plugins.length; i++) {
|
for (var i = 0; i < plugins.length; i++) {
|
||||||
|
@ -66,8 +66,7 @@ plugins.service('plugins', ['userPlugins', '$sce', function(userPlugins, $sce) {
|
||||||
|
|
||||||
var pluginContent = plugins[i].contentForMessage(message.text);
|
var pluginContent = plugins[i].contentForMessage(message.text);
|
||||||
if (pluginContent) {
|
if (pluginContent) {
|
||||||
pluginContent = {'visible': visible,
|
pluginContent = {'content': $sce.trustAsHtml(pluginContent),
|
||||||
'content': $sce.trustAsHtml(pluginContent),
|
|
||||||
'nsfw': nsfw,
|
'nsfw': nsfw,
|
||||||
'name': plugins[i].name };
|
'name': plugins[i].name };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue