From 09af858132cf9e8b156fc468107fcf0fc1c70b75 Mon Sep 17 00:00:00 2001 From: Palaniraja Date: Wed, 23 Jan 2013 19:51:44 +0530 Subject: [PATCH 1/6] testing --- trello_bookmarklet.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/trello_bookmarklet.js b/trello_bookmarklet.js index 23f2e97..9f11f36 100755 --- a/trello_bookmarklet.js +++ b/trello_bookmarklet.js @@ -37,6 +37,8 @@ // We're looking at a redmine issue name = $("#content h2:first").text().trim() + ": " + $("#content h3:first").text().trim(); + } else if(desc.match(/salesforce.com/)){ + alert('Yes salesforce'); } else { // It isn't anything we recognize, but we'll see if we can make something using the selected text From 66fa44ece8a2e05ed908529621f35a4c5fe7f47e Mon Sep 17 00:00:00 2001 From: Palaniraja Date: Wed, 23 Jan 2013 20:11:44 +0530 Subject: [PATCH 2/6] Salesforce Case to Trello Use case description or recent comment for card description. --- trello_bookmarklet.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/trello_bookmarklet.js b/trello_bookmarklet.js index 9f11f36..3659908 100755 --- a/trello_bookmarklet.js +++ b/trello_bookmarklet.js @@ -37,8 +37,14 @@ // We're looking at a redmine issue name = $("#content h2:first").text().trim() + ": " + $("#content h3:first").text().trim(); - } else if(desc.match(/salesforce.com/)){ - alert('Yes salesforce'); + } else if(desc.match(/salesforce.com\/500/)){ + name = 'Case:' + $('h2.pageDescription').text().trim() + ' ' + $('td:contains(Subject)').closest('td').next().text().trim(); + + if($('td.dataCell').eq(0).text().trim().length){ + desc = $('td.dataCell').eq(0).text().trim() + '\n\n\n' + location.href; + }else{ + desc = $('td:contains(Description)').closest('td').next().text().trim() + '\n\n\n' + location.href; + } } else { // It isn't anything we recognize, but we'll see if we can make something using the selected text From aef6e7b8dd3f7b6e5cc4bdd00f72b9cbe52dcb45 Mon Sep 17 00:00:00 2001 From: Palaniraja Date: Thu, 24 Jan 2013 13:35:59 +0530 Subject: [PATCH 3/6] updated to see if there is any case comment --- trello_bookmarklet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trello_bookmarklet.js b/trello_bookmarklet.js index 3659908..0229fc9 100755 --- a/trello_bookmarklet.js +++ b/trello_bookmarklet.js @@ -40,7 +40,7 @@ } else if(desc.match(/salesforce.com\/500/)){ name = 'Case:' + $('h2.pageDescription').text().trim() + ' ' + $('td:contains(Subject)').closest('td').next().text().trim(); - if($('td.dataCell').eq(0).text().trim().length){ + if($('span.listTitle:contains(Case Comments[0])').length){ desc = $('td.dataCell').eq(0).text().trim() + '\n\n\n' + location.href; }else{ desc = $('td:contains(Description)').closest('td').next().text().trim() + '\n\n\n' + location.href; From 075e55cd5ecb7b7cccbd40f1cc2e9b7196f612bf Mon Sep 17 00:00:00 2001 From: Palaniraja Date: Thu, 24 Jan 2013 13:40:36 +0530 Subject: [PATCH 4/6] if condition reversed --- trello_bookmarklet.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trello_bookmarklet.js b/trello_bookmarklet.js index 0229fc9..2207722 100755 --- a/trello_bookmarklet.js +++ b/trello_bookmarklet.js @@ -40,7 +40,7 @@ } else if(desc.match(/salesforce.com\/500/)){ name = 'Case:' + $('h2.pageDescription').text().trim() + ' ' + $('td:contains(Subject)').closest('td').next().text().trim(); - if($('span.listTitle:contains(Case Comments[0])').length){ + if($('span.listTitle:contains(Case Comments[0])').length != 0){ desc = $('td.dataCell').eq(0).text().trim() + '\n\n\n' + location.href; }else{ desc = $('td:contains(Description)').closest('td').next().text().trim() + '\n\n\n' + location.href; From b85b8220087039b2e209fcb32ef03e47434784ae Mon Sep 17 00:00:00 2001 From: palaniraja Date: Thu, 24 Jan 2013 14:18:36 +0530 Subject: [PATCH 5/6] Send SF case to Trello --- README.md | 2 +- trello_bookmarklet.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index efbbf4e..1c5d09b 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ```javascript -javascript:(function(a){window.trelloAppKey="optional";window.trelloIdList="optional";var b=a.createElement("script");b.src="https://raw.github.com/danlec/Trello-Bookmarklet/master/trello_bookmarklet.js";a.getElementsByTagName("head")[0].appendChild(b)})(document); +javascript:(function(a){window.trelloAppKey="optional";window.trelloIdList="optional";var b=a.createElement("script");b.src="https://raw.github.com/palaniraja/Trello-Bookmarklet/master/trello_bookmarklet.js";a.getElementsByTagName("head")[0].appendChild(b)})(document); ``` This is a bookmarklet you can use to create a card in Trello from ... diff --git a/trello_bookmarklet.js b/trello_bookmarklet.js index 2207722..ea36d35 100755 --- a/trello_bookmarklet.js +++ b/trello_bookmarklet.js @@ -40,10 +40,10 @@ } else if(desc.match(/salesforce.com\/500/)){ name = 'Case:' + $('h2.pageDescription').text().trim() + ' ' + $('td:contains(Subject)').closest('td').next().text().trim(); - if($('span.listTitle:contains(Case Comments[0])').length != 0){ - desc = $('td.dataCell').eq(0).text().trim() + '\n\n\n' + location.href; + if($('span.listTitle:contains(Case Comments[0])').length != 1){ + desc = $('td.dataCell').eq(0).text().trim() + '\n\n\n' + location.href; }else{ - desc = $('td:contains(Description)').closest('td').next().text().trim() + '\n\n\n' + location.href; + desc = $('td:contains(Description)').closest('td').next().text().trim() + '\n\n\n' + location.href; } } else { @@ -284,4 +284,4 @@ // Run the user portion run ]); -})(window); +})(window); \ No newline at end of file From 52aa6f6f18e5db096b29368815ca055c1f64330a Mon Sep 17 00:00:00 2001 From: Palaniraja Date: Thu, 31 Jan 2013 20:09:17 +0530 Subject: [PATCH 6/6] added salesforce to the list. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c5d09b..599d7b9 100755 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ javascript:(function(a){window.trelloAppKey="optional";window.trelloIdList="opti This is a bookmarklet you can use to create a card in Trello from ... - FogBugz cases + - Salesforce cases - Copies Case subject as description or recent comment if exists. - JIRA issues - GitHub issues and commits - The selected text from an arbitrary URL @@ -31,4 +32,4 @@ and prepending `javascript:` to the front. If you'd rather not add your appKey and idList for every new domain, you can modify the bookmarklet and include values for `window.trelloAppKey` and `window.trelloIdList` (currently both have the value `"optional"`) -**Note:** This basic concept originated with https://github.com/markdrago/cardorizer; this approach doesn't require you to run a server \ No newline at end of file +**Note:** This basic concept originated with https://github.com/markdrago/cardorizer; this approach doesn't require you to run a server