From 36d2842b6e407fe5f1b730091ba718e950d3e12e Mon Sep 17 00:00:00 2001 From: rr- Date: Mon, 29 Feb 2016 00:57:09 +0100 Subject: [PATCH] Added [sjis]...[/sjis] tag --- public_html/css/comments.css | 13 +++++++++++++ public_html/js/Util/Misc.js | 9 +++++++++ public_html/templates/help.tpl | 4 ++++ 3 files changed, 26 insertions(+) diff --git a/public_html/css/comments.css b/public_html/css/comments.css index 92c366dd..e37fcbc4 100644 --- a/public_html/css/comments.css +++ b/public_html/css/comments.css @@ -113,3 +113,16 @@ ul.comments { #global-comment-list .post-small .link { margin: 0; } + +.sjis { + font-family: 'MS PGothic', 'MS Pゴシック', 'IPAMonaPGothic', 'Trebuchet MS', Verdana, Futura, Arial, Helvetica, sans-serif; + border: solid 4px #ccc; + color: #111; + font-size: 12pt; + line-height: 1; + margin: 0; + padding: 4px; + overflow: auto; + white-space: pre; + word-wrap: normal; +} diff --git a/public_html/js/Util/Misc.js b/public_html/js/Util/Misc.js index c3958111..924ebff1 100644 --- a/public_html/js/Util/Misc.js +++ b/public_html/js/Util/Misc.js @@ -193,7 +193,14 @@ App.Util.Misc = function(_, jQuery, marked, promise) { smartypants: true, }; + var sjis = []; + var preDecorator = function(text) { + text = text.replace(/\[sjis\]((?:[^\[]|\[(?!\/?sjis\]))+)\[\/sjis\]/ig, function(match, capture) { + var ret = '%%%SJIS' + sjis.length; + sjis.push(capture); + return ret; + }); //prevent ^#... from being treated as headers, due to tag permalinks text = text.replace(/^#/g, '%%%#'); //fix \ before ~ being stripped away @@ -211,6 +218,8 @@ App.Util.Misc = function(_, jQuery, marked, promise) { text = text.replace(/%%%T/g, '\\~'); text = text.replace(/%%%#/g, '#'); + text = text.replace(/%%%SJIS(\d+)/, function(match, capture) { return '
' + sjis[capture] + '
'; }); + //search permalinks text = text.replace(/\[search\]((?:[^\[]|\[(?!\/?search\]))+)\[\/search\]/ig, '$1'); //spoilers diff --git a/public_html/templates/help.tpl b/public_html/templates/help.tpl index 58e56a4a..1bb41161 100644 --- a/public_html/templates/help.tpl +++ b/public_html/templates/help.tpl @@ -229,6 +229,10 @@ [spoiler]Lelouch survives[/spoiler] marks text as spoiler and hides it + + [sjis](´・ω・`)[/sjis] + adds SJIS art +