Skip to content

Instantly share code, notes, and snippets.

@iArnaud
iArnaud / gist:3039322
Created July 3, 2012 11:56
Meta viewport iPhone & Android
<!-- Iphone (classic & retina) -->
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=0.5,minimum-scale=0.3, maximum-scale=0.7">
<!-- Android (tested on HTC desire S) -->
<meta name="viewport" content="width=device-width,height=device-height,target-densitydpi=high-dpi,user-scalable=no,initial-scale=0.05,minimum-scale=0.001, maximum-scale=0.5">
(function($) {
// Used by dateinput
$.expr = {':': {}};
// Used by bootstrap
$.support = {};
// Used by dateinput
$.fn.clone = function(){
var ret = $();
(function () {
// Mock necessary parts of zepto for fx module
window.Zepto = function () { return $(arguments) }
window.Zepto.isObject = function () { return false }
window.Zepto.each = $.each
window.Zepto.extend = $.extend
window.Zepto.fn = {}
/*
<?php
$deviceClass = "";
$graduateLevelClass = "";
if (ereg('iPhone',$_SERVER['HTTP_USER_AGENT']) || ereg('iPod',$_SERVER['HTTP_USER_AGENT'])) {
$deviceClass = "ui-iphone";
} else if (ereg('iPad',$_SERVER['HTTP_USER_AGENT'])) {
$deviceClass = "ui-ipad";
} else if (ereg('Android',$_SERVER['HTTP_USER_AGENT']) && ereg('Mobile Safari',$_SERVER['HTTP_USER_AGENT'])) {
$deviceClass = "ui-android";
};
@iArnaud
iArnaud / focus.js
Created January 28, 2013 14:05 — forked from pamelafox/focus.js
// From Lindsey Simon
/**
* This is a hack to make text input focus work in Android/PhoneGap
* where calling el.focus() doesn't actually have the blinking cursor
* effect = scumbag.
* @param {Zepto} $el A zepto element.
*/
ws.focus = function($el) {
var el = $el.get(0);
el.focus();
(function($){
$.fn.highest = function() {
var height, highest = 0;
this.each(function() {
height = $(this).height();
if (height > highest) highest = height;
});
return highest;
};
})(window.Zepto || window.jQuery);
// Fix to make zepto work with ujs-jquery
$.fn.ajaxSend = function(callback) {
return this.each(function(){
$(this).on('ajaxBeforeSend', callback);
});
};
var jQuery = $;
@iArnaud
iArnaud / index.js
Created January 28, 2013 14:07 — forked from max-mapper/index.js
var mapLink = "http://maps.google.com/maps?z=12&t=m&q=loc:" + lat + "+" + lon
if ($.os.ios && navigator.userAgent.match(/iPhone OS 6_/)) mapLink = "Maps://?q=" + lat + "," + lon
if ($.os.android) mapLink = "geo:" + lat + "," + lon + "?z=12&q=" + lat + "," + lon
// assumes you have zepto and zepto.detect loaded
// also you should use target=_blank on your <a> tags
// Adds a matchHeight method to jQuery/zepto.
// Takes a jquery/zepto collection and makes them all as tall as the tallest elements
// Ideal for equal column layouts
// ## Paramaters
// * None (run on a zepto collection instead)
// ## Returns
// The collection which it was run on
// ## Example
// $('#myDiv1, #myDiv2').matchHeight();
// #test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>title</title>
<script src="https://raw.github.com/madrobby/zepto/v0.7/src/zepto.js"></script>
<script>
$(document).ready(function(){
console.log('READY IN THE HEAD', document.readyState);
});