Created
May 24, 2024 03:12
-
-
Save 0-a-e/419a329e759ebeb8ce122c8620d56319 to your computer and use it in GitHub Desktop.
misskey readonly
This file contains 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 Misskey read-only | |
// @version 1.0 | |
// @description misskeyを読み専にするやつ | |
// @author @oae@msk.seppuku.club | |
// @match https://misskey.io/* | |
// @match https://msk.seppuku.club/* | |
// @grant none | |
// ==/UserScript== | |
window.addEventListener("load", function () { | |
'use strict'; | |
const observerConfig = { | |
childList: true, | |
subtree: true | |
}; | |
function observerCallback(mutationsList, observer) { | |
let controlBox; | |
let reactionButtonContainer; | |
let functionButtonContainer; | |
try { | |
controlBox = document.querySelectorAll('.xhAPG');// 下部ボックス v13? | |
reactionButtonContainer = document.querySelectorAll('.xlT1y'); // | |
functionButtonContainer =document.querySelectorAll('.xApN7'); | |
if(controlBox.length === 0){ | |
controlBox = document.querySelectorAll('.footer'); // 下部ボックス v12? | |
reactionButtonContainer = document.querySelectorAll('.tdflqwzn'); // | |
functionButtonContainer = document.querySelectorAll('.buttons'); // | |
} | |
} catch { | |
console.log('misskey read-only: error'); | |
} | |
controlBox.forEach(controlElems => { | |
try { | |
controlElems.childNodes.forEach((controlElem) => { | |
controlElem.childNodes.forEach((e) => { | |
try { | |
if(!Array.from(e.classList).includes('ti-dots')) { | |
controlElem.style.display = 'none'; | |
} | |
} catch { | |
} | |
}); | |
}); | |
} catch(e) { | |
console.log(e); | |
} | |
}); | |
reactionButtonContainer.forEach(reactionButtons => { | |
reactionButtons.childNodes.forEach(reactionButton => { | |
reactionButton.disabled = true; | |
reactionButton.classList.remove('cantoggle'); | |
}); | |
}); | |
functionButtonContainer.forEach(controlElems => { | |
try { | |
controlElems.childNodes.forEach((controlElem) => { | |
controlElem.childNodes.forEach((e) => { | |
try { | |
if(Array.from(e.classList).includes('ti-pencil')) { | |
controlElem.style.display = 'none'; | |
} | |
} catch { | |
} | |
}); | |
}); | |
} catch(e) { | |
console.log(e); | |
} | |
}); | |
} | |
const observer = new MutationObserver(observerCallback); | |
observer.observe(document.body, observerConfig); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment