Skip to content

Instantly share code, notes, and snippets.

@hibiyasleep
Last active May 10, 2019 19:24
Show Gist options
  • Save hibiyasleep/42a5dd2b15b649391766f013990ddfd9 to your computer and use it in GitHub Desktop.
Save hibiyasleep/42a5dd2b15b649391766f013990ddfd9 to your computer and use it in GitHub Desktop.
펀가가 아니라! 펀! 즈! 에요!
// ==UserScript==
// @name 가->즈
// @namespace https://idyllshi.re/
// @version 0.0.1
// @description 펀가가 아니라! 펀! 즈! 에요!
// @author kuriyama hibiya <kuriyama@hibiya.moe>
// @match https://tgd.kr/*
// @grant all
// ==/UserScript==
const dummy = {
getAttribute() {},
addEventListener() {}
}
const _ = sel => document.querySelector(sel) || dummy
const __ = sel => document.querySelectorAll(sel) || dummy
const _id = sel => document.getElementById(sel) || dummy
function 가가_아니라_즈입니다(, ) {
if(!) return
[] = [].replace(//g, '즈')
}
function work(el) {
let node
const walk = document.createTreeWalker(el || document.body, NodeFilter.SHOW_TEXT, {
acceptNode: node => node.textContent.indexOf('가') !== -1? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
})
while(node = walk.nextNode()) {
가가_아니라_즈입니다(node, 'textContent')
}
}
//
//
//
if(!(_id('board-info').getAttribute('data-name') === 'Funzinnu' || _('form[action="/board/write/funzinnu"]'))) return
//
//
//
if(Array.isArray(window.AD)) {
for(let k in window.AD) {
가가_아니라_즈입니다(window.AD[k], 'content')
}
}
//
work()
_id('writeCommentBtn').addEventListener('mouseover', () => work(_('.fr-view')))
_id('article-write-button').addEventListener('mouseover', () => {
work(_('.fr-view'))
가가_아니라_즈입니다(_id('title'), 'value')
가가_아니라_즈입니다(_id('nickname'), 'value')
})
_('#pollModal .modal-footer').addEventListener('mouseover', () => {
__('#pollModal input[type="text"]').forEach(el => {
가가_아니라_즈입니다(el, 'value')
})
})
if(_id('#reply-real-area')) {
setTimeout(() => work(), 300)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment