This file contains hidden or 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
/** | |
obj:触发元素; | |
dir:期望触发方向;'up','down','left','right' | |
fn :触发后的回调函数 | |
*/ | |
var touchEvent = function(obj,dir,fn){ | |
this.pos = {x:0,y:0};//开始触发位置 | |
var me = this; | |
obj.addEventListener('touchstart',function(event){ | |
var touch = event.touches[0]; |
This file contains hidden or 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.prototype.deleteElementByValue = function(varElement) | |
{ | |
var numDeleteIndex = -1; | |
for (var i=0; i<this.length; i++) | |
{ | |
// 严格比较,即类型与数值必须同时相等。 | |
if (this[i] === varElement) | |
{ | |
this.splice(i, 1); | |
numDeleteIndex = i; |
This file contains hidden or 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 includeScriprt(url,fnback){ | |
var script = document.createElement("script"); | |
script.type="text/javascript"; | |
script.src = url; | |
document.getElementsByTagName("body")[0].appendChild(script); | |
function done(){ | |
fnback(); | |
} | |
script.onload = script.onreadystatechange = function(){ script.readyState ? script.readyState.toLowerCase() == 'loaded' && done() : done() }; |
This file contains hidden or 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($){ | |
/** | |
* 绑定css3的animateend事件 | |
* @public | |
* @function | |
* @name $.fn.onAnimated | |
* @param {Function} cbk 事件处理函数 | |
*/ | |
$.fn.onAnimated = function (cbk) { |
This file contains hidden or 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($){ | |
/** | |
* transitionend | |
* @public | |
* @function | |
* @name $.fn.onTransitioned | |
* @param {Function} cbk 事件处理函数 | |
*/ | |
$.fn.onTransitioned = function (cbk) { |
This file contains hidden or 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
/* | |
常用中文字体的Unicode编码 | |
新细明体 PMingLiU \65B0\7EC6\660E\4F53 | |
细明体 MingLiU \7EC6\660E\4F53 | |
标楷体 DFKai-SB \6807\6977\4F53 | |
黑体 SimHei \9ED1\4F53 | |
宋体 SimSun \5B8B\4F53 | |
新宋体 NSimSun \65B0\5B8B\4F53 | |
仿宋 FangSong \4EFF\5B8B |
This file contains hidden or 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
<?php | |
/** | |
* 获取用户真实 IP | |
*/ | |
function getIP() | |
{ | |
static $realip; | |
if (isset($_SERVER)){ | |
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])){ | |
$realip = $_SERVER["HTTP_X_FORWARDED_FOR"]; |
This file contains hidden or 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
//Get days and other datetime | |
//diffrence two datetime | |
// date1 :更早的日期 小的日期 | |
// date2 :后面的日期 大的日期 | |
// 返回两个时间差的天数小时数分数秒数和毫秒数 | |
function DiffLong(datestr1,datestr2) | |
{ | |
var date1 = new Date(Date.parse(datestr1)); | |
var date2 = new Date(Date.parse(datestr2)); | |
var datetimeTemp; |
This file contains hidden or 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 array_diff(array1, array2) { | |
var o = {};//转成hash可以减少运算量,数据量越大,优势越明显。 | |
for(var i = 0, len = array2.length; i < len; i++) { | |
o[array2[i]] = true; | |
} | |
var result = []; | |
for(i = 0, len = array1.length; i < len; i++) { | |
var v = array1[i]; | |
if(o[v]) continue; |
This file contains hidden or 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
/.mod_([^{|^:]+)/ |