Last active
June 11, 2020 21:33
-
-
Save Aran-Fey/45a57f81c2ab4345dd7c95993d15b952 to your computer and use it in GitHub Desktop.
A userscript for StackExchange that adds a link to the question's timeline below the question.
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 StackExchange timeline link | |
// @description Adds a link to the question's timeline below the question | |
// @version 1.2.8 | |
// @author Paul Pinterits | |
// @include *://*.stackexchange.com/questions/* | |
// @include *://meta.serverfault.com/questions/* | |
// @include *://meta.stackoverflow.com/questions/* | |
// @include *://meta.superuser.com/questions/* | |
// @include *://serverfault.com/questions/* | |
// @include *://stackoverflow.com/questions/* | |
// @include *://superuser.com/questions/* | |
// @exclude *://*/questions/tagged/* | |
// @exclude *://*/questions/originals/* | |
// @exclude *://*/questions/ask | |
// @require https://github.com/Aran-Fey/userscript-lib/raw/ca6999d1bac2494421b70286f74d7a9a9ba636e7/userscript_lib.js | |
// @require https://github.com/Aran-Fey/SE-userscript-lib/raw/bf77f40b25d7fa88a6c3f474390c858446154ec2/SE_userscript_lib.js | |
// @grant none | |
// @updateURL https://gist.github.com/Aran-Fey/45a57f81c2ab4345dd7c95993d15b952/raw/SE_timeline_link.user.js | |
// @downloadURL https://gist.github.com/Aran-Fey/45a57f81c2ab4345dd7c95993d15b952/raw/SE_timeline_link.user.js | |
// ==/UserScript== | |
function add_timeline_link(post){ | |
let timeline_url = post.timeline_url; | |
let post_menu = post.menu_element; | |
if (post_menu.lastChild.href === timeline_url) | |
return; | |
let sep = document.createElement('SPAN'); | |
sep.classList.add('lsep'); | |
sep.textContent = '|'; | |
post_menu.appendChild(sep); | |
let link = document.createElement('A'); | |
link.textContent = 'timeline'; | |
link.title = "show this post's timeline"; | |
link.href = timeline_url; | |
post_menu.appendChild(link); | |
} | |
page.transform_posts(add_timeline_link, Rerun.AFTER_CHANGE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment