Skip to content

Instantly share code, notes, and snippets.

@Bananamilk452
Last active June 15, 2022 12:17
Show Gist options
  • Save Bananamilk452/9649de5bd4c6557e3ddd9629bfa0499b to your computer and use it in GitHub Desktop.
Save Bananamilk452/9649de5bd4c6557e3ddd9629bfa0499b to your computer and use it in GitHub Desktop.
Remove Select
// ==UserScript==
// @name Remove Select from hiyobi
// @version 0.1
// @author You
// @match https://hiyobi.me/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=hiyobi.me
// @grant none
// @run-at document-start
// ==/UserScript==
let isitokay = false;
let loop = setInterval(() => {
if (isitokay) clearInterval(loop)
let sel = document.querySelector('select')
if (sel) {
isitokay = true;
sel.innerHTML = ''
}
}, 100)
const onChangeState = (state, title, url, isReplace) => {
let isitokay = false;
let loop = setInterval(() => {
if (isitokay) clearInterval(loop)
let sel = document.querySelector('select')
if (sel) {
isitokay = true;
sel.innerHTML = ''
}
}, 100)
}
// set onChangeState() listener:
['pushState', 'replaceState'].forEach((changeState) => {
// store original values under underscored keys (`window.history._pushState()` and `window.history._replaceState()`):
window.history['_' + changeState] = window.history[changeState]
window.history[changeState] = new Proxy(window.history[changeState], {
apply (target, thisArg, argList) {
const [state, title, url] = argList
onChangeState(state, title, url, changeState === 'replaceState')
return target.apply(thisArg, argList)
},
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment