/*! * Galleria History Plugin v 1.0 * http://galleria.aino.se * * Original Copyright (c) 2009-2010 Rostislav Hristov * Modified by Aino (c) 2010 * * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * */ (function($) { var G = window.Galleria; if (typeof G == 'undefined') { return; } G.History = (function () { var _trigger = function(name) { $(G.History).trigger( $.extend($.Event(name), (function() { var parameters = {}, parameterNames = G.History.parameterNames(); for (var i = 0, l = parameterNames.length; i < l; i++) { parameters[parameterNames[i]] = G.History.parameter(parameterNames[i]); } return { value: G.History.value(), path: G.History.path(), pathNames: G.History.pathNames(), parameterNames: parameterNames, parameters: parameters, queryString: G.History.queryString() }; }).call(G.History) ) ); }, _bind = function(value, data, fn) { fn = fn || function(){}; $(G.History).bind(value, data, fn); return G.History; }, _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) ? '' : '/') + (G.History ? G.History.value() : '')).replace(/\/\//, '/').replace(/^\/$/, ''), fn = _t[_opts.tracker]; if (typeof fn == FUNCTION) { fn(value); } else if (typeof urchinTracker == FUNCTION) { urchinTracker(value); } else if (typeof pageTracker != UNDEFINED && typeof pageTracker._trackPageview == FUNCTION) { pageTracker._trackPageview(value); } else if (typeof _gaq != UNDEFINED && typeof _gaq.push == FUNCTION) { _gaq.push(['_trackPageview', value]); } }, _html = function() { var doc = _frame.contentWindow.document; doc.open(); doc.write('