Merge branch 'new-dev' of ssh.gitgud.io:fatchan/jschan into new-dev

merge-requests/208/head
Thomas Lynch 4 years ago
commit 9c532f78d7
  1. 2
      gulp/res/css/style.css
  2. BIN
      gulp/res/img/attachment.png
  3. BIN
      gulp/res/img/audio.png
  4. 12
      gulp/res/js/hideimages.js
  5. 16
      gulp/res/js/hover.js
  6. 8
      package-lock.json

@ -501,7 +501,7 @@ th {
} }
.fw td, .fw th { .fw td, .fw th {
width: 15%; /*Fixes log tables when large actions are taken*/ width: 8%; /*Fixes log tables when large actions are taken*/
} }
td, th { td, th {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

@ -4,7 +4,7 @@ let imageSourcesList;
const toggleAllHidden = (state) => imageSources.forEach(i => toggleSource(i, state)); const toggleAllHidden = (state) => imageSources.forEach(i => toggleSource(i, state));
const toggleSource = (source, state) => { const toggleSource = (source, state) => {
const images = document.querySelectorAll(`img.file-thumb[src="${source}"]`); const images = document.querySelectorAll(`img.file-thumb[src="${source}"], img.catalog-thumb[src="${source}"]`);
images.forEach(i => i.classList[state?'add':'remove']('vh')); images.forEach(i => i.classList[state?'add':'remove']('vh'));
} }
@ -26,8 +26,14 @@ document.querySelectorAll('.hide-image').forEach(el => {
const handleHiddenImages = (e) => { const handleHiddenImages = (e) => {
//hide any images from this post that should already be hidden //hide any images from this post that should already be hidden
const hasHiddenImages = e.detail.json.files.forEach(f => { const hasHiddenImages = e.detail.json.files.forEach(f => {
if (imageSources.has(f.filename)) { let hideFilename = '/file/';
toggleSource(f.filename, true); if (f.hasThumb) {
hideFilename += `thumb-${f.hash}${f.thumbextension}`
} else {
hideFilename += f.filename;
}
if (imageSources.has(hideFilename)) {
toggleSource(hideFilename, true);
} }
}); });
//add the hide toggle link and event listener //add the hide toggle link and event listener

@ -59,6 +59,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
clone.appendChild(post.cloneNode(true)); clone.appendChild(post.cloneNode(true));
document.body.appendChild(clone); document.body.appendChild(clone);
setFloatPos(quote, clone, xpos, ypos); setFloatPos(quote, clone, xpos, ypos);
return clone;
}; };
const toggleHighlightPost = async function (e) { const toggleHighlightPost = async function (e) {
@ -85,13 +86,12 @@ window.addEventListener('DOMContentLoaded', (event) => {
lastHover = loading; lastHover = loading;
const hash = this.hash.substring(1); const hash = this.hash.substring(1);
const anchor = document.getElementById(hash); const anchor = document.getElementById(hash);
let hoveredPost; let hoveredPost, postJson;
if (anchor if (anchor
&& jsonPath.split('/')[1] === anchor.nextSibling.dataset.board) { && jsonPath.split('/')[1] === anchor.nextSibling.dataset.board) {
hoveredPost = anchor.nextSibling; hoveredPost = anchor.nextSibling;
} else { } else {
let hovercache = localStorage.getItem(`hovercache-${jsonPath}`); let hovercache = localStorage.getItem(`hovercache-${jsonPath}`);
let postJson;
if (hovercache) { if (hovercache) {
hovercache = JSON.parse(hovercache); hovercache = JSON.parse(hovercache);
if (hovercache.postId == hash) { if (hovercache.postId == hash) {
@ -135,6 +135,13 @@ window.addEventListener('DOMContentLoaded', (event) => {
const wrap = document.createElement('div'); const wrap = document.createElement('div');
wrap.innerHTML = postHtml; wrap.innerHTML = postHtml;
hoveredPost = wrap.firstChild.nextSibling; hoveredPost = wrap.firstChild.nextSibling;
}
if (hovering && !isVisible(hoveredPost)) {
hoveredPost = floatPost(this, hoveredPost, e.clientX, e.clientY);
} else {
hovering ? hoveredPost.classList.add('hoverhighlighted') : hoveredPost.classList.remove('hoverhighlighted');
}
if (postJson) {
//need this event so handlers like post hiding still apply to hover introduced posts //need this event so handlers like post hiding still apply to hover introduced posts
const newPostEvent = new CustomEvent('addPost', { const newPostEvent = new CustomEvent('addPost', {
detail: { detail: {
@ -147,11 +154,6 @@ window.addEventListener('DOMContentLoaded', (event) => {
window.dispatchEvent(newPostEvent); window.dispatchEvent(newPostEvent);
} }
toggleDottedUnderlines(hoveredPost, thisId); toggleDottedUnderlines(hoveredPost, thisId);
if (hovering && !isVisible(hoveredPost)) {
floatPost(this, hoveredPost, e.clientX, e.clientY);
} else {
hovering ? hoveredPost.classList.add('hoverhighlighted') : hoveredPost.classList.remove('hoverhighlighted');
}
} }
for (let i = 0; i < quotes.length; i++) { for (let i = 0; i < quotes.length; i++) {

8
package-lock.json generated

@ -3448,11 +3448,11 @@
}, },
"dependencies": { "dependencies": {
"debug": { "debug": {
"version": "4.1.1", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
"requires": { "requires": {
"ms": "^2.1.1" "ms": "2.1.2"
} }
}, },
"ms": { "ms": {

Loading…
Cancel
Save