Skip to content

Instantly share code, notes, and snippets.

@mfyz
Last active March 25, 2017 05:04
Show Gist options
  • Save mfyz/0fe41ed10584dfc2cf15be316939fd2e to your computer and use it in GitHub Desktop.
Save mfyz/0fe41ed10584dfc2cf15be316939fd2e to your computer and use it in GitHub Desktop.
Export trello card names in a list - userscript for Tampermonkey (or grease monkey browser extension)
// ==UserScript==
// @name Trello export card titles in a list
// @namespace http://www.mfyz.com/
// @version 1.0
// @description Export card names in a list
// @match https://trello.com/*
// @match https://*.trello.com/*
// @copyright 2017+, Mehmet Fatih Yildiz
// ==/UserScript==
function renderExportLinks (){
console.log('prepare export card names links for each list menu');
var lists_to_prepare_export_links = $('#board .list:not(.export_names_prepared)');
$.each(lists_to_prepare_export_links, function(i, e){
var el = $(e);
var list_title = el.find('.list-header-name').val();
el.addClass('export_names_prepared');
el.find('.list-header-extras-menu').click(function(){
//console.log(list_title);
setTimeout(function(){
var list_options = $('<hr><ul class="pop-over-list"><li><a href=\"#\" class="m-export-cardnames">Export Card Names</a></li></li>');
list_options.find('.m-export-cardnames').click(function(){
var card_names = '';
el.find('.list-card-title').map(function(j, f){ card_names += f.innerText + ' ' + f.href.substr(0,f.href.indexOf('/', 25)) + '\n'; });
prompt('Card Names (Copy and Enter)', card_names);
});
$('.pop-over .pop-over-content > div > div').append(list_options);
}, 50);
});
});
}
$(document).ready(function(){
renderExportLinks();
$(document).ajaxSuccess(function(e, xhr, opt) {
renderExportLinks();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment