Skip to content

Instantly share code, notes, and snippets.

@hyrious
Last active October 13, 2023 01:41
Show Gist options
  • Save hyrious/35f7e2e271b76126068b0d25b9b65332 to your computer and use it in GitHub Desktop.
Save hyrious/35f7e2e271b76126068b0d25b9b65332 to your computer and use it in GitHub Desktop.
Who Starred Me - GitHub RSS
// ==UserScript==
// @name Who Starred Me - GitHub RSS
// @namespace star-rss.hyrious.me
// @match https://github.com/*.private.atom
// @grant none
// @version 1.0
// @author hyrious
// @description Because refined github hides them.
// ==/UserScript==
(async () => {
Object.assign(document.documentElement.dataset, {
colorMode: 'auto',
lightTheme: 'light',
darkTheme: 'dark',
})
const user = location.pathname.slice(1).split('.')[0]
const index = await fetch('/').then(r => r.text())
index.replace(/ href="(.+?\.css)"/g, (t, css) => {
const el = document.createElement('link')
el.rel = 'stylesheet'
el.href = css
document.head.append(el)
})
document.head.appendChild(document.createElement('style')).textContent = 'body { padding: 50px 30px }'
const filtered = []
const raw = document.querySelector('pre').textContent
const root = new DOMParser().parseFromString(raw, 'application/xml')
for (const entry of root.querySelectorAll('entry')) {
if (entry.querySelector('title').textContent.includes(' starred ' + user + '/')) {
filtered.push(entry)
}
}
let html = ''
for (const entry of filtered) {
html += entry.querySelector('content').textContent
}
document.body.innerHTML = html
})();
// ==UserScript==
// @name Read on GitHub RSS
// @namespace gh-rss.hyrious.me
// @match https://github.com/*.atom
// @grant none
// @version 1.0
// @author hyrious
// @description Because github new dashboard is terrible.
// ==/UserScript==
(async () => {
Object.assign(document.documentElement.dataset, {
colorMode: 'auto',
lightTheme: 'light',
darkTheme: 'dark',
})
const user = location.pathname.slice(1).split('.')[0]
const index = await fetch('/').then(r => r.text())
index.replace(/ href="(.+?\.css)"/g, (t, css) => {
const el = document.createElement('link')
el.rel = 'stylesheet'
el.href = css
document.head.append(el)
})
document.head.appendChild(document.createElement('style')).textContent = 'body { padding: 50px 30px }'
const filtered = []
const raw = document.querySelector('pre').textContent
const root = new DOMParser().parseFromString(raw, 'application/xml')
let html = ''
for (const entry of root.querySelectorAll('entry')) {
html += entry.querySelector('content').textContent
}
document.body.innerHTML = html
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment