Methods
- 
			
<static> parts( url ) → {FooGallery.utils.url~Parts}
Parses the supplied url into an object containing it's component parts.
 - 
	
Parameters
Name Type Description urlstring The url to parse.
Returns
Examples
// alias the FooGallery.utils.url namespace var _url = FooGallery.utils.url; console.log( _url.parts( "http://example.com/path/?param=true#something" ) ); // => {"hash":"#something", ...}Details
 - 
			
<static> full( url ) → {string}
Given a
urlthat could be relative or full this ensures a full url is returned. - 
	
Description
Given a full url this will simply return it however if given a relative url this will create a full url using the current location to fill in the blanks.
Parameters
Name Type Description urlstring The url to ensure is full.
Returns
Examples
// alias the FooGallery.utils.url namespace var _url = FooGallery.utils.url; console.log( _url.full( "http://example.com/path/" ) ); // => "http://example.com/path/" console.log( _url.full( "/path/" ) ); // => "{protocol}//{host}/path/" console.log( _url.full( "path/" ) ); // => "{protocol}//{host}/{pathname}/path/" console.log( _url.full( "../path/" ) ); // => "{protocol}//{host}/{calculated pathname}/path/" console.log( _url.full() ); // => null console.log( _url.full( 123 ) ); // => nullDetails
 - 
			
<static> param( search, key [, value ] ) → {string}
Gets or sets a parameter in the given
searchstring. - 
	
Parameters
Name Type Attributes Description searchstring The search string to use (usually
location.search).keystring The key of the parameter.
valuestring <optional> The value to set for the parameter. If not provided the current value for the
keyis returned.Returns
Examples
Shows how to retrieve a parameter value from a search string.
// alias the FooGallery.utils.url namespace var _url = FooGallery.utils.url, // create a search string to test search = "?wmode=opaque&autoplay=1"; console.log( _url.param( search, "wmode" ) ); // => "opaque" console.log( _url.param( search, "autoplay" ) ); // => "1" console.log( _url.param( search, "nonexistent" ) ); // => nullShows how to set a parameter value in the given search string.
// alias the FooGallery.utils.url namespace var _url = FooGallery.utils.url, // create a search string to test search = "?wmode=opaque&autoplay=1"; console.log( _url.param( search, "wmode", "window" ) ); // => "?wmode=window&autoplay=1" console.log( _url.param( search, "autoplay", "0" ) ); // => "?wmode=opaque&autoplay=0" console.log( _url.param( search, "v", "2" ) ); // => "?wmode=opaque&autoplay=1&v=2"Details
 
Type Definitions
- 
			
Parts
A plain JavaScript object returned by the FooGallery.utils.url.parts method.
 - 
	
Properties
Name Type Description hashstring A string containing a
#followed by the fragment identifier of the URL.hoststring A string containing the host, that is the hostname, a
:, and the port of the URL.hostnamestring A string containing the domain of the URL.
hrefstring A string containing the entire URL.
originstring A string containing the canonical form of the origin of the specific location.
pathnamestring A string containing an initial
/followed by the path of the URL.portstring A string containing the port number of the URL.
protocolstring A string containing the protocol scheme of the URL, including the final
:.searchstring A string containing a
?followed by the parameters of the URL. Also known as "querystring".Details