Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ubiquity command for Check That Later.
/**
* 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
You can’t perform that action at this time.