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
/** | |
# Usages: | |
pfv.start('some'); | |
// some code | |
// some code | |
pfv.end(); | |
pfv.check('ff', () => { | |
// some code |
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 forFunc(curr, compare, changer, actions) { | |
if (compare(curr)) { | |
actions(curr); | |
return forFunc(changer(curr), compare, changer, actions); | |
} | |
} | |
function iterateArr(arr, actions) { | |
forFunc(0, i => i < arr.length, i => i+1, i => actions(arr[i], 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
/*让position:fixed在IE6下可用! */ | |
.fixed-top /* 头部固定 */{position:fixed;bottom:auto;top:0px;} | |
.fixed-bottom /* 底部固定 */{position:fixed;bottom:0px;top:auto;} | |
.fixed-left /* 左侧固定 */{position:fixed;right:auto;left:0px;} | |
.fixed-right /* 右侧固定 */{position:fixed;right:0px;left:auto;} | |
/* 上面的是除了IE6的主流浏览器通用的方法 */ | |
* html,* html body /* 修正IE6振动bug */{background-image:url(about:blank);background-attachment:fixed;} | |
* html .fixed-top /* IE6 头部固定 */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));} | |
* html .fixed-right /* IE6 右侧固定 */ {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
<object type="application/x-shockwave-flash" | |
data="c.swf?path=movie.swf" | |
width="400" height="300"> | |
</object> |
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
/** | |
* [checkMail 验证用户输入的邮箱格式是否正确] | |
* @param {[string]} mailStr [已经去除两边空白的邮箱地址] | |
* @return {[int]} [0,合法;1,不合法] | |
*/ | |
function checkMail(mailStr){//验证邮箱格式 | |
if(mailStr.match(/^[\w-]+@[\w-]+((\.[\w-]{2,3}){1,2})$/gi)){return 0;} | |
else{return 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
/** | |
* [trimSpace 去除转入字符串两边的空白并返回新的字符串] | |
* @param {[string]} str [需要处理的字符串] | |
* @return {[string]} [处理之后的字符串] | |
*/ | |
function trimSpace(str){//去除字符串两端的空白字符 | |
return str.replace(/^\s*|\s*$/g,''); | |
} |
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
/** | |
* [checkNull 查看函数是否为空或者只有空格] | |
* @param {[string]} str [要验证的字符串] | |
* @return {[int]} [0,为空;1,不为空] | |
*/ | |
function checkNull(str){//,是,则return 0 | |
if(str.match(/^\s*$/g)){return 0;} | |
else{return 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
/** | |
* @name disorderArr | |
* @description 乱序排列数组 | |
* @param arr Array 要乱序排列的数组 | |
* @return Array 乱序排列后的数组 | |
* @author 水中月明(shuizhongyueming@gmail.com) | |
*/ | |
function disorderArr(arr){ | |
var copyArr = [],len = arr.length,i = 0,disorderedArr = [],randomVal; | |
for(i;i<len;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
/* | |
* @name quickSort | |
* @description 针对数组进行快速排序 | |
* @param arr Array 要排序的数组 | |
* @param type String 排序的方式 desc 降序 | |
* @notice 目前只实现了降序排序 | |
* @author 水中月明(shuizhongyueming@gmail.com) | |
*/ | |
function quickSort(arr,type){ | |
var len = arr.length, |
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 AddFavorite(sURL, sTitle) { | |
try { | |
window.external.addFavorite(sURL, sTitle); | |
} | |
catch (e) { | |
try { | |
window.sidebar.addPanel(sTitle, sURL, ""); | |
}catch (e) { | |
alert("加入收藏失败,请使用Ctrl+D进行添加"); | |
} |
NewerOlder