Created
October 20, 2010 04:56
-
-
Save zilbuz/635792 to your computer and use it in GitHub Desktop.
Ubiquity command for Check That Later.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This Ubiquity command is designed to use the website | |
* checkthatlater.ftpix.com, created by Gonzague. | |
* | |
* Author : Zilbuz | |
*/ | |
var base_url = "http://www.checkthatlater.com/"; | |
CmdUtils.CreateCommand({ | |
names: ["check that later login", | |
"checkthatlater login", | |
"ctl login", | |
"check later login", | |
"checklater login"], | |
description: "Login to Check that later (by Gonzague).", | |
help: "If you're not logged in, select this command to go to the website of Check that later", | |
author: { | |
name: "Zilbuz", | |
}, | |
execute: function execute(args) { | |
Utils.openUrlInBrowser(base_url); | |
}, | |
preview: function preview(pblock, args) { | |
pblock.innerHTML = _("Login to Check that later"); | |
}, | |
}); | |
CmdUtils.CreateCommand({ | |
names: ["check that later logout", | |
"checkthatlater logout", | |
"ctl logout", | |
"check later logout", | |
"checklater logout"], | |
description: "Logout of Check that later (by Gonzague).", | |
help: "If you're logged in, select this command to go to the website of Check that later and logout", | |
author: { | |
name: "Zilbuz", | |
}, | |
execute: function execute(args) { | |
Utils.openUrlInBrowser(base_url + "/User/logout"); | |
}, | |
preview: function preview(pblock, args) { | |
pblock.innerHTML = _("Logout of Check that later"); | |
}, | |
}); | |
CmdUtils.CreateCommand({ | |
names: ["check that later list", | |
"checkthatlater list", | |
"ctl list", | |
"check later list", | |
"checklater list"], | |
description: "List the websites you haven't read yet on check that later (by Gonzague).", | |
help: "This command will bring you to the website of check that later to see the list of the URLs you haven't seen yet.", | |
author: { | |
name: "Zilbuz", | |
}, | |
execute: function execute(args) { | |
Utils.openUrlInBrowser(base_url); | |
}, | |
preview: function preview(pblock, args) { | |
pblock.innerHTML = _("Your website list on check that later"); | |
CmdUtils.previewGet(pblock, base_url, function (htm) { | |
pblock.innerHTML = htm; | |
}); | |
}, | |
}); | |
CmdUtils.CreateCommand({ | |
names: ["check that later", | |
"checkthatlater", | |
"ctl", | |
"check later", | |
"checklater"], | |
description: "Save URLs so you can check them later (Ubiquity script to use checklater.ftpix.com by Gonzague)", | |
help: "Just type 'check that later' or 'ctl' to save the current page.", | |
author: { | |
name: "Zilbuz", | |
}, | |
arguments: [{role: "object", | |
nountype: noun_type_url, | |
label: "url"}], | |
execute: function execute(args) { | |
if(args.object.text != "" && args.object.text != undefined && args.object.text != null){ | |
var paramStr = "link="+escape(args.object.text); | |
jQuery.ajax({ | |
type:"POST", | |
url: base_url+"API/add", | |
data: paramStr, | |
success: function(html){ | |
if(html == 1){ | |
displayMessage(_("Link added : ${url}", {url: args.object.text})); | |
}else if(html == -1){ | |
displayMessage(_("Please log in to http://checklater.ftpix.com first.")); | |
} | |
}, | |
error: function(){displayMessage(_("Error"));} | |
}); | |
}else{ | |
displayMessage(_("No link selected")); | |
} | |
}, | |
preview: function preview(pblock, args) { | |
pblock.innerHTML = _("Check that later : ${url}", {url: args.object.text}); | |
}, | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment