-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
41 lines (35 loc) · 1.18 KB
/
main.js
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
(function() {
var hideAddressBar, init, preventAutoscale, scrollToContentOnSingle;
preventAutoscale = function() {
var viewportmeta;
viewportmeta = document.querySelector('meta[name="viewport"]');
if (viewportmeta) {
viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0';
document.body.addEventListener('gesturestart');
}
(function() {
return viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6';
});
return false;
};
hideAddressBar = function() {
return setTimeout(function() {
return scrollTo(0, 1);
}, 100);
};
scrollToContentOnSingle = function() {
var header_height;
if (document.body.className.match(/single/i)) {
header_height = document.querySelector('[role="complementary"]').getBoundingClientRect().height;
return scrollTo(0, header_height);
}
};
init = function() {
if (navigator.userAgent.match(/iPhone/i || navigator.userAgent.match(/iPad/i))) {
preventAutoscale();
hideAddressBar();
return scrollToContentOnSingle();
}
};
document.addEventListener("DOMContentLoaded", init, false);
}).call(this);