Skip to content

Commit

Permalink
Works
Browse files Browse the repository at this point in the history
  • Loading branch information
agrobost committed Mar 25, 2017
1 parent 8205002 commit 500a3d1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
23 changes: 17 additions & 6 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ window.addEventListener("load", myMain, false);

function updateUI() {
"use strict";
//add link 'Copy emails to clipboard' to all divs. Links id are 0, 1, 2
//add link 'Copy emails to clipboard' to all divs. Links id are div0, div1, div2
$('.js-list.list-wrapper').each(function (i) {
"use strict";
$(this).find('.icon-sm.icon-overflow-menu-horizontal').click(function () {
Expand All @@ -12,11 +12,13 @@ function updateUI() {
//addclickListener
let numberOfDiv = $('.js-list.list-wrapper').length;
for (let i = 0; i < numberOfDiv; i++) {
$('#div' + i).click(function (i) {
console.log('hello from ' + i);
$('#div' + i).click(function () {
let str = getEmails(i);
console.log(str);
window.prompt("Copy to clipboard: Ctrl+C, Enter", str);
});
}
}, 50);
}, 100);
});
});
}
Expand All @@ -27,17 +29,26 @@ function extractEmails(text) {
}

function getEmails(idDiv) {
let str = '';
"use strict";
$('.js-list.list-wrapper').each(function (i) {
$(this).find('.list-card.js-member-droppable.ui-droppable').each(function (j) {
//test card label
if (!$(this).find('.card-label').hasClass('card-label-black')) {
if (!$(this).find('.card-label').hasClass('card-label-black') && i === idDiv) {
let email = $(this).find('.list-card-title.js-card-name').text().trim();
email = extractEmails(email);
console.log('bloc ' + i + ' ligne ' + j + ' ' + email);
if (email) {
if (!str) {
str += email;
} else {
str += ', ' + email + ' ';
}

}
}
});
});
return str.trim();
}

function myMain(evt) {
Expand Down
10 changes: 7 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"manifest_version": 2,

"name": "Chez Nestor Trello Addon",
"description": "Improves Trello and other internal tools for our use-cases",
"version": "1.0.1",
Expand All @@ -11,8 +10,13 @@
},
"content_scripts": [
{
"matches": ["https://trello.com/*"],
"js": ["content.js", "jquery.js"]
"matches": [
"https://trello.com/*"
],
"js": [
"content.js",
"jquery.js"
]
}
],
"browser_action": {
Expand Down

0 comments on commit 500a3d1

Please sign in to comment.