diff --git a/README.md b/README.md index efbbf4e..599d7b9 100755 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ ```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 ... - 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 diff --git a/trello_bookmarklet.js b/trello_bookmarklet.js index 23f2e97..ea36d35 100755 --- a/trello_bookmarklet.js +++ b/trello_bookmarklet.js @@ -37,6 +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\/500/)){ + name = 'Case:' + $('h2.pageDescription').text().trim() + ' ' + $('td:contains(Subject)').closest('td').next().text().trim(); + + 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; + } } else { // It isn't anything we recognize, but we'll see if we can make something using the selected text @@ -276,4 +284,4 @@ // Run the user portion run ]); -})(window); +})(window); \ No newline at end of file