-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprizes.old.html
122 lines (115 loc) · 3.43 KB
/
prizes.old.html
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
122
---
layout: default
---
<div class="posts">
<div class="content full-bleed" id="intro">
<div style="padding-top: 25px; padding-left: 50px; padding-right: 50px; text-align: center">
<h1>GovHack | Prizes</h1>
</div>
<div class="breaker"></div>
<div class="content full-bleed" id="recent-posts">
<div class="end" style="padding-left: 50px; padding-right: 50px; text-align: left"><p>
Browse prizes for your state...
</p>
{% include jurisdictions_bar.html section="prizes" %}
<p>
{% include prize_cards.html %}
</p>
</div>
<div class="breaker"></div>
</div>
</div>
<script type="text/javascript">
(function(f){
var onload = function(f) {
if (window.addEventListener) {
window.addEventListener('DOMContentLoaded', f, false);
} else {
window.attachEvent('onload', f);
}
};
onload(function(){
f();
if (window.addEventListener) {
window.addEventListener('resize', f, false);
} else {
window.attachEvent('resize', f);
}
});
})(function(){
var winw = window.innerWidth, w; //, width_thresholds = [680, 780];
w = window.__post_grid_width;
if ( (w !== undefined) &&
( (w === 680 && winw < 680) ||
(w === 780 && winw >= 680 && winw < 780) ||
(w === 10000 && winw >= 780)
)
)
{
// console.log('noop w:', w+ ', winw:', winw);
return;
} else {
window.__post_grid_width = w =
winw > 780 ? 10000 :
winw > 680 ? 780 :
680;
// console.log('op w:', w);
}
var posts = document.getElementById('recent-posts');
var child_nodes = posts.childNodes, k, node, h,
col_width, col0_y, col1_y, col1_x,
origin = {x:0, y:0}, node_count = 0, is_col0, row0_max_y;
posts.style.position = (window.__post_grid_width <= 680) ? null : 'relative';
for (k in child_nodes) {
node = child_nodes[k];
if (node.nodeType === Node.ELEMENT_NODE) {
if (node.className === 'breaker') {
if (window.__post_grid_width <= 680) {
node.style.height = null;
} else {
node.style.height = (Math.max(col0_y, col1_y) - row0_max_y) + 'px';
}
break;
}
if (col0_y === undefined) {
origin.x = node.offsetLeft;
origin.y = node.offsetTop;
col_width = node.clientWidth;
col0_y = origin.y + node.clientHeight;
row0_max_y = col0_y;
} else {
if (col1_y === undefined) {
col1_y = origin.y + node.clientHeight;
col1_x = origin.x + node.clientWidth;
if (col1_y > row0_max_y) {
row0_max_y = col1_y;
}
} else {
if (window.__post_grid_width <= 680) {
// console.log('Clear');
node.style.position = null;
node.style.width = null;
node.style.left = null;
node.style.top = null;
} else {
is_col0 = (node_count % 2) === 0;
node.style.position = 'absolute';
node.style.width = col_width + 'px';
if (is_col0) {
node.style.left = origin.x + 'px';
node.style.top = col0_y + 'px';
col0_y += node.clientHeight;
} else {
node.style.left = col1_x + 'px';
node.style.top = col1_y + 'px';
col1_y += node.clientHeight;
}
}
// console.dir(node);
}
}
++node_count;
}
}
});
</script>