potential fix for dumb palememe

merge-requests/208/head
fatchan 4 years ago
parent 0dd997a029
commit d17670c857
  1. 11
      gulp/res/js/forms.js
  2. 3
      models/forms/makepost.js
  3. 2
      package.json

@ -4,6 +4,7 @@ function removeModal() {
} }
function doModal(data, postcallback) { function doModal(data, postcallback) {
try {
const modalHtml = modal({ modal: data }); const modalHtml = modal({ modal: data });
let checkInterval; let checkInterval;
document.body.insertAdjacentHTML('afterbegin', modalHtml); document.body.insertAdjacentHTML('afterbegin', modalHtml);
@ -16,13 +17,15 @@ function doModal(data, postcallback) {
clearInterval(checkInterval); clearInterval(checkInterval);
}; };
const modalframe = document.getElementById('modalframe'); const modalframe = document.getElementById('modalframe');
modalframe.onload = () => { if (modalframe) {
//if theres a modal frame and user has default theme, style it
if (localStorage.getItem('theme') === 'default') { if (localStorage.getItem('theme') === 'default') {
modalframe.onload = () => {
const currentTheme = document.head.querySelector('#theme').href; const currentTheme = document.head.querySelector('#theme').href;
modalframe.contentDocument.styleSheets[1].ownerNode.href = currentTheme; modalframe.contentDocument.styleSheets[1].ownerNode.href = currentTheme;
} }
} }
if (modalframe && postcallback) { if (postcallback) {
checkInterval = setInterval(() => { checkInterval = setInterval(() => {
if (modalframe && modalframe.contentDocument.title == 'Success') { if (modalframe && modalframe.contentDocument.title == 'Success') {
clearInterval(checkInterval); clearInterval(checkInterval);
@ -32,6 +35,10 @@ function doModal(data, postcallback) {
}, 100); }, 100);
} }
} }
} catch(e) {
console.error(e)
}
}
const checkTypes = ['checkbox', 'radio']; const checkTypes = ['checkbox', 'radio'];
function isCheckBox(element) { function isCheckBox(element) {

@ -48,7 +48,8 @@ module.exports = async (req, res, next) => {
maxFiles, forceAnon, replyLimit, disableReplySubject, maxFiles, forceAnon, replyLimit, disableReplySubject,
threadLimit, ids, userPostSpoiler, pphTrigger, tphTrigger, triggerAction, threadLimit, ids, userPostSpoiler, pphTrigger, tphTrigger, triggerAction,
captchaMode, lockMode, allowedFileTypes, flags } = res.locals.board.settings; captchaMode, lockMode, allowedFileTypes, flags } = res.locals.board.settings;
if ((lockMode === 0 || (lockMode === 1 && !req.body.thread)) && res.locals.permLevel >= 4) { if ((lockMode === 2 || (lockMode === 1 && !req.body.thread)) //if board lock, or thread lock and its a new thread
&& res.locals.permLevel >= 4) { //and not staff
await deleteTempFiles(req).catch(e => console.error); await deleteTempFiles(req).catch(e => console.error);
return dynamicResponse(req, res, 400, 'message', { return dynamicResponse(req, res, 400, 'message', {
'title': 'Bad request', 'title': 'Bad request',

@ -1,7 +1,7 @@
{ {
"name": "jschan", "name": "jschan",
"version": "0.0.1", "version": "0.0.1",
"migrateVersion": "0.0.3", "migrateVersion": "0.0.4",
"description": "", "description": "",
"main": "server.js", "main": "server.js",
"dependencies": { "dependencies": {

Loading…
Cancel
Save