Skip to content

Instantly share code, notes, and snippets.

@lambdadog
Created March 4, 2018 06:17
Show Gist options
  • Save lambdadog/6c7f2d2e4edac2d2a67917428c97b7d9 to your computer and use it in GitHub Desktop.
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.
// ==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