|Last Updated|| ||Ratings|| ||Unique User Downloads|| ||Download Rankings|
|2011-02-12 (5 years ago) ||Not enough user ratings||Total: 314 ||All time: 126 This week: 53|
This object can be used to set and get variable passed in the page URL hash.
It can retrieve the current page URL and parse the value in front of the URL hash, if present.
The object can also set new variable values and add listener so given callback functions are called when the variables in the current page URL hash are changed eventually when links in the page are clicked or the user used the browser back or forward buttons.
Copyright (C) Fabian Vogelsteller [frozeman.de]
published under the GNU General Public License version 3
This program is free software;
you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program;
if not,see <http://www.gnu.org/licenses/>.
Fabian Vogelsteller <http://frozeman.de>
You can set and get variables, and run a listener to hash changes, e.g. when the the history back button get pressed.
This allows you to create a usable history navigation in your ajay application. It should work with all a-grade browsers.
Just include the jsGET.js in your website/webapplication and use the jsGET object with it's methods to set, get, remove history hash variables.
See the demo.html for examples.
- vars: (object) the hash variables object loaded by get(), set(), remove(), or clear() or load().
- vars.current: (object) the current variables.
- vars.old: (object) the old variables, before they where changed with get(), set(), remove(), or clear(),load() or the browser history back button.
- vars.changed: (object) the variabels which have changed since the last call of get(), set(), remove(), or clear(), load() or the browser history back button.
- load(): loads the current hash variables into an JSON object.
- clear(): clears the hash part of the URL.
- get(get): (string) try to get a hash variable with the given name.
- set(set): (string,number,object) sets the given parameters to the hash variales. If its a string it should have the following format: "key=value".
- remove(remove): (string,array) the variable name(s) which should be removed from the hash variables
- addListener(listener,callAlways,bind): (listener: function, callAlways: boolean, bind: object instance) creates a listener which calls the given function, when a hash change appears. The called function will get the vars property (vars.current,vars.old,vars.changed) and the "bind" as "this", when specified.
The return of the addListener() method is a setInterval ID and must be passed to the removeListener() method, to stop the listening.
When callAlways is FALSE, it only calls when the browser history buttons are pressed and not when get(), set(), remove() or clear() is called.
- removeListener(listenerID): (the setInterval Id get from a addListener() method) removes a listener set with the addListener() method.
Everytime you call set(), remove() or clear() a new hash string will be set,
that means you also create a new history step in the browser history!
||Applications that use this package
If you know an application of this package, send a message to the author to add a link here.
Here you can find the latest code of jsGET
||Pages that reference this package
Latest pages that reference packages