Remove MathJax (for now)

cordova
Lorenz Hübschle-Schneider 10 years ago
parent ebcef891ac
commit 26b013019a
  1. 12
      index.html
  2. 23
      js/filters.js
  3. 17
      js/glowingbear.js

@ -287,7 +287,7 @@ chown -R <strong>username</strong>:<strong>username</strong> ~<strong>username</
<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.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="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:'_system':{rel:'noopener noreferrer'} | linksForCordova | DOMfilter:'irclinky' | 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:'_system':{rel:'noopener noreferrer'} | linksForCordova | DOMfilter:'irclinky' | DOMfilter:'inlinecolour'"></span>
</td> </td>
</tr> </tr>
<tr class="readmarker" ng-if="activeBuffer().lastSeen==$index"> <tr class="readmarker" ng-if="activeBuffer().lastSeen==$index">
@ -426,16 +426,6 @@ chown -R <strong>username</strong>:<strong>username</strong> ~<strong>username</
</div> </div>
</form> </form>
</li> </li>
<li>
<form class="form-inline" role="form">
<div class="checkbox">
<label>
<input type="checkbox" ng-model="settings.enableMathjax">
Enable LaTeX math rendering
</label>
</div>
</form>
</li>
</ul> </ul>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">

@ -166,29 +166,6 @@ weechat.filter('getBufferQuickKeys', function () {
}; };
}); });
weechat.filter('latexmath', function() {
return function(text, selector, enabled) {
if (!enabled || typeof(katex) === "undefined") {
return text;
}
if (text.indexOf("$$") != -1 || text.indexOf("\\[") != -1 || text.indexOf("\\(") != -1) {
// contains math -> delayed rendering
setTimeout(function() {
var math = document.querySelector(selector);
renderMathInElement(math, {
delimiters: [
{left: "$$", right: "$$", display: false},
{left: "\\[", right: "\\]", display: true},
{left: "\\(", right: "\\)", display: false}
]
});
});
}
return text;
};
});
weechat.filter('prefixlimit', function() { weechat.filter('prefixlimit', function() {
return function(input, chars) { return function(input, chars) {
if (isNaN(chars)) return input; if (isNaN(chars)) return input;

@ -42,7 +42,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
'fontsize': '14px', 'fontsize': '14px',
'fontfamily': (utils.isMobileUi() ? 'sans-serif' : 'Inconsolata, Consolas, Monaco, Ubuntu Mono, monospace'), 'fontfamily': (utils.isMobileUi() ? 'sans-serif' : 'Inconsolata, Consolas, Monaco, Ubuntu Mono, monospace'),
'readlineBindings': false, 'readlineBindings': false,
'enableMathjax': false,
'customCSS': '', 'customCSS': '',
"currentlyViewedBuffers":{}, "currentlyViewedBuffers":{},
}); });
@ -361,22 +360,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$rootScope.predicate = orderbyserver ? 'serverSortKey' : 'number'; $rootScope.predicate = orderbyserver ? 'serverSortKey' : 'number';
}); });
// To prevent unnecessary loading times for users who don't
// want LaTeX math, load it only if the setting is enabled.
// This also fires when the page is loaded if enabled.
// Note that this says MathJax but we switched to KaTeX
settings.addCallback('enableMathjax', function(enabled) {
if (enabled && !$rootScope.mathjax_init) {
// Load MathJax only once
$rootScope.mathjax_init = true;
utils.inject_css("https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.css");
utils.inject_script("https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.js");
utils.inject_script("https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/contrib/auto-render.min.js");
}
});
// Inject theme CSS // Inject theme CSS
settings.addCallback('theme', function(theme) { settings.addCallback('theme', function(theme) {
// Unload old theme // Unload old theme

Loading…
Cancel
Save