diff --git a/copyparty/web/md.js b/copyparty/web/md.js index 222eea1e..d55d92d3 100644 --- a/copyparty/web/md.js +++ b/copyparty/web/md.js @@ -24,23 +24,6 @@ var dbg = function () { }; var md_plug = {}; -function hesc(txt) { - return txt.replace(/&/g, "&").replace(//g, ">"); -} - - -function cls(dom, name, add) { - var re = new RegExp('(^| )' + name + '( |$)'); - var lst = (dom.getAttribute('class') + '').replace(re, "$1$2").replace(/ /, ""); - dom.setAttribute('class', lst + (add ? ' ' + name : '')); -} - - -function statify(obj) { - return JSON.parse(JSON.stringify(obj)); -} - - // dodge browser issues (function () { var ua = navigator.userAgent; @@ -65,7 +48,7 @@ function statify(obj) { if (a > 0) loc.push(n[a]); - var dec = hesc(uricom_dec(n[a])[0]); + var dec = esc(uricom_dec(n[a])[0]); nav.push('' + dec + ''); } diff --git a/copyparty/web/md2.js b/copyparty/web/md2.js index d62fe1aa..faf2d417 100644 --- a/copyparty/web/md2.js +++ b/copyparty/web/md2.js @@ -98,7 +98,7 @@ var draw_md = (function () { var src = dom_src.value; convert_markdown(src, dom_pre); - var lines = hesc(src).replace(/\r/g, "").split('\n'); + var lines = esc(src).replace(/\r/g, "").split('\n'); nlines = lines.length; var html = []; for (var a = 0; a < lines.length; a++) @@ -108,7 +108,7 @@ var draw_md = (function () { map_src = genmap(dom_ref, map_src); map_pre = genmap(dom_pre, map_pre); - cls(ebi('save'), 'disabled', src == server_md); + clmod(ebi('save'), 'disabled', src == server_md); var t1 = Date.now(); delay = t1 - t0 > 100 ? 25 : 1; @@ -1091,9 +1091,9 @@ action_stack = (function () { ref = newtxt; dbg('undos(%d) redos(%d)', hist.un.length, hist.re.length); if (hist.un.length > 0) - dbg(statify(hist.un.slice(-1)[0])); + dbg(jcp(hist.un.slice(-1)[0])); if (hist.re.length > 0) - dbg(statify(hist.re.slice(-1)[0])); + dbg(jcp(hist.re.slice(-1)[0])); } return {