source: trunk/plugins/MootoolsFileManager/mootools-filemanager/Assets/js/README.md @ 1321

Last change on this file since 1321 was 1321, checked in by gogo, 7 years ago

Merge the MootoolsFileManager?-Update branch into the trunk.

File size: 4.9 KB
Line 
1jsGET
2==============================================
3Copyright (C) Fabian Vogelsteller [frozeman.de]
4published under the GNU General Public License version 3
5
6This program is free software;
7you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
9
10This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12See the GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License along with this program;
15if not,see <http://www.gnu.org/licenses/>.
16_____________________________________________
17
18### AUTHOR
19Fabian Vogelsteller <http://frozeman.de>
20
21### DESCRIPTION
22jsGET is a http GET-Variables clone for javascript, using the hash part of the URL (index.html#...).
23You can set and get variables, and run a listener to hash changes, e.g. when the the history back button gets pressed.
24This allows you to create a usable history navigation in your ajax application. It should work with all A-grade browsers.
25
26### VERSION
270.2
28
29### INSTALLATION
30Just include the jsGET.js in your website/webapplication and use the jsGET object with its methods to set, get, remove history hash variables.
31See the demo.html for examples.
32
33### Properties
34- vars:                     (object) the hash variables object loaded by get(), set(), remove(), or clear() or load() plus various indicators and trackers:
35- vars.current:             (object) the current variables.
36- vars.old:                 (object) the old variables, before they where changed with set(), remove(), clear() or the browser history back button.   *WARNING*: this is one is only valid while the listener is invoked.
37- vars.changed:             (object) the variables which have changed since the last call of get(), set(), remove(), clear(), load() or the browser history back button.   *WARNING*: this is one is updated by setChangedVars() depending on 'vars.old' and usually is only valid while the listener is invoked.
38- vars.change_count:        (integer) a number of variables changed/added/removed since the last time the listener was invoked.   *WARNING*: this is one is updated by setChangedVars() depending on 'vars.old' and usually is only valid while the listener is invoked.
39- vars.last_hash_loaded:    (string, internal use only) the raw hash string which was just processed; in the listener, this equals the current hash.
40- vars.last_hash_saved:     (string, internal use only) the hash section string which was the last one generated by set(), clear() or remove().
41- vars.foreign_hash_change: (boolean) TRUE when the hash was changed from outside our control, e.g. when the user hit the 'back/history' button in the browser, after the previous invocation of the listener.
42- vars.hash_changed:        (boolean) TRUE when the hash has changed after the previous invocation of the listener.
43
44### Methods
45- load():                                 loads the current hash variables into the vars.current property as JSON object. Return the updated set of key/value pairs.
46- clear():                                clears the hash part of the URL. (because it's not completely possible, it sets it to "#_")
47- get(get):                               (string) try to get a hash variable with the given name.
48- set(set):                               (string,object) sets the given parameters to the hash variables. If it's a string it should have the following format: "key=value". Return the updated set of key/value pairs.
49- remove(remove):                         (string,array) the variable name(s) which should be removed from the hash variables. Return the old set of key/value pairs.
50- addListener(listener,callAlways,bind):  (listener: function, callAlways: boolean, bind: object instance) creates a listener which calls the given function when a hash change occurs. The called function will get the vars property (vars.current,vars.old,vars.changed) and use the "bind" parameter as "this", when specified.
51  The return of the addListener() method is a setInterval ID and must be passed to the removeListener() method to stop the listening.
52  When callAlways is FALSE, it only calls when the browser history buttons are pressed and not when get(), set(), remove() or clear() is called.
53- removeListener(listenerID):             (the setInterval Id received from a addListener() method) removes a listener set with the addListener() method.
54- setChangedVars():                       (internal use) updates the vars.changed collection and vars.change_count value.
55
56### ATTENTION!
57Everytime you call set(), remove() or clear() a new hash string will be set,
58that means you also create a new history step in the browser history!
59
60These are 'special' characters to jsGET and will therefor be encoded when they are part of a key or value:
61
62>  # & =
63
Note: See TracBrowser for help on using the repository browser.