Merge pull request #990 from lorenzhs/fix-hidden-angle-brackets

Don't put hidden angle brackets around actions and other non-messages
This commit is contained in:
Lorenz Hübschle-Schneider 2018-10-27 15:52:02 +02:00 committed by GitHub
commit 6bf2ea6b02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -334,7 +334,7 @@ npm run build-electron-{windows, darwin, linux}</pre>
<span class="cof-chat_time cob-chat_time coa-chat_time" ng-bind-html="::bufferline.formattedTime"></span> <span class="cof-chat_time cob-chat_time coa-chat_time" ng-bind-html="::bufferline.formattedTime"></span>
</span> </span>
</td> </td>
<td class="prefix"><span ng-class="::{'repeated-prefix': bufferline.prefixtext==bufferlines[$index-1].prefixtext}"><a ng-click="addMention(bufferline.prefix)"><span class="hidden-bracket">&lt;</span><span ng-repeat="part in ::bufferline.prefix" ng-class="::part.classes" ng-bind="::part.text|prefixlimit:25"></span><span class="hidden-bracket">&gt;</span></a></span></td><!-- <td class="prefix"><span ng-class="::{'repeated-prefix': bufferline.prefixtext==bufferlines[$index-1].prefixtext}"><a ng-click="addMention(bufferline)"><span class="hidden-bracket" ng-if="::(bufferline.showHiddenBrackets)">&lt;</span><span ng-repeat="part in ::bufferline.prefix" ng-class="::part.classes" ng-bind="::part.text|prefixlimit:25"></span><span class="hidden-bracket" ng-if="::(bufferline.showHiddenBrackets)">&gt;</span></a></span></td><!--
--><td class="message"><!-- --><td class="message"><!--
--><div ng-repeat="metadata in ::bufferline.metadata" plugin data="::metadata"></div><!-- --><div ng-repeat="metadata in ::bufferline.metadata" plugin data="::metadata"></div><!--
--><span ng-repeat="part in ::bufferline.content" class="text" ng-class="::part.classes.concat(['line-' + part.$$hashKey.replace(':','_')])" ng-bind-html="::part.text | linky:'_blank':{rel:'noopener noreferrer'} | DOMfilter:'irclinky' | DOMfilter:'emojify':settings.enableJSEmoji | DOMfilter:'inlinecolour' | DOMfilter:'latexmath':('.line-' + part.$$hashKey.replace(':','_')):settings.enableMathjax"></span> --><span ng-repeat="part in ::bufferline.content" class="text" ng-class="::part.classes.concat(['line-' + part.$$hashKey.replace(':','_')])" ng-bind-html="::part.text | linky:'_blank':{rel:'noopener noreferrer'} | DOMfilter:'irclinky' | DOMfilter:'emojify':settings.enableJSEmoji | DOMfilter:'inlinecolour' | DOMfilter:'latexmath':('.line-' + part.$$hashKey.replace(':','_')):settings.enableMathjax"></span>

View File

@ -208,7 +208,12 @@ weechat.directive('inputBar', function() {
}; };
//XXX THIS DOES NOT BELONG HERE! //XXX THIS DOES NOT BELONG HERE!
$rootScope.addMention = function(prefix) { $rootScope.addMention = function(bufferline) {
if (!bufferline.showHiddenBrackets) {
// the line is a notice or action or something else that doesn't belong
return;
}
var prefix = bufferline.prefix;
// Extract nick from bufferline prefix // Extract nick from bufferline prefix
var nick = prefix[prefix.length - 1].text; var nick = prefix[prefix.length - 1].text;

View File

@ -359,6 +359,11 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
var highlight = message.highlight; var highlight = message.highlight;
var content = parseRichText(message.message); var content = parseRichText(message.message);
// only put invisible angle brackets around nicks in normal messages
// (for copying/pasting)
var showHiddenBrackets = (tags_array.indexOf('irc_privmsg') >= 0 &&
tags_array.indexOf('irc_action') === -1);
if (highlight) { if (highlight) {
prefix.forEach(function(textEl) { prefix.forEach(function(textEl) {
textEl.classes.push('highlight'); textEl.classes.push('highlight');
@ -386,8 +391,8 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo
highlight: highlight, highlight: highlight,
displayed: displayed, displayed: displayed,
prefixtext: prefixtext, prefixtext: prefixtext,
text: rtext text: rtext,
showHiddenBrackets: showHiddenBrackets
}; };
}; };