Fullchan X

8chan features script

目前为 2025-04-26 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Fullchan X
  3. // @namespace Violentmonkey Scripts
  4. // @match *://8chan.moe/*
  5. // @match *://8chan.se/*
  6. // @match *://8chan.cc/*
  7. // @match *://8chan.cc/*
  8. // @run-at document-end
  9. // @grant none
  10. // @version 1.14.1
  11. // @author vfyxe
  12. // @description 8chan features script
  13. // ==/UserScript==
  14.  
  15.  
  16. class fullChanX extends HTMLElement {
  17. constructor() {
  18. super();
  19. }
  20.  
  21. init() {
  22. this.settingsEl = document.querySelector('fullchan-x-settings');
  23. this.settingsAll = this.settingsEl.settings;
  24. this.settings = this.settingsAll.main;
  25.  
  26. this.settingsThreadBanisher = this.settingsAll.threadBanisher;
  27. this.settingsMascot = this.settingsAll.mascot;
  28. this.isThread = !!document.querySelector('.opCell');
  29. this.isDisclaimer = window.location.href.includes('disclaimer');
  30. Object.keys(this.settings).forEach(key => {
  31. this[key] = this.settings[key]?.value;
  32. });
  33.  
  34. this.settingsButton = this.querySelector('#fcx-settings-btn');
  35. this.settingsButton.addEventListener('click', () => this.settingsEl.toggle());
  36. this.handleBoardLinks();
  37. if (!this.isThread) {
  38. if (this.settingsThreadBanisher.enableThreadBanisher.value) this.banishThreads(this.settingsThreadBanisher);
  39. return;
  40. }
  41. this.quickReply = document.querySelector('#quick-reply');
  42. this.qrbody = document.querySelector('#qrbody');
  43. this.threadParent = document.querySelector('#divThreads');
  44. this.threadId = this.threadParent.querySelector('.opCell').id;
  45. this.thread = this.threadParent.querySelector('.divPosts');
  46. this.posts = [...this.thread.querySelectorAll('.postCell')];
  47. this.postOrder = 'default';
  48. this.postOrderSelect = this.querySelector('#thread-sort');
  49. this.myYousLabel = this.querySelector('.my-yous__label');
  50. this.yousContainer = this.querySelector('#my-yous');
  51.  
  52. this.gallery = document.querySelector('fullchan-x-gallery');
  53. this.galleryButton = this.querySelector('#fcx-gallery-btn');
  54.  
  55. this.updateYous();
  56. this.observers();
  57.  
  58. if (this.enableFileExtensions) this.handleTruncatedFilenames();
  59. if (this.settingsMascot.enableMascot.value) this.showMascot(this.settingsMascot);
  60.  
  61. this.styleUI();
  62.  
  63. if (this.settings.doNotShowLocation) {
  64. const checkbox = document.getElementById('qrcheckboxNoFlag');
  65. if (checkbox) checkbox.checked = true;
  66. checkbox.dispatchEvent(new Event('change', { bubbles: true }));
  67. }
  68. }
  69.  
  70. styleUI () {
  71. this.style.setProperty('--top', this.uiTopPosition);
  72. this.style.setProperty('--right', this.uiRightPosition);
  73. this.classList.toggle('fcx-in-nav', this.moveToNav)
  74. this.classList.toggle('fcx--dim', this.uiDimWhenInactive && !this.moveToNave);
  75. this.classList.toggle('page-thread', this.isThread);
  76. document.body.classList.toggle('fcx-replies-plus', this.enableEnhancedReplies);
  77. document.body.classList.toggle('fcx-hide-delete', this.hideDeletionBox);
  78. const style = document.createElement('style');
  79.  
  80. if (this.hideDefaultBoards !== '' && this.hideDefaultBoards.toLowerCase() !== 'all') {
  81. style.textContent += '#navTopBoardsSpan{display:block!important;}'
  82. }
  83. document.body.appendChild(style);
  84. }
  85.  
  86. checkRegexList(string, regexList) {
  87. const regexObjects = regexList.map(r => {
  88. const match = r.match(/^\/(.*)\/([gimsuy]*)$/);
  89. return match ? new RegExp(match[1], match[2]) : null;
  90. }).filter(Boolean);
  91.  
  92. return regexObjects.some(regex => regex.test(string));
  93. }
  94.  
  95. banishThreads(banisher) {
  96. this.threadsContainer = document.querySelector('#divThreads');
  97. if (!this.threadsContainer) return;
  98. this.threadsContainer.classList.add('fcx-threads');
  99.  
  100. const currentBoard = document.querySelector('#labelBoard')?.textContent.replace(/\//g,'');
  101. const boards = banisher.boards.value?.split(',') || [''];
  102. if (!boards.includes(currentBoard)) return;
  103.  
  104. const minCharacters = banisher.minimumCharacters.value || 0;
  105. const banishTerms = banisher.banishTerms.value?.split('\n') || [];
  106. const banishAnchored = banisher.banishAnchored.value;
  107. const wlCyclical = banisher.whitelistCyclical.value;
  108. const wlReplyCount = parseInt(banisher.whitelistReplyCount.value);
  109.  
  110. const banishSorter = (thread) => {
  111. if (thread.querySelector('.pinIndicator') || thread.classList.contains('fcx-sorted')) return;
  112. let shouldBanish = false;
  113.  
  114. const isAnchored = thread.querySelector('.bumpLockIndicator');
  115. const isCyclical = thread.querySelector('.cyclicIndicator');
  116. const replyCount = parseInt(thread.querySelector('.labelReplies')?.textContent?.trim()) || 0;
  117. const threadSubject = thread.querySelector('.labelSubject')?.textContent?.trim() || '';
  118. const threadMessage = thread.querySelector('.divMessage')?.textContent?.trim() || '';
  119. const threadContent = threadSubject + ' ' + threadMessage;
  120.  
  121. const hasMinChars = threadMessage.length > minCharacters;
  122. const hasWlReplyCount = replyCount > wlReplyCount;
  123.  
  124. if (!hasMinChars) shouldBanish = true;
  125. if (isAnchored && banishAnchored) shouldBanish = true;
  126. if (isCyclical && wlCyclical) shouldBanish = false;
  127. if (hasWlReplyCount) shouldBanish = false;
  128.  
  129. // run heavy regex process only if needed
  130. if (!shouldBanish && this.checkRegexList(threadContent, banishTerms)) shouldBanish = true;
  131. if (shouldBanish) thread.classList.add('shit-thread');
  132. thread.classList.add('fcx-sorted');
  133. };
  134.  
  135. const banishThreads = () => {
  136. this.threads = this.threadsContainer.querySelectorAll('.catalogCell');
  137. this.threads.forEach(thread => banishSorter(thread));
  138. };
  139. banishThreads();
  140.  
  141. const observer = new MutationObserver((mutationsList) => {
  142. for (const mutation of mutationsList) {
  143. if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
  144. banishThreads();
  145. break;
  146. }
  147. }
  148. });
  149.  
  150. observer.observe(this.threadsContainer, { childList: true });
  151. }
  152.  
  153. handleBoardLinks () {
  154. const navBoards = document.querySelector('#navTopBoardsSpan');
  155. const customBoardLinks = this.customBoardLinks?.toLowerCase().replace(/\s/g,'').split(',');
  156. let hideDefaultBoards = this.hideDefaultBoards?.toLowerCase().replace(/\s/g,'') || '';
  157. const urlCatalog = this.catalogBoardLinks ? '/catalog.html' : '';
  158.  
  159. if (hideDefaultBoards === 'all') {
  160. document.body.classList.add('hide-navboard');
  161. } else {
  162. const waitForNavBoards = setInterval(() => {
  163. const navBoards = document.querySelector('#navTopBoardsSpan');
  164. if (!navBoards || !navBoards.querySelector('a')) return;
  165.  
  166. clearInterval(waitForNavBoards);
  167.  
  168. hideDefaultBoards = hideDefaultBoards.split(',');
  169. const defaultLinks = [...navBoards.querySelectorAll('a')];
  170. defaultLinks.forEach(link => {
  171. link.href += urlCatalog;
  172. const linkText = link.textContent;
  173. const shouldHide = hideDefaultBoards.includes(linkText) || customBoardLinks.includes(linkText);
  174. link.classList.toggle('hidden', shouldHide);
  175. });
  176. }, 50);
  177.  
  178. if (this.customBoardLinks?.length > 0) {
  179. const customNav = document.createElement('span');
  180. customNav.classList = 'nav-boards nav-boards--custom';
  181. customNav.innerHTML = '<span>[</span>';
  182.  
  183. customBoardLinks.forEach((board, index) => {
  184. const link = document.createElement('a');
  185. link.href = '/' + board + urlCatalog;
  186. link.textContent = board;
  187. customNav.appendChild(link);
  188. if (index < customBoardLinks.length - 1) customNav.innerHTML += '<span>/</span>';
  189. });
  190.  
  191. customNav.innerHTML += '<span>]</span>';
  192. navBoards?.parentNode.insertBefore(customNav, navBoards);
  193. }
  194. }
  195. }
  196.  
  197. observers () {
  198. this.postOrderSelect.addEventListener('change', (event) => {
  199. this.postOrder = event.target.value;
  200. this.assignPostOrder();
  201. });
  202.  
  203.  
  204. // Thread click
  205. this.threadParent.addEventListener('click', event => this.handleClick(event));
  206.  
  207.  
  208. // Your (You)s
  209. const observerCallback = (mutationsList, observer) => {
  210. for (const mutation of mutationsList) {
  211. if (mutation.type === 'childList') {
  212. this.posts = [...this.thread.querySelectorAll('.postCell')];
  213. if (this.postOrder !== 'default') this.assignPostOrder();
  214. this.updateYous();
  215. this.gallery.updateGalleryImages();
  216. if (this.settings.enableFileExtensions) this.handleTruncatedFilenames();
  217. }
  218. }
  219. };
  220. const threadObserver = new MutationObserver(observerCallback);
  221. threadObserver.observe(this.thread, { childList: true, subtree: false });
  222.  
  223.  
  224. // Gallery
  225. this.galleryButton.addEventListener('click', () => this.gallery.open());
  226. this.myYousLabel.addEventListener('click', (event) => {
  227. if (this.myYousLabel.classList.contains('unseen')) {
  228. this.yousContainer.querySelector('.unseen').click();
  229. }
  230. });
  231.  
  232. if (!this.enableEnhancedReplies) return;
  233. const setReplyLocation = (replyPreview) => {
  234. const parent = replyPreview.parentElement;
  235. if (!parent || (!parent.classList.contains('innerPost') && !parent.classList.contains('innerOP'))) return;
  236. const parentMessage = parent.querySelector('.divMessage');
  237.  
  238. if (parentMessage && parentMessage.parentElement === parent) {
  239. parentMessage.insertAdjacentElement('beforebegin', replyPreview);
  240. }
  241. };
  242.  
  243. const observer = new MutationObserver(mutations => {
  244. for (const mutation of mutations) {
  245. for (const node of mutation.addedNodes) {
  246. if (node.nodeType !== 1) continue;
  247.  
  248. if (node.classList.contains('inlineQuote')) {
  249. const replyPreview = node.closest('.replyPreview');
  250. if (replyPreview) {
  251. setReplyLocation(replyPreview);
  252. }
  253. }
  254. }
  255. }
  256. });
  257.  
  258. if (this.threadParent) observer.observe(this.threadParent, {childList: true, subtree: true });
  259. }
  260.  
  261. handleClick (event) {
  262. const clicked = event.target;
  263. let replyLink = clicked.closest('.panelBacklinks a');
  264. const parentPost = clicked.closest('.innerPost, .innerOP');
  265. const closeButton = clicked.closest('.postInfo > a:first-child');
  266. const anonId = clicked.closest('.labelId');
  267.  
  268. if (closeButton) this.handleReplyCloseClick(closeButton, parentPost);
  269. if (replyLink) this.handleReplyClick(replyLink, parentPost);
  270. if (anonId) this.handleAnonIdClick(anonId, event);
  271. }
  272.  
  273. handleReplyCloseClick(closeButton, parentPost) {
  274. const replyLink = document.querySelector(`[data-close-id="${closeButton.id}"]`);
  275. if (!replyLink) return;
  276. const linkParent = replyLink.closest('.innerPost, .innerOP');
  277. this.handleReplyClick(replyLink, linkParent);
  278. }
  279.  
  280. handleReplyClick(replyLink, parentPost) {
  281. replyLink.classList.toggle('active');
  282. let replyColor = replyLink.dataset.color;
  283. const replyId = replyLink.href.split('#').pop();
  284. let replyPost = false;
  285. let labelId = false;
  286.  
  287. const randomNum = () => `${Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0')}`
  288.  
  289. if (!replyColor) {
  290. replyPost = document.querySelector(`#${CSS.escape(replyId)}`);
  291. labelId = replyPost?.querySelector('.labelId');
  292. replyColor = labelId?.textContent || randomNum();
  293. }
  294.  
  295. const linkQuote = [...parentPost.querySelectorAll('.replyPreview .linkQuote')]
  296. .find(link => link.textContent === replyId);
  297. if (!labelId && linkQuote) linkQuote.style = `--active-color: #${replyColor};`;
  298.  
  299. const closeId = randomNum();
  300. const closeButton = linkQuote?.closest('.innerPost').querySelector('.postInfo > a:first-child');
  301. if (closeButton) closeButton.id = closeId;
  302.  
  303. replyLink.style = `--active-color: #${replyColor};`;
  304. replyLink.dataset.color = `${replyColor}`;
  305. replyLink.dataset.closeId = closeId;
  306. }
  307.  
  308. handleAnonIdClick (anonId, event) {
  309. this.anonIdPosts?.remove();
  310. if (anonId === this.anonId) {
  311. this.anonId = null;
  312. return;
  313. }
  314.  
  315. this.anonId = anonId;
  316. const anonIdText = anonId.textContent.split(' ')[0];
  317. this.anonIdPosts = document.createElement('div');
  318. this.anonIdPosts.classList = 'fcx-id-posts fcx-prevent-nesting';
  319.  
  320. const match = window.location.pathname.match(/^\/[^/]+\/res\/\d+\.html/);
  321. const prepend = match ? `${match[0]}#` : '';
  322.  
  323. const selector = `.postInfo:has(.labelId[style="background-color: #${anonIdText}"]) .linkQuote`;
  324.  
  325. const postIds = [...this.threadParent.querySelectorAll(selector)].map(link => {
  326. const postId = link.getAttribute('href').split('#q').pop();
  327. const newLink = document.createElement('a');
  328. newLink.className = 'quoteLink';
  329. newLink.href = prepend + postId;
  330. newLink.textContent = `>>${postId}`;
  331. return newLink;
  332. });
  333.  
  334. postIds.forEach(postId => this.anonIdPosts.appendChild(postId));
  335. anonId.insertAdjacentElement('afterend', this.anonIdPosts);
  336.  
  337. this.setPostListeners(this.anonIdPosts);
  338. }
  339.  
  340. handleTruncatedFilenames () {
  341. this.postFileNames = [...this.threadParent.querySelectorAll('.originalNameLink[download]:not([data-file-ext])')];
  342. this.postFileNames.forEach(fileName => {
  343. if (!fileName.textContent.includes('.')) return;
  344. const strings = fileName.textContent.split('.');
  345. const typeStr = `.${strings.pop()}`;
  346. const typeEl = document.createElement('a');
  347. typeEl.classList = ('file-ext originalNameLink');
  348. typeEl.textContent = typeStr;
  349. fileName.dataset.fileExt = typeStr;
  350. fileName.textContent = strings.join('.');
  351. fileName.parentNode.insertBefore(typeEl, fileName.nextSibling);
  352. });
  353. }
  354.  
  355. assignPostOrder () {
  356. const postOrderReplies = (post) => {
  357. const replyCount = post.querySelectorAll('.panelBacklinks a').length;
  358. post.style.order = 100 - replyCount;
  359. }
  360.  
  361. const postOrderCatbox = (post) => {
  362. const postContent = post.querySelector('.divMessage').textContent;
  363. const matches = postContent.match(/catbox\.moe/g);
  364. const catboxCount = matches ? matches.length : 0;
  365. post.style.order = 100 - catboxCount;
  366. }
  367.  
  368. if (this.postOrder === 'default') {
  369. this.thread.style.display = 'block';
  370. return;
  371. }
  372.  
  373. this.thread.style.display = 'flex';
  374.  
  375. if (this.postOrder === 'replies') {
  376. this.posts.forEach(post => postOrderReplies(post));
  377. } else if (this.postOrder === 'catbox') {
  378. this.posts.forEach(post => postOrderCatbox(post));
  379. }
  380. }
  381.  
  382. updateYous () {
  383. this.yous = this.posts.filter(post => post.querySelector('.quoteLink.you'));
  384. this.yousLinks = this.yous.map(you => {
  385. const youLink = document.createElement('a');
  386. youLink.textContent = '>>' + you.id;
  387. youLink.href = '#' + you.id;
  388. return youLink;
  389. })
  390.  
  391. let hasUnseenYous = false;
  392. this.setUnseenYous();
  393.  
  394. this.yousContainer.innerHTML = '';
  395. this.yousLinks.forEach(you => {
  396. const youId = you.textContent.replace('>>', '');
  397. if (!this.seenYous.includes(youId)) {
  398. you.classList.add('unseen');
  399. hasUnseenYous = true
  400. }
  401. this.yousContainer.appendChild(you)
  402. });
  403.  
  404. this.myYousLabel.classList.toggle('unseen', hasUnseenYous);
  405.  
  406. if (this.replyTabIcon === '') return;
  407. const icon = this.replyTabIcon;
  408. document.title = hasUnseenYous
  409. ? document.title.startsWith(`${icon} `)
  410. ? document.title
  411. : `${icon} ${document.title}`
  412. : document.title.replace(new RegExp(`^${icon} `), '');
  413. }
  414.  
  415. observeUnseenYou(you) {
  416. you.classList.add('observe-you');
  417.  
  418. const observer = new IntersectionObserver((entries, observer) => {
  419. entries.forEach(entry => {
  420. if (entry.isIntersecting) {
  421. const id = you.id;
  422. you.classList.remove('observe-you');
  423.  
  424. if (!this.seenYous.includes(id)) {
  425. this.seenYous.push(id);
  426. localStorage.setItem(this.seenKey, JSON.stringify(this.seenYous));
  427. }
  428.  
  429. observer.unobserve(you);
  430. this.updateYous();
  431.  
  432. }
  433. });
  434. }, { rootMargin: '0px', threshold: 0.1 });
  435.  
  436. observer.observe(you);
  437. }
  438.  
  439. setUnseenYous() {
  440. this.seenKey = `${this.threadId}-seen-yous`;
  441. this.seenYous = JSON.parse(localStorage.getItem(this.seenKey));
  442.  
  443. if (!this.seenYous) {
  444. this.seenYous = [];
  445. localStorage.setItem(this.seenKey, JSON.stringify(this.seenYous));
  446. }
  447.  
  448. this.unseenYous = this.yous.filter(you => !this.seenYous.includes(you.id));
  449.  
  450. this.unseenYous.forEach(you => {
  451. if (!you.classList.contains('observe-you')) {
  452. this.observeUnseenYou(you);
  453. }
  454. });
  455. }
  456.  
  457. showMascot(settings) {
  458. const mascot = document.createElement('img');
  459. mascot.classList.add('fcx-mascot');
  460. mascot.src = settings.image.value;
  461. mascot.style.opacity = settings.opacity.value * 0.01;
  462. mascot.style.top = settings.top.value;
  463. mascot.style.left = settings.left.value;
  464. mascot.style.right = settings.right.value;
  465. mascot.style.bottom = settings.bottom.value;
  466. mascot.style.height = settings.height.value;
  467. mascot.style.width = settings.width.value;
  468. document.body.appendChild(mascot);
  469. }
  470. };
  471.  
  472. window.customElements.define('fullchan-x', fullChanX);
  473.  
  474.  
  475. class fullChanXGallery extends HTMLElement {
  476. constructor() {
  477. super();
  478. }
  479.  
  480. init() {
  481. this.fullchanX = document.querySelector('fullchan-x');
  482. this.imageContainer = this.querySelector('.gallery__images');
  483. this.mainImageContainer = this.querySelector('.gallery__main-image');
  484. this.mainImage = this.mainImageContainer.querySelector('img');
  485. this.sizeButtons = [...this.querySelectorAll('.gallery__scale-options .scale-option')];
  486. this.closeButton = this.querySelector('.gallery__close');
  487. this.listeners();
  488. this.addGalleryImages();
  489. this.initalized = true;
  490. }
  491.  
  492. addGalleryImages () {
  493. this.thumbs = [...this.fullchanX.threadParent.querySelectorAll('.imgLink')].map(thumb => {
  494. return thumb.cloneNode(true);
  495. });
  496.  
  497. this.thumbs.forEach(thumb => {
  498. this.imageContainer.appendChild(thumb);
  499. });
  500. }
  501.  
  502. updateGalleryImages () {
  503. if (!this.initalized) return;
  504.  
  505. const newThumbs = [...this.fullchanX.threadParent.querySelectorAll('.imgLink')].filter(thumb => {
  506. return !this.thumbs.find(thisThumb.href === thumb.href);
  507. }).map(thumb => {
  508. return thumb.cloneNode(true);
  509. });
  510.  
  511. newThumbs.forEach(thumb => {
  512. this.thumbs.push(thumb);
  513. this.imageContainer.appendChild(thumb);
  514. });
  515. }
  516.  
  517. listeners () {
  518. this.addEventListener('click', event => {
  519. const clicked = event.target;
  520.  
  521. let imgLink = clicked.closest('.imgLink');
  522. if (imgLink?.dataset.filemime === 'video/webm') return;
  523.  
  524. if (imgLink) {
  525. event.preventDefault();
  526. this.mainImage.src = imgLink.href;
  527. }
  528.  
  529. this.mainImageContainer.classList.toggle('active', !!imgLink);
  530.  
  531. const scaleButton = clicked.closest('.scale-option');
  532. if (scaleButton) {
  533. const scale = parseFloat(getComputedStyle(this.imageContainer).getPropertyValue('--scale')) || 1;
  534. const delta = scaleButton.id === 'fcxg-smaller' ? -0.1 : 0.1;
  535. const newScale = Math.max(0.1, scale + delta);
  536. this.imageContainer.style.setProperty('--scale', newScale.toFixed(2));
  537. }
  538.  
  539. if (clicked.closest('.gallery__close')) this.close();
  540. });
  541. }
  542.  
  543. open () {
  544. if (!this.initalized) this.init();
  545. this.classList.add('open');
  546. document.body.classList.add('fct-gallery-open');
  547. }
  548.  
  549. close () {
  550. this.classList.remove('open');
  551. document.body.classList.remove('fct-gallery-open');
  552. }
  553. }
  554.  
  555. window.customElements.define('fullchan-x-gallery', fullChanXGallery);
  556.  
  557.  
  558.  
  559. class fullChanXSettings extends HTMLElement {
  560. constructor() {
  561. super();
  562. this.settingsKey = 'fullchan-x-settings';
  563. this.inputs = [];
  564. this.settings = {};
  565. this.settingsTemplate = {
  566. main: {
  567. moveToNav: {
  568. info: 'Move Fullchan-X controls into the navbar.',
  569. type: 'checkbox',
  570. value: true
  571. },
  572. enableEnhancedReplies: {
  573. info: "Enhances 8chan's native reply post previews.<p>Inline replies are now a <b>native feature</b> of 8chan, remember to enable them.</p>",
  574. type: 'checkbox',
  575. value: true
  576. },
  577. hideDeletionBox: {
  578. info: "Not much point in seeing this if you're not an mod.",
  579. type: 'checkbox',
  580. value: false
  581. },
  582. doNotShowLocation: {
  583. info: "Board with location option will be set to false by default.",
  584. type: 'checkbox',
  585. value: false
  586. },
  587. enableFileExtensions: {
  588. info: 'Always show filetype on shortened file names.',
  589. type: 'checkbox',
  590. value: true
  591. },
  592. customBoardLinks: {
  593. info: 'List of custom boards in nav (seperate by comma)',
  594. type: 'input',
  595. value: 'v,a,b'
  596. },
  597. hideDefaultBoards: {
  598. info: 'List of boards to remove from nav (seperate by comma). Set as "all" to remove all.',
  599. type: 'input',
  600. value: 'interracial,mlp'
  601. },
  602. catalogBoardLinks: {
  603. info: 'Redirect nav board links to catalog pages.',
  604. type: 'checkbox',
  605. value: true
  606. },
  607. uiTopPosition: {
  608. info: 'Position from top of screen e.g. 100px',
  609. type: 'input',
  610. value: '50px'
  611. },
  612. uiRightPosition: {
  613. info: 'Position from right of screen e.g. 100px',
  614. type: 'input',
  615. value: '25px'
  616. },
  617. uiDimWhenInactive: {
  618. info: 'Dim UI when not hovering with mouse.',
  619. type: 'checkbox',
  620. value: true
  621. },
  622. hideNavbar: {
  623. info: 'Hide navbar until hover.',
  624. type: 'checkbox',
  625. value: false
  626. },
  627. replyTabIcon: {
  628. info: 'Set the icon/text added to tab title when you get a new (You).',
  629. type: 'input',
  630. value: '❗'
  631. }
  632. },
  633. mascot: {
  634. enableMascot: {
  635. info: 'Enable mascot image.',
  636. type: 'checkbox',
  637. value: false
  638. },
  639. image: {
  640. info: 'Image URL (8chan image recommended).',
  641. type: 'input',
  642. value: '/.static/logo.png'
  643. },
  644. opacity: {
  645. info: 'Opacity (1 to 100)',
  646. type: 'input',
  647. inputType: 'number',
  648. value: '75'
  649. },
  650. width: {
  651. info: 'Width of image.',
  652. type: 'input',
  653. value: '300px'
  654. },
  655. height: {
  656. info: 'Height of image.',
  657. type: 'input',
  658. value: 'auto'
  659. },
  660. bottom: {
  661. info: 'Bottom position.',
  662. type: 'input',
  663. value: '0px'
  664. },
  665. right: {
  666. info: 'Right position.',
  667. type: 'input',
  668. value: '0px'
  669. },
  670. top: {
  671. info: 'Top position.',
  672. type: 'input',
  673. value: ''
  674. },
  675. left: {
  676. info: 'Left position.',
  677. type: 'input',
  678. value: ''
  679. }
  680. },
  681. threadBanisher: {
  682. enableThreadBanisher: {
  683. info: 'Banish shit threads to the bottom of the calalog.',
  684. type: 'checkbox',
  685. value: true
  686. },
  687. boards: {
  688. info: 'Banish theads on these boards (seperated by comma).',
  689. type: 'input',
  690. value: 'v,a'
  691. },
  692. minimumCharacters: {
  693. info: 'Minimum character requirements',
  694. type: 'input',
  695. inputType: 'number',
  696. value: 100
  697. },
  698. banishTerms: {
  699. info: `<p>Banish threads with these terms to the bottom of the catalog (new line per term).</p>
  700. <p>How to use regex: <a href="https://www.datacamp.com/cheat-sheet/regular-expresso" target="__blank">Regex Cheatsheet</a>.</p>
  701. <p>NOTE: word breaks (\\b) MUST be entered as double escapes (\\\\b), they will appear as (\\b) when saved.</p>
  702. `,
  703. type: 'textarea',
  704. value: '/\\bcuck\\b/i\n/\\bchud\\b/i\n/\\bblacked\\b/i\n/\\bnormie\\b/i\n/\\bincel\\b/i\n/\\btranny\\b/i\n/\\bslop\\b/i\n'
  705. },
  706. whitelistCyclical: {
  707. info: 'Whitelist cyclical threads.',
  708. type: 'checkbox',
  709. value: true
  710. },
  711. banishAnchored: {
  712. info: 'Banish anchored threads that are under minimum reply count.',
  713. type: 'checkbox',
  714. value: true
  715. },
  716. whitelistReplyCount: {
  717. info: 'Threads above this reply count (excluding those with banish terms) will be whitelisted.',
  718. type: 'input',
  719. inputType: 'number',
  720. value: 100
  721. },
  722. }
  723. };
  724. }
  725.  
  726. init() {
  727. this.fcx = document.querySelector('fullchan-x');
  728. this.settingsMain = this.querySelector('.fcxs-main');
  729. this.settingsThreadBanisher = this.querySelector('.fcxs-thread-banisher');
  730. this.settingsMascot = this.querySelector('.fcxs-mascot');
  731. this.getSavedSettings();
  732. if (this.settings.main) {
  733. this.fcx.init();
  734. this.loaded = true;
  735. };
  736. this.buildSettingsOptions('main', this.settingsMain);
  737. this.buildSettingsOptions('threadBanisher', this.settingsThreadBanisher);
  738. this.buildSettingsOptions('mascot', this.settingsMascot);
  739. this.listeners();
  740. this.querySelector('.fcx-settings__close').addEventListener('click', () => this.close());
  741.  
  742. if (!this.loaded) this.fcx.init();
  743. this.fcx.styleUI();
  744. document.body.classList.toggle('fcx-hide-navbar',this.settings.main.hideNavbar.value);
  745. }
  746.  
  747. setSavedSettings(updated) {
  748. localStorage.setItem(this.settingsKey, JSON.stringify(this.settings));
  749. if (updated) this.classList.add('fcxs-updated');
  750. }
  751.  
  752. getSavedSettings() {
  753. let saved = JSON.parse(localStorage.getItem(this.settingsKey));
  754. if (!saved) return;
  755.  
  756. // Ensure all top-level keys exist
  757. for (const key in this.settingsTemplate) {
  758. if (!saved[key]) saved[key] = {};
  759. }
  760.  
  761. this.settings = saved;
  762. }
  763.  
  764. listeners() {
  765. this.inputs.forEach(input => {
  766. input.addEventListener('change', () => {
  767. const section = input.dataset.section;
  768. const key = input.name;
  769. const value = input.type === 'checkbox' ? input.checked : input.value;
  770. this.settings[section][key].value = value;
  771. this.setSavedSettings(true);
  772. });
  773. });
  774. }
  775.  
  776. buildSettingsOptions(subSettings, parent) {
  777. if (!this.settings[subSettings]) this.settings[subSettings] = {}
  778.  
  779. Object.entries(this.settingsTemplate[subSettings]).forEach(([key, config]) => {
  780. const wrapper = document.createElement('div');
  781. const infoWrapper = document.createElement('div');
  782. wrapper.classList.add('fcx-setting');
  783. infoWrapper.classList.add('fcx-setting__info');
  784. wrapper.appendChild(infoWrapper);
  785.  
  786. const label = document.createElement('label');
  787. label.textContent = key
  788. .replace(/([A-Z])/g, ' $1')
  789. .replace(/^./, str => str.toUpperCase());
  790. label.setAttribute('for', key);
  791. infoWrapper.appendChild(label);
  792.  
  793. if (config.info) {
  794. const info = document.createElement('p');
  795. info.innerHTML = config.info;
  796. infoWrapper.appendChild(info);
  797. }
  798.  
  799. const savedValue = this.settings[subSettings][key]?.value ?? config.value;
  800. let input;
  801.  
  802. if (config.type === 'checkbox') {
  803. input = document.createElement('input');
  804. input.type = 'checkbox';
  805. input.checked = savedValue;
  806. } else if (config.type === 'textarea') {
  807. input = document.createElement('textarea');
  808. input.value = savedValue;
  809. } else if (config.type === 'input') {
  810. input = document.createElement('input');
  811. input.type = config.inputType || 'text';
  812. input.value = savedValue;
  813. } else if (config.type === 'select' && config.options) {
  814. input = document.createElement('select');
  815. const options = config.options.split(',');
  816. options.forEach(opt => {
  817. const option = document.createElement('option');
  818. option.value = opt;
  819. option.textContent = opt;
  820. if (opt === savedValue) option.selected = true;
  821. input.appendChild(option);
  822. });
  823. }
  824.  
  825. if (input) {
  826. input.id = key;
  827. input.name = key;
  828. input.dataset.section = subSettings;
  829. wrapper.appendChild(input);
  830. this.inputs.push(input);
  831. this.settings[subSettings][key] = {
  832. value: input.type === 'checkbox' ? input.checked : input.value
  833. };
  834. }
  835.  
  836. parent.appendChild(wrapper);
  837. });
  838. }
  839.  
  840. open() {
  841. this.classList.add('open');
  842. }
  843.  
  844. close() {
  845. this.classList.remove('open');
  846. }
  847.  
  848. toggle() {
  849. this.classList.toggle('open');
  850. }
  851. }
  852.  
  853. window.customElements.define('fullchan-x-settings', fullChanXSettings);
  854.  
  855.  
  856.  
  857. class ToggleButton extends HTMLElement {
  858. constructor() {
  859. super();
  860. const data = this.dataset;
  861. this.onclick = () => {
  862. const target = data.target ? document.querySelector(data.target) : this;
  863. const value = data.value || 'active';
  864. !!data.set ? target.dataset[data.set] = value : target.classList.toggle(value);
  865. }
  866. }
  867. }
  868.  
  869. window.customElements.define('toggle-button', ToggleButton);
  870.  
  871.  
  872.  
  873. // Create fullchan-x gallery
  874. const fcxg = document.createElement('fullchan-x-gallery');
  875. fcxg.innerHTML = `
  876. <div class="fcxg gallery">
  877. <button id="fcxg-close" class="gallery__close fullchan-x__option">Close</button>
  878. <div class="gallery__scale-options">
  879. <button id="fcxg-smaller" class="scale-option fullchan-x__option">-</button>
  880. <button id="fcxg-larger" class="scale-option fullchan-x__option">+</button>
  881. </div>
  882. <div id="fcxg-images" class="gallery__images" style="--scale:1.0"></div>
  883. <div id="fcxg-main-image" class="gallery__main-image">
  884. <img src="" />
  885. </div>
  886. </div>
  887. `;
  888. document.body.appendChild(fcxg);
  889.  
  890.  
  891.  
  892. // Create fullchan-x element
  893. const fcx = document.createElement('fullchan-x');
  894. fcx.innerHTML = `
  895. <div class="fcx__controls">
  896. <button id="fcx-settings-btn" class="fullchan-x__option fcx-settings-toggle">
  897. <a>⚙️</a><span>Settings</span>
  898. </button>
  899.  
  900. <div class="fullchan-x__option fullchan-x__sort thread-only">
  901. <a>☰</a>
  902. <select id="thread-sort">
  903. <option value="default">Default</option>
  904. <option value="replies">Replies</option>
  905. <option value="catbox">Catbox</option>
  906. </select>
  907. </div>
  908.  
  909. <button id="fcx-gallery-btn" class="gallery__toggle fullchan-x__option thread-only">
  910. <a>🖼️</a><span>Gallery</span>
  911. </button>
  912.  
  913. <div class="fcx__my-yous thread-only">
  914. <p class="my-yous__label fullchan-x__option"><a>💬</a><span>My (You)s</span></p>
  915. <div class="my-yous__yous fcx-prevent-nesting" id="my-yous"></div>
  916. </div>
  917. </div>
  918. `;
  919. (document.querySelector('.navHeader') || document.body).appendChild(fcx);
  920.  
  921.  
  922.  
  923. // Create fullchan-x settings
  924. const fcxs = document.createElement('fullchan-x-settings');
  925. fcxs.innerHTML = `
  926. <div class="fcx-settings fcxs" data-tab="main">
  927. <header>
  928. <div class="fcxs__heading">
  929. <span class="fcx-settings__title">
  930. <img class="fcxs_logo" src="/.static/logo/logo_blue.png" height="25px" width="auto">
  931. <span>
  932. Fullchan-X Settings
  933. </span>
  934. </span>
  935. <button class="fcx-settings__close fullchan-x__option">Close</button>
  936. </div>
  937.  
  938. <div class="fcx-settings__tab-buttons">
  939. <toggle-button data-target=".fcxs" data-set="tab" data-value="main">
  940. Main
  941. </toggle-button>
  942. <toggle-button data-target=".fcxs" data-set="tab" data-value="catalog">
  943. catalog
  944. </toggle-button>
  945. <toggle-button data-target=".fcxs" data-set="tab" data-value="mascot">
  946. Mascot
  947. </toggle-button>
  948. </div>
  949. </header>
  950.  
  951. <main>
  952. <div class="fcxs__updated-message">
  953. <p>Settings updated, refresh page to apply</p>
  954. <button class="fullchan-x__option" onClick="location.reload()">Reload page</button>
  955. </div>
  956.  
  957. <div class="fcx-settings__settings">
  958. <div class="fcxs-main fcxs-tab"></div>
  959. <div class="fcxs-mascot fcxs-tab"></div>
  960. <div class="fcxs-catalog fcxs-tab">
  961. <div class="fcxs-thread-banisher"></div>
  962. </div>
  963. </div>
  964. </main>
  965.  
  966. <footer>
  967. </footer>
  968. </div>
  969. `;
  970.  
  971.  
  972. // Styles
  973. const style = document.createElement('style');
  974. style.innerHTML = `
  975. .hide-navboard #navTopBoardsSpan {
  976. display: none!important;
  977. }
  978.  
  979. fullchan-x {
  980. --top: 50px;
  981. --right: 25px;
  982. background: var(--background-color);
  983. border: 1px solid var(--navbar-text-color);
  984. color: var(--link-color);
  985. font-size: 14px;
  986. z-index: 3;
  987. }
  988.  
  989. toggle-button {
  990. cursor: pointer;
  991. }
  992.  
  993. /* Fullchan-X in nav styles */
  994. .fcx-in-nav {
  995. padding: 0;
  996. border-width: 0;
  997. line-height: 20px;
  998. margin-right: 2px;
  999. background: none;
  1000. }
  1001.  
  1002. .fcx-in-nav .fcx__controls:before,
  1003. .fcx-in-nav .fcx__controls:after {
  1004. color: var(--navbar-text-color);
  1005. font-size: 85%;
  1006. }
  1007.  
  1008. .fcx-in-nav .fcx__controls:before {
  1009. content: "]";
  1010. }
  1011.  
  1012. .fcx-in-nav .fcx__controls:after {
  1013. content: "[";
  1014. }
  1015.  
  1016. .fcx-in-nav .fcx__controls,
  1017. .fcx-in-nav:hover .fcx__controls:hover {
  1018. flex-direction: row-reverse;
  1019. }
  1020.  
  1021. .fcx-in-nav .fcx__controls .fullchan-x__option {
  1022. padding: 0!important;
  1023. justify-content: center;
  1024. background: none;
  1025. line-height: 0;
  1026. max-width: 20px;
  1027. min-width: 20px;
  1028. translate: 0 1px;
  1029. border: solid var(--navbar-text-color) 1px !important;
  1030. }
  1031.  
  1032. .fcx-in-nav .fcx__controls .fullchan-x__option:hover {
  1033. border: solid var(--subject-color) 1px !important;
  1034. }
  1035.  
  1036. .fcx-in-nav .fullchan-x__sort > a {
  1037. position: relative
  1038. margin-bottom: 1px;
  1039. }
  1040.  
  1041. .fcx-in-nav .fcx__controls > * {
  1042. position: relative;
  1043. }
  1044.  
  1045. .fcx-in-nav .fcx__controls .fullchan-x__option > span,
  1046. .fcx-in-nav .fcx__controls .fullchan-x__option:not(:hover) > select {
  1047. display: none;
  1048. }
  1049.  
  1050. .fcx-in-nav .fcx__controls .fullchan-x__option > select {
  1051. appearance: none;
  1052. position: absolute;
  1053. left: 0;
  1054. top: 0;
  1055. width: 100%;
  1056. height: 100%;
  1057. font-size: 0;
  1058. }
  1059.  
  1060. .fcx-in-nav .fcx__controls .fullchan-x__option > select option {
  1061. font-size: 12px;
  1062. }
  1063.  
  1064. .fcx-in-nav .my-yous__yous {
  1065. position: absolute;
  1066. left: 50%;
  1067. translate: -50%;
  1068. background: var(--background-color);
  1069. border: 1px solid var(--navbar-text-color);
  1070. padding: 14px;
  1071. }
  1072.  
  1073. .bottom-header .fcx-in-nav .my-yous__yous {
  1074. top: 0;
  1075. translate: -50% -100%;
  1076. }
  1077.  
  1078. /* Fullchan-X main styles */
  1079. fullchan-x:not(.fcx-in-nav) {
  1080. top: var(--top);
  1081. right: var(--right);
  1082. display: block;
  1083. padding: 10px;
  1084. position: fixed;
  1085. display: block;
  1086. }
  1087.  
  1088. fullchan-x:not(.page-thread) .thread-only,
  1089. fullchan-x:not(.page-catalog) .catalog-only {
  1090. display: none!important;
  1091. }
  1092.  
  1093. fullchan-x:hover {
  1094. z-index: 1000!important;
  1095. }
  1096.  
  1097. .navHeader:has(fullchan-x:hover) {
  1098. z-index: 1000!important;
  1099. }
  1100.  
  1101. fullchan-x.fcx--dim:not(:hover) {
  1102. opacity: 0.6;
  1103. }
  1104.  
  1105. .divPosts {
  1106. flex-direction: column;
  1107. }
  1108.  
  1109. .fcx__controls {
  1110. display: flex;
  1111. flex-direction: column;
  1112. gap: 6px;
  1113. }
  1114.  
  1115. fullchan-x:not(:hover):not(:has(select:focus)) span,
  1116. fullchan-x:not(:hover):not(:has(select:focus)) select {
  1117. display: none;
  1118. margin-left: 5px;
  1119. z-index:3;
  1120. }
  1121.  
  1122. .fcx__controls span,
  1123. .fcx__controls select {
  1124. margin-left: 5px;
  1125. }
  1126.  
  1127. .fcx__controls select {
  1128. cursor: pointer;
  1129. }
  1130.  
  1131. #thread-sort {
  1132. border: none;
  1133. background: none;
  1134. }
  1135.  
  1136. .my-yous__yous {
  1137. display: none;
  1138. flex-direction: column;
  1139. padding-top: 10px;
  1140. max-height: calc(100vh - 220px - var(--top));
  1141. overflow: auto;
  1142. }
  1143.  
  1144. .fcx__my-yous:hover .my-yous__yous {
  1145. display: flex;
  1146. }
  1147.  
  1148. .fullchan-x__option {
  1149. display: flex;
  1150. padding: 6px 8px;
  1151. background: white;
  1152. border: none !important;
  1153. border-radius: 0.2rem;
  1154. transition: all ease 150ms;
  1155. cursor: pointer;
  1156. margin: 0;
  1157. text-align: left;
  1158. min-width: 18px;
  1159. min-height: 18px;
  1160. align-items: center;
  1161. }
  1162.  
  1163. .fullchan-x__option,
  1164. .fullchan-x__option select {
  1165. font-size: 12px;
  1166. font-weight: 400;
  1167. color: #374369;
  1168. }
  1169.  
  1170. fullchan-x:not(:hover):not(:has(select:focus)) .fullchan-x__option {
  1171. display: flex;
  1172. justify-content: center;
  1173. }
  1174.  
  1175. #thread-sort {
  1176. padding-right: 0;
  1177. }
  1178.  
  1179. #thread-sort:hover {
  1180. display: block;
  1181. }
  1182.  
  1183. .innerPost:has(.quoteLink.you) {
  1184. border-left: solid #dd003e 6px;
  1185. }
  1186.  
  1187. .innerPost:has(.youName) {
  1188. border-left: solid #68b723 6px;
  1189. }
  1190.  
  1191. /* --- Nested quotes --- */
  1192. .divMessage .nestedPost {
  1193. display: inline-block;
  1194. width: 100%;
  1195. margin-bottom: 14px;
  1196. white-space: normal!important;
  1197. overflow-wrap: anywhere;
  1198. margin-top: 0.5em;
  1199. border: 1px solid var(--navbar-text-color);
  1200. }
  1201.  
  1202. .nestedPost .innerPost,
  1203. .nestedPost .innerOP {
  1204. width: 100%;
  1205. }
  1206.  
  1207. .nestedPost .imgLink .imgExpanded {
  1208. width: auto!important;
  1209. height: auto!important;
  1210. }
  1211.  
  1212. .my-yous__label.unseen {
  1213. background: var(--link-hover-color)!important;
  1214. color: white;
  1215. }
  1216.  
  1217. .my-yous__yous .unseen {
  1218. font-weight: 900;
  1219. color: var(--link-hover-color);
  1220. }
  1221.  
  1222. .panelBacklinks a.active {
  1223. color: #dd003e;
  1224. }
  1225.  
  1226. /*--- Settings --- */
  1227. .fcx-settings {
  1228. display: block;
  1229. position: fixed;
  1230. top: 50vh;
  1231. left: 50vw;
  1232. translate: -50% -50%;
  1233. padding: 20px 0;
  1234. background: var(--background-color);
  1235. border: 1px solid var(--navbar-text-color);
  1236. color: var(--link-color);
  1237. font-size: 14px;
  1238. max-width: 480px;
  1239. max-height: 80vh;
  1240. overflow: scroll;
  1241. min-width: 500px;
  1242. z-index: 1000;
  1243. }
  1244.  
  1245. fullchan-x-settings:not(.open) {
  1246. display: none;
  1247. }
  1248.  
  1249. .fcxs__heading,
  1250. .fcxs-tab,
  1251. .fcxs footer {
  1252. padding: 0 20px;
  1253. }
  1254.  
  1255. .fcx-settings header {
  1256. margin: 0 0 15px;
  1257. border-bottom: 1px solid var(--navbar-text-color);
  1258. }
  1259.  
  1260. .fcxs__heading {
  1261. display: flex;
  1262. align-items: center;
  1263. justify-content: space-between;
  1264. padding-bottom: 20px;
  1265. }
  1266.  
  1267. .fcx-settings__title {
  1268. display: flex;
  1269. align-items: center;
  1270. gap: 10px;
  1271. font-size: 24px;
  1272. font-size: 24px;
  1273. letter-spacing: 0.04em;
  1274. }
  1275.  
  1276. .fcxs_logo {
  1277. .margin-top: -2px;
  1278. }
  1279.  
  1280. .fcx-settings__tab-buttons {
  1281. border-top: 1px solid var(--navbar-text-color);
  1282. display: flex;
  1283. align-items: center;
  1284. }
  1285.  
  1286. .fcx-settings__tab-buttons toggle-button {
  1287. flex: 1;
  1288. padding: 15px;
  1289. font-size: 14px;
  1290. }
  1291.  
  1292. .fcx-settings__tab-buttons toggle-button + toggle-button {
  1293. border-left: 1px solid var(--navbar-text-color);
  1294. }
  1295.  
  1296. .fcx-settings__tab-buttons toggle-button:hover {
  1297. color: var(--role-color);
  1298. }
  1299.  
  1300. fullchan-x-settings:not(.fcxs-updated) .fcxs__updated-message {
  1301. display: none;
  1302. }
  1303.  
  1304. .fcxs:not([data-tab="main"]) .fcxs-main,
  1305. .fcxs:not([data-tab="catalog"]) .fcxs-catalog,
  1306. .fcxs:not([data-tab="mascot"]) .fcxs-mascot {
  1307. display: none;
  1308. }
  1309.  
  1310. .fcxs[data-tab="main"] [data-value="main"],
  1311. .fcxs[data-tab="catalog"] [data-value="catalog"],
  1312. .fcxs[data-tab="mascot"] [data-value="mascot"] {
  1313. font-weight: 700;
  1314. }
  1315.  
  1316. .fcx-setting {
  1317. display: flex;
  1318. justify-content: space-between;
  1319. align-items: center;
  1320. padding: 12px 0;
  1321. }
  1322.  
  1323. .fcx-setting__info {
  1324. max-width: 60%;
  1325. }
  1326.  
  1327. .fcx-setting input[type="text"],
  1328. .fcx-setting input[type="number"],
  1329. .fcx-setting select,
  1330. .fcx-setting textarea {
  1331. padding: 4px 6px;
  1332. min-width: 35%;
  1333. }
  1334.  
  1335. .fcx-setting textarea {
  1336. min-height: 100px;
  1337. }
  1338.  
  1339. .fcx-setting label {
  1340. font-weight: 600;
  1341. }
  1342.  
  1343. .fcx-setting p {
  1344. margin: 6px 0 0;
  1345. font-size: 12px;
  1346. }
  1347.  
  1348. .fcx-setting + .fcx-setting {
  1349. border-top: 1px solid var(--navbar-text-color);
  1350. }
  1351.  
  1352. .fcxs__updated-message {
  1353. margin: 10px 0;
  1354. text-align: center;
  1355. }
  1356.  
  1357. .fcxs__updated-message p {
  1358. font-size: 14px;
  1359. color: var(--error);
  1360. }
  1361.  
  1362. .fcxs__updated-message button {
  1363. margin: 14px auto 0;
  1364. }
  1365.  
  1366. /* --- Gallery --- */
  1367. .fct-gallery-open,
  1368. body.fct-gallery-open,
  1369. body.fct-gallery-open #mainPanel {
  1370. overflow: hidden!important;
  1371. }
  1372.  
  1373. body.fct-gallery-open fullchan-x:not(.fcx-in-nav),
  1374. body.fct-gallery-open #quick-reply {
  1375. display: none!important;
  1376. }
  1377.  
  1378. fullchan-x-gallery {
  1379. position: fixed;
  1380. top: 0;
  1381. left: 0;
  1382. width: 100%;
  1383. background: rgba(0,0,0,0.9);
  1384. display: none;
  1385. height: 100%;
  1386. overflow: auto;
  1387. }
  1388.  
  1389. fullchan-x-gallery.open {
  1390. display: block;
  1391. }
  1392.  
  1393. fullchan-x-gallery .gallery {
  1394. padding: 50px 10px 0
  1395. }
  1396.  
  1397. fullchan-x-gallery .gallery__images {
  1398. --scale: 1.0;
  1399. display: flex;
  1400. width: 100%;
  1401. height: 100%;
  1402. justify-content: center;
  1403. align-content: flex-start;
  1404. gap: 4px 8px;
  1405. flex-wrap: wrap;
  1406. }
  1407.  
  1408. fullchan-x-gallery .imgLink {
  1409. float: unset;
  1410. display: block;
  1411. zoom: var(--scale);
  1412. }
  1413.  
  1414. fullchan-x-gallery .imgLink img {
  1415. border: solid white 1px;
  1416. }
  1417.  
  1418. fullchan-x-gallery .imgLink[data-filemime="video/webm"] img {
  1419. border: solid #68b723 4px;
  1420. }
  1421.  
  1422. fullchan-x-gallery .gallery__close {
  1423. border: solid 1px var(--background-color)!important;
  1424. position: fixed;
  1425. top: 60px;
  1426. right: 35px;
  1427. padding: 6px 14px;
  1428. min-height: 30px;
  1429. z-index: 10;
  1430. }
  1431.  
  1432. .fcxg .gallery__scale-options {
  1433. position: fixed;
  1434. bottom: 30px;
  1435. right: 35px;
  1436. display: flex;
  1437. gap: 14px;
  1438. z-index: 10;
  1439. }
  1440.  
  1441. .fcxg .gallery__scale-options .fullchan-x__option {
  1442. border: solid 1px var(--background-color)!important;
  1443. width: 35px;
  1444. height: 35px;
  1445. font-size: 18px;
  1446. display: flex;
  1447. justify-content: center;
  1448. }
  1449.  
  1450. .gallery__main-image {
  1451. display: none;
  1452. position: fixed;
  1453. top: 0;
  1454. left: 0;
  1455. width: 100%;
  1456. height: 100%;
  1457. justify-content: center;
  1458. align-content: center;
  1459. background: rgba(0,0,0,0.5);
  1460. }
  1461.  
  1462. .gallery__main-image img {
  1463. padding: 40px 10px 15px;
  1464. height: auto;
  1465. max-width: calc(100% - 20px);
  1466. object-fit: contain;
  1467. }
  1468.  
  1469. .gallery__main-image.active {
  1470. display: flex;
  1471. }
  1472.  
  1473. /*-- Truncated file extentions --*/
  1474. .originalNameLink[data-file-ext] {
  1475. display: inline-block;
  1476. overflow: hidden;
  1477. white-space: nowrap;
  1478. text-overflow: ellipsis;
  1479. max-width: 65px;
  1480. }
  1481.  
  1482. .originalNameLink[data-file-ext]:hover {
  1483. max-width: unset;
  1484. white-space: normal;
  1485. display: inline;
  1486. }
  1487.  
  1488. a[data-file-ext]:hover:after {
  1489. content: attr(data-file-ext);
  1490. }
  1491.  
  1492. a[data-file-ext] + .file-ext {
  1493. pointer-events: none;
  1494. }
  1495.  
  1496. a[data-file-ext]:hover + .file-ext {
  1497. display: none;
  1498. }
  1499.  
  1500. /*-- Enhanced replies --*/
  1501. .fcx-replies-plus .panelBacklinks a.active {
  1502. --active-color: red;
  1503. color: var(--active-color);
  1504. }
  1505.  
  1506. .fcx-replies-plus .replyPreview .linkQuote {
  1507. color: var(--active-color);
  1508. }
  1509.  
  1510. .fcx-replies-plus .replyPreview {
  1511. padding-left: 40px;
  1512. padding-right: 10px;
  1513. margin-top: 10px;
  1514. }
  1515.  
  1516. .fcx-replies-plus .replyPreview .inlineQuote + .inlineQuote {
  1517. margin-top: 8px;
  1518. }
  1519.  
  1520. .fcx-replies-plus .inlineQuote .innerPost {
  1521. border: solid 1px var(--navbar-text-color)
  1522. }
  1523.  
  1524. .fcx-replies-plus .quoteLink + .inlineQuote {
  1525. margin-top: 6px;
  1526. }
  1527.  
  1528. .fcx-replies-plus .inlineQuote .postInfo > a:first-child {
  1529. position: absolute;
  1530. display: inline-block;
  1531. font-size: 0;
  1532. width: 14px;
  1533. height: 14px;
  1534. background: var(--link-color);
  1535. border-radius: 50%;
  1536. translate: 6px 0.5px;
  1537. }
  1538.  
  1539. .fcx-replies-plus .inlineQuote .postInfo > a:first-child:after {
  1540. content: '+';
  1541. display: block;
  1542. position: absolute;
  1543. left: 50%;
  1544. top: 50%;
  1545. font-size: 18px;
  1546. color: var(--contrast-color);
  1547. transform: translate(-50%, -50%) rotate(45deg);
  1548. z-index: 1;
  1549. }
  1550.  
  1551. .fcx-replies-plus .inlineQuote .postInfo > a:first-child:hover {
  1552. background: var(--link-hover-color);
  1553. }
  1554.  
  1555. .fcx-replies-plus .inlineQuote .hideButton {
  1556. margin-left: 25px;
  1557. }
  1558.  
  1559. /*-- Nav Board Links --*/
  1560. .nav-boards--custom {
  1561. display: flex;
  1562. gap: 3px;
  1563. }
  1564.  
  1565. #navTopBoardsSpan.hidden ~ #navBoardsSpan,
  1566. #navTopBoardsSpan.hidden ~ .nav-fade,
  1567. #navTopBoardsSpan a.hidden + span {
  1568. display: none;
  1569. }
  1570.  
  1571. /*-- Anon Unique ID posts --*/
  1572. .postInfo .spanId {
  1573. position: relative;
  1574. }
  1575.  
  1576. .fcx-id-posts {
  1577. position: absolute;
  1578. top: 0;
  1579. left: 20px;
  1580. translate: 0 calc(-100% - 5px);
  1581. display: flex;
  1582. flex-direction: column;
  1583. padding: 10px;
  1584. background: var(--background-color);
  1585. border: 1px solid var(--navbar-text-color);
  1586. width: max-content;
  1587. max-width: 500px;
  1588. max-height: 500px;
  1589. overflow: auto;
  1590. z-index: 1000;
  1591. }
  1592.  
  1593. .fcx-id-posts .nestedPost {
  1594. pointer-events: none;
  1595. width: auto;
  1596. }
  1597.  
  1598. /* mascot */
  1599. .fcx-mascot {
  1600. position: fixed;
  1601. z-index: -1;
  1602. }
  1603.  
  1604. .fct-gallery-open .fcx-mascot {
  1605. display: none;
  1606. }
  1607.  
  1608. /*-- Thread sorting --*/
  1609. #divThreads.fcx-threads {
  1610. display: flex!important;
  1611. flex-wrap: wrap;
  1612. justify-content: center;
  1613. }
  1614.  
  1615. .catalogCell.shit-thread {
  1616. order: 10;
  1617. filter: sepia(0.17);
  1618. }
  1619.  
  1620. .catalogCell.shit-thread .labelPage:after {
  1621. content: " 💩";
  1622. }
  1623.  
  1624. /* Hide navbar */
  1625. .fcx-hide-navbar .navHeader {
  1626. --translateY: -100%;
  1627. translate: 0 var(--translateY);
  1628. transition: ease 300ms translate;
  1629. }
  1630.  
  1631. .bottom-header.fcx-hide-navbar .navHeader {
  1632. --translateY: 100%;
  1633. }
  1634.  
  1635. .fcx-hide-navbar .navHeader:after {
  1636. content: "";
  1637. display: block;
  1638. height: 100%;
  1639. width: 100%;
  1640. left: 0;
  1641. position: absolute;
  1642. top: 100%;
  1643. }
  1644.  
  1645. .fcx-hide-navbar .navHeader:hover {
  1646. --translateY: -0%;
  1647. }
  1648.  
  1649. .bottom-header .fcx-hide-navbar .navHeader:not(:hover) {
  1650. --translateY: 100%;
  1651. }
  1652.  
  1653. .bottom-header .fcx-hide-navbar .navHeader:after {
  1654. top: -100%;
  1655. }
  1656.  
  1657. /* Extra styles */
  1658. .fcx-hide-delete .postInfo .deletionCheckBox {
  1659. display: none;
  1660. }
  1661. `;
  1662.  
  1663. document.head.appendChild(style);
  1664.  
  1665. document.body.appendChild(fcxs);
  1666. fcxs.init();
  1667.  
  1668. // Asuka and Eris (fantasy Asuka) are best girls