PageSourceSearch

https://www.visegradgroup.eu/js/aitia/aitia_url.js

js visegradgroup.eu collected 2026-09-24 18:15:39 UTC 4,285 bytes, 185 lines download raw bytes

1// függőségek
2if ("undefined" == typeof AITIA) {
3	alert("AITIA include missing!");
4} else if ("undefined" == typeof AITIA_COOKIE) {
5	alert("AITIA_COOKIE include missing!");
6}
7
8// többszörös include
9if ("undefined" != typeof AITIA_URL) {
10	 alert("AITIA_URL multiple insert!");
11}
12
13AITIA_URL = 1;
14
15Aitia.Url = {};
16
17/** ez visszaadja a get parametereket egy tombben
18  * @param empty ha true, akkor ures parametereket is visszaadja, default: true
19  * @return egy tomb, melyben nevvel lehet elerni a kulcsokat
20  */
21Aitia.Url.parseLocationSearch = function(empty) {
22  var empty=(empty != null) ? empty : true;
23  var ret=new Array();
24  var search=location.search;
25
26  if (search != '') {
27    search=search.substr(1);  //? levagasa
28    search=unescape(search);
29    var t=search.split('&');
30    for (var i=0; i<t.length; ++i) {
31      if (t[i]) {
32        var t2=t[i].split('=');
33        if (empty || t2[1]) {
34          //ha uresek is kellenek, akkor mindenkeppen kell
35          //amugy csak akkor, ha nem ures
36          ret[t2[0]]=t2[1];
37        }
38      }
39    }
40  }
41  
42  return ret;
43} // parseLocationSearch
44
45
46/** A PHPSESSID erteket adja vissza vagy get-bol, vagy cookie-bol
47  * @param sessionName opcialisan megadhato, hogy milyen nevu valtozot keressen, def: PHPSESSID
48  * @return a php session id-ja
49  */
50Aitia.Url.getSessionId = function(sessionName) {
51  var sessionName = (sessionName != null) ? sessionName : "PHPSESSID";
52 
53  var getValues = Aitia.Url.parseLocationSearch();
54  if (getValues[sessionName]) {
55    //ha _GET-ben utazik a session
56    return getValues[sessionName];
57  } else {
58    //ha _COOKIE-ban utazik a session
59    return getCookie(sessionName);
60  }
61  return ""; 
62} // getSessionId
63
64
65
66
67
68/* * * * * * * * * * * * * *
69	START PageQuery class
70 * * * * * * * * * * * * * */
71
72// Egy url get paraméter részét manipuláló osztály
73function PageQuery(q) {
74	q = trim(q);
75	var originQ = q;
76	
77	this.href = '';
78	if ( q.indexOf('?')>0 ) {
79		this.href = q.substring(0,q.indexOf('?'));
80		q = q.substring(q.indexOf('?'));
81	}
82	
83	this.q = ( q.indexOf('?')==0 ? q.substring(1, q.length) : q );
84	
85	this.hash = '';
86	if ( this.q.lastIndexOf('#')>0 ) {
87		this.hash = this.q.substring(this.q.lastIndexOf('#')+1);
88		this.q = this.q.substring(0,this.q.lastIndexOf('#'));
89	}
90
91	this.keyValuePairs = new Array();
92
93	if( q.length>0 ) {
94		for(var i=0; i<this.q.split("&").length; i++) {
95			var qIndex = trim(this.q.split("&")[i].split("=")[0]);
96			var qValue = ( typeof this.q.split("&")[i].split("=")[1]!='undefined' ? this.q.split("&")[i].split("=")[1] : '' );
97			
98			if ( qIndex!='' ) {
99				this.keyValuePairs.push( Array(qIndex,qValue) );
100			}
101		}
102	}
103
104	this.getKeyValuePairs = function() { return this.keyValuePairs; }
105
106	this.getLength = function() { return this.keyValuePairs.length; } 
107	
108	this.getValue = function(s) {
109		for(var j=0; j < this.keyValuePairs.length; j++) {
110			if(this.keyValuePairs[j][0] == s) return this.keyValuePairs[j][1];
111		}
112	
113		return false;
114	}
115	
116	this.setValue = function(s,newValue) {
117		var isSet = false;
118		
119		for(var j=0; j < this.keyValuePairs.length; j++) {
120			if(this.keyValuePairs[j][0] == s) {
121				this.keyValuePairs[j][1] = newValue;
122				isSet = true;
123			}
124		}
125		
126		if ( !isSet ) {
127			this.keyValuePairs.push( Array(s,newValue) );
128		}
129	}
130	
131	this.removeKey = function(s) {
132		var keyCount = 0;
133
134		for(var j=0; j < this.keyValuePairs.length; j++) {
135			if(this.keyValuePairs[j][0] == s) {
136				this.keyValuePairs.splice(j, 1);
137				keyCount += 1;
138			}
139		}
140
141		if ( keyCount>0 ) {
142			return true;
143		} else {
144			return false;
145		}
146	}
147
148	this.getQuery = function() {
149		var outStr = '';
150
151		for (var i=0;i<this.keyValuePairs.length;i++) {
152			if ( i>0 ) {
153				outStr += '&';
154			}
155			outStr += this.keyValuePairs[i][0]+'='+this.keyValuePairs[i][1];
156		}
157
158		return outStr;
159	}
160
161	this.getURL = function() {
162		var outStr = '';
163		
164		var urlSearch = this.getQuery();
165		
166		if ( this.hash!='' ) outStr = '#'+this.hash;
167		if ( urlSearch!='' ) outStr = '?'+urlSearch+outStr;
168		if ( this.href!='' ) outStr = this.href+outStr;
169
170		return outStr;
171	}
172}
173
174/* * * * * * * * * * * * * *
175	END PageQuery class
176 * * * * * * * * * * * * * */
177
178
179
180var orig_encodeURIComponent = encodeURIComponent;
181encodeURIComponent = function(param) {
182	return orig_encodeURIComponent(param).replace(/'/g, "%27");
183};
184
185

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.