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.toCustomFile = function () { | |
return this.each(function () { | |
var | |
$file = $(this), // The file input | |
// Necessary markup | |
$wrap = $('<div class="wrap">'), | |
$input = $('<input type="text" class="filename" />'), |
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
/*-------------------------------------------------------------------------- | |
jq-idealforms 2.0 | |
* Author: Cedric Ruiz | |
* License: GPL or MIT | |
* Demo: http://elclanrs.github.com/jq-idealforms/ | |
* | |
--------------------------------------------------------------------------*/(function(e){"use strict";e.idealforms={};var t={getMaxWidth:function(t){var n=0;return t.each(function(){e(this).outerWidth()>n&&(n=e(this).outerWidth())}),n},getLessVar:function(t,n){var r=e('<p class="'+t+'"></p>').hide().appendTo("body").css(n);return e("."+t).remove(),/^\d+/.test(r)?parseInt(r,10):r},getKeys:function(e){var t=[];for(var n in e)t.push(n);return t},isFunction:function(e){return typeof e=="function"},isRegex:function(e){return e instanceof RegExp},getByNameOrId:function(t){if(e('[name="'+t+'"]').length)return e('[name="'+t+'"]');if(e('[name="'+t+'"]').length)return e("#"+t);e.error('The field "'+t+"\" doesn't exist.")},getIdealType:function(e){var t=e.attr("type")||e[0].tagName.toLowerCase();return/(text|password|em |
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
/** | |
* A custom <select> menu jQuery plugin | |
* @example `$('select').idealSelect()` | |
*/ | |
$.fn.idealSelect = function () { | |
return this.each(function () { | |
var |
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
function newDialog(id) { | |
var $div = $('<div id="#'+ id +'"/>').dialog({ | |
open: function() { | |
$(this).append( | |
'<textarea class="content-area">Content</textarea>'+ | |
'<textarea class="input-area">Input</textarea>' | |
) | |
}, | |
title: id | |
}); |
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.animateText = function(delay, klass) { | |
var text = this.text(); | |
var letters = text.split(''); | |
return this.each(function(){ | |
var $this = $(this); | |
$this.html(text.replace(/./g, '<span class="letter">$&</span>')); | |
$this.find('span.letter').each(function(i, el){ | |
setTimeout(function(){ $(el).addClass(klass); }, delay * i); |
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
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> |
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
// Copy paste in browser console | |
// F5 to stop interval | |
setInterval(function () { | |
[].filter.call(document.querySelectorAll('link'), function(el) { | |
return !/google|lorempixel/.test(el.href); | |
}).forEach(function (el) { | |
var href = el.href, | |
date = '?' + new Date().getTime(); | |
el.href = /\?/.test(href) ? href.replace(/\?.+/, date) : href + date; | |
}); |
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
function convertMonthToName( val ) { | |
var months = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', | |
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]; | |
return months[ val-1 ]; | |
} |
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
// Super RegExp | |
// @param regex A regular expression as literal or as string | |
// @param obj And object containing the values to replace inside the regex | |
// Usage: var regex = sRegExp( /Hello #{a}/, { a: 'World' } ) | |
function sRegExp( regex, obj ) { | |
regex = regex.toString(); | |
var newRegex = regex.replace(/(^\/|\/$|\/([igm]+)$)/g, '') | |
.replace( /#\{(\w+)\}/g, function( a,b ) { return obj[b]; }); | |
var mods = regex.match( /\/([igm]+)$/ ); | |
return new RegExp( newRegex, mods ? mods[1] : '' ); |
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
.sliced { | |
position: relative; | |
width: 640px; | |
height: 400px; | |
} | |
.tile { float: left; } |
OlderNewer