Toggle Trello Shortlinks

A bookmarklet for toggling Trello shortlinks on the face of each card.

HTML

<h1>Drag the Trello+ link below to your bookmarks bar</h1>

<a href='javascript:!function(){window.__shortlinks=!window.__shortlinks,$(".list-card-title").each(function(e){var t=$(this)[0];if(window.__shortlinks){var o=t.href,n=/trello\.com\/c\/(.*)\//;shortlink="https://trello.com/c/" + n.exec(o)[1],d=document.createElement("span"),d.innerText=shortlink,d.className="card-short-link",d.style.fontSize="80%",d.style.marginLeft="5px",d.style.padding="1px 2px",d.style.color="rgb(221, 17, 68)",d.style.backgroundColor="rgb(247, 247, 249)",d.style.border="1px solid rgb(225, 225, 232)",d.style.borderRadius="3px",d.dataset.shortlink=shortlink,d.addEventListener("click",function(e){var t=document.createElement("textarea");return document.body.appendChild(t),t.value=this.dataset.shortlink,console.log("shortlink:"+this.dataset.shortlink),t.focus(),document.execCommand("SelectAll"),document.execCommand("Copy",!1,null),t.remove(),e.preventDefault(),e.stopPropagation(),!1}),t.appendChild(d)}else $(".card-short-link",t).remove()})}();'>Trello+</a>

<p>See <code><a href='https://github.com/shyam-habarakada/node-github-webhooks/'>https://github.com/shyam-habarakada/node-github-webhooks/</a></code> for more details</p>