Skip to content

Instantly share code, notes, and snippets.

@tobbbe
Last active February 7, 2020 16:40
Show Gist options
  • Save tobbbe/6f64c7cf765d3aaf0df63050219b1d56 to your computer and use it in GitHub Desktop.
Save tobbbe/6f64c7cf765d3aaf0df63050219b1d56 to your computer and use it in GitHub Desktop.
copy list items from trello
javascript:!function(){let e=prompt("Ange namn på listan du vill kopiera");e&&(e=e.toLowerCase().trim());let t=$(".list-header-name-assist").filter((t,n)=>n.innerHTML.toLowerCase()===e).first().closest(".list").find(".list-card-title").contents().toArray().filter(e=>3===e.nodeType).map(e=>e.data).reduce((e,t)=>(e.text=`${e.text}${t}\n`,e),{html:"",text:""});var n=window.open();const o=n.document.createElement("textarea");o.value=t.text,o.style="width:100%;height: 600px;font-size: 16px",n.document.body.appendChild(o),o.select(),n.document.execCommand("copy")}();
(function () {
let listname = prompt("Ange namn på listan du vill kopiera");
if(listname) {
listname = listname.toLowerCase().trim();
}
let nodes = $('.list-header-name-assist').filter((i, node) => node.innerHTML.toLowerCase() === listname).first().closest('.list').find('.list-card-title').contents().toArray();
let rows = nodes.filter(x => x.nodeType === 3).map(x => x.data).reduce((acc, curr) => {
acc.text = `${acc.text}${curr}\n`;
return acc;
}, {html: "", text: ""})
var newWindow = window.open();
//newWindow.document.write(`<pre>${rows.text}</pre>`);
const el = newWindow.document.createElement('textarea');
el.value = rows.text;
el.style = "width:100%;height: 600px;font-size: 16px";
newWindow.document.body.appendChild(el);
el.select();
newWindow.document.execCommand('copy');
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment