ƒ.url - Get-Kraken/fixx GitHub Wiki
ƒ.url.get.parameter
parameter(parameter, url)
returns the value of a url parameter / variable on the current page's url
url is OPTIONAL: can supply a different url from the current page url if required.
example:
assume the url is http://www.site.com?product=123&category=paper
ƒ.url.get.parameter('product'); → 123
ƒ.url.get.parameter('category'); → 'paper'
with custom url:
ƒ.url.get.parameter('product', 'http://www.site.com?product=123&category=paper');
// → 123
ƒ.url.get.parameter('category', 'http://www.site.com?product=123&category=paper');
// → 'paper'
ƒ.url.get.toggleChar
toggleChar(url)
(dependent on ƒ.string)
Used for dynamically building urls that might have url parameters already. This method will check and return the appropriate variable toggle
character i.e. ?
or &
example:
ƒ.url.get.toggleChar('http://www.site.com'); // → '?'
ƒ.url.get.toggleChar('http://www.site.com?product=123&category=paper'); // → '&'
ƒ.url.contains
contains(term, toLower)
(dependent on ƒ.string)
url string search with optional toLower
boolean
uses the current page url
assuming the following url: http://www.site.com?product=123&category=Paper
ƒ.url.contains('paper'); // → false
ƒ.url.contains('Paper'); // → true
ƒ.url.contains('paper', true); // → true
to search a custom url for a substring, use:
ƒ.string.contains('url','substring'); // → true / false