ajax 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +291 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/app/controllers/ajax_controller.rb +3 -0
- data/app/views/ajax/framework.html.erb +7 -0
- data/config/initializers/ajax.rb +14 -0
- data/lib/ajax.rb +79 -0
- data/lib/ajax/action_controller.rb +154 -0
- data/lib/ajax/action_view.rb +56 -0
- data/lib/ajax/helpers.rb +15 -0
- data/lib/ajax/helpers/request_helper.rb +76 -0
- data/lib/ajax/helpers/robot_helper.rb +31 -0
- data/lib/ajax/helpers/url_helper.rb +47 -0
- data/lib/ajax/railtie.rb +7 -0
- data/lib/ajax/routes.rb +12 -0
- data/lib/ajax/spec/extension.rb +34 -0
- data/lib/ajax/spec/helpers.rb +95 -0
- data/lib/ajax/tasks.rb +1 -0
- data/lib/rack-ajax.rb +60 -0
- data/lib/rack-ajax/decision_tree.rb +60 -0
- data/lib/rack-ajax/parser.rb +115 -0
- data/public/images/loading-icon-large.gif +0 -0
- data/public/images/loading-icon-small.gif +0 -0
- data/public/javascripts/ajax.js +529 -0
- data/public/javascripts/jquery.address-1.1.js +450 -0
- data/public/javascripts/jquery.address-1.1.min.js +11 -0
- data/public/javascripts/jquery.address-1.2.js +528 -0
- data/public/javascripts/jquery.address-1.2.min.js +25 -0
- data/public/javascripts/jquery.address-1.2rc.js +599 -0
- data/public/javascripts/jquery.address-1.2rc.min.js +27 -0
- data/public/javascripts/jquery.json-2.2.js +178 -0
- data/public/javascripts/jquery.json-2.2.min.js +31 -0
- data/rails/init.rb +4 -0
- data/rails/install.rb +23 -0
- data/rails/uninstall.rb +1 -0
- data/spec/ajax/helpers_spec.rb +102 -0
- data/spec/ajax/request_helper_spec.rb +33 -0
- data/spec/integration/ajax_spec.rb +146 -0
- data/spec/rack-ajax/parser_spec.rb +62 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +18 -0
- data/tasks/ajax_tasks.rake +15 -0
- metadata +106 -0
| @@ -0,0 +1,528 @@ | |
| 1 | 
            +
            /*
         | 
| 2 | 
            +
             * jQuery Address Plugin v1.2
         | 
| 3 | 
            +
             * http://www.asual.com/jquery/address/
         | 
| 4 | 
            +
             *
         | 
| 5 | 
            +
             * Copyright (c) 2009-2010 Rostislav Hristov
         | 
| 6 | 
            +
             * Dual licensed under the MIT or GPL Version 2 licenses.
         | 
| 7 | 
            +
             * http://jquery.org/license
         | 
| 8 | 
            +
             *
         | 
| 9 | 
            +
             * Date: 2010-03-03 21:24:30 +0200 (Wed, 03 Mar 2010)
         | 
| 10 | 
            +
             */
         | 
