Created
September 4, 2008 18:42
-
-
Save boucher/8843 to your computer and use it in GitHub Desktop.
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
function main(args, namedArgs) | |
{ | |
// FIXME: This code should be in Objective-J. | |
var args = window.location.hash.replace("#", "").split("/").slice(0), | |
searchParams = window.location.search.substring(1).split("&"); | |
namedArgs = [CPDictionary dictionary]; | |
for(var i=0, count = args.length; i<count; i++) | |
args[i] = decodeURIComponent(args[i]); | |
if([args containsObject:"debug"]) | |
CPLogRegister(CPLogPopup); | |
for(var i=0; i<searchParams.length; i++) | |
{ | |
var index = searchParams[i].indexOf('='); | |
if(index == -1) | |
[namedArgs setObject: "" forKey:searchParams[i]]; | |
else | |
[namedArgs setObject: searchParams[i].substring(index+1) forKey: searchParams[i].substring(0, index)]; | |
} | |
CPApplicationMain(args, namedArgs); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment