/* * jQuery Address Plugin v1.2rc * http://www.asual.com/jquery/address/ * * Copyright (c) 2009-2010 Rostislav Hristov * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Date: 2010-03-31 11:35:36 +0300 (Wed, 31 Mar 2010) */ (function ($) { $.address = (function () { var _trigger = function(name) { $($.address).trigger( $.extend($.Event(name), (function() { var parameters = {}, parameterNames = $.address.parameterNames(); for (var i = 0, l = parameterNames.length; i < l; i++) { parameters[parameterNames[i]] = $.address.parameter(parameterNames[i]); } return { value: $.address.value(), path: $.address.path(), pathNames: $.address.pathNames(), parameterNames: parameterNames, parameters: parameters, queryString: $.address.queryString() }; }).call($.address) ) ); }, _bind = function(value, data, fn) { if (fn || data) { $($.address).bind(value, fn || data, fn && data); } return $.address; }, _hash = function() { var index = _l.href.indexOf('#'); return index != -1 ? _ec(_dc(_crawl(_l.href.substr(index + 1), FALSE))) : ''; }, _window = function() { try { return top.document !== undefined ? top : window; } catch (e) { return window; } }, _js = function() { return 'javascript'; }, _strict = function(value, force) { if (_opts.strict) { value = force ? (value.substr(0, 1) != '/' ? '/' + value : value) : (value == '' ? '/' : value); } return value; }, _local = function(value, direction) { return (_msie && _l.protocol == 'file:') ? (direction ? _value.replace(/\?/, '%3F') : _value.replace(/%253F/, '?')) : value; }, _crawl = function(value, direction) { if (_opts.crawlable && direction) { return (value != '' ? '!' : '') + value; } return value.replace(/^\!/, ''); }, _cssint = function(el, value) { return parseInt(el.css(value), 10); }, _search = function(el) { var url, s; for (var i = 0, l = el.childNodes.length; i < l; i++) { if (el.childNodes[i].src) { url = String(el.childNodes[i].src); } s = _search(el.childNodes[i]); if (s) { url = s; } } return url; }, _listen = function() { if (!_silent) { var hash = _hash(), diff = _value != hash; if (_safari && _version < 523) { if (_length != _h.length) { _length = _h.length; if (typeof _stack[_length - 1] != UNDEFINED) { _value = _stack[_length - 1]; } _update(FALSE); } } else if (_msie && _version < 7 && diff) { _l.reload(); } else if (diff) { _value = hash; _update(FALSE); } } }, _update = function(internal) { _trigger(CHANGE); _trigger(internal ? INTERNAL_CHANGE : EXTERNAL_CHANGE); _st(_track, 10); }, _track = function() { var value = (_l.pathname + (/\/$/.test(_l.pathname) ? '' : '/') + $.address.value()).replace(/\/\//, '/').replace(/^\/$/, ''), fn = window[_opts.tracker]; if (typeof fn == FUNCTION) { fn(value); } else if (typeof _gaq != UNDEFINED && typeof _gaq.push == FUNCTION) { _gaq.push(['_trackPageview', value]); } else if (typeof pageTracker != UNDEFINED && typeof pageTracker._trackPageview == FUNCTION) { pageTracker._trackPageview(value); } else if (typeof urchinTracker == FUNCTION) { urchinTracker(value); } }, _html = function() { var doc = _frame.contentWindow.document; doc.open(); doc.write('