From 6258303465418cc4362f452664aa04c20802317c Mon Sep 17 00:00:00 2001 From: Tor Hveem Date: Mon, 28 Oct 2013 13:21:51 +0100 Subject: [PATCH] New user setting for display embedded content by default --- index.html | 12 +++++++++++- js/plugins.js | 5 ++--- js/websockets.js | 10 +++++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index bb2d302..9d6bafb 100644 --- a/index.html +++ b/index.html @@ -178,7 +178,17 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
+
+ + +
  • +
    +
    +
    diff --git a/js/plugins.js b/js/plugins.js index ed2ffe0..91c6d58 100644 --- a/js/plugins.js +++ b/js/plugins.js @@ -53,16 +53,15 @@ plugins.service('plugins', ['userPlugins', '$sce', function(userPlugins, $sce) { * Iterates through all the registered plugins * and run their contentForMessage function. */ - var contentForMessage = function(message) { + var contentForMessage = function(message, visible) { message.metadata = []; for (var i = 0; i < plugins.length; i++) { var nsfw = false; - var visible = true; if (message.text.match(nsfwRegexp)) { var nsfw = true; - var visible = false; + visible = false; } var pluginContent = plugins[i].contentForMessage(message.text); diff --git a/js/websockets.js b/js/websockets.js index 3478ce9..6f4aa1b 100644 --- a/js/websockets.js +++ b/js/websockets.js @@ -27,7 +27,7 @@ weechat.factory('handlers', ['$rootScope', 'models', 'plugins', function($rootSc // Only react to line if its displayed if(message.displayed) { var buffer = models.getBuffer(message.buffer); - message = plugins.PluginManager.contentForMessage(message); + message = plugins.PluginManager.contentForMessage(message, $rootScope.visible); buffer.addLine(message); if (buffer.active) { @@ -513,6 +513,14 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $store.bind($scope, "hotlistsync", true); // Save setting for displaying nicklist $store.bind($scope, "nonicklist", false); + // Save setting for displaying embeds + $store.bind($scope, "noembed", false); + // Save setting for displaying embeds in rootscope so it can be used from service + $rootScope.visible = $scope.noembed == false; + // Watch model and update show setting when it changes + $scope.$watch('noembed', function() { + $rootScope.visible = $scope.noembed == false; + }); $scope.setActiveBuffer = function(key) { models.setActiveBuffer(key);