| 11 | 
            +
            (function ($) {
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                $.address = (function () {
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    var _trigger = function(name) {
         | 
| 16 | 
            +
                            $($.address).trigger(
         | 
| 17 | 
            +
                                $.extend($.Event(name),
         | 
| 18 | 
            +
                                    (function() {
         | 
| 19 | 
            +
                                        var parameters = {},
         | 
| 20 | 
            +
                                            parameterNames = $.address.parameterNames();
         | 
| 21 | 
            +
                                        for (var i = 0, l = parameterNames.length; i < l; i++) {
         | 
| 22 | 
            +
                                            parameters[parameterNames[i]] = $.address.parameter(parameterNames[i]);
         | 
| 23 | 
            +
                                        }
         | 
| 24 | 
            +
                                        return {
         | 
| 25 | 
            +
                                            value: $.address.value(),
         | 
| 26 | 
            +
                                            path: $.address.path(),
         | 
| 27 | 
            +
                                            pathNames: $.address.pathNames(),
         | 
| 28 | 
            +
                                            parameterNames: parameterNames,
         | 
| 29 | 
            +
                                            parameters: parameters,
         | 
| 30 | 
            +
                                            queryString: $.address.queryString()
         | 
| 31 | 
            +
                                        };
         | 
| 32 | 
            +
                                    }).call($.address)
         | 
| 33 | 
            +
                                )
         | 
| 34 | 
            +
                            );
         | 
| 35 | 
            +
                        },
         | 
| 36 | 
            +
                        _bind = function(value, data, fn) {
         | 
| 37 | 
            +
                            if (fn || data) {
         | 
| 38 | 
            +
                                $($.address).bind(value, fn || data, fn && data);
         | 
| 39 | 
            +
                            }
         | 
| 40 | 
            +
                            return $.address;
         | 
| 41 | 
            +
                        },
         | 
| 42 | 
            +
                        _hash = function() {
         | 
| 43 | 
            +
                            var index = _l.href.indexOf('#');
         | 
| 44 | 
            +
                            return index != -1 ? _ec(_dc(_l.href.substr(index + 1))) : '';
         | 
| 45 | 
            +
                        },
         | 
| 46 | 
            +
                        _window = function() {
         | 
| 47 | 
            +
                            try {
         | 
| 48 | 
            +
                                return top.document !== undefined ? top : window;
         | 
| 49 | 
            +
                            } catch (e) {
         | 
| 50 | 
            +
                                return window;
         | 
| 51 | 
            +
                            }
         | 
| 52 | 
            +
                        },
         | 
| 53 | 
            +
                        _js = function() {
         | 
| 54 | 
            +
                            return 'javascript';
         | 
| 55 | 
            +
                        },
         | 
| 56 | 
            +
                        _strict = function(value, force) {
         | 
| 57 | 
            +
                            if (_opts.strict) {
         | 
| 58 | 
            +
                                value = force ? (value.substr(0, 1) != '/' ? '/' + value : value) : (value == '' ? '/' : value);
         | 
| 59 | 
            +
                            }
         | 
| 60 | 
            +
                            return value;
         | 
| 61 | 
            +
                        },
         | 
| 62 | 
            +
                        _local = function(value, direction) {
         | 
| 63 | 
            +
                            return (_msie && _l.protocol == 'file:') ?
         | 
| 64 | 
            +
                                (direction ? _value.replace(/\?/, '%3F') : _value.replace(/%253F/, '?')) : value;
         | 
| 65 | 
            +
                        },
         | 
| 66 | 
            +
                        _search = function(el) {
         | 
| 67 | 
            +
                            var url, s;
         | 
| 68 | 
            +
                            for (var i = 0, l = el.childNodes.length; i < l; i++) {
         | 
| 69 | 
            +
                                if (el.childNodes[i].src) {
         | 
| 70 | 
            +
                                    url = String(el.childNodes[i].src);
         | 
| 71 | 
            +
                                }
         | 
| 72 | 
            +
                                s = _search(el.childNodes[i]);
         | 
| 73 | 
            +
                                if (s) {
         | 
| 74 | 
            +
                                    url = s;
         | 
| 75 | 
            +
                                }
         | 
| 76 | 
            +
                            }
         | 
| 77 | 
            +
                            return url;
         | 
| 78 | 
            +
                        },
         | 
| 79 | 
            +
                        _listen = function() {
         | 
| 80 | 
            +
                            if (!_silent) {
         | 
| 81 | 
            +
                                var hash = _hash(),
         | 
| 82 | 
            +
                                    diff = _value != hash;
         | 
| 83 | 
            +
                                if (_safari && _version < 523) {
         | 
| 84 | 
            +
                                    if (_length != _h.length) {
         | 
| 85 | 
            +
                                        _length = _h.length;
         | 
| 86 | 
            +
                                        if (typeof _stack[_length - 1] != UNDEFINED) {
         | 
| 87 | 
            +
                                            _value = _stack[_length - 1];
         | 
| 88 | 
            +
                                        }
         | 
| 89 | 
            +
                                        _update(FALSE);
         | 
| 90 | 
            +
                                    }
         | 
| 91 | 
            +
                                } else if (_msie && _version < 7 && diff) {
         | 
| 92 | 
            +
                                    _l.reload();
         | 
| 93 | 
            +
                                } else if (diff) {
         | 
| 94 | 
            +
                                    _value = hash;
         | 
| 95 | 
            +
                                    _update(FALSE);
         | 
| 96 | 
            +
                                }
         | 
| 97 | 
            +
                            }
         | 
| 98 | 
            +
                        },
         | 
| 99 | 
            +
                        _update = function(internal) {
         | 
| 100 | 
            +
                            _trigger('change');
         | 
| 101 | 
            +
                            _trigger(internal ? 'internalChange' : 'externalChange');
         | 
| 102 | 
            +
                            _st(_track, 10);
         | 
| 103 | 
            +
                        },
         | 
| 104 | 
            +
                        _track = function() {
         | 
| 105 | 
            +
                            var value = (_l.pathname + (/\/$/.test(_l.pathname) ? '' : '/') + $.address.value()).replace(/\/\//, '/').replace(/^\/$/, ''),
         | 
| 106 | 
            +
                                fn = window[_opts.tracker];
         | 
| 107 | 
            +
                            if (typeof fn == FUNCTION) {
         | 
| 108 | 
            +
                                fn(value);
         | 
| 109 | 
            +
                            } else if (typeof _gaq != UNDEFINED && typeof _gaq.push == FUNCTION) {
         | 
| 110 | 
            +
                                _gaq.push(['_trackPageview', value]);
         | 
| 111 | 
            +
                            } else if (typeof pageTracker != UNDEFINED && typeof pageTracker._trackPageview == FUNCTION) {
         | 
| 112 | 
            +
                                pageTracker._trackPageview(value);
         | 
| 113 | 
            +
                            } else if (typeof urchinTracker == FUNCTION) {
         | 
| 114 | 
            +
                                urchinTracker(value);
         | 
| 115 | 
            +
                            }
         | 
| 116 | 
            +
                        },
         | 
| 117 | 
            +
                        _html = function() {
         | 
| 118 | 
            +
                            var doc = _frame.contentWindow.document;
         | 
| 119 | 
            +
                            doc.open();
         | 
| 120 | 
            +
                            doc.write('<html><head><title>' + _d.title + '</title><script>var ' + ID + ' = "' + _hash() + '";</' + 'script></head></html>');
         | 
| 121 | 
            +
                            doc.close();
         | 
| 122 | 
            +
                        },
         | 
| 123 | 
            +
                        _load = function() {
         | 
| 124 | 
            +
                            if (!_loaded) {
         | 
| 125 | 
            +
                                _loaded = TRUE;
         | 
| 126 | 
            +
                                if (_msie && _version < 8) {
         | 
| 127 | 
            +
                                    var frameset = _d.getElementsByTagName('frameset')[0];
         | 
| 128 | 
            +
                                    _frame = _d.createElement((frameset ? '' : 'i') + 'frame');
         | 
| 129 | 
            +
                                    if (frameset) {
         | 
| 130 | 
            +
                                        frameset.insertAdjacentElement('beforeEnd', _frame);
         | 
| 131 | 
            +
                                        frameset[frameset.cols ? 'cols' : 'rows'] += ',0';
         | 
| 132 | 
            +
                                        _frame.src = _js() + ':' + FALSE;
         | 
| 133 | 
            +
                                        _frame.noResize = TRUE;
         | 
| 134 | 
            +
                                        _frame.frameBorder = _frame.frameSpacing = 0;
         | 
| 135 | 
            +
                                    } else {
         | 
| 136 | 
            +
                                        _frame.src = _js() + ':' + FALSE;
         | 
| 137 | 
            +
                                        _frame.style.display = 'none';
         | 
| 138 | 
            +
                                        _d.body.insertAdjacentElement('afterBegin', _frame);
         | 
| 139 | 
            +
                                    }
         | 
| 140 | 
            +
                                    _st(function() {
         | 
| 141 | 
            +
                                        $(_frame).bind('load', function() {
         | 
| 142 | 
            +
                                            var win = _frame.contentWindow;
         | 
| 143 | 
            +
                                            var src = win.location.href;
         | 
| 144 | 
            +
                                            _value = (typeof win[ID] != UNDEFINED ? win[ID] : '');
         | 
| 145 | 
            +
                                            if (_value != _hash()) {
         | 
| 146 | 
            +
                                                _update(FALSE);
         | 
| 147 | 
            +
                                                _l.hash = _local(_value, TRUE);
         | 
| 148 | 
            +
                                            }
         | 
| 149 | 
            +
                                        });
         | 
| 150 | 
            +
                                        if (typeof _frame.contentWindow[ID] == UNDEFINED) {
         | 
| 151 | 
            +
                                            _html();
         | 
| 152 | 
            +
                                        }
         | 
| 153 | 
            +
                                    }, 50);
         | 
| 154 | 
            +
                                } else if (_safari) {
         | 
| 155 | 
            +
                                    if (_version < 418) {
         | 
| 156 | 
            +
                                        $(_d.body).append('<form id="' + ID + '" style="position:absolute;top:-9999px;" method="get"></form>');
         | 
| 157 | 
            +
                                        _form = _d.getElementById(ID);
         | 
| 158 | 
            +
                                    }
         | 
| 159 | 
            +
                                    if (typeof _l[ID] == UNDEFINED) {
         | 
| 160 | 
            +
                                        _l[ID] = {};
         | 
| 161 | 
            +
                                    }
         | 
| 162 | 
            +
                                    if (typeof _l[ID][_l.pathname] != UNDEFINED) {
         | 
| 163 | 
            +
                                        _stack = _l[ID][_l.pathname].split(',');
         | 
| 164 | 
            +
                                    }
         | 
| 165 | 
            +
                                }
         | 
| 166 | 
            +
             | 
| 167 | 
            +
                                _st(function() {
         | 
| 168 | 
            +
                                    _trigger('init');
         | 
| 169 | 
            +
                                    _update(FALSE);
         | 
| 170 | 
            +
                                }, 1);
         | 
| 171 | 
            +
             | 
| 172 | 
            +
                                if ((_msie && _version > 7) || (!_msie && ('on' + HASH_CHANGE) in _t)) {
         | 
| 173 | 
            +
                                    if (_t.addEventListener) {
         | 
| 174 | 
            +
                                        _t.addEventListener(HASH_CHANGE, _listen, false);
         | 
| 175 | 
            +
                                    } else if (_t.attachEvent) {
         | 
| 176 | 
            +
                                        _t.attachEvent('on' + HASH_CHANGE, _listen);
         | 
| 177 | 
            +
                                    }
         | 
| 178 | 
            +
                                } else {
         | 
| 179 | 
            +
                                    _si(_listen, 50);
         | 
| 180 | 
            +
                                }
         | 
| 181 | 
            +
                                $('a[rel*=address:]').address();
         | 
| 182 | 
            +
                            }
         | 
| 183 | 
            +
                        },
         | 
| 184 | 
            +
                        _unload = function() {
         | 
| 185 | 
            +
                            if (_t.removeEventListener) {
         | 
| 186 | 
            +
                                _t.removeEventListener(HASH_CHANGE, _listen, false);
         | 
| 187 | 
            +
                            } else if (_t.detachEvent) {
         | 
| 188 | 
            +
                                _t.detachEvent('on' + HASH_CHANGE, _listen);
         | 
| 189 | 
            +
                            }
         | 
| 190 | 
            +
                        },
         | 
| 191 | 
            +
                        ID = 'jQueryAddress',
         | 
| 192 | 
            +
                        FUNCTION = 'function',
         | 
| 193 | 
            +
                        UNDEFINED = 'undefined',
         | 
| 194 | 
            +
                        HASH_CHANGE = 'hashchange',
         | 
| 195 | 
            +
                        TRUE = true,
         | 
| 196 | 
            +
                        FALSE = false,
         | 
| 197 | 
            +
                        _browser = $.browser,
         | 
| 198 | 
            +
                        _version = parseFloat($.browser.version),
         | 
| 199 | 
            +
                        _mozilla = _browser.mozilla,
         | 
| 200 | 
            +
                        _msie = _browser.msie,
         | 
| 201 | 
            +
                        _opera = _browser.opera,
         | 
| 202 | 
            +
                        _safari = _browser.safari,
         | 
| 203 | 
            +
                        _supported = FALSE,
         | 
| 204 | 
            +
                        _t = _window(),
         | 
| 205 | 
            +
                        _d = _t.document,
         | 
| 206 | 
            +
                        _h = _t.history,
         | 
| 207 | 
            +
                        _l = _t.location,
         | 
| 208 | 
            +
                        _si = setInterval,
         | 
| 209 | 
            +
                        _st = setTimeout,
         | 
| 210 | 
            +
                        _dc = decodeURI,
         | 
| 211 | 
            +
                        _ec = encodeURI,
         | 
| 212 | 
            +
                        _agent = navigator.userAgent,
         | 
| 213 | 
            +
                        _frame,
         | 
| 214 | 
            +
                        _form,
         | 
| 215 | 
            +
                        _url = _search(document),
         | 
| 216 | 
            +
                        _qi = _url ? _url.indexOf('?') : -1,
         | 
| 217 | 
            +
                        _title = _d.title,
         | 
| 218 | 
            +
                        _length = _h.length,
         | 
| 219 | 
            +
                        _silent = FALSE,
         | 
| 220 | 
            +
                        _loaded = FALSE,
         | 
| 221 | 
            +
                        _justset = TRUE,
         | 
| 222 | 
            +
                        _juststart = TRUE,
         | 
| 223 | 
            +
                        _updating = FALSE,
         | 
| 224 | 
            +
                        _stack = [],
         | 
| 225 | 
            +
                        _listeners = {},
         | 
| 226 | 
            +
                        _value = _hash(),
         | 
| 227 | 
            +
                        _api = {},
         | 
| 228 | 
            +
                        _opts = {autoUpdate: TRUE, history: TRUE, strict: TRUE};
         | 
| 229 | 
            +
             | 
| 230 | 
            +
                    if (_msie) {
         | 
| 231 | 
            +
                        _version = parseFloat(_agent.substr(_agent.indexOf('MSIE') + 4));
         | 
| 232 | 
            +
                        if (_d.documentMode && _d.documentMode != _version) {
         | 
| 233 | 
            +
                            _version = _d.documentMode != 8 ? 7 : 8;
         | 
| 234 | 
            +
                        }
         | 
| 235 | 
            +
                    }
         | 
| 236 | 
            +
             | 
| 237 | 
            +
                    _supported =
         | 
| 238 | 
            +
                        (_mozilla && _version >= 1) ||
         | 
| 239 | 
            +
                        (_msie && _version >= 6) ||
         | 
| 240 | 
            +
                        (_opera && _version >= 9.5) ||
         | 
| 241 | 
            +
                        (_safari && _version >= 312);
         | 
| 242 | 
            +
             | 
| 243 | 
            +
                    if (_supported) {
         | 
| 244 | 
            +
             | 
| 245 | 
            +
                        for (var i = 1; i < _length; i++) {
         | 
| 246 | 
            +
                            _stack.push('');
         | 
| 247 | 
            +
                        }
         | 
| 248 | 
            +
             | 
| 249 | 
            +
                        _stack.push(_value);
         | 
| 250 | 
            +
             | 
| 251 | 
            +
                        if (_msie && _l.hash != _value) {
         | 
| 252 | 
            +
                            _l.hash = '#' + _local(_value, TRUE);
         | 
| 253 | 
            +
                        }
         | 
| 254 | 
            +
             | 
| 255 | 
            +
                        if (_opera) {
         | 
| 256 | 
            +
                            history.navigationMode = 'compatible';
         | 
| 257 | 
            +
                        }
         | 
| 258 | 
            +
             | 
| 259 | 
            +
                        if (_url && _qi != -1) {
         | 
| 260 | 
            +
                            var param, params = _url.substr(_qi + 1).split('&');
         | 
| 261 | 
            +
                            for (i = 0; i < params.length; i++) {
         | 
| 262 | 
            +
                                param = params[i].split('=');
         | 
| 263 | 
            +
                                if (/^(autoUpdate|history|strict)$/.test(param[0])) {
         | 
| 264 | 
            +
                                    _opts[param[0]] = (isNaN(param[1]) ? /^(true|yes)$/i.test(param[1]) : (parseInt(param[1], 10) !== 0));
         | 
| 265 | 
            +
                                }
         | 
| 266 | 
            +
                                if (/^tracker$/.test(param[0])) {
         | 
| 267 | 
            +
                                    _opts[param[0]] = param[1];
         | 
| 268 | 
            +
                                }
         | 
| 269 | 
            +
                            }
         | 
| 270 | 
            +
                        }
         | 
| 271 | 
            +
             | 
| 272 | 
            +
                        if (document.readyState == 'complete') {
         | 
| 273 | 
            +
                            _load();
         | 
| 274 | 
            +
                        }
         | 
| 275 | 
            +
                        $(_load);
         | 
| 276 | 
            +
                        $(window).bind('unload', _unload);
         | 
| 277 | 
            +
             | 
| 278 | 
            +
                    } else if ((!_supported && _l.href.indexOf('#') != -1) ||
         | 
| 279 | 
            +
                        (_safari && _version < 418 && _l.href.indexOf('#') != -1 && _l.search != '')) {
         | 
| 280 | 
            +
                        _d.open();
         | 
| 281 | 
            +
                        _d.write('<html><head><meta http-equiv="refresh" content="0;url=' +
         | 
| 282 | 
            +
                            _l.href.substr(0, _l.href.indexOf('#')) + '" /></head></html>');
         | 
| 283 | 
            +
                        _d.close();
         | 
| 284 | 
            +
                    } else {
         | 
| 285 | 
            +
                        _track();
         | 
| 286 | 
            +
                    }
         | 
| 287 | 
            +
             | 
| 288 | 
            +
                    return {
         | 
| 289 | 
            +
                        init: function(data, fn) {
         | 
| 290 | 
            +
                            return _bind('init', data, fn);
         | 
| 291 | 
            +
                        },
         | 
| 292 | 
            +
                        change: function(data, fn) {
         | 
| 293 | 
            +
                            return _bind('change', data, fn);
         | 
| 294 | 
            +
                        },
         | 
| 295 | 
            +
                        internalChange: function(data, fn) {
         | 
| 296 | 
            +
                            return _bind('internalChange', data, fn);
         | 
| 297 | 
            +
                        },
         | 
| 298 | 
            +
                        externalChange: function(data, fn) {
         | 
| 299 | 
            +
                            return _bind('externalChange', data, fn);
         | 
| 300 | 
            +
                        },
         | 
| 301 | 
            +
                        baseURL: function() {
         | 
| 302 | 
            +
                            var url = _l.href;
         | 
| 303 | 
            +
                            if (url.indexOf('#') != -1) {
         | 
| 304 | 
            +
                                url = url.substr(0, url.indexOf('#'));
         | 
| 305 | 
            +
                            }
         | 
| 306 | 
            +
                            if (url.substr(url.length - 1) == '/') {
         | 
| 307 | 
            +
                                url = url.substr(0, url.length - 1);
         | 
| 308 | 
            +
                            }
         | 
| 309 | 
            +
                            return url;
         | 
| 310 | 
            +
                        },
         | 
| 311 | 
            +
                        strict: function(value) {
         | 
| 312 | 
            +
                            if (value !== undefined) {
         | 
| 313 | 
            +
                                _opts.strict = value;
         | 
| 314 | 
            +
                                return this;
         | 
| 315 | 
            +
                            }
         | 
| 316 | 
            +
                            return _opts.strict;
         | 
| 317 | 
            +
                        },
         | 
| 318 | 
            +
                        autoUpdate: function(value) {
         | 
| 319 | 
            +
                            if (value !== undefined) {
         | 
| 320 | 
            +
                                _opts.autoUpdate = value;
         | 
| 321 | 
            +
                                return this;
         | 
| 322 | 
            +
                            }
         | 
| 323 | 
            +
                            return _opts.autoUpdate;
         | 
| 324 | 
            +
                        },
         | 
| 325 | 
            +
                        update: function() {
         | 
| 326 | 
            +
                            _updating = TRUE;
         | 
| 327 | 
            +
                            this.value(_value);
         | 
| 328 | 
            +
                            _updating = FALSE;
         | 
| 329 | 
            +
                            return this;
         | 
| 330 | 
            +
                        },
         | 
| 331 | 
            +
                        history: function(value) {
         | 
| 332 | 
            +
                            if (value !== undefined) {
         | 
| 333 | 
            +
                                _opts.history = value;
         | 
| 334 | 
            +
                                return this;
         | 
| 335 | 
            +
                            }
         | 
| 336 | 
            +
                            return _opts.history;
         | 
| 337 | 
            +
                        },
         | 
| 338 | 
            +
                        tracker: function(value) {
         | 
| 339 | 
            +
                            if (value !== undefined) {
         | 
| 340 | 
            +
                                _opts.tracker = value;
         | 
| 341 | 
            +
                                return this;
         | 
| 342 | 
            +
                            }
         | 
| 343 | 
            +
                            return _opts.tracker;
         | 
| 344 | 
            +
                        },
         | 
| 345 | 
            +
                        title: function(value) {
         | 
| 346 | 
            +
                            if (value !== undefined) {
         | 
| 347 | 
            +
                                value = _dc(value);
         | 
| 348 | 
            +
                                _st(function() {
         | 
| 349 | 
            +
                                    _title = _d.title = value;
         | 
| 350 | 
            +
                                    if (_juststart && _frame && _frame.contentWindow && _frame.contentWindow.document) {
         | 
| 351 | 
            +
                                        _frame.contentWindow.document.title = value;
         | 
| 352 | 
            +
                                        _juststart = FALSE;
         | 
| 353 | 
            +
                                    }
         | 
| 354 | 
            +
                                    if (!_justset && _mozilla) {
         | 
| 355 | 
            +
                                        _l.replace(_l.href.indexOf('#') != -1 ? _l.href : _l.href + '#');
         | 
| 356 | 
            +
                                    }
         | 
| 357 | 
            +
                                    _justset = FALSE;
         | 
| 358 | 
            +
                                }, 50);
         | 
| 359 | 
            +
                                return this;
         | 
| 360 | 
            +
                            }
         | 
| 361 | 
            +
                            return _d.title;
         | 
| 362 | 
            +
                        },
         | 
| 363 | 
            +
                        value: function(value) {
         | 
| 364 | 
            +
                            if (value !== undefined) {
         | 
| 365 | 
            +
                                value = _ec(_dc(_strict(value, TRUE)));
         | 
| 366 | 
            +
                                if (value == '/') {
         | 
| 367 | 
            +
                                    value = '';
         | 
| 368 | 
            +
                                }
         | 
| 369 | 
            +
                                if (_value == value && !_updating) {
         | 
| 370 | 
            +
                                    return;
         | 
| 371 | 
            +
                                }
         | 
| 372 | 
            +
                                _justset = TRUE;
         | 
| 373 | 
            +
                                _value = value;
         | 
| 374 | 
            +
                                if (_opts.autoUpdate || _updating) {
         | 
| 375 | 
            +
                                    _silent = TRUE;
         | 
| 376 | 
            +
                                    _update(TRUE);
         | 
| 377 | 
            +
                                    _stack[_h.length] = _value;
         | 
| 378 | 
            +
                                    if (_safari) {
         | 
| 379 | 
            +
                                        if (_opts.history) {
         | 
| 380 | 
            +
                                            _l[ID][_l.pathname] = _stack.toString();
         | 
| 381 | 
            +
                                            _length = _h.length + 1;
         | 
| 382 | 
            +
                                            if (_version < 418) {
         | 
| 383 | 
            +
                                                if (_l.search == '') {
         | 
| 384 | 
            +
                                                    _form.action = '#' + _value;
         | 
| 385 | 
            +
                                                    _form.submit();
         | 
| 386 | 
            +
                                                }
         | 
| 387 | 
            +
                                            } else if (_version < 523 || _value == '') {
         | 
| 388 | 
            +
                                                var evt = _d.createEvent('MouseEvents');
         | 
| 389 | 
            +
                                                evt.initEvent('click', TRUE, TRUE);
         | 
| 390 | 
            +
                                                var anchor = _d.createElement('a');
         | 
| 391 | 
            +
                                                anchor.href = '#' + _value;
         | 
| 392 | 
            +
                                                anchor.dispatchEvent(evt);
         | 
| 393 | 
            +
                                            } else {
         | 
| 394 | 
            +
                                                _l.hash = '#' + _value;
         | 
| 395 | 
            +
                                            }
         | 
| 396 | 
            +
                                        } else {
         | 
| 397 | 
            +
                                            _l.replace('#' + _value);
         | 
| 398 | 
            +
                                        }
         | 
| 399 | 
            +
                                    } else if (_value != _hash()) {
         | 
| 400 | 
            +
                                        if (_opts.history) {
         | 
| 401 | 
            +
                                            _l.hash = '#' + _local(_value, TRUE);
         | 
| 402 | 
            +
                                        } else {
         | 
| 403 | 
            +
                                            _l.replace('#' + _value);
         | 
| 404 | 
            +
                                        }
         | 
| 405 | 
            +
                                    }
         | 
| 406 | 
            +
                                    if ((_msie && _version < 8) && _opts.history) {
         | 
| 407 | 
            +
                                        _st(_html, 50);
         | 
| 408 | 
            +
                                    }
         | 
| 409 | 
            +
                                    if (_safari) {
         | 
| 410 | 
            +
                                        _st(function(){ _silent = FALSE; }, 1);
         | 
| 411 | 
            +
                                    } else {
         | 
| 412 | 
            +
                                        _silent = FALSE;
         | 
| 413 | 
            +
                                    }
         | 
| 414 | 
            +
                                }
         | 
| 415 | 
            +
                                return this;
         | 
| 416 | 
            +
                            }
         | 
| 417 | 
            +
                            if (!_supported) {
         | 
| 418 | 
            +
                                return null;
         | 
| 419 | 
            +
                            }
         | 
| 420 | 
            +
                            return _dc(_strict(_local(_value, FALSE), FALSE));
         | 
| 421 | 
            +
                        },
         | 
| 422 | 
            +
                        path: function(value) {
         | 
| 423 | 
            +
                            if (value !== undefined) {
         | 
| 424 | 
            +
                                var qs = this.queryString();
         | 
| 425 | 
            +
                                this.value(value + (qs ? '?' + qs : ''));
         | 
| 426 | 
            +
                                return this;
         | 
| 427 | 
            +
                            }
         | 
| 428 | 
            +
                            value = this.value();
         | 
| 429 | 
            +
                            return (value.indexOf('?') != -1) ? value.split('?')[0] : value;
         | 
| 430 | 
            +
                        },
         | 
| 431 | 
            +
                        queryString: function(value) {
         | 
| 432 | 
            +
                            if (value !== undefined) {
         | 
| 433 | 
            +
                                this.value(this.path() + (value ? '?' + value : ''));
         | 
| 434 | 
            +
                                return this;
         | 
| 435 | 
            +
                            }
         | 
| 436 | 
            +
                            value = this.value();
         | 
| 437 | 
            +
                            var index = value.indexOf('?');
         | 
| 438 | 
            +
                            if (index != -1 && index < value.length) {
         | 
| 439 | 
            +
                                return value.substr(index + 1);
         | 
| 440 | 
            +
                            }
         | 
| 441 | 
            +
                        },
         | 
| 442 | 
            +
                        parameter: function(name, value, append) {
         | 
| 443 | 
            +
                            var i, params;
         | 
| 444 | 
            +
                            if (value !== undefined) {
         | 
| 445 | 
            +
                                var names = this.parameterNames();
         | 
| 446 | 
            +
                                params = [];
         | 
| 447 | 
            +
                                for (i = 0; i < names.length; i++) {
         | 
| 448 | 
            +
                                    var n = names[i],
         | 
| 449 | 
            +
                                        v = this.parameter(n);
         | 
| 450 | 
            +
                                    if (typeof v == 'string') {
         | 
| 451 | 
            +
                                        v = [v];
         | 
| 452 | 
            +
                                    }
         | 
| 453 | 
            +
                                    if (n == name) {
         | 
| 454 | 
            +
                                        v = (value === null || value == '') ? [] :
         | 
| 455 | 
            +
                                            (append ? v.concat([value]) : [value]);
         | 
| 456 | 
            +
                                    }
         | 
| 457 | 
            +
                                    for (var j = 0; j < v.length; j++) {
         | 
| 458 | 
            +
                                        params.push(n + '=' + v[j]);
         | 
| 459 | 
            +
                                    }
         | 
| 460 | 
            +
                                }
         | 
| 461 | 
            +
                                if ($.inArray(name, names) == -1) {
         | 
| 462 | 
            +
                                    params.push(name + '=' + value);
         | 
| 463 | 
            +
                                }
         | 
| 464 | 
            +
                                this.queryString(params.join('&'));
         | 
| 465 | 
            +
                                return this;
         | 
| 466 | 
            +
                            }
         | 
| 467 | 
            +
                            value = this.value();
         | 
| 468 | 
            +
                            var index = value.indexOf('?');
         | 
| 469 | 
            +
                            if (index != -1) {
         | 
| 470 | 
            +
                                value = value.substr(index + 1);
         | 
| 471 | 
            +
                                params = value.split('&');
         | 
| 472 | 
            +
                                var r = [];
         | 
| 473 | 
            +
                                for (i = 0; i < params.length; i++) {
         | 
| 474 | 
            +
                                    var p = params[i].split('=');
         | 
| 475 | 
            +
                                    if (p[0] == name) {
         | 
| 476 | 
            +
                                        r.push(p[1]);
         | 
| 477 | 
            +
                                    }
         | 
| 478 | 
            +
                                }
         | 
| 479 | 
            +
                                if (r.length !== 0) {
         | 
| 480 | 
            +
                                    return r.length != 1 ? r : r[0];
         | 
| 481 | 
            +
                                }
         | 
| 482 | 
            +
                            }
         | 
| 483 | 
            +
                        },
         | 
| 484 | 
            +
                        pathNames: function() {
         | 
| 485 | 
            +
                            var path = this.path(),
         | 
| 486 | 
            +
                                names = path.split('/');
         | 
| 487 | 
            +
                            if (path.substr(0, 1) == '/' || path.length === 0) {
         | 
| 488 | 
            +
                                names.splice(0, 1);
         | 
| 489 | 
            +
                            }
         | 
| 490 | 
            +
                            if (path.substr(path.length - 1, 1) == '/') {
         | 
| 491 | 
            +
                                names.splice(names.length - 1, 1);
         | 
| 492 | 
            +
                            }
         | 
| 493 | 
            +
                            return names;
         | 
| 494 | 
            +
                        },
         | 
| 495 | 
            +
                        parameterNames: function() {
         | 
| 496 | 
            +
                            var value = this.value(),
         | 
| 497 | 
            +
                                index = value.indexOf('?'),
         | 
| 498 | 
            +
                                names = [];
         | 
| 499 | 
            +
                            if (index != -1) {
         | 
| 500 | 
            +
                                value = value.substr(index + 1);
         | 
| 501 | 
            +
                                if (value != '' && value.indexOf('=') != -1) {
         | 
| 502 | 
            +
                                    var params = value.split('&');
         | 
| 503 | 
            +
                                    for (var i = 0; i < params.length; i++) {
         | 
| 504 | 
            +
                                        var name = params[i].split('=')[0];
         | 
| 505 | 
            +
                                        if ($.inArray(name, names) == -1) {
         | 
| 506 | 
            +
                                            names.push(name);
         | 
| 507 | 
            +
                                        }
         | 
| 508 | 
            +
                                    }
         | 
| 509 | 
            +
                                }
         | 
| 510 | 
            +
                            }
         | 
| 511 | 
            +
                            return names;
         | 
| 512 | 
            +
                        }
         | 
| 513 | 
            +
                    };
         | 
| 514 | 
            +
             | 
| 515 | 
            +
                })();
         | 
| 516 | 
            +
             | 
| 517 | 
            +
                $.fn.address = function (fn) {
         | 
| 518 | 
            +
                    var f = function() {
         | 
| 519 | 
            +
                        var value = fn ? fn.call(this) :
         | 
| 520 | 
            +
                            /address:/.test($(this).attr('rel')) ? $(this).attr('rel').split('address:')[1].split(' ')[0] :
         | 
| 521 | 
            +
                            $(this).attr('href').replace(/^#/, '');
         | 
| 522 | 
            +
                        $.address.value(value);
         | 
| 523 | 
            +
                        return false;
         | 
| 524 | 
            +
                    };
         | 
| 525 | 
            +
                    $(this).click(f).live('click', f);
         | 
| 526 | 
            +
                };
         | 
| 527 | 
            +
             | 
| 528 | 
            +
            }(jQuery));
         |