PageSourceSearch

https://www.sibiul.ro/ajax-news.js

js sibiul.ro collected 2026-10-02 12:54:44 UTC 3,487 bytes, 103 lines download raw bytes

1// Declare our request variable.
2var request = false;
3
4// Define a function that will make our request for us:
5function retrieveNews(categ_id) {
6    // Clear the curent request
7    request = false;
8	var categ_id = categ_id;
9	var checkbox_fields = document.news_categ.stiri_categ;
10	//alert(categ_id);
11	//alert(getSelectedCheckbox(checkbox_fields));
12    //alert(getSelectedCheckboxValue(checkbox_fields));
13	
14	// Generate the request object and handle different browsers:
15    if (window.XMLHttpRequest) { // Mozilla & other compliant browsers
16        request = new XMLHttpRequest();
17    } else if (window.ActiveXObject) { // Internet Explorer
18        request = new ActiveXObject("Microsoft.XMLHTTP");
19    }
20
21    // If we don't have a request object, then error out.
22    if (!request) {
23        alert('Browser does not support AJAX!');
24        return false;
25    }
26
27    // Ok, now we are ready.  Make the request, and tell it to run the
28    // function 'updateDate' when it gets data back.
29    request.onreadystatechange = updateNews;
30
31    // Open the connection, sending the current value of the form element:
32    request.open('GET',
33        'ajax-news.php?categ_id=' + getSelectedCheckboxValue(checkbox_fields))
34    request.send(null);
35}
36
37// The function that will accept the data, and update the page:
38function updateNews() {
39    // Make sure that the state is '4', which means finished:
40    if (request.readyState == 4) {
41        // Make sure that the status is 200, or 'ok'
42        if (request.status == 200) {
43            // And now, update the text on the page:
44            var text = document.getElementById('filtred_news');
45            //text.innerHTML = result.firstChild.data;
46			text.innerHTML = request.responseText;
47        } else {
48            alert('Error performing request!' + request.status);
49        }
50    }
51}
52
53/*-----------------------------------------------------------+
54 | addLoadEvent: Add event handler to body when window loads |
55 +-----------------------------------------------------------*/
56function addLoadEvent(func) {
57	var oldonload = window.onload;
58	
59	if (typeof window.onload != "function") {
60		window.onload = func;
61	} else {
62		window.onload = function () {
63			oldonload();
64			func();
65		}
66	}
67}
68
69/*------------------------------------+
70 | Functions to run when window loads |
71 +------------------------------------*/
72addLoadEvent(function () {
73	initChecklist();
74});
75
76/*----------------------------------------------------------+
77 | initChecklist: Add :hover functionality on labels for IE |
78 +----------------------------------------------------------*/
79function initChecklist() {
80	if (document.all && document.getElementById) {
81		// Get all unordered lists
82		var lists = document.getElementsByTagName("ul");
83		
84		for (i = 0; i < lists.length; i++) {
85			var theList = lists[i];
86			
87			// Only work with those having the class "checklist"
88			if (theList.className.indexOf("checklist") > -1) {
89				var labels = theList.getElementsByTagName("label");
90				
91				// Assign event handlers to labels within
92				for (var j = 0; j < labels.length; j++) {
93					var theLabel = labels[j];
94					theLabel.onmouseover = function() { this.className += " hover"; };
95					theLabel.onmouseout = function() { this.className = this.className.replace(" hover", ""); };
96				}
97			}
98		}
99	}
100}
101
102
103/*<script src="<?= $website_address;?>/ajax-news.js" type="text/javascript"></script>*/

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.