Last active
October 8, 2025 06:48
-
-
Save koreapyj/9e79843a4d414b490c3b6c88024a50ae 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 Coupang Search | |
// @namespace https://koreapyj.dcmys.kr | |
// @downloadURL https://gist.github.com/koreapyj/9e79843a4d414b490c3b6c88024a50ae/raw/coupang_search.user.js | |
// @updateURL https://gist.github.com/koreapyj/9e79843a4d414b490c3b6c88024a50ae/raw/coupang_search.user.js | |
// @version 2025-10-08 | |
// @description 복수할테다 쿠팡 | |
// @author koreapyj | |
// @match https://www.coupang.com/np/search?* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=coupang.com | |
// @grant none | |
// ==/UserScript== | |
(async function() { | |
'use strict'; | |
const sleep = ms => new Promise(r => setTimeout(r,ms)) | |
const query = (new URLSearchParams(location.search)).get('q') | |
const query_segments = query.split(' ') | |
const apply_filter = () => { | |
const results = Array.from(document.querySelectorAll('#product-list>li')) | |
for(const row of results) { | |
const name = row.querySelector('[class^="ProductUnit_productName"]').textContent | |
for(const seg of query_segments) { | |
if(seg.startsWith('!')) { | |
if(name.toLowerCase().includes(seg.toLowerCase().substr(1))) { | |
row.style.display = 'none' | |
break | |
} | |
} | |
else { | |
if(!name.toLowerCase().includes(seg.toLowerCase())) { | |
row.style.display = 'none' | |
break | |
} | |
} | |
} | |
} | |
} | |
{ | |
const observer = new MutationObserver(apply_filter); | |
let target = null; | |
setInterval(()=>{ | |
if(target && document.body.contains(target)) return; | |
observer.disconnect(); | |
target = document.getElementById('product-list'); | |
observer.observe(target, { | |
attributes: true, | |
characterData: true, | |
childList: true, | |
}); | |
apply_filter(); | |
},100); | |
} | |
{ | |
const price_regex = /\((\d+)(?:g|개입|개)당\s+([0-9,]+)원\)/; | |
let li = null; | |
setInterval(()=>{ | |
if(li && document.body.contains(li)) return; | |
if(!li) { | |
li = document.createElement('li'); | |
const label = document.createElement('label'); | |
label.textContent = '단가낮은순'; | |
li.appendChild(label); | |
li.addEventListener('click', () => { | |
const currentSelectedLi = li.parentNode.querySelector('[class^="Sort_selected"]'); | |
const className = Array.from(currentSelectedLi.classList.values()).find(x=>/^Sort_selected/.test(x)); | |
currentSelectedLi.classList.remove(className); | |
li.classList.add(className); | |
Array.from(document.querySelectorAll('#product-list > li')).sort((a,b)=>{ | |
const a_match = price_regex.exec(a.querySelector('[class^="PriceArea_priceArea"]').textContent) | |
const b_match = price_regex.exec(b.querySelector('[class^="PriceArea_priceArea"]').textContent) | |
if(!a_match && !b_match) return 0; | |
if(!a_match) return 1; | |
if(!b_match) return -1; | |
return Math.round(((~~a_match[2].replace(/,/g,'')) / ~~a_match[1].replace(/,/g,'')) * 100) - Math.round(((~~b_match[2].replace(/,/g,'')) / ~~b_match[1].replace(/,/g,'')) * 100) | |
}).forEach(elem=>elem.parentNode.appendChild(elem)); | |
}); | |
} | |
document.querySelector('#contents [class^="Sort_sort"]').appendChild(li); | |
},100); | |
} | |
})(); |
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 fc-ab-root remover | |
// @namespace https://koreapyj.dcmys.kr | |
// @downloadURL https://gist.github.com/koreapyj/9e79843a4d414b490c3b6c88024a50ae/raw/fc_ab_root_remover.user.js | |
// @updateURL https://gist.github.com/koreapyj/9e79843a4d414b490c3b6c88024a50ae/raw/fc_ab_root_remover.user.js | |
// @version 2025-09-28 | |
// @description fc-ab-root 귀찮아 | |
// @author koreapyj | |
// @match *://*/* | |
// @grant none | |
// @run-at document-body | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const disallowed_events = [ | |
'contextmenu', | |
'dragstart', | |
'selectstart', | |
]; | |
{ | |
for(const elem of [window, document]) { | |
const addEventListener = elem.addEventListener; | |
elem.addEventListener = function() { | |
if(disallowed_events.includes(arguments[0])) { | |
return; | |
} | |
return addEventListener.apply(this, arguments); | |
} | |
} | |
} | |
document.addEventListener('DOMContentLoaded', () => { | |
for(const event of disallowed_events) { | |
if(document[`on${event}`]) { | |
if(document[`on${event}`].toString().replace(/\s|;/g,'').match(/\{returnfalse\}/)) { | |
document[`on${event}`] = ()=>{}; | |
} | |
} | |
} | |
const apply_filter = () => { | |
const fcAbRootElem = document.querySelector('.fc-ab-root'); | |
if(!fcAbRootElem) return; | |
fcAbRootElem.remove(); | |
document.body.style.overflow = ''; | |
} | |
{ | |
const observer = new MutationObserver(apply_filter); | |
observer.observe(document.body, { | |
attributes: true, | |
characterData: true, | |
childList: true, | |
}); | |
} | |
apply_filter(); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment