Ubiquity commands
CmdUtils.CreateCommand({
name: "dtag",
takes: {"tags": noun_arb_text},
homepage: "http://naveenium.com/code/ubiquity",
author: { name: "naveen", email: "naveenium+ubiquity@gmail.com"},
license: "MPL",
description: "Save current page to del.icio.us.",
help: "Tag and save current page to del.icio.us.",
preview: function( pblock ) {
var msg = 'Tags and saves current page to del.icio.us';
},
execute: function(tags) {
var baseUrl = "https://api.del.icio.us/v1/posts/add?";
var params = {tags: tags.text,
description: Application.activeWindow.activeTab.document.title,
url: Application.activeWindow.activeTab.document.location.href};
jQuery.ajax({
type: "GET",
url: baseUrl,
data: params,
error: function() { displayMessage("Could not save to del.icio.us"); },
success: function() { displayMessage("Saved to del.icio.us"); }
});
}
})
CmdUtils.CreateCommand({
name: "shifd",
homepage: "http://naveenium.com/code/ubiquity",
author: { name: "naveen", email: "naveenium+ubiquity@gmail.com"},
license: "MPL",
description: "Save current page to shifd.",
help: "Save current page to shifd.",
preview: function( pblock ) {
var msg = 'Save current page to shifd';
},
execute: function(tags) {
var baseUrl = "http://shifd.com/api/content/add?";
var params = {type_id: 3,
title: Application.activeWindow.activeTab.document.title,
content: Application.activeWindow.activeTab.document.location.href};
jQuery.ajax({
type: "GET",
url: baseUrl,
data: params,
error: function() { displayMessage("Could not save to shifd"); },
success: function(data) { if (data.errors.code == 562) { displayMessage("Not logged into shifd"); } else { displayMessage("Saved to shifd"); } }
});
}
})