summaryrefslogtreecommitdiff
path: root/media/js
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2011-05-09 16:22:25 -0400
committerluxagraf <sng@luxagraf.net>2011-05-09 16:22:25 -0400
commit5bb96d4c2c8b42474953ca29d2422b3be60da25b (patch)
tree959adb3e57c0baf54f56253e5347f45960439b97 /media/js
parent261b92d06de346cd5a6d18b9bdf38ee7084960ab (diff)
updated styles and templates for revamped design
Diffstat (limited to 'media/js')
-rw-r--r--media/js/ios-viewport-scaling-bug-fix.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/media/js/ios-viewport-scaling-bug-fix.js b/media/js/ios-viewport-scaling-bug-fix.js
new file mode 100644
index 0000000..4e9a9b3
--- /dev/null
+++ b/media/js/ios-viewport-scaling-bug-fix.js
@@ -0,0 +1,23 @@
+// My rewritten version
+// 1) won't restrict viewport if JS is disabled
+// 2) uses capture phase
+// 3) assumes last viewport meta is the one to edit (incase for some odd reason there is more than one)
+// 4) feature inference (no sniffs, behavior should be ignored on other enviros)
+// 5) removes event handler after fired
+!function(doc) {
+ var addEvent = 'addEventListener',
+ type = 'gesturestart',
+ qsa = 'querySelectorAll',
+ scales = [1, 1],
+ meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
+
+ function fix() {
+ meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1];
+ doc.removeEventListener(type, fix, !0);
+ }
+ if ((meta = meta[meta.length - 1]) && addEvent in doc) {
+ fix();
+ scales = [.25, 1.6];
+ doc[addEvent](type, fix, !0);
+ }
+}(document); \ No newline at end of file