From 6ae5da3d10bae67abd2001670cff880752eaca27 Mon Sep 17 00:00:00 2001 From: ClemDee Date: Wed, 24 Jul 2019 14:41:37 +0200 Subject: [PATCH] Move stripTags function to Util --- www/common/common-util.js | 6 ++++++ www/common/diffMarked.js | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/www/common/common-util.js b/www/common/common-util.js index 9fd2305c3..03c9e321b 100644 --- a/www/common/common-util.js +++ b/www/common/common-util.js @@ -319,6 +319,12 @@ define([], function () { return window.innerHeight < 800 || window.innerWidth < 800; }; + Util.stripTags = function (text) { + var div = document.createElement("div"); + div.innerHTML = text; + return div.innerText; + }; + return Util; }); }(self)); diff --git a/www/common/diffMarked.js b/www/common/diffMarked.js index 35633c4cd..44a2f56a4 100644 --- a/www/common/diffMarked.js +++ b/www/common/diffMarked.js @@ -84,12 +84,6 @@ define([ } }; - var stripTags = function (text) { - var div = document.createElement("div"); - div.innerHTML = text; - return div.innerText; - }; - renderer.heading = function (text, level) { var i = 0; var safeText = text.toLowerCase().replace(/[^\w]+/g, '-'); @@ -105,7 +99,7 @@ define([ toc.push({ level: level, id: id, - title: stripTags(text) + title: Util.stripTags(text) }); return "" + text + ""; };