Open main menu

CDOT Wiki β

Changes

Vesper:scratchspace

47 bytes removed, 21:24, 11 September 2008
Welcome to Vesper's Scratchspace~
==Welcome to Vesper's Scratchspace~==
'''Today's menu: ''' [https://wiki.mozilla.org/Labs/Ubiquity Ubiquity] URL noun type (and a basic function that uses it)
The regex in the code more or less says this:
universe://milky.way/earth/north-america/canada/ontario/
This is not valid, because All of these choices were arbitrarily chosen by me. I've never seen ll be pursuing the community for a better description of what a period in strings after the domain name. (In this case, the period between the "d" URL should and "e" makes it invalid.)  a://b.c/dshould not be.e
All of these choices were arbitrarily chosen by me. I'll be pursuing the community for a better description of what a URL should and should not be.
================================================================================================'''The code itself:'''
var noun_type_url = {
if(/^[A-Za-z0-9]+:\/\/([A-Za-z0-9_-]+)(\.([A-Za-z0-9_-]+))+*(\/([A-Za-z0-9_-~#=]+*))*[\/[A-Za-z0-9]*\.[A-Za-z0-9]*]?$/.test(text)){
return [ CmdUtils.makeSugg(text) ];
}
}
})
 
My apologies to those with screens that aren't 1280 pixels wide, but the regex doesn't like to be split into multiple lines.
 
'''Known issues:'''
You can't link to a file with an extension (such as ".html"), because of the period. This will be fixed shortly...
It can't handle the "?" in PHP querries. I assume there can only be one, and it must be after the filename (with the extension).  http://www.examplefoo.com/index.htmlphp?user=blarg  '''Credits:'''
Syntax for the sample command was edited from the sample "echo" command in the [https://wiki.mozilla.org/Labs/Ubiquity/Ubiquity_0.1_Author_Tutorial tutorial].
1
edit