Skip to content

Instantly share code, notes, and snippets.

@zwithz
Last active September 5, 2020 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zwithz/1763a360ae43f2d61974605c9e17ba00 to your computer and use it in GitHub Desktop.
Save zwithz/1763a360ae43f2d61974605c9e17ba00 to your computer and use it in GitHub Desktop.
Flomo evergreen theme for Tampermonkey
// ==UserScript==
// @name flomo-evergreen-theme
// @version 0.5
// @author zwithz
// @match https://flomo.app/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const url='https://gist.githubusercontent.com/zwithz/cbde0915b2675781675d89bcfd517f46/raw/';
fetch(url).then(rsp=>rsp.text()).then(csstxt=>{
let s = document.createElement('style');
s.setAttribute('type', 'text/css');
s.appendChild(document.createTextNode(csstxt));
document.querySelector('head').appendChild(s);
console.log('Inserted flomo evergreen theme, enjoy :\)');
})
function hideByClassName(className) {
const target = document.getElementsByClassName(className)[0];
target.style.display = target.style.display === "none" ? "" : "none";
}
function focusMode() {
hideByClassName('el-aside');
hideByClassName('input-box');
}
// Hide left sidebar and bottom input box
let parentNode = document.querySelectorAll('div.topbar')[0];
const siblingNode = document.querySelectorAll('div.search')[0];
let focusModeButton = document.createElement('input');
focusModeButton.setAttribute('type', 'button');
focusModeButton.setAttribute('id', 'hide-sidebar');
focusModeButton.setAttribute('value', '👨‍💻 ');
focusModeButton.setAttribute('padding', '5px');
focusModeButton.onclick = focusMode;
parentNode.insertBefore(focusModeButton, siblingNode);
//@deprecated Hide search bar
/*
let parentNode = document.querySelectorAll('#sidebar div.user')[0];
let hideTopbarButton = document.createElement('input');
hideTopbarButton.setAttribute('type', 'button');
hideTopbarButton.setAttribute('id', 'search');
hideTopbarButton.setAttribute('value', 'search');
hideTopbarButton.onclick = () => hide('topbar');
parentNode.appendChild(hideTopbarButton);
*/
/*let parentNode = document.querySelectorAll('div.stat + ul')[0];
let search = document.createElement('li');
search.setAttribute('class', '');
search.setAttribute('data-v-16bfa902', '');
search.innerHTML = 'Search';
search.onclick = () => hide('topbar');
parentNode.appendChild(search);*/
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment