aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2008-07-28 21:11:48 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2008-07-28 21:11:48 +0000
commit5bb45e13c6948725ce4abc25d3097b8c669d0707 (patch)
treea0e99cbb49e15eccb80b8cf449b04742849e2081 /ui
parentf2265bf9e6c2bde7402d5dfef1d1f223e9a4de2e (diff)
downloadjquery-ui-5bb45e13c6948725ce4abc25d3097b8c669d0707.tar.gz
jquery-ui-5bb45e13c6948725ce4abc25d3097b8c669d0707.zip
moved history plugin to 1.7
Diffstat (limited to 'ui')
-rw-r--r--ui/ui.history.js112
1 files changed, 0 insertions, 112 deletions
diff --git a/ui/ui.history.js b/ui/ui.history.js
deleted file mode 100644
index 40848ebe5..000000000
--- a/ui/ui.history.js
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * jQuery UI History
- *
- * Copyright (c) 2008 Klaus Hartl (stilbuero.de)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/History
- *
- * Depends:
- * ui.core.js
- */
-(function($) {
-
-// TODO lazy loading singleton
-$.ui.hmanager = new function() {
- var states = {}, def = function() {};
-
- var $window = $(window), hash = location.hash;
-
- function getState() {
- return hash.replace('#', '');
- }
-
- var iframe;
- // var keepHistoryIn = iframe || window;
-
- return {
-
- enable: function() {
-
- if ($.browser.msie && parseInt($.browser.version) < 8) {
- $(function() {
- // create hidden iframe for hash change tracking
- iframe = $('<iframe id="ui-history-iframe" style="display: none;"></iframe>').
- prependTo(document.body)[0];
-
- // create initial history entry
- iframe.contentWindow.document.open();
- iframe.contentWindow.document.close();
-
- if (getState())
- iframe.contentWindow.document.location.hash = getState();
-
- });
- }
-
- $window.bind('hashchange', function(e) {
- // Prevent IE 8 from fireing an event twice,
- // one from true event, one from trigger...
- if (!iframe && hash == location.hash || iframe && hash == iframe.contentWindow.document.location.hash)
- return false;
-
- if ($.browser.msie && parseInt($.browser.version) < 8) {
- hash = iframe.contentWindow.document.location.hash;
- }
- else
- hash = location.hash;
-
- if (getState())
- states[getState()]();
- else
- // TODO invoke default
- ;
- });
-
- if (!($.browser.msie && parseInt($.browser.version) >= 8)) {
- setInterval(
- ($.browser.msie ?
- function() {
- if (hash != iframe.contentWindow.document.location.hash)
- $window.trigger('hashchange');
- } :
- function() {
- if (hash != location.hash)
- $window.trigger('hashchange');
- else
- // Do the history.length check hack for Safari 2
- ;
- }
- )
- , 200
- );
- }
- },
-
- add: function(state, handler) {
- states[state] = handler;
- },
-
- go: function(state) {
- if (state) {
- if ($.browser.msie && parseInt($.browser.version) < 8) {
- iframe.contentWindow.document.open();
- iframe.contentWindow.document.close();
- iframe.contentWindow.document.location.hash = state;
- }
- location.hash = state;
- $window.trigger('hashchange');
- }
- else
- console.log('TODO do default state');
- }
- }
-};
-
-$.ui.history = function() {
- var args = Array.prototype.slice.call(arguments, 1);
- $.ui.hmanager[arguments[0]].apply($.ui.hmanager, args);
-};
-
-})(jQuery);