-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_index.html
More file actions
157 lines (142 loc) · 6.95 KB
/
Copy path_index.html
File metadata and controls
157 lines (142 loc) · 6.95 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html>
<html manifest="?cache.manifest">
<head>
<meta charset="UTF-8" />
<title>YOUR NAME HERE</title>
<meta name="description" content="YOUR NAME HERE - Description of your portfolio" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<script src="jquery.min.js"></script>
<script src="Animate.js"></script>
<script src="Scroller.js"></script>
<script src="EasyScroller.js"></script>
<style type="text/css">
body { background-color: #222; overflow: hidden; padding: 0; }
.title { position: absolute; top: 0; left: 0; color: white; font-size: 200%; width: 100%; text-align: center; z-index: 1; }
.title input { position: absolute; top: 5px; right: 5px; width: 10em; }
a { color: white }
.column { position: relative; }
.scrolly { position: absolute; }
h3 { color: white; }
.row { position: relative; }
.scrollx { position: absolute; padding: 10px; white-space: nowrap; }
.scrollx img { padding: 5px; }
.enlarge_message { display: inline-block; margin-left: 2em; font-size: 50%; }
form { position: absolute; bottom: 0px; left: 0px; z-index: 1; }
</style>
</head>
<body>
<div class="title"><a href="resume.pdf">YOUR NAME HERE</a></div>
<form><input type="text" name="code" id="code" /></form>
<script>
$(function(){
(function($){
// Determine if we on iPhone or iPad
var isiOS = false;
var agent = navigator.userAgent.toLowerCase();
if(agent.indexOf('iphone') >= 0 || agent.indexOf('ipad') >= 0){
isiOS = true;
}
if ('ontouchstart' in window) {
isiOS = true;
}
$.fn.doubletap = function(onDoubleTapCallback, onTapCallback, delay){
var eventName, action;
delay = delay == null? 500 : delay;
eventName = isiOS == true? 'touchend' : 'click';
$(this).bind(eventName, function(event){
var now = new Date().getTime();
var lastTouch = $(this).data('lastTouch') || now + 1; // the first time this will make delta a negative number
var delta = now - lastTouch;
clearTimeout(action);
if(delta<500 && delta>0){
if(onDoubleTapCallback != null && typeof onDoubleTapCallback == 'function'){
onDoubleTapCallback(event);
}
}else{
$(this).data('lastTouch', now);
action = setTimeout(function(evt){
if(onTapCallback != null && typeof onTapCallback == 'function'){
onTapCallback(evt);
}
clearTimeout(action); // clear the timeout
}, delay, [event]);
}
$(this).data('lastTouch', now);
});
};
})(jQuery);
if( window.navigator.onLine ) {
$('form').submit(function(e){
var val = $('#code').val();
document.cookie = "code=" + val;
window.location.reload();
return false;
});
$.ajax("?update").complete(function( response ){
var data = window.localStorage['data'] = response.responseText;
var json = JSON.parse( data );
onUpdate( json );
});
} else {
$('form').hide();
var data = window.localStorage['data'];
var json = JSON.parse( data );
onUpdate( json );
}
function onUpdate( json ) {
if( 'code' in json ) {
var code = json.code;
$('#code').val(code);
}
var width = $(window).width();
var height = $(window).height();
$('.column').remove();
var column = $('<div/>');
column.addClass('column');
$(document.body).append(column);
var scroll = $('<div/>');
scroll.addClass('scrolly');
scroll.attr('data-scrollable','y');
column.append(scroll);
var path = json.path;
for( var category in json ) {
if( category == 'path' || category == 'code' ) { continue; }
var images = json[ category ];
var header = $('<h3/>');
header.addClass('row');
header.css("width", width + "px");
header.html(category);
scroll.append(header);
var dbl = $('<div/>');
dbl.addClass('enlarge_message');
dbl.html("(double-click to enlarge)");
header.append(dbl);
var row = $('<div/>');
row.addClass('row');
row.css("width", width + "px");
row.css("height", "240px");
scroll.append(row);
var div = $('<div/>');
div.addClass('scrollx');
div.attr('data-scrollable',"x");
row.append(div);
for( var i = 0, image; (i < images.length) && (image = images[i]); i++ ) {
var href = path + '/' + category + '/' + image;
var src = "?thumbnail=" + category + '/' + image;
var img = $('<img/>');
img.attr('src',src);
img.css('width','320px');
img.doubletap((function(href){return function(e){
window.location = href;
};})(href));
div.append(img);
}
}
var col = $(".column");
col.css("height", height + "px");
EasyScroller.prototype.bind();
}
});
</script>
</body>
</html>