NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name VTrello // @namespace http://tampermonkey.net/ // @version 0.0.7 // @description Enhances Trello for my board (Biome Defense) // @author Venryx // @match https://trello.com/b/qLhVk9M1/* // @match https://trello.com/b/2ZYLJ2l1/* // @grant none // @require http://code.jquery.com/jquery-latest.js // ==/UserScript== (function() { 'use strict'; var mainStyle = $("<style>").appendTo("body").html(` /*.list-header { padding-right: 25px !important; }*/ /*.list-wrapper:first-child { width: 220px !important; }*/ `); var toggleLeftLists_style = $("<style>").appendTo("body"); var toggleLeftLists = $(`<button style="min-height: 27px; height: 27px; margin-top: 0; padding: 0px 10px;"></button>`); $("#permission-level").after(toggleLeftLists); toggleLeftLists.click(function() { var listsOpen = $(".list-wrapper:first-child").is(":visible"); listsOpen = !listsOpen; toggleLeftLists_style.html(listsOpen ? "" : ` .list-wrapper:first-child { display: none !important; } ${$(".list-wrapper:nth-child(2):contains(Roadmap/megatasks)").length ? ".list-wrapper:nth-child(2) { display: none !important; }" : ""} #board { padding-left: 5px; } `); toggleLeftLists.html(`${listsOpen ? "Hide" : "Show"} notes and roadmap`); }); //toggleLeftLists.click(); $(()=>toggleLeftLists.click()); // adds "add card" button at top of each list $(()=> { $(".list-header-extras").each((index, item)=>{ console.log("Adding..."); var button = $(`<button style="position: absolute; min-height: 20px; height: 20px; margin-top: 0; padding: 0px 10px; font-size: 13px;">Add card</button>`); button.click(e=>{ var popupHider = $(`<style id="popupHider">.pop-over { display: none !important; }</style>`).appendTo("body"); // var openListButton = $(item).children(".js-open-list-menu"); openListButton[0].click(); var timerFunc = setInterval(()=> { var addCardMenuItem = $(".js-add-card:not(input)"); if (addCardMenuItem.length) { clearInterval(timerFunc); addCardMenuItem[0].click(); //setTimeout(()=>addCardMenuItem[0].click(), 100); //setTimeout(()=>addCardMenuItem[0].click(), 1000); popupHider.remove(); } }, 50); e.stopPropagation(); }); $(item).after(button); }); }); // makes-so when a card is open, and user alt-clicks, card completedness is toggled $(document).mousedown(e=>{ if (e.altKey) { var textBox = $(".js-card-detail-title-input"); if (textBox.length == 0) return; var text = textBox.val(); var estimateMatch = text.match(/^\(([0-9.]+)\) /); if (estimateMatch == null) return; var estimate = parseFloat(estimateMatch[1]); var finishedMatch = text.match(/\[[0-9.]+\]$/); var newText = text; if (finishedMatch) newText = newText.substr(0, newText.lastIndexOf("[") - 1); else newText += " [" + estimate + "]"; textBox.focus(); textBox.val(newText); } }); })();