PageSourceSearch

https://aplicaciones.anp.com.uy/CtaCteANP/static/Shared/HistoryManager/HistoryManager.js

js anp.com.uy collected 2026-09-24 23:27:43 UTC 3,853 bytes, 141 lines download raw bytes

1function HistoryManager()
2{
3	this.start = function(){
4		if (gx.grid.drawAtServer)
5			return;
6		HistoryManager.Initialize(this);
7		this.UpdateProperties();
8	};
9	
10	this.destroy = function(){
11		if (gx.grid.drawAtServer)
12			return;
13		HistoryManager.RemoveListener(this);
14	};
15	
16	this.urlListener = function(){
17		if (gx.grid.drawAtServer)
18			return;
19		if (this.URLChanged){
20			this.UpdateProperties();
21			this.URLChanged();
22		}
23	};
24	
25	this.getId = function(){
26		return (this.ParentObject ? this.ParentObject.CmpContext || "" + "-" + this.ParentObject.ServerClass || "" : "") + "-" + this.ControlName;
27	};
28
29	this.AddHistoryPoint = function(pointId, fireUrlChangedEvent){
30		if (gx.grid.drawAtServer)
31			return;
32		HistoryManager.AddHistoryPoint(pointId, !(fireUrlChangedEvent === true));
33	};
34	
35	this.UpdateProperties = function(){
36		if (gx.grid.drawAtServer)
37			return;
38		this.Hash = (document.location.hash.length > 0) ? document.location.hash.substr(1) : "";
39		this.URL = document.location.href;
40		this.QueryString = (document.location.search.length > 0) ? document.location.search.substr(1) : "";
41	};
42}
43
44HistoryManager.listeners = {};
45
46HistoryManager.listenerFn = function(){
47	if (gx.grid.drawAtServer)
48		return;
49	for (var listener in HistoryManager.listeners){
50		var fn = HistoryManager.listeners[listener];
51		if (fn){
52			fn();
53		}
54	}
55};
56
57HistoryManager.Initialize = function (uc) {
58	if (window.dhtmlHistory.isSupported){
59		if (!HistoryManager.m_initialized){
60			HistoryManager.m_initialized = true;
61			if (!window.dhtmlHistory.isCreated)
62				dhtmlHistoryCreate();
63			window.dhtmlHistory.initialize();
64			gx.fx.obs.addObserver('gx.onunload', HistoryManager, HistoryManager.Destroy);
65			window.dhtmlHistory.addListener(HistoryManager.listenerFn);
66		}
67	
68		if (!uc.IsPostBack){
69			HistoryManager.AddListener(uc);
70			if (document.location.hash != ""){
71				gx.evt.on_ready(uc, function(){
72					setTimeout(function () {
73						window.dhtmlHistory.checkLocation();
74						window.dhtmlHistory.fireHistoryEvent(document.location.hash);
75					}, 10);
76				});
77			}
78		}
79	}
80};
81
82HistoryManager.Destroy = function () {
83	window.dhtmlHistory.destroy();
84	HistoryManager.m_initialized = false;
85};
86
87HistoryManager.AddListener = function(inst){
88	if (gx.grid.drawAtServer)
89		return;
90	HistoryManager.listeners[inst.getId()] = function(){
91		HistoryManager.PushReferer(window.location.hash);
92		inst.urlListener();
93	};
94};
95
96HistoryManager.PushReferer = function(anchor) {
97	var curLoc,
98		url,
99		anchor = anchor ? '#' + anchor.replace('#','') : '';
100	if (gx.ajax && typeof(gx.ajax.pushReferer) == 'function') {
101		curLoc = window.location.toString();
102		url = (curLoc.indexOf('#') >= 0) ? curLoc.replace(/#.*$/, anchor) : curLoc + anchor;
103		gx.ajax.pushReferer(gx.popup.popuplvl(), url);
104	}
105};
106
107HistoryManager.RemoveListener = function(inst){
108	if (gx.grid.drawAtServer)
109		return;
110	delete HistoryManager.listeners[inst.getId()];
111};
112
113HistoryManager.AddHistoryPoint = function(anchor, avoidURLChangedEvent, event){
114	if (gx.grid.drawAtServer)
115		return;
116	if (event)
117		event.stopPropagation();		
118	else {
119		if (gx.spa)
120			gx.spa.ignoreClick = true;
121	}
122		
123	// anchor: History point identifier
124	// avoidURLChangedEvent: Set to true if you want to avoid fireing the URLChanged event with the hash change. Set to false if you want to fire the URLChanged event.
125	if (window.dhtmlHistory.isSupported){
126		if (avoidURLChangedEvent) {
127			window.dhtmlHistory.add(anchor);
128			HistoryManager.PushReferer(anchor);
129		}
130		else{
131			if (window.dhtmlHistory.isIE){
132				window.dhtmlHistory.ignoreLocationChange = true; // Set to true to avoid fireing the URLChanged event twice in IE.
133			}
134			document.location.hash = "#" + anchor;
135		}
136
137		return false;
138	}
139	else
140		return true;
141};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.