5 var page_times
= Array();
8 var processing_file_time
= true;
11 var display_para_interval
;
12 var time_param_set
= 0;
13 var display_changed
= false
15 var month_names
=["Jan" , "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec"];
16 var day_names
=["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
17 function beginAJAXCalls(){
21 function retrieveLedgerFile(){
22 var ledger_request
= new XMLHttpRequest();
23 ledger_request
.onreadystatechange
= ledgerFetch
;
24 ledger_request
.open("GET", "../4Chan_Bans_Log-Ledger.txt");
25 ledger_request
.send();
28 function ledgerFetch(ledger
){
29 ledger
= ledger
.currentTarget
;
30 if(ledger
.readyState
== 4){
31 ledger_arr
= ledger
.response
.split("\n");
32 item_count
= ledger_arr
[0];
33 top_page
= ledger_arr
[1];
36 var page_max
= parseInt(top_page
)+1;
37 current_file
= top_page
;
39 display_para_interval
= setInterval(alterDisplayParagraph
, 16);
40 listing_interval
= setInterval(createListingItems
, 16);
47 function fetchFileTime(){
48 $.post('Scripts/sql-reader.php', {Query
:1},
49 function(query_response
) {
50 query_response
= query_response
.split("-");
51 query_response
.forEach(function(query_set
){
52 query_set
= query_set
.split(" ");
53 page_times
[query_set
[0]] = new Date(query_set
[1]*1000).toUTCString();
55 processing_file_time
= false;
60 function alterDisplayParagraph(){
61 if(!processing_file_time
){
62 document
.getElementById("display_id").textContent
= "Displaying " + item_count
+ " results of " + (parseInt(top_page
)+1) + " pages from " + page_times
[bottom_page
]
63 + " to " + page_times
[top_page
] + ".";
64 document
.getElementById("display_id").setAttribute("style", "display:block");
65 display_changed
= true;
69 function unsetIntervals(){
70 clearInterval(display_para_interval
);
71 clearInterval(listing_interval
);
74 function createListingItems(){
75 if(page_times
[current_file
] !== undefined){
76 var listing_r
= document
.getElementById("rendered_listing_id");
77 var li_r
= document
.createElement("LI");
78 li_r
.innerHTML
= "<a href='pages?file=" + ((top_page
- current_file
) + 1) + "'>" + page_times
[current_file
] +"</a>";
80 listing_r
.appendChild(li_r
);
82 var listing_j
= document
.getElementById("json_listing_id");
83 var li_j
= document
.createElement("LI");
84 li_j
.innerHTML
= "<a href=' Logs/4Chan_Bans_Log-Reverse_Chrono-" + (current_file
) + ".json'>" + page_times
[current_file
] +"</a>";
85 listing_j
.appendChild(li_j
);
88 if(current_file
< 0 && display_changed
){