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
/* | |
* @name getOuterHtml 获取元素自身以及包含的元素的html | |
* @description 原理是给该元素外面包裹一层div | |
* 获取该div的innerHTML就是要的内容 | |
* 然后再移出包裹的div | |
* @notice 这个方法会移除元素的绑定事件 | |
* @author 水中月明(shuizhongyueming@gmail.com) | |
*/ | |
function getOuterHtml(jqObj){ |
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
<!DOCTYPE HTML> | |
<html lang="zh-CN"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>demo</title> | |
</head> | |
<body> | |
</body> | |
</html> |
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进行添加"); | |
} |
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
/** | |
* [SlideMarkMark 滑动评分组件,目前仅支持横向] | |
* @require jQuery 1.7+ | |
* @demo http://news.7k7k.com/webgame/astd/ | |
* @param {[Object]} slideRegion [将参数打包成对象传入] | |
* @param {[Number]} slideRegion.maxMark [评分的最大值 默认:10] | |
* @param {[Number]} slideRegion.decimalPlace [小数的位数 默认:1] | |
* @param {[Number]} slideRegion.contWidth [滑动区域的宽度 默认:slideRegion.cont.width()] | |
* @param {[Number]} slideRegion.shortestLeft [滑块最小偏移值,考虑到滑块的宽度 一般会认为滑动的按钮的中线(非左右两边)到达两端时为滑动的极限 有默认值] |
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 [getRealStyle] | |
* @overview [获取元素的CSS属性值] | |
* @param {[Object]} obj [要获取CSS属性值的DOM对象或者jQuery对象] | |
* @param {[string]} styleName [属性名] | |
* @return {[string]} [属性值] | |
* @author unknown | |
*/ | |
function getRealStyle(obj,styleName){//访问CSS属性 | |
var realStyle = null; |
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[CloudTag] | |
* @overview [一个UI组件,用于制作云标签, | |
* 依赖jQuery 做的很简单,只能简单的从下往上滚动,没有做到那种球状的旋转] | |
* @param {[Array]} arr [存放云标签内容的数组] | |
* @param {[Array]} fontSizeArr [存放文本大小可以随机的值] | |
* @param {[Array]} colorArr [存放文本颜色可以随机的值] | |
* @param {[Object]} option [传入相关参数] | |
* @param {[string]} option.cont [存放云标签的容器 query string] | |
* @param {[string]} option.tagConts [单个标签的各自的直接父元素 query string] |