Whatever, fix it for ops like this

merge-requests/208/head
Thomas Lynch 4 years ago
parent f667c797bb
commit 4497e59eeb
  1. 5
      gulp/res/js/forms.js
  2. 6
      gulp/res/js/localstorage.js

@ -177,6 +177,11 @@ class formHandler {
if (json.postId) {
window.myPostId = json.postId;
}
if (json.redirect) {
const redirectBoard = json.redirect.split('/')[1];
const redirectPostId = json.redirect.split('#')[1];
appendLocalStorageArray('yous', `${redirectBoard}-${redirectPostId}`);
}
if (json.message || json.messages || json.error || json.errors) {
doModal(json);
if (json.message === 'Incorrect captcha answer') {

@ -12,6 +12,12 @@ function setLocalStorage(key, value) {
}
}
function appendLocalStorageArray(key, value) {
const storedArray = JSON.parse(localStorage.getItem(key));
storedArray.push(value);
setLocalStorage(key, JSON.stringify(storedArray));
}
function deleteStartsWith(startString = 'hovercache') {
//clears hover cache when localstorage gets full
const hoverCaches = Object.keys(localStorage).filter(k => k.startsWith(startString));

Loading…
Cancel
Save