Created
March 4, 2018 06:17
-
-
Save lambdadog/6c7f2d2e4edac2d2a67917428c97b7d9 to your computer and use it in GitHub Desktop.
A greasemonkey userscript (for niu.moe, but you just need to change the @include to switch that bit up) to add a "see more" arrow to statuses.
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 See More Mastodon | |
// @version 1 | |
// @grant none | |
// @include https://niu.moe/* | |
// ==/UserScript== | |
function addGlobalStyle(css) { | |
var head, style; | |
head = document.getElementsByTagName('head')[0]; | |
if (!head) { return; } | |
style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.innerHTML = css; | |
head.appendChild(style); | |
} | |
addGlobalStyle(` | |
.status > .status__action-bar::before { | |
content: "▼"; | |
padding-bottom: 5px; | |
font-size: 15px; | |
margin-left: 10px; | |
margin-right: 18px; | |
color:#606984 | |
} | |
.greasyshow > .status__action-bar::before { | |
content: "▲"; | |
} | |
.status > .status__content { | |
max-height:110px; | |
} | |
.greasyshow > .status__content { | |
max-height:200%; | |
} | |
`); | |
document.onclick = function(e) { | |
var el=document.elementFromPoint(e.clientX, e.clientY); | |
if(el.classList.contains("status__action-bar")){ | |
var par = el.parentElement; | |
if(par.classList.contains("greasyshow")){ | |
par.classList.remove("greasyshow"); | |
}else{ | |
par.classList.add("greasyshow"); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment