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 short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
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
/*Make position:fixed work in IE6!*/ | |
.fixed-top /* position fixed Top */{position:fixed;bottom:auto;top:0;} | |
.fixed-bottom /* position fixed Bottom */{position:fixed;bottom:0;top:auto;} | |
.fixed-left /* position fixed Left */{position:fixed;right:auto;left:0;} | |
.fixed-right /* position fixed right */{position:fixed;right:0;left:auto;} | |
* html,* html body /* IE6 Fixed Position Jitter Fix */{background-image:url(about:blank);background-attachment:fixed;} | |
* html .fixed-top /* IE6 position fixed Top */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));} | |
* html .fixed-right /* IE6 position fixed right */{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));} |
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
// Array Remove - By John Resig (MIT Licensed) | |
Array.prototype.remove = function(from, to) { | |
var rest = this.slice((to || from) + 1 || this.length); | |
this.length = from < 0 ? this.length + from : from; | |
return this.push.apply(this, rest); | |
}; |
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
/*! | |
* from: http://stackoverflow.com/questions/7127600/which-jquery-plugin-design-pattern-should-i-use | |
*/ | |
(function ($) { | |
// the constructor | |
var MyClass = function (node, options) { | |
// node is the target | |
this.node = node; |
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
var store = function(days) { | |
if ( typeof localStorage == 'undefined' ) { | |
var obj = document.createElement('q'), | |
days = days || 365; | |
obj.style.display = 'none'; | |
obj.addBehavior('#default#userData'); | |
var exp = new Date(); | |
exp.setDate(exp.getDate() + days) |
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 ($) { | |
/** | |
* pluginName插件 | |
*/ | |
var pluginName = function (that, options, callback) { | |
this.opts = $.extend({ | |
content: that.title || '', | |
options: 'you want to set' |
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
var insertRandom = function(sign) { | |
// 默认给含[diy-random] class 的元素添加点击事件 | |
var class_name = sign || 'diy-random'; | |
$('.' + class_name).livequery('click', function(e) { | |
var $this = $(e.target), | |
href = $(this).attr('href'), | |
random = (+new Date()), res; | |
if ( href.indexOf('?')>-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
/* | |
https://github.com/gruntjs/grunt-contrib-jshint | |
Copyright (c) 2013 John Urberg | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
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
var formatSecounds = function(seconds, callback) { | |
var rDays, rHours, rMinutes, rSeconds; | |
if (!seconds || seconds < 0) { | |
return; | |
} else { | |
seconds = Math.round(seconds); | |
} | |
//剩余天 |
OlderNewer