Skip to content

Instantly share code, notes, and snippets.

@eri451
Created April 30, 2012 14:28
Show Gist options
  • Save eri451/2558796 to your computer and use it in GitHub Desktop.
Save eri451/2558796 to your computer and use it in GitHub Desktop.
user title
let title = subscriber.getTitle(feedhref);
if (!options.feedtitle){
if (title === undefined || title === ""){
commandline.input("Title: ", createFeed, { argCount: "+"});
}
else{
createFeed(title)
}
else{
commandline.input("Change title \'" + title + "\' ? [y,N]",
getTitleFromUser,
{ argCount: "1" });
}
function createFeed(args){
if (typeof(args) === "string") title = args;
lvmsvc.createLivemark(
subscriber.getFeedFolderId(),
title,
iosvc.newURI(loc, null ,null),
iosvc.newURI(feedhref, null, null),
-1
);
}
function getTitleFromUser(args){
if (args[0].length === 0
|| "" + args[0] === "N"
|| "" + args[0] === "n"
|| "" + args[0] === "y"){
if ("" + args[0] !== "y") createFeed();
else
commandline.input("Title: ", createFeed, { argCount: "+" });
@dodo
Copy link

dodo commented Apr 30, 2012

how about:

        function getTitleFromUser(args){
            let arg = ("" + args[0]).toLowerCase();
            if (arg.length === 0 || arg === "n" || arg === "y"){
                    if (arg !== "y") createFeed();
                    else
                        commandline.input("Title: ", createFeed, { argCount: "+" });

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment