Permalink
Browse files

simplify function names

  • Loading branch information...
1 parent f403c4a commit cbf5c2d222e33ac9535e3ff2b1f6745e3f06eb34 @chitsaou committed Apr 26, 2012
Showing with 19 additions and 19 deletions.
  1. +6 −6 context-menu.js
  2. +9 −9 copy-as-markdown.js
  3. +4 −4 service.js
View
@@ -10,7 +10,7 @@ chrome.contextMenus.create({
type: "normal",
contexts: ["page"],
onclick: function copyPageAsMarkdownCallback(info, tab) {
- CopyAsMarkdown.copyLinkAsMarkdown(tab.title, tab.url, {use_identifier: false});
+ CopyAsMarkdown.copyLink(tab.title, tab.url, {use_identifier: false});
}
});
@@ -20,7 +20,7 @@ chrome.contextMenus.create({
type: "normal",
contexts: ["page"],
onclick: function copyPageAsMarkdownCallback(info, tab) {
- CopyAsMarkdown.copyLinkAsMarkdown(tab.title, tab.url, {use_identifier: true});
+ CopyAsMarkdown.copyLink(tab.title, tab.url, {use_identifier: true});
}
});
@@ -38,7 +38,7 @@ chrome.contextMenus.create({
} else {
linkText = info.selectionText;
}
- CopyAsMarkdown.copyLinkAsMarkdown(linkText, info.linkUrl, {use_identifier: false});
+ CopyAsMarkdown.copyLink(linkText, info.linkUrl, {use_identifier: false});
}
});
@@ -57,7 +57,7 @@ chrome.contextMenus.create({
linkText = info.selectionText;
}
- CopyAsMarkdown.copyLinkAsMarkdown(linkText, info.linkUrl, {use_identifier: true});
+ CopyAsMarkdown.copyLink(linkText, info.linkUrl, {use_identifier: true});
}
});
@@ -66,7 +66,7 @@ chrome.contextMenus.create({
title: "Image ![](src)", // TODO: how to fetch alt text?
type: "normal",
contexts: ["image"],
- onclick: function copyImageAsMarkdownCallback(info, tab) {
- CopyAsMarkdown.copyImageAsMarkdown("", info.srcUrl);
+ onclick: function copyImageCallback(info, tab) {
+ CopyAsMarkdown.copyImage("", info.srcUrl);
}
});
View
@@ -22,18 +22,18 @@ var CopyAsMarkdown = new (function() {
resultContainer.value = text;
};
- var copyMarkdownCodeToClipboard = function() {
+ var copyResultToClipboard = function() {
resultContainer.select();
document.execCommand('Copy');
}
- this.copyLinkAsMarkdown = function(title, url, options) {
+ this.copyLink = function(title, url, options) {
var markdown = Markdown.linkTo(title, url, options);
setMarkdownResult(markdown);
- copyMarkdownCodeToClipboard();
+ copyResultToClipboard();
}
- this.copyLinksAsListMarkdown = function(links, options) {
+ this.copyListOfLinks = function(links, options) {
var md_list = [];
for(var i in links) {
var md = Markdown.linkTo(links[i].title, links[i].url, options);
@@ -42,19 +42,19 @@ var CopyAsMarkdown = new (function() {
var markdown = md_list.join("\n");
setMarkdownResult(markdown);
- copyMarkdownCodeToClipboard();
+ copyResultToClipboard();
};
- this.copyImageAsMarkdown = function(title, url) {
+ this.copyImage = function(title, url) {
var markdown = Markdown.imageFor(title, url);
setMarkdownResult(markdown);
- copyMarkdownCodeToClipboard();
+ copyResultToClipboard();
}
this.copyCurrentTab = function(options, callback) {
getCurrentTab(function(tab) {
// XXX: Bad namespacing! (CoffeeScript's binding can resolve this issue)
- CopyAsMarkdown.copyLinkAsMarkdown(tab.title, tab.url, options);
+ CopyAsMarkdown.copyLink(tab.title, tab.url, options);
callback();
});
};
@@ -71,7 +71,7 @@ var CopyAsMarkdown = new (function() {
};
// XXX: Bad namespacing! (CoffeeScript's binding can resolve this issue)
- CopyAsMarkdown.copyLinksAsListMarkdown(links, options);
+ CopyAsMarkdown.copyListOfLinks(links, options);
callback();
});
};
View
@@ -1,11 +1,11 @@
chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
switch(request.action) {
- case "copyLinkAsMarkdown":
- var md = CopyAsMarkdown.copyLinkAsMarkdown(request.params.title, request.params.url, request.params.options);
+ case "copyLink":
+ var md = CopyAsMarkdown.copyLink(request.params.title, request.params.url, request.params.options);
sendResponse({markdown: md});
break;
- case "copyLinksAsListMarkdown":
- var md = CopyAsMarkdown.copyLinksAsListMarkdown(request.params.links, request.params.options);
+ case "copyListOfLinks":
+ var md = CopyAsMarkdown.copyListOfLinks(request.params.links, request.params.options);
sendResponse({markdown: md});
break;
default:

0 comments on commit cbf5c2d

Please sign in to comment.