Last active
July 19, 2022 10:36
-
-
Save scarf005/72089ee97f9c2984273a90da05c42bd7 to your computer and use it in GitHub Desktop.
크-린디씨
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Sanitize DCinside | |
| // @namespace https://gist.github.com/scarf005/72089ee97f9c2984273a90da05c42bd7 | |
| // @version 0.3.0 | |
| // @description make this site less of a pain to read | |
| // @author scarf005 | |
| // @match https://gall.dcinside.com/* | |
| // @grant none | |
| // ==/UserScript== | |
| { | |
| const getDomArray = cls => Array.from(document.querySelectorAll(cls)) | |
| const elems = [ | |
| '.gall_exposure', | |
| '.right_content', | |
| '.type1.dcfoot', | |
| '.gallery_box.issuebox', | |
| '.gnb_bar', | |
| '.dc_logo', | |
| '.vst.newvisit_history', | |
| '.wrap_search', | |
| '.bottom_movebox', | |
| '.dark.join_tip.pop_tipbox', | |
| '.writer_nikcon', | |
| '#zzbang_div', | |
| '.clear.recom_bottom_box', | |
| '.comment_count > .fr', | |
| '.icon_guide_open.sp_img', | |
| '.writing_banbox.con_banner', | |
| '.relate', | |
| '.cmt_inner', | |
| '.cmt_mdf_del', | |
| '.ub-content.dory', | |
| '.adr_copy', | |
| 'div.gall_issuebox.fr > button:not(.block_setting)', | |
| ].flatMap(cls => getDomArray(cls)) | |
| const removeCommentLinks = () => { | |
| document | |
| .querySelectorAll('.reply_numbox') | |
| .forEach(prev => prev.replaceWith(document.createElement('span'), prev.innerText)) | |
| } | |
| const centerContainer = () => { | |
| const container = document.getElementById('container').style | |
| container.display = 'flex' | |
| container.justifyContent = 'center' | |
| getDomArray('.left_content') | |
| .map(e => e.classList) | |
| .forEach(e => e.remove('left_content')) | |
| } | |
| removeCommentLinks() | |
| centerContainer() | |
| const topButtons = getDomArray('.area_links.clear > ul.fl > li > a') | |
| .filter(e => ![ '갤로그', '디시콘', '로그인', '로그아웃' ].includes(e.firstChild.data)) | |
| .map(e => e.parentNode) | |
| const mgallery = () => { | |
| return getDomArray('td.gall_subject') | |
| .filter(e => [ '이슈', '설문' ].includes(e.textContent)) | |
| .map(e => e.parentNode) | |
| } | |
| const gallery = () => { | |
| return getDomArray('td.gall_num') | |
| .filter(e => [ '이슈', '설문' ].includes(e.firstChild.data)) | |
| .map(e => e.parentNode) | |
| } | |
| const postNames = window.location.href.includes('mgallery') ? mgallery() : gallery(); | |
| [ ...elems, ...topButtons, ...postNames ] | |
| .forEach(e => e.remove()) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment