jUri documentation (v0.4)

Version 0.4



.ajax()

Updated in 0.4
jUri.ajax( url )
jUri.ajax( data )

url The url to load, the function will return the xmlhttpRequest method
data A map of these properties:

Scroll to top

.anchorExists()

jUri.anchorExists( name [, callback] )

name A string to search an anchor like
callback A function to be executed if the anchor exists (the anchor is passed as argument of the function)

Scroll to top

.animateAnchorLinks()

jUri.animateAnchorLinks( )
jUri.animateAnchorLinks( [anchors] [, changehash] )

This function set an animate scrolling when a link like Bar is clicked (an there is an anchor like )
anchors The anchor name's to be animated, separated by ','. The string can be '*' to animate all the anchors
changehash A boolean, if true, the hash is changed after each scroll

Scroll to top

.back()

Since 0.2
jUri.back( [int][, fallback] )

Calls window.history.back()
int Number of pages to go back in the history
fallback A function to execute if it fails

Scroll to top

.get()

Updated in 0.3
jUri.get( )
jUri.get( str )

Returns a map of the GET vars in the current url. If str is passed as an argument, .get() tries to convert it in a map
str A string like '?foo=bar&b=f'

Scroll to top

.hash()

jUri.hash( )//returns the current hash
jUri.hash( newhash )//set a new hash
jUri.hash( regexp [, callback] )//match the current hash with the regexp, returns true/false. If true, execute the callback

newhash A string with the new hash
regexp A regular expresion to be matched with the current hash
callback A function to be executed if the hash matches with the regexp

Scroll to top

.hashchange()

jUri.hashchange( callback )

callback A function to be executed when the hash changes

Scroll to top

.host()

Updated in 0.3
jUri.host( )

Returns window.location.host

Scroll to top

.hostname()

Updated in 0.3
jUri.hostname( )

Returns window.location.hostname

Scroll to top

.href()

Updated in 0.3
jUri.href( )

Returns window.location.href

Scroll to top

.isFile()

jUri.isFile( [callback] )

This function checks if the current url is a file-url (but doesn't check if the file exists)
callback A function to be executed if the url is a file-url

Scroll to top

.isHTTP()

jUri.isHTTP( )

Returns true/false when the current protocol is http://

Scroll to top

.isHTTPS()

jUri.isHTTPS( )

Returns true/false when the current protocol is https://

Scroll to top

.parseAsGet()

Deprecated in 0.3, use .get() instead
jUri.parseAsGet( getstring )

getstring A string like '?foo=bar&b=f'
Returns a map of the vars passed in the string

Scroll to top

.pathname()

Updated in 0.3
jUri.pathname( )

Returns window.location.pathname

Scroll to top

.port()

Updated in 0.3
jUri.host( )

Returns window.location.port

Scroll to top

.protocol()

Updated in 0.3
jUri.protocol( )

Returns window.location.protocol

Scroll to top

.redirect()

jUri.redirect( url [, timeout] )

url The url to redirect to
timeout An integer in miliseconds to redirect after that time

Scroll to top

.reload()

jUri.redirect( [timeout] )

timeout An integer in miliseconds to reload after that time

Scroll to top

.set()

Updated in 0.4
jUri.set( url [, fallback] )
jUri.set( object [, fallback][, newState] ) jUri.set( object [, fallback][, forceUrlChangeEvent][, newState] )

url A string with the url to set
fallback A function to be executed if the browser doesn't support url changes
object A map of these three properties:


newState A bool, true by default. If it's true, the method will be history.pushState, else history.replaceState.
forceUrlChangeEvent If there's set an .urlchange() listener with fireOnJUriSet=false, this will fire anyway

Scroll to top

.title()

jUri.title( title )
jUri.title( array[, ms] )
//It returns always a .stop() method, check tester.html to see its use

title A string with the new window title
array An set of titles to change to periodically
ms An integer in miliseconds to set the period of title changing

Scroll to top

.urlchange()

New in 0.3
fireOnJUriSet new in 0.4
jUri.urlchange( callback[, fireOnHashChange][, fireOnJUriSet] )

callback A function to be executed when the url changes
fireOnHashChange A bool, false by default
fireOnJUriSet A bool, false by default. The event will not fire if the url is changed using jUri.set('')

Scroll to top