PageSourceSearch

https://www.ilpiccolo.net/ilpiccolodialessandria/news/wp-content/p…navia-custom-populate-debug-page.js?ver=1.0

js ilpiccolo.net collected 2026-10-02 09:59:59 UTC 3,534 bytes, 99 lines download raw bytes

1/*
2function my_action_javascript() {
3
4    console.log("ciao");
5	jQuery(document).ready(function($) {
6
7		var data = {
8			'action': 'my_action',
9			'whatever': 1234
10		};
11
12		// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
13		jQuery.post(ajaxurl, data, function(response) {
14			alert('Got this from the server: ' + response);
15		});
16	});
17
18}
19*/
20
21function run_custom_populate(){
22    jQuery("#results-old")[0].innerHTML="";
23    jQuery("#results-new")[0].innerHTML="";
24	var dataVariable = {
25        'action': 'run_custom_populate', // your action name
26        'post_id': jQuery("#post_id_cp")[0].value,  
27        'type': "print" // some additional data to send
28    };
29
30    
31
32    jQuery.ajax({
33        url: ajaxurl, // this will point to admin-ajax.php
34        type: 'GET',
35        data: dataVariable,
36        beforeSend: function(jqXHR, settings) {
37            console.log(settings.url);
38        },
39        success: function (response) {
40            console.log(response);
41
42            display_json(response);
43		}
44            
45    });
46
47}
48
49function display_json(response){
50    $myObject=JSON.parse(response);
51    print_json("old");
52    print_json("new");
53    
54
55}
56
57function print_json(oldnew){
58    if($myObject["old"] == undefined){
59        jQuery("#results-old")[0].innerHTML=$myObject;
60    }
61
62
63    for (var key in $myObject[oldnew]){
64        
65        highlighted="text-normal";
66        if($myObject["changed"][key]==true && oldnew=="new"){
67            highlighted="text-highlighted";
68        }
69     
70        if (key == "category" || key == "source" || key == "destination" || key == "ta_other"){
71
72            jQuery("#results-"+ oldnew)[0].innerHTML = jQuery("#results-"+ oldnew)[0].innerHTML + "<br>" + "<div class='" + highlighted + "'>" + key + ":<div>" ;
73            for (var key2 in $myObject[oldnew][key]){
74                jQuery("#results-"+ oldnew)[0].innerHTML = jQuery("#results-"+ oldnew)[0].innerHTML + JSON.stringify($myObject[oldnew][key][key2]["name"]) +"<br>";     
75            }
76
77        }
78        else if (key == "post"){
79            //jQuery("#results-"+ oldnew)[0].innerHTML = jQuery("#results-"+ oldnew)[0].innerHTML + "<br>" + "<div class='" + highlighted + "'>" + key + ":<div>" ;
80            jQuery("#results-"+ oldnew)[0].innerHTML = jQuery("#results-"+ oldnew)[0].innerHTML + "<br>" + "<div class='" + highlighted + "'>" + key + ":<div>" ;
81            for (var key2 in $myObject[oldnew][key]){
82                jQuery("#results-"+ oldnew)[0].innerHTML = jQuery("#results-"+ oldnew)[0].innerHTML + key2 +": " + JSON.stringify($myObject[oldnew][key][key2]) +"<br>";
83            }
84
85        }else if (key == "meta"){
86            //jQuery("#results-"+ oldnew)[0].innerHTML = jQuery("#results-"+ oldnew)[0].innerHTML + "<br>" + "<div class='" + highlighted + "'>" + key + ":<div>" ;
87            jQuery("#results-"+ oldnew)[0].innerHTML = jQuery("#results-"+ oldnew)[0].innerHTML + "<br>" + "<div class='" + highlighted + "'>" + key + ":<div>" ;
88            for (var key2 in $myObject[oldnew][key]){
89                jQuery("#results-"+ oldnew)[0].innerHTML = jQuery("#results-"+ oldnew)[0].innerHTML + key2 +": " + JSON.stringify($myObject[oldnew][key][key2]) +"<br>";
90            }
91
92        }
93        else{
94            jQuery("#results-"+ oldnew)[0].innerHTML = jQuery("#results-"+ oldnew)[0].innerHTML + "<br>" + key +": " + JSON.stringify($myObject[oldnew][key]); 
95        }
96    }
97}
98
99

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.