-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.tpl
executable file
·102 lines (86 loc) · 3.11 KB
/
model.tpl
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
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Funny Pictures</title>
<meta name="description" content="A Website About Funny Pictures">
<meta name="author" content="cY">
<meta name="viewport" content="width=device-width,initial-scale=1">
<!-- CSS Reset -->
<link rel="stylesheet" href="static/reset.css">
<!-- Styling for your grid blocks -->
<link rel="stylesheet" href="static/style.css">
</head>
<body>
<div id="container">
<header>
<h1>Funny Pictures</h1>
<p>by cY</p>
</header>
<div id="main" role="main">
<ul id="tiles">
<!-- These are our grid blocks -->
%for path in path_list:
<li><img src="image/{{path[0]}}" width="200" height="{{path[1]}}"></li>
<!-- End of grid blocks -->
%end
</ul>
</div>
<input id="hid" type="hidden" value={{p}}></input>
<footer>
</footer>
</div>
<!-- include jQuery -->
<script src="static/jquery-1.7.1.min.js"></script>
<!-- Include the plug-in -->
<script src="static/jquery.wookmark.js"></script>
<script src="static/jquery.scrollLoading.js"></script>
<!-- Once the page is loaded, initalize the plug-in. -->
<script type="text/javascript">
var handler = null;
var idv=parseInt(document.getElementById("hid").value)+1;
// Prepare layout options.
var options = {
autoResize: true, // This will auto-update the layout when the browser window is resized.
container: $('#main'), // Optional, used for some extra CSS styling
offset: 2, // Optional, the distance between grid items
itemWidth: 250 // Optional, the width of a grid item
};
$(function(){
$(".lm").scrollLoading();
});
/**
* When scrolled all the way to the bottom, add more tiles.
*/
function onScroll(event) {
// Check if we're within 100 pixels of the bottom edge of the broser window.
var closeToBottom = ($(window).scrollTop() + $(window).height() > $(document).height() - 10);
if(closeToBottom) {
// Get the first then items from the grid, clone them, and add them to the bottom of the grid.
//var items = $('#tiles li');
//var firstTen = items.slice(0, 10);
//$('#tiles').append(firstTen.clone())
$.get('/'+idv,function(data){
idv++;
$('#tiles').append(data);})
// Clear our previous layout handler.
if(handler) handler.wookmarkClear();
// Create a new layout handler.
handler = $('#tiles li');
handler.wookmark(options);
}
};
$(document).ready(new function() {
// Capture scroll event.
$(document).bind('scroll', onScroll);
// Call the layout function.
handler = $('#tiles li');
handler.wookmark(options);
});
</script>
</body>
</html>