/tech/ - Tech


Mode: Reply

Max message length: 8192


Max file size: 80.00 MB

Max files: 5


(used to delete files and postings)


Remember to follow the rules

(14.43 KB 418x378 wizard.png)
Share your bunkerchan CSS/JS Comrade 04/06/2020 (Mon) 18:00:44 No. 801
Share your custom CSS and JS for bunkerchan settings. Here's mine: CSS // Better readability on wide screens .divMessage { max-width: 80em; } // Hide ugly green borders in default theme #divLatestPosts .latestPostCell, .innerPost, .sideCatalogCell, .markedPost, .sideCatalogMarkedCell, .catalogCell { border: none; } hr, input, select, textarea, #newPostFieldset, #quick-reply table, .modalDecorationPanel, .floatingMenu, #settingsFieldset, .reportFieldset, input[type=button], input[type=submit], button, .dropzone, .selectedCell, #postingForm th, .modalTableBody th { border-color: #444; } // Differentiate pdf/epub thumbnails from webm/mp4 .uploadCell a[href$=".pdf"] img, .uploadCell a[href$="epub+zip"] img { filter: grayscale(100%); } JS // Store the last read post for each thread and scroll to it automatically if (location.pathname.indexOf('/res/') >= 0) { let main = function() { let maxThreads = 300; let delay = 500; let storageKey = 'lastRead'; let lastRead = JSON.parse(localStorage.getItem(storageKey)) || {}; let highlighted = null; let scrollTimer = null; let scrollContainer = document.getElementById('mainPanel'); if (lastRead[location.pathname]) { let lastReadPost = document.getElementById(lastRead[location.pathname]); if (lastReadPost) { highlight(lastReadPost); if (!location.hash) lastReadPost.scrollIntoView(); } } function highlight(post) { if (highlighted) highlighted.style.borderBottom = ''; highlighted = post; highlighted.style.borderBottom = 'dashed 1px #555'; } function onScroll() { let scrollBottom = scrollContainer.scrollTop + scrollContainer.offsetHeight; let posts = document.getElementsByClassName('postCell'); let lastReadPost = null; for (let i = 0; i [orange] posts.length; i++) { // CHANGE [orange] to the "less than" character if (posts[i].offsetTop + posts[i].offsetHeight > scrollBottom) break; lastReadPost = posts[i]; } if (lastReadPost) { delete lastRead[location.pathname]; lastRead[location.pathname] = Number(lastReadPost.id); let keys = Object.keys(lastRead); if (keys.length > maxThreads) delete lastRead[keys[0]]; localStorage.setItem(storageKey, JSON.stringify(lastRead)); } } scrollContainer.addEventListener('scroll', () => { if (scrollTimer) clearTimeout(scrollTimer); scrollTimer = setTimeout(onScroll, delay); }); window.addEventListener('storage', (event) => { if (event.key === storageKey) lastRead = JSON.parse(event.newValue) || {}; }); let refreshButton = document.getElementById('refreshButton'); if (refreshButton) refreshButton.addEventListener('click', () => { let posts = document.getElementsByClassName('postCell'); if (posts.length) highlight(posts[posts.length - 1]); }); }; if (document.readyState === 'complete') main(); else document.addEventListener('readystatechange', (event) => { if (event.target.readyState === 'complete') main(); }); } // Uncheck autorefresh let autorefresh = document.getElementById('checkboxChangeRefresh'); if (autorefresh && autorefresh.checked) autorefresh.click();
Edited last time by antious666 on 09/11/2020 (Fri) 22:18:37.
>>801 Post messed up my script a bit. [ orange ] in onScroll() loop should be <
// Fix watch button let fixWatch = function() { let ops = document.getElementsByClassName('innerOP'); for (var i = 0; i [orange] ops.length; i++) { if (!ops[i].getElementsByClassName('watchButton')[0]) watcher.processOP(ops[i]); } } if (document.readyState === 'complete') fixWatch(); else document.addEventListener('readystatechange', (event) => { if (event.target.readyState === 'complete') fixWatch(); }); Again, replace [ orange ] with < Space plz fix
My stylus css is unmaintainable and out of date (I tacked on this site like 5 mins ago), so I switched to fl.ux... I wish I was joking, ~245KB export if anybody wants to see: https://pastebin.com/Z3ZyrEFF
>>801 OP here. Updated scripts at https://paste.gg/p/comrade/43edd0e233364a5cb7e638eab6169a16 to avoid the angle bracket mangling
very nice I can use the default theme again. Whoever is in charge should add these by default to hold us over while they make that new software. Or at least add some notice so more people can use it.
>>852 works on mobile too. can watch threads now.
Does anyone have a script that when I enter a board it gets me directly to the catalog?
>>3099 seconding this, would save me a click every time i switch boards
>>3099 >>3121 if (/^\/\w+\/?$/.test(location.pathname) && !/overboard/.test(location.pathname)) { location.href = 'catalog.html'; } Note you won't be able to access the non-catalog page.
>>3134 Thanks anon
Dracula theme for bunkerchan https://pastebin.com/DzrjC2zV You can use it with addons like stylus
CSS newbie here, made some QOL improvements https://pastebin.com/vXT9qfrN >Quick reply form no longer overlaps backlink previews >Hide scroll bar in catalog >Remove post background from the catalog >Differentiate file types Icons made by >>>/gulag/6431 and hosted on imgur
(33.94 KB 633x472 BunkerScript.png)
>>3169 >turns off uBlock origin for bunkerchan there is no reason to disable it anon ever.
How do I actually implement custom css? t. brainlet.
>>5318 Stylish addon.
>>5318 >>5329 Better use Stylus, Stylish is botnet
is this just being silly? I'm an infrequent visitor and browsing bunkerchan without any additional modifications although I run uBlock origin with javascript disabled....
>>805 How come the watch button hasn't been officially fixed, but the fix is so simple?
>>5499 that doesn't actually fix it
>>5499 The real fix is even simpler. Watcher is broken because it tries to initialize before the document is ready. The script tag needs to be moved to the bottom of the body, or edit watcher.js to wait for DOMContentLoaded event before calling watcher.init(). My script is just a hacky workaround.
>>5500 Here's an improved script that fixes the watch button and unread counter as well: https://paste.gg/p/comrade/43edd0e233364a5cb7e638eab6169a16#0836852e91854c69b5ff29093aeb2e17-title Still a giant hack though.
>>5506 This seems to work perfectly, thank you comrade
What does the labelBoard class do in the CSS? I tried customizing the margins of posts and this labelBoard thing just seemingly appeared, starting from this one random post, and then to every single one afterwards. It has a width of 0.25em so it makes the top margin of a post seem bigger.
>>5522 Seems like it's an empty h3 element on posts added via auto-refresh (gone after refreshing page). See posting.postCellTemplate in posting.js Should be fine to just hide it with .labelBoard { display: none; }
Any way to change scrollbar width yet?
(115.39 KB 1080x952 IMG_20201026_165622.jpg)
anyway to update differentiation between PDFs and other file types, now that PDFs can have thumbnail previews? pic related, first is image, second pdf
>>5613 Maybe something like .uploadCell > a[href$=".pdf"]:before { content: "PDF"; display: block; } .uploadCell > a[href$="epub+zip"]:before { content: "EPUB"; display: block; }
>>5576 /* Firefox */ * { scrollbar-width: thin; } /* Chrome */ ::-webkit-scrollbar { width: 7px; height: 7px; } but the settings CSS does not apply to the catalog page, so you would need Stylus extension for that.
>>5615 Doesn't work
>>5616 Oh I guess for Chrome you need to set the colors as well. Try this ::-webkit-scrollbar { width: 7px; height: 7px; } ::-webkit-scrollbar-thumb { background: #666; } ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
>>5634 Is Firefox just one line? By itself it doesn't seem to do anything.
>>5635 You need the * {} part too. Maybe try below with color added. It requires FF version 64+ also. * { scrollbar-width: thin; scrollbar-color: #666 transparent; }


no cookies?