Skip to content

Instantly share code, notes, and snippets.

@dbuteau
Created November 17, 2022 08:26
Show Gist options
  • Save dbuteau/36c50b2580af124c56b5e46a2200aa59 to your computer and use it in GitHub Desktop.
Save dbuteau/36c50b2580af124c56b5e46a2200aa59 to your computer and use it in GitHub Desktop.
UserScript(TamperMonkey) to toggle display of pouet column for framapiaf mastodon instance
// ==UserScript==
// @name Toggle Framapiaf column
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Daniel Buteau
// @match https://framapiaf.org/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=framapiaf.org
// @require https://code.jquery.com/jquery-3.6.1.slim.min.js
// @grant none
// ==/UserScript==
var button = $("a.drawer__tab").first();
var div = $("div.drawer");
var header= $(".drawer__header");
var pouet = $(".drawer__inner");
var reply = $("i.fa-reply");
console.debug('Loading toggle menu')
function toggleDiv(event){
try{
event.preventDefault();
// event.stopPropagation();
// event.stopImmediatePropagation();
if (div.css('width') == '50px') {
console.debug('Opening menu...')
pouet.css('display', 'block');
header.css('flex-direction','row');
div.css('width', 'auto');
}else{
console.debug('Closing menu...')
div.css('width', '50px');
header.css('flex-direction','column');
pouet.css('display', 'none');
}
}catch(e){
console.error(e);
}
}
try{
header.css('flex-direction','column');
div.css('width', '50px');
pouet.css('display', 'none');
button.click(toggleDiv);
reply.click(toggleDiv);
}catch(e){
console.error(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment