Merge branch 'master' of github.com:fatchan/jschan

merge-requests/208/head
fatchan 4 years ago
commit 3307ca3728
  1. 8
      controllers/pages.js
  2. 2
      gulp/res/css/themes/clear.css
  3. 18
      helpers/posting/diceroll.js
  4. 2
      helpers/posting/markdown.js
  5. 12
      helpers/posting/quotes.js

@ -29,8 +29,8 @@ router.get('/news.html', news);
router.get('/boards.html', sessionRefresh, calcPerms, boardlist);
//board pages
router.get('/:board/:page(1[0-9]{0,}|[2-9]{1,}|index).html', Boards.exists, paramConverter, board); //index
router.get('/:board/thread/:id(\\d+).html', Boards.exists, paramConverter, Posts.exists, thread); //thread view
router.get('/:board/:page(1[0-9]{1,}|[2-9][0-9]{0,}|index).html', Boards.exists, paramConverter, board); //index
router.get('/:board/thread/:id([1-9][0-9]{0,}).html', Boards.exists, paramConverter, Posts.exists, thread); //thread view
router.get('/:board/catalog.html', Boards.exists, catalog); //catalog
router.get('/:board/logs.html', Boards.exists, modloglist);//modlog list
router.get('/:board/logs/:date(\\d{2}-\\d{2}-\\d{4}).html', Boards.exists, paramConverter, modlog); //daily log
@ -44,8 +44,8 @@ router.get('/:board/manage/bans.html', sessionRefresh, isLoggedIn, Boards.exists
router.get('/:board/manage/settings.html', sessionRefresh, isLoggedIn, Boards.exists, calcPerms, hasPerms(2), csrf, manageSettings);
router.get('/:board/manage/banners.html', sessionRefresh, isLoggedIn, Boards.exists, calcPerms, hasPerms(2), csrf, manageBanners);
// if (mod view enabled) {
router.get('/:board/manage/:page(1[0-9]{0,}|[2-9]{1,}|index).html', sessionRefresh, isLoggedIn, Boards.exists, paramConverter, calcPerms, hasPerms(3), csrf, manageBoard);
router.get('/:board/manage/thread/:id(\\d+).html', sessionRefresh, isLoggedIn, Boards.exists, paramConverter, calcPerms, hasPerms(3), csrf, Posts.exists, manageThread);
router.get('/:board/manage/:page(1[0-9]{1,}|[2-9][0-9]{0,}|index).html', sessionRefresh, isLoggedIn, Boards.exists, paramConverter, calcPerms, hasPerms(3), csrf, manageBoard);
router.get('/:board/manage/thread/:id([1-9][0-9]{0,}).html', sessionRefresh, isLoggedIn, Boards.exists, paramConverter, calcPerms, hasPerms(3), csrf, Posts.exists, manageThread);
//global manage pages
router.get('/globalmanage/reports.html', sessionRefresh, isLoggedIn, calcPerms, hasPerms(1), csrf, globalManageReports);

@ -25,7 +25,7 @@
--input-borders: #d2d2d2;
--input-color: #333;
--input-background: #f5f5f5;
--dice-color: darkorange;
--dice-color: maroon;
--title-color: #d70000;
--greentext-color: #789922;
--pinktext-color:#E0727F;

@ -2,22 +2,8 @@
module.exports = (match, numdice, numsides, operator, modifier) => {
numdice = parseInt(numdice);
if (numdice > 100) {
numdice = 100;
} else if (numdice <= 0) {
numdice = 1;
}
numsides = parseInt(numsides);
if (numsides > 100) {
numsides = 100;
} else if (numsides <= 0) {
numsides = 1;
}
let sum = 0;
for (let i = 0; i < numdice; i++) {
const roll = Math.floor(Math.random() * numsides)+1;
sum += roll;
}
let sum = (Math.floor(Math.random() * numsides) + 1) * numdice;
if (modifier && operator) {
modifier = parseInt(modifier);
//do i need to make sure it doesnt go negative or maybe give absolute value?
@ -27,5 +13,5 @@ module.exports = (match, numdice, numsides, operator, modifier) => {
sum -= modifier;
}
}
return `\n<img src='/img/dice.png' height='16' width='16' /><span class='dice'>(${match}) Rolled ${numdice} dice with ${numsides} sides${modifier ? ' and modifier '+operator+modifier : '' } = ${sum}</span>\n`;
return `<img src='/img/dice.png' height='16' width='16' /><span class='dice'>(${match}) Rolled ${numdice} dice with ${numsides} sides${modifier ? ' and modifier '+operator+modifier : '' } = ${sum}</span>`;
}

@ -14,7 +14,7 @@ const greentextRegex = /^&gt;((?!&gt;\d+|&gt;&gt;&#x2F;\w+(&#x2F;\d*)?).*)/gm
, codeRegex = /(?:(?<language>[a-z+]{1,10})\r?\n)?(?<code>[\s\S]+)/i
, splitRegex = /```([\s\S]+?)```/gm
, trimNewlineRegex = /^\s*(\r?\n)*|(\r?\n)*$/g
, diceRegex = /##(?<numdice>\d+)d(?<numsides>\d+)(?:(?<operator>[+-])(?<modifier>\d+))?/gmi
, diceRegex = /##(?<numdice>[1-9][0-9]{0,8})d(?<numsides>[2-9][0-9]{0,8})(?:(?<operator>[+-])(?<modifier>[1-9][0-9]{0,8}))?/gmi
, getDomain = (string) => string.split(/\/\/|\//)[1] //unused atm
, escape = require(__dirname+'/escape.js')
, { highlight, highlightAuto } = require('highlight.js')

@ -101,19 +101,15 @@ module.exports = async (board, text, thread) => {
}
return `<a class='quote' href='/${board}/thread/${postThreadIdMap[board][quotenum].thread}.html#${quotenum}'>&gt;&gt;${quotenum}</a>${postThreadIdMap[board][quotenum].postId == thread ? ' <small>(OP)</small> ' : ''}`;
}
return match;//`<span class='invalid-quote'>&gt;&gt;${quotenum}</span>`;
return `<span class='invalid-quote'>&gt;&gt;${quotenum}</span>`;
});
}
if (crossQuotes) {
text = text.replace(crossQuoteRegex, (match, quoteboard, quotenum) => {
if (postThreadIdMap[quoteboard]) {
if (!isNaN(quotenum) && quotenum > 0 && postThreadIdMap[quoteboard][quotenum]) {
return `<a class='quote' href='/${quoteboard}/thread/${postThreadIdMap[quoteboard][quotenum].thread}.html#${quotenum}'>&gt;&gt;&gt;/${quoteboard}/${quotenum}</a>`;
} else {
return `<a class='quote' href='/${quoteboard}/index.html'>&gt;&gt;&gt;/${quoteboard}/</a>`;
}
if (postThreadIdMap[quoteboard] && !isNaN(quotenum) && quotenum > 0 && postThreadIdMap[quoteboard][quotenum]) {
return `<a class='quote' href='/${quoteboard}/thread/${postThreadIdMap[quoteboard][quotenum].thread}.html#${quotenum}'>&gt;&gt;&gt;/${quoteboard}/${quotenum}</a>`;
}
return match;// `<span class='invalid-quote'>&gt;&gt;&gt;/${quoteboard}/</span>`;
return `<span class='invalid-quote'>&gt;&gt;&gt;/${quoteboard}/${quotenum || ''}</span>`;
});
}

Loading…
Cancel
Save