This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for font-family swap | |
(navigator.appVersion.indexOf("Win")>-1) && $('html').addClass('os-win'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ie 6,7 border-spacing */ | |
table{ | |
width:100%; | |
border-spacing:0; | |
border-collapse:separate; | |
*border-collapse:collapse; /* ie6,7 */ | |
border-right:8px solid #333; | |
border-bottom:8px solid #333; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* quick orientation detection */ | |
document.body.onorientationchange = (function(){ | |
document.body.className = | |
orientation % 180 == 0 ? 'vertical' : 'horizontal'; | |
return arguments.callee; | |
})(); | |
/* from http://mir.aculo.us/2010/10/08/quick-and-easy-orientation-detection-for-mobile-sites/ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* $.ua: iPhone, iPad, iPod detection */ | |
/** | |
* $.ua | |
*/ | |
$.ua = (function(){ | |
var o = {}; | |
var ua = navigator.userAgent; | |
$.each(['iPhone', 'iPod', 'iPad'], function(i, current){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* random val 40~60 */ | |
function randomNum(from, to){ | |
return from + Math.floor( Math.random() * (to - from + 1) ); | |
} | |
console.log(random(40,60)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
element:after{ content:"."; display:block; clear:both; height:0; visibility: hidden; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ex-wordwrap { | |
word-wrap: break-word; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* $.fn.zebraTable | |
* $(anyTableElement).zebraTable() will attach 'odd' or 'even' to each trs. | |
*/ | |
$.fn.zebraTable = function(){ | |
return this.each(function(){ | |
var $el = $(this); | |
var $tbody = $('tbody', $el); | |
$el = $tbody.size() ? $tbody : $el; | |
$('tr:odd', $el).addClass('odd'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* $.fn.autolink | |
* wrap a element for each http://~ text inside the dom | |
*/ | |
$.fn.autolink = function(){ | |
return this.each(function(){ | |
var $el = $(this); | |
var re = /((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g; | |
$el.html( $el.html().replace(re, '<a href="$1">$1</a> ') ); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage: log('inside coolFunc',this,arguments); | |
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ | |
window.log = function(){ | |
log.history = log.history || []; // store logs to an array for reference | |
log.history.push(arguments); | |
if(this.console){ | |
console.log( Array.prototype.slice.call(arguments) ); | |
} | |
}; |
OlderNewer