Last active
May 12, 2024 10:29
-
-
Save FlandreDaisuki/e92fe0e863d2881681fc9e16a1634949 to your computer and use it in GitHub Desktop.
安裝 Tampermonkey 後,點 Raw 下載→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→→↘
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 slido mark as read | |
// @namespace https://flandre.tw | |
// @version 0.0.2 | |
// @description Add "mark as read" function to slido question | |
// @author FlandreDaisuki | |
// @match https://app.sli.do/event/* | |
// @require https://unpkg.com/[email protected]/dist/winkblue.umd.js | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=sli.do | |
// @grant none | |
// ==/UserScript== | |
/* global winkblue */ | |
winkblue.on('[data-testid="question-list-item"]', (questionListItemEl) => { | |
console.log(questionListItemEl); | |
const questionHeaderEl = questionListItemEl.querySelector('.question-item__header-center'); | |
const labelEl = document.createElement('label'); | |
labelEl.innerHTML = `<input type="checkbox">`; | |
questionHeaderEl.insertAdjacentElement('afterend', labelEl); | |
}); | |
winkblue.on('.question-form-ui + .content-header', (contentHeaderEl) => { | |
contentHeaderEl.insertAdjacentHTML('afterend', ` | |
<label style="display: block; text-align: right;"> | |
隱藏已讀 | |
<input type="checkbox" id="hide-all-read"> | |
</label> | |
`); | |
}); | |
document.body.insertAdjacentHTML('beforeend', ` | |
<style> | |
[data-testid="question-list-item"]:has(label > input:checked) .question-item__body { | |
opacity: 0.3; | |
text-decoration-line: line-through; | |
} | |
#live-tabpanel-questions:has(input#hide-all-read:checked) [data-testid="question-list-item"]:has(label > input:checked) { | |
display: none; | |
} | |
</style> | |
`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment