Files
Umbraco-CMS/umbraco/presentation/umbraco_client/Application/HistoryManager.js
Shandem 545fec4cfe Fixes jquery 1.4.2 bugs, tree fully working with persistence between apps and much faster too :)
Also fixes: 26476, 26584 (Individual deletion from recycle bins, context menus for recycle bin items)

[TFS Changeset #65349]
2010-04-08 13:27:33 +00:00

50 lines
2.0 KiB
JavaScript

/// <reference path="/umbraco_client/Application/NamespaceManager.js" />
/// <reference name="MicrosoftAjax.js"/>
/// <reference path="/umbraco_client/Application/Query/jquery.ba-bbq.min.js" />
Umbraco.Sys.registerNamespace("Umbraco.Controls");
(function($) {
Umbraco.Controls.HistoryManager = function() {
/// <summary>This is a wrapper for the bbq plugin history manager, but we could do alot with history mgmt in the future!</summary>
var obj = {
onNavigate: function(e) {
var l = $.param.fragment();
if (l != "") {
jQuery(window.top).trigger("navigating", [$.param.fragment()]); //raise event!
}
},
addHistory: function(name, forceRefresh) {
if ($.param.fragment() == name && forceRefresh) {
this.onNavigate();
}
else {
$.bbq.pushState(name, 2);
}
},
getCurrent: function() {
return ($.param.fragment().length > 0) ? $.param.fragment() : "";
},
addEventHandler: function(fnName, fn) {
/// <summary>Adds an event listener to the event name event</summary>
if (typeof (jQuery) != "undefined") jQuery(window.top).bind(fnName, fn); //if there's no jQuery, there is no events
},
removeEventHandler: function(fnName, fn) {
/// <summary>Removes an event listener to the event name event</summary>
if (typeof (jQuery) != "undefined") jQuery(window.top).unbind(fnName, fn); //if there's no jQuery, there is no events
}
};
//wire up the navigate events, wrap method to maintain scope
$(window).bind('hashchange', function(e) { obj.onNavigate.call(obj); });
return obj;
};
})(jQuery);