SHOW:
|
|
- or go back to the newest paste.
1 | //================================================================ | |
2 | // | |
3 | // Toastmaster 2.5.3 | |
4 | // Finds the bread so you don't have to. | |
5 | // | |
6 | // Always look through the code to find shifty stuff. | |
7 | // | |
8 | // | |
9 | //================================================================ | |
10 | //2345678901234567890123456789012345678901234567890123456789012345 | |
11 | /* | |
12 | these files can be extracted and saved as text and they should | |
13 | still be loadable | |
14 | */ | |
15 | var container; | |
16 | /* this is literally just a picture of toast */ | |
17 | ||
18 | var toast = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAA" | |
19 | + "AAbCAMAAAC6CgRnAAAARVBMVEWZMwAAAABmMwBmMzNmZjOZZgCZ" | |
20 | + "ZjOZZmbMZgDMZjPMZmaZmTOZmWbMmTPMmWbMmZn/mWbMzGbMzJn" | |
21 | + "/zGb/zJn/zMz//8zDFCa2AAAAAXRSTlMAQObYZgAAAAlwSFlzAA" | |
22 | + "ALEwAACxMBAJqcGAAAAAd0SU1FB+IIBAI4ECHmtE4AAAFKSURBV" | |
23 | + "CjPVVIBcsMwCKubQuZb0J2xu/8/dRJJt5ZzcnGEhAy+3V7R3uL2" | |
24 | + "FtrfffN927a7P+7tDYEDuRiZ4II/LrQ5EQwQKVAp8HZCBu6Jrpm" | |
25 | + "5JpiST+ytBGFBovIrB5iDX3RECCKKh+SDSoxEYaYtWVEkhkdgCl" | |
26 | + "uBTmIO2kHwr015m6mCqROMkMwsOcjOurwERYbcpBDrgfyBsPpDM" | |
27 | + "VHLiVTYifJ5sEiWKs6FoLtRPo+ijXI4aazzvGEvrHJXnAcgyi9b" | |
28 | + "wiyrm8mKKUCS5IJnaPFfpXrHWt27xyqsV8Fuhu5yadHDIcy+7eK" | |
29 | + "xWVaaqKyz15IHaWFfTjkhvTQpEp1pxmWdc+aL7D/M1F1a57l6KI" | |
30 | + "GwNPuCrOZ5tlVvCsU4edX6+he8E+xY5bWaA0eX6+BgBq/SwfGz/" | |
31 | + "2EahAbLGgd8Z/92v0JD+rjQH/ELBU8elOTZkAQAAAAASUVORK5C" | |
32 | + "YII="; | |
33 | ||
34 | /* this is an MP3 file. you should inspect it yourself */ | |
35 | var frog = "data:audio/wav;base64,UklGRjkKAABXQVZFZm10IBAAAAABA" | |
36 | + "AEAQB8AAEAfAAABAAgAZGF0YRUKAAB9fn1+gIGDhIOAf4B/gH+B" | |
37 | + "goGCgYKBf4CAf4B/gIGDgoGCf4B+foGCgYKBfnx9f3+AgoGCgoK" | |
38 | + "Af35/gYB/f4B/foKDhIOEg398fYB+fH6BgoGCgX9+foGCgYKCgH" | |
39 | + "17e3yAhISCgYOEg4GAfHuAg4SDgH+BgoGBg4aEf31/f3x8foB9e" | |
40 | + "XuAgoCAg4aFgoF+e3p8f4B8foOBf4GEgn6Ag4N+f4SDe3d+gn1+" | |
41 | + "h4h8e4aLh4GDhoB4eoB+eX6HhXx8g4R8fIODgX+Cgnp3foF8fYS" | |
42 | + "Ggn+BgHp4en6Af4CBf4GEgoCCh4V+en2CgX6DiYh+eH6BfICMjo" | |
43 | + "J4eXl4gIuLhIGDfnV7hYeDhYh9b3F9gn+Bh4Z7dX+Ef3+Lint0f" | |
44 | + "YN8e4SFeniDiYB5g4d/foaEdnqJjH58iId4eIaGeHqIhXR1hYh6" | |
45 | + "dn+Ce3qFiod9d4CGgnp+hYF5e4WHgYGHhHd2goiDg4uNf3iBhHt" | |
46 | + "7iZCDdnl8dneGjYF3fHtzdIKKhH+Afnd0eoOFfXd+iIN7hY2Acn" | |
47 | + "aEiImPjn1rboCTlo+Gdm5veIuYmY59Z11shJaenIVnX2NqgZ2fi" | |
48 | + "315bGV4kIp2f457aH2UgmyDnodqe5WCaIKkjGVymIxjcaCdbWSN" | |
49 | + "l25gi6aFYXWUelx8p5RocJiKXWidqHdghp1zWIKumWlumJNiYJe" | |
50 | + "vfll9m3FTga2NWG+ce1F5sp5kaZiDV3avr3lohXVQZp6ynYmBal" | |
51 | + "xxhYSOoZRwbY6KYGiXlm1/r5RbZY95V4i+oF9hinJMe7mra2KFa" | |
52 | + "Ul6urBwZIpyTXu1omVxpIhYdq2RV26upGJjoJ1bWZ61d1SKqW1M" | |
53 | + "jsSVUG2jdUN8w6FQXpx7RXnAolhtoHRMgbyfZXqZZEByqJFniKl" | |
54 | + "+W3mcmXxodIeAfpmfeWJ6kIZ/lJl5a4WTeWuEknZmgZN6aIKPaF" | |
55 | + "WApI1uhplwW3ySfH6qsYBda3VoeKi1hmJ0fVxinrKCapScbGuil" | |
56 | + "1RUj5ZkdLqsWkR9lWhzvrlrVH99T2u2uHNeh4VXZaOhZWWel1xi" | |
57 | + "oZtWXa29dWChqVpSqs6DSoKlWDWLxoVIeJhOO5rYnFaDqGIzcLe" | |
58 | + "mboGwj19xloRedqKMYnmSX0WJwphnkK9sNXC+o15ynntdfpaLf3" | |
59 | + "yAhIF/gIOCfnt+gH9/gYKBgoF+e32BgX+Af4GCgYKBgoGBgoGCg" | |
60 | + "YKAf4B/gH+BgX+Af4CBg4SGhIKBgoF/gYKCgH1/gYKBgoGCfnuA" | |
61 | + "goB/gYJ+f3+BgoKEgoF/gH+AgoGCgoB/fX6Af4CCgn99f4B/gIG" | |
62 | + "CgX+BgoGAf4GCgYKBgoF/gYKDgYCDg397fYB/f4GFhoSBfnx7fX" | |
63 | + "+AgYODhIKBf4B/e32AgoF/gH97foGAgH+BgX+AgYKBgoSDgYKBg" | |
64 | + "oGAgoKAgYKAf4CDhYOCf319foCBgX1+gYF/gISGg4GBgn19gYB/" | |
65 | + "gIJ/e36BgYB+f35+gICCgoGAgYJ/e36CgH5/g4J/gYKEgn+Bg4O" | |
66 | + "AgIOEgX+BgoGCgYOBfH+CgHt9g4WBfICDg35/gYB/foGEg4B9e3" | |
67 | + "p9goGAhIiFe3d7gIOEg4GAf4GBfX+CgX9+gYF8foWGgHt/gn58g" | |
68 | + "IOBf4GBfH2DhYJ/gYSBe32AfnyChIKEhoN/gYKBf4KGgnp7fXp8" | |
69 | + "hYeBgIJ/en2Fgnl4g4eCg4R+eHh+goGCgoWBeHl/gHx/h4J3eIG" | |
70 | + "DgIOGgX6EiH58h42Een2CgHp4gIaAf4ySgW51h4h+goqDdnuJgW" | |
71 | + "1zjI97eIyPeXB6f3l5hox/dHuEfXeBh4J9gH55fYKDhIN9eoKDf" | |
72 | + "ICIgXd8iIZ6f4yOgnyChX17h4qCeYCGfnuChH13eX+Dg4F+f4B9" | |
73 | + "fYB8e4GGfnmAg3x4e3p0d4aHfnyCgXuAiIR4eoJ7dX+PlI6Ig3l" | |
74 | + "ydYGHhoyVi3dvdHZ3g5GUi4WFgXpyamx+j42CiJOEbGlxb3CKoJ" | |
75 | + "V9eXxpW22LkomPn5NxY292bG+Rr6qNfIJ8XU1qlaWXhpGcgllSc" | |
76 | + "4uIiZGIdXqAbnKQlXlrhZiBaniQh3J6jo57doGIgHZ7g4F6f4uM" | |
77 | + "gHJ5g4J8g4p8bnaGgXmEjHlqeox+b36RhG58kol0f5eLcHaPjnp" | |
78 | + "/lIxsYnWBfYuhoIFoZmVqg6GkkIB2ZGCAnY9xd5F+X3Gbl2xpjI" | |
79 | + "llcJ+gc2KEh2Jon7CBXX6WbVmJr4lfgKaAV3upiVd2rZpgZ6CUV" | |
80 | + "2GjomNblZFUY6mxb16YjlRprrR2aJKFVWCUooN6lIdfZYeNd3eP" | |
81 | + "jGtmiZd2ZIOYd1+GsZhgYpCOW2Kit4NagJ9zUYK2mmB1qYtQaKe" | |
82 | + "TTlylrWhPjaVfSpHBi054pW1Hg76kZnadd0xroqZ/fJmEX2mIjo" | |
83 | + "iHgXl3eXl6hIyFeHV7d293hod6eIWGeHSFjoJ2foiBfIeQhnl7h" | |
84 | + "IJ/hIiGgn1ya3qTlYd/gHVibJCei3qHimhRbZOThJKihF1jgoBo" | |
85 | + "d5+fc2OIl2xUf6KAX4q4k1tnkn9VdLKscWeXkVRZmqtzYJ6saE+" | |
86 | + "JnFxNlb2FUH+naD+AxLFnb6J6QFibr4FslpZmYoWXj4J7gIZ8bG" | |
87 | + "t8ioiFjZF5YW2Ff2p6m49nbpqVYFiFmHNporqEVW+PaVSUx6Bjd" | |
88 | + "aB4RW+xnF1yt6VXUpWcTkSYxotKeahkK2nDznpYlY9KRYSwlXOK" | |
89 | + "lnBgfZOPiIN7dneBioiCg4aAc292g4N4dYGIgHl9hH1ydIOLgny" | |
90 | + "GiXpzgY2BdoOZmYBvfI6MeHOEhWhbe52YhIOPfVlTb4WGjqGhe1" | |
91 | + "Zcen9zi66heHaQf1JVh5V2fq+yeFRjbFNjqsmgcoCDUE2QuI9sn" | |
92 | + "bp7RGCUdUBuv712Xo2HOz+e2KhfgqVhMWaxqXJ4n4BVbJGVhoKH" | |
93 | + "hHp3fIGEhoJ+fHx2cHJ2dnV+i46GhIuJd2pxfoCBjJiRgXx+end" | |
94 | + "9io+Dd4CSlIh5cnBjW26MlpGTloRhUWeHg3qXtJtpYHmAamqLm4" | |
95 | + "qEmJBlV298am2dwKZwZnprTWyzwpWBnpNSPXSbcFWb2adTUYVoJ" | |
96 | + "FzS8ZlVgY5AJXS7pG6Do31cdZeUhn55e4OLioODiYd9dXd7f4KF" | |
97 | + "hYSBenNxdnh3eH+Ki4WBgn54en6AgomSkIiDhIJ7dnd8f4KKlJe" | |
98 | + "Qf29pYVtke5ajnIRtYF9sgY2Up7amhG5tbGNpjq2lj4N1VzY9a4" | |
99 | + "yZtNzPgUtMUD5QpOXSloeFUjBelH1zvNOAQnKaPQV/9+GCf8Z7A" | |
100 | + "BOo5oNkoqVTRIejkn94e4aLiYSFjIt+cm5wdHV6hIaCg4iLgnV3" | |
101 | + "gn98jJuWhH+CfGtkeI+NfX2RnZJ7bWtjYX6aknqAmpd6Y2h2fYi" | |
102 | + "ZopN/eoB6aWiAjoiLnqGDZGZza197q7WYhox9T0F6rJh7nruGRF" | |
103 | + "mafCZM1emXa621OgBB39mPi6eeXE1vioV/gYGAf4CAgoF/gH+Bg" | |
104 | + "oB/"; | |
105 | ||
106 | function _i(o) { | |
107 | return (o) ? document.getElementById(o) : null; | |
108 | } | |
109 | function _n(o) { | |
110 | return (o) ? document.getElementsByName(o) : []; | |
111 | } | |
112 | function _t(o) { | |
113 | return (o) ? document.getElementsByTagName(o) : []; | |
114 | } | |
115 | function _$(o) { | |
116 | return (o) ? document.getElementsByClassName(o): []; | |
117 | } | |
118 | ||
119 | function _c(ob,id) { | |
120 | switch(ob) { | |
121 | case 'DIV': | |
122 | case 'SPAN': | |
123 | case 'INPUT': | |
124 | var ob = document.createElement(ob); | |
125 | ob.id = id; | |
126 | break; | |
127 | case 'LABEL': | |
128 | var ob = document.createElement(ob); | |
129 | ob.setAttribute('for', id); | |
130 | break; | |
131 | default: | |
132 | ob.appendChild(document.createTextNode(id)); | |
133 | } | |
134 | return ob; | |
135 | } | |
136 | ||
137 | function css(s, j) { | |
138 | for(var k in j) { | |
139 | s.style[k] = j[k]; | |
140 | } | |
141 | } | |
142 | ||
143 | function filter_by_id() { | |
144 | var id = _i('search_input').value; | |
145 | var list = _$('poster_id'); | |
146 | var node; | |
147 | var valid; | |
148 | for(var i = 0; i < list.length; i++) { | |
149 | node = (list[i].parentNode.parentNode); | |
150 | valid = (-1 == node.innerText.indexOf(id)); | |
151 | node.style.display=(valid)?'none':'inline-block'; | |
152 | if (node.nextSibling) { | |
153 | node.nextSibling.style.display=(valid)?'none':'inline'; | |
154 | } | |
155 | } | |
156 | } | |
157 | ||
158 | function get_bread_number(text) { | |
159 | if ( (text.toLowerCase().indexOf('ebake') != -1) | |
160 | || (text.toLowerCase().indexOf('q research general') != -1)) { | |
161 | var rx = /[^0-9]*([0-9]+)[^0-9]*/g; | |
162 | var arr = rx.exec(text); | |
163 | ||
164 | return arr && arr.length > 1 ? arr[1] : false; | |
165 | } | |
166 | ||
167 | return false; | |
168 | } | |
169 | window.colored = 0; | |
170 | window.all_breads = {}; | |
171 | ||
172 | function make_toast(url, time) { | |
173 | ||
174 | var response; | |
175 | var x = new XMLHttpRequest(); | |
176 | x.open('GET', url, true); | |
177 | ||
178 | if (typeof window.all_breads[url] == 'undefined') { | |
179 | window.all_breads[url] = 0; | |
180 | } | |
181 | if (window.all_breads[url] > 751 || window.all_breads[url] == -1) { | |
182 | return; | |
183 | } | |
184 | if (url == '#') { | |
185 | var opt = _c('SPAN', "ribbit"); | |
186 | ||
187 | var container = _i('dythreads'); | |
188 | ||
189 | var colors = ["#fefefe", "green", "red"]; | |
190 | ||
191 | ||
192 | css(opt,{ | |
193 | font : 'normal normal bold 8px/15px ' | |
194 | + '"Courier New", Courier, Monospace', | |
195 | float : 'right', | |
196 | color : colors[1], | |
197 | cursor : 'pointer', | |
198 | width : '49px', | |
199 | height : '13px', | |
200 | margin : '1px', | |
201 | border : '1px solid #b0b0b0', | |
202 | display : 'inline-block', | |
203 | filter : 'brightness(100%)', | |
204 | textAlign : 'left', | |
205 | textIndent : '9px', | |
206 | borderRadius : '3px', | |
207 | verticalAlign : 'top', | |
208 | backgroundSize : '13px' | |
209 | }); | |
210 | ||
211 | opt.innerHTML = "RIBBIT!" | |
212 | + " <span style='font-weight:bold;color:" | |
213 | + colors[2] | |
214 | + ";'>" | |
215 | + "</span>"; | |
216 | ||
217 | ||
218 | container.appendChild(opt); | |
219 | ||
220 | opt.onclick = function () { | |
221 | var snd = new Audio(frog); | |
222 | snd.play(); | |
223 | }; | |
224 | return; | |
225 | } | |
226 | else x.onreadystatechange = function() { | |
227 | var that = url; | |
228 | ||
229 | if(x.readyState === 4 && x.status == 200) { | |
230 | ||
231 | response = JSON.parse(x.responseText); | |
232 | ||
233 | var container = _i('dythreads'); | |
234 | ||
235 | var bread = response.posts[0]; | |
236 | var posts = response.posts.length; | |
237 | var txt = bread.sub; | |
238 | window.all_breads[url] = posts; | |
239 | if (typeof txt == 'undefined') { | |
240 | txt = bread.com; | |
241 | if (txt.length > 40) { | |
242 | txt = txt.substring(0,39) + '...'; | |
243 | } | |
244 | } | |
245 | var num = get_bread_number(txt); | |
246 | ||
247 | // skip this bread forever | |
248 | if (false == num) { | |
249 | window.all_breads[that] = -1; | |
250 | return; | |
251 | } | |
252 | ||
253 | var thread = _n('thread'); | |
254 | ||
255 | var hrefs = _t('A'); | |
256 | for(var i = window.colored; i < hrefs.length; i++) { | |
257 | ||
258 | if (-1 == hrefs[i].href.indexOf("res/" + thread[0].value+".html") && | |
259 | -1 != hrefs[i].href.indexOf("qresearch")) { | |
260 | hrefs[i].style.color='#0077aa'; | |
261 | window.colored = i; // don't color it twice. | |
262 | } | |
263 | } | |
264 | ||
265 | if (thread[0].value == bread.no) { | |
266 | var pfi = _i('post-form-inner'); | |
267 | ||
268 | if (pfi && (posts > 750)) { | |
269 | css(pfi,{ | |
270 | border :'3px solid red', | |
271 | padding :'3px', | |
272 | opacity : '0.7', | |
273 | background : 'url(data:image/png;base64,iVB' | |
274 | + 'ORw0KGgoAAAANSUhEUgAAAAQAAAAE' | |
275 | + 'CAYAAACp8Z5+AAAAGklEQVQIW2NkY' | |
276 | + 'GD4D8SMQAwGcAY2AbBKDBUAVuYCBQ' | |
277 | + 'Pd34sAAAAASUVORK5CYII=) repeat', | |
278 | borderRadius : '10px', | |
279 | }); | |
280 | } | |
281 | } | |
282 | ||
283 | var opts = _n('toast'); | |
284 | var colors = ((thread[0].value == bread.no) | |
285 | ? ((posts < 750) | |
286 | ? ["#04ae04", "white", "black"] | |
287 | : ["#ae0404", "white", "black"]) | |
288 | : ["#fefefe", "green", "red"]); | |
289 | for(var i = 0; i < opts.length; i++) { | |
290 | if (opts[i].getAttribute('no') == bread.no) { | |
291 | opts[i].innerHTML = num | |
292 | + " <span style='font-weight:bold;color:" | |
293 | + colors[2] | |
294 | + "'>" | |
295 | + posts | |
296 | +"</span>"; | |
297 | ||
298 | opts[i].style.background = colors[0] | |
299 | + " url(" | |
300 | + toast | |
301 | + ") 0px 0px/25px 25px no-repeat"; | |
302 | ||
303 | opts[i].style.backgroundSize = "13px"; | |
304 | ||
305 | return; | |
306 | } | |
307 | ||
308 | } | |
309 | ||
310 | var opt = _c('SPAN', "" + bread.no); | |
311 | ||
312 | opt.setAttribute('no',bread.no); | |
313 | ||
314 | opt.addEventListener('mouseout',function() { | |
315 | css(opt,{ | |
316 | cursor : 'pointer', | |
317 | filter : 'brightness(100%)' | |
318 | }) | |
319 | }); | |
320 | ||
321 | opt.addEventListener('mouseover',function() { | |
322 | css(opt,{ | |
323 | cursor : 'auto', | |
324 | filter : 'brightness(80%)' | |
325 | }) | |
326 | }); | |
327 | ||
328 | css(opt,{ | |
329 | font : 'normal normal bold 8px/15px ' | |
330 | + '"Courier New", Courier, Monospace', | |
331 | float : 'right', | |
332 | color : colors[1], | |
333 | width : '59px', | |
334 | height : '13px', | |
335 | margin : '1px', | |
336 | border : '1px solid #b0b0b0', | |
337 | display : 'inline-block', | |
338 | filter : 'brightness(100%)', | |
339 | textAlign : 'left', | |
340 | textIndent : '18px', | |
341 | background : colors[0] + ' url(' + toast | |
342 | + ') 0px 0px/25px 25px no-repeat', | |
343 | ||
344 | borderRadius : '3px', | |
345 | verticalAlign : 'top', | |
346 | backgroundSize : '13px' | |
347 | }); | |
348 | ||
349 | opt.innerHTML = num | |
350 | + " <span style='font-weight:bold;color:" | |
351 | + colors[2] | |
352 | + ";'>" | |
353 | + posts | |
354 | + "</span>"; | |
355 | ||
356 | opt.id = "" + bread.no; | |
357 | ||
358 | container.appendChild(opt); | |
359 | ||
360 | opt.setAttribute('name','toast'); | |
361 | ||
362 | opt.onclick = function () { | |
363 | var no = bread.no; | |
364 | if(typeof url != 'undefined') { | |
365 | window.location.href = | |
366 | '/qresearch/res/' + no + '.html'; | |
367 | } | |
368 | }; | |
369 | ||
370 | opt.setAttribute('old',false); | |
371 | } | |
372 | }; | |
373 | x.send(); | |
374 | ||
375 | } | |
376 | ||
377 | // every 60 seconds we reload from threads.json | |
378 | ||
379 | function refresh() { | |
380 | // prune expired breads and append new ones. | |
381 | var opts = _n('toast'); | |
382 | ||
383 | for(var i = 0; i < opts.length; i++) { | |
384 | if (opts[i].getAttribute('old') == true) { | |
385 | container.removeChild(opts[i]); | |
386 | ||
387 | } | |
388 | else { | |
389 | opts[i].setAttribute('old',true); | |
390 | } | |
391 | } | |
392 | ||
393 | var x = new XMLHttpRequest(); | |
394 | x.open('GET', "/qresearch/threads.json", true); | |
395 | x.onreadystatechange = function() { | |
396 | if(x.readyState === 4 && x.status == 200) { | |
397 | ||
398 | var response = JSON.parse(x.responseText); | |
399 | find_recent_bread(response); | |
400 | } | |
401 | }; | |
402 | x.send(); | |
403 | trips(); | |
404 | ||
405 | ||
406 | } | |
407 | window.qcount = 0; | |
408 | // Count instances of Q with trips, mark untripped Q's as fakes | |
409 | function trips() { | |
410 | var m = _i('notify'); | |
411 | var t = 0; | |
412 | var k, r; | |
413 | var list = _$('trip'); | |
414 | for(var i = 0; i < list.length; i++) { | |
415 | r = list[i].innerText.trim(); | |
416 | if (list[i].parentNode.parentNode.className !='intro') continue; | |
417 | if (! r.length || r == 'FAKE') { | |
418 | continue; | |
419 | } | |
420 | k = list[i].previousSibling.innerText.trim(); | |
421 | if (k == 'Q' || k == 'Q+') { | |
422 | t++; | |
423 | ||
424 | } | |
425 | } | |
426 | if (t) { | |
427 | m.innerHTML = "Q Posts (" + t + ")"; | |
428 | ||
429 | if(window.qcount != t) { | |
430 | var snd = new Audio(frog); | |
431 | snd.play(); | |
432 | } | |
433 | window.qcount = t; | |
434 | ||
435 | } | |
436 | if ((t != window.t) && t) { | |
437 | m.animate([ | |
438 | { color: 'red' }, | |
439 | { color: 'white' }, | |
440 | { color: 'blue' } | |
441 | ], { | |
442 | duration: 500, | |
443 | iterations: 17 | |
444 | }); | |
445 | window.t = t; | |
446 | } | |
447 | var list = _$('name'); | |
448 | for(var i = 0; i < list.length; i++) { | |
449 | r = list[i].innerText.trim(); | |
450 | k = list[i].nextSibling; | |
451 | ||
452 | if (k && k.className!='trip') { | |
453 | if (r == 'Q' || r == 'Q+') { | |
454 | list[i].innerHTML = r | |
455 | + " <span style='color:red'>[FAKE]</span>"; | |
456 | } | |
457 | } | |
458 | } | |
459 | ||
460 | } | |
461 | ||
462 | function find_recent_bread(board) { | |
463 | var now = ~~((new Date).getTime() / 1000); | |
464 | var thread; | |
465 | for(var i = 0; i < board.length; i++) { | |
466 | for(var j = 0; j < board[i].threads.length; j++) { | |
467 | thread = board[i].threads[j]; | |
468 | // only show threads modified within the last 2 hours | |
469 | ||
470 | if (now - thread.last_modified < 7200) { | |
471 | make_toast('/qresearch/res/'+thread.no + '.json', | |
472 | thread.last_modified); | |
473 | } | |
474 | } | |
475 | } | |
476 | ||
477 | } | |
478 | ||
479 | // Post controls is loaded and we're already in a thread | |
480 | // append the controls at the top, but only once. | |
481 | var toast_init = function() { | |
482 | container = (_n('postcontrols'))[0]; | |
483 | var dythreads = _i('dythreads'); | |
484 | ||
485 | if (! dythreads) { | |
486 | var box = _c('DIV', 'notify'); | |
487 | var bar = _c('DIV', 'dythreads'); | |
488 | var label = _c('LABEL', 'search_input'); | |
489 | var text = _c(label, 'Search:'); | |
490 | var search = _c('INPUT', 'search_input'); | |
491 | ||
492 | container.appendChild(bar); | |
493 | bar.appendChild(label); | |
494 | bar.appendChild(search); | |
495 | bar.appendChild(box); | |
496 | ||
497 | css(bar,{ | |
498 | top : '15px', | |
499 | width : 'calc(100% - 8px)', | |
500 | height : '16px', | |
501 | margin : '0 0 0 -16px', | |
502 | zIndex : '100', | |
503 | display : 'block', | |
504 | padding : '0 8px 0 16px', | |
505 | position : 'fixed', | |
506 | textAlign : 'left', | |
507 | background : '#eef2ff url(/stylesheets/img/fade-blue.png)' | |
508 | + ' repeat-x 50% 0%', | |
509 | borderBottom : '1px solid #b0b0b0' | |
510 | }); | |
511 | ||
512 | css(search,{ | |
513 | font : 'normal normal bold 8px/13px "Courier New", ' | |
514 | + 'Courier, Monospace', | |
515 | float :'left', | |
516 | height :'9px', | |
517 | border :'none', | |
518 | marginTop :'2px' | |
519 | }); | |
520 | ||
521 | css(label,{ | |
522 | font : 'normal normal bold 8px/15px "Courier New", ' | |
523 | + 'Courier, Monospace', | |
524 | float :'left', | |
525 | height : '13px', | |
526 | }); | |
527 | ||
528 | css(box,{ | |
529 | font : 'normal normal bold 8px/13px "Courier New", ' | |
530 | + 'Courier, Monospace', | |
531 | color : 'red', | |
532 | width : '105px', | |
533 | float : 'left', | |
534 | height : '15px', | |
535 | margin : '2px 0 0 5px' | |
536 | }); | |
537 | ||
538 | ||
539 | ||
540 | setInterval("refresh();", 5000); | |
541 | search.onkeyup = | |
542 | search.oninput = | |
543 | search.onchange = | |
544 | search.onkeydown = function(e) { | |
545 | var c; | |
546 | e = e || event; | |
547 | c = (e.keyCode || e.which || e.charCode || 0) | |
548 | if (c == 13) e.stopPropagation(); | |
549 | if (window.to) clearTimeout(window.to); | |
550 | window.to = setTimeout(function() { | |
551 | filter_by_id(); | |
552 | }, 1000); | |
553 | ||
554 | return c !== 13; | |
555 | }; | |
556 | var auto = _i('auto_update_status'); | |
557 | if (auto) { | |
558 | ||
559 | auto.setAttribute('checked',true); | |
560 | //auto.setPropertyuchecked = true; | |
561 | } | |
562 | refresh(); | |
563 | make_toast('#',0); | |
564 | } | |
565 | } | |
566 | $(document).ready(toast_init); |