blob: 93d27b027ae8e0bf6c5f200d327b8c9185b72135 (
plain)
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
|
// Shared initializer for log-like pages (frontpage/log views) that include pichat.js.
// Keeps templates mostly data-only (Recips, MasonryColumnWidth).
(function($){
function initLogIfPresent() {
if (typeof window.Recips === 'undefined') { window.Recips = []; }
if (typeof window.initLog === 'function') { window.initLog(window.Recips); }
}
function initMasonryIfPresent() {
var $posts = $('#posts');
if (!$posts.length) { return; }
if (typeof $posts.masonry !== 'function') { return; }
var colWidth = typeof window.MasonryColumnWidth !== 'undefined' ? window.MasonryColumnWidth : 275;
$posts.masonry({ columnWidth: colWidth });
$posts.masonry({ singleMode: true });
$posts.masonry({ resizeable: true });
$posts.masonry({ animate: true });
}
$(initLogIfPresent);
$(window).load(initMasonryIfPresent);
})(jQuery);
if (typeof window.images_loading_bar !== 'function') {
window.images_loading_bar = function images_loading_bar() {
try {
var imgs = document.getElementsByTagName('img');
var total = imgs.length;
if (!total) {
var lb0 = document.getElementById('LB0');
if (lb0) { lb0.style.display = 'none'; }
return;
}
var loaded = 0;
for (var i = 0; i < total; i++) {
loaded += imgs[i].complete ? 1 : 0;
}
var lb1 = document.getElementById('LB1');
if (lb1) { lb1.style.width = Math.round((loaded / total) * 100) + 'px'; }
if (loaded === total) {
setTimeout(function() {
var lb0Done = document.getElementById('LB0');
if (lb0Done) { lb0Done.style.display = 'none'; }
}, 128);
} else {
setTimeout(images_loading_bar, 64);
}
} catch (e) {}
};
}
|