-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtarget.html
More file actions
123 lines (99 loc) · 2.33 KB
/
target.html
File metadata and controls
123 lines (99 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.scrollTo.js"></script>
<script type="text/javascript">
var indexNum = 0;
$(document).ready(
function() {
fetchIRC();
//setInterval("ajaxd()", 10000);
setInterval("fetchIRC()", 1500);
}
);
function ajaxd() {
$.ajax({
type: "GET",
url: "random.php",
data: "indexNum=" + $("#indexCount").val(),
success: function(msg) {
$("#results").append(msg);
$("#indexCount").val( parseInt( $("#indexCount").val() ) + 1 ) ;
}
});
}
function fetchIRC() {
$.getJSON("output.json", parseJSONinput);
}
function parseJSONinput(objJSON) {
//console.log(objJSON);
objLen = objJSON.length;
initLoad = 5000;
if ( indexNum == 0 ) {
indexNum = objLen - initLoad;
if ( indexNum < 0 ) {
indexNum = 0;
}
}
for(var i = indexNum; i < objJSON.length; i++) {
var decoded = $("<div/>").text(objJSON[i][2]).html();
$("#results").append(decoded);
$("#results").append("<br>");
indexNum = i+1;
// $("#mydiv").scrollTop($("#mydiv")[0].scrollHeight);
}
if (document.getElementById("checkScroll").checked) {
$("#results").scrollTo('100%');
$("#results").css("overflow", "hidden");
} else {
$("#results").css("overflow", "scroll");
//$("#results").style.overflow = 'scroll';
}
} // end function parseJSONinput()
function toggleScroll() {
if (document.getElementById("checkScroll").checked) {
$("#results").scrollTo('100%');
$("#results").css("overflow", "hidden");
} else {
$("#results").css("overflow", "scroll");
//$("#results").style.overflow = 'scroll';
}
}
</script>
<style type="text/css">
div.chatwindow
{
border-style:dotted;
border-width:4px;
width:95%;
height:80%;
padding:10px;
overflow-y:scroll;
}
div.chatHeader
{
width:80%;
height:50px;
}
h1
{
text-align:center;
}
</style>
</head>
<body>
<div class="chatHeader">
<h3>You are watching #LOPSA-Live on freenode!</h1>
</div>
<div id="results" width="80%" class="chatwindow">
</div>
<div class="controlPanel">
<div class="checkScrollBox">
Auto Scroll
<input type="checkbox" id="checkScroll" name="checkScroll" value="checkScroll" label="Auto Scroll" checked onClick="toggleScroll()">
(uncheck to review history)
</div>
</div>
<input type="hidden" value="0" id="indexCount"/>
</body>
</html>