From 5740c647d647460be68813fec7354586d06ef4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Mon, 9 Mar 2015 15:09:32 +0100 Subject: [PATCH 1/2] Basic MathJax hackery --- index.html | 11 ++++++++++- js/filters.js | 13 +++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index d1dd0ed..509d4a9 100644 --- a/index.html +++ b/index.html @@ -36,6 +36,15 @@ + + @@ -278,7 +287,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
+ --> diff --git a/js/filters.js b/js/filters.js index 9921d8a..5490335 100644 --- a/js/filters.js +++ b/js/filters.js @@ -150,4 +150,17 @@ weechat.filter('emojify', function() { }; }); +weechat.filter('mathjax', function() { + return function(text, selector) { + if (text.indexOf("$$") != -1 || text.indexOf("\\[") != -1 || text.indexOf("\\(") != -1) { + // contains math + //var math = document.getElementById("MathExample"); + var math = document.querySelector(selector); + MathJax.Hub.Queue(["Typeset",MathJax.Hub,math]); + } + + return text; + }; +}); + })(); From be8ab42b7c0d8807b7d44002280b127c379873b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenz=20H=C3=BCbschle-Schneider?= Date: Sat, 21 Mar 2015 12:25:18 +0100 Subject: [PATCH 2/2] Make MathJax a setting and load it only if enabled --- index.html | 21 +++++++++++---------- js/filters.js | 12 ++++++++---- js/glowingbear.js | 27 ++++++++++++++++++++++++++- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index 509d4a9..2984351 100644 --- a/index.html +++ b/index.html @@ -36,15 +36,6 @@ - - @@ -287,7 +278,7 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel
+ --> @@ -457,6 +448,16 @@ $ openssl req -nodes -newkey rsa:4096 -keyout relay.pem -x509 -days 365 -out rel +
  • +
    +
    + +
    +
    +