├── .gitignore ├── docs ├── paging.jpg ├── demo.txt ├── index-requirejs.html ├── paging.css ├── index.html └── paging.js ├── package.json ├── dest ├── paging.css ├── paging.js ├── require.js └── jquery-1.11.2.js ├── dist ├── paging.css └── paging.js ├── src ├── paging.css ├── query.js ├── paging.js └── rpaging.js ├── README.md ├── gulpfile.js └── http.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_components -------------------------------------------------------------------------------- /docs/paging.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tianxiangbing/paging/HEAD/docs/paging.jpg -------------------------------------------------------------------------------- /docs/demo.txt: -------------------------------------------------------------------------------- 1 | 我是paging的内容啊,我的github地址是:https://github.com/tianxiangbing/paging -------------------------------------------------------------------------------- /docs/index-requirejs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 分页控件 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 32 | 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jq-page", 3 | "version": "1.0.7", 4 | "description": "js分页插件", 5 | "main": "dist/paging.js", 6 | "directories": { 7 | "example": "example" 8 | }, 9 | "scripts": { 10 | "prepublish": "gulp" 11 | }, 12 | "devDependencies": { 13 | "gulp-concat": "^2.6.1", 14 | "gulp": "^3.9.1", 15 | "gulp-concat": "^2.6.1", 16 | "gulp-minify-css": "^1.2.4", 17 | "gulp-requirejs": "^1.0.0-rc2", 18 | "gulp-uglify": "^2.1.2", 19 | "gulp-watch": "^4.3.11" 20 | }, 21 | "scripts": { 22 | "test": "echo \"Error: no test specified\" && exit 1" 23 | }, 24 | "repository": { 25 | "type": "git", 26 | "url": "git+https://github.com/tianxiangbing/paging.git" 27 | }, 28 | "keywords": [ 29 | "page", 30 | "js", 31 | "jquery" 32 | ], 33 | "author": "tianxiangbing", 34 | "license": "ISC", 35 | "bugs": { 36 | "url": "https://github.com/tianxiangbing/paging/issues" 37 | }, 38 | "homepage": "https://github.com/tianxiangbing/paging#readme" 39 | } 40 | -------------------------------------------------------------------------------- /dest/paging.css: -------------------------------------------------------------------------------- 1 | .ui-paging-container{color:#666;font-size:12px}.ui-paging-container ul{overflow:hidden;text-align:center}.ui-paging-container li,.ui-paging-container ul{list-style:none}.ui-paging-container li{display:inline-block;padding:3px 6px;margin-left:5px;color:#666}.ui-paging-container li.ui-pager{cursor:pointer;border:1px solid #ddd;border-radius:2px}.ui-paging-container li.focus,.ui-paging-container li.ui-pager:hover{background-color:#288df0;color:#FFF}.ui-paging-container li.ui-paging-ellipse{border:none}.ui-paging-container li.ui-paging-toolbar{padding:0}.ui-paging-container li.ui-paging-toolbar select{height:22px;border:1px solid #ddd;color:#666}.ui-paging-container li.ui-paging-toolbar input{vertical-align:top;line-height:20px;height:20px;padding:0;border:1px solid #ddd;text-align:center;width:30px;margin:0 0 0 5px}.ui-paging-container li.ui-paging-toolbar a{text-decoration:none;display:inline-block;height:20px;border:1px solid #ddd;vertical-align:top;border-radius:2px;line-height:20px;padding:0 3px;cursor:pointer;margin-left:5px;color:#666}.ui-paging-container li.ui-pager-disabled,.ui-paging-container li.ui-pager-disabled:hover{background-color:#f6f6f6;cursor:default;border:none;color:#ddd} -------------------------------------------------------------------------------- /dist/paging.css: -------------------------------------------------------------------------------- 1 | .ui-paging-container{color:#666;font-size:12px}.ui-paging-container ul{overflow:hidden;text-align:center}.ui-paging-container li,.ui-paging-container ul{list-style:none}.ui-paging-container li{display:inline-block;padding:3px 6px;margin-left:5px;color:#666}.ui-paging-container li.ui-pager{cursor:pointer;border:1px solid #ddd;border-radius:2px}.ui-paging-container li.focus,.ui-paging-container li.ui-pager:hover{background-color:#288df0;color:#FFF}.ui-paging-container li.ui-paging-ellipse{border:none}.ui-paging-container li.ui-paging-toolbar{padding:0}.ui-paging-container li.ui-paging-toolbar select{height:22px;border:1px solid #ddd;color:#666}.ui-paging-container li.ui-paging-toolbar input{vertical-align:top;line-height:20px;height:20px;padding:0;border:1px solid #ddd;text-align:center;width:30px;margin:0 0 0 5px}.ui-paging-container li.ui-paging-toolbar a{text-decoration:none;display:inline-block;height:20px;border:1px solid #ddd;vertical-align:top;border-radius:2px;line-height:20px;padding:0 3px;cursor:pointer;margin-left:5px;color:#666}.ui-paging-container li.ui-pager-disabled,.ui-paging-container li.ui-pager-disabled:hover{background-color:#f6f6f6;cursor:default;border:none;color:#ddd} -------------------------------------------------------------------------------- /docs/paging.css: -------------------------------------------------------------------------------- 1 | .ui-paging-container{color:#666;font-size:12px}.ui-paging-container ul{overflow:hidden;text-align:center}.ui-paging-container li,.ui-paging-container ul{list-style:none}.ui-paging-container li{display:inline-block;padding:3px 6px;margin-left:5px;color:#666}.ui-paging-container li.ui-pager{cursor:pointer;border:1px solid #ddd;border-radius:2px}.ui-paging-container li.focus,.ui-paging-container li.ui-pager:hover{background-color:#288df0;color:#FFF}.ui-paging-container li.ui-paging-ellipse{border:none}.ui-paging-container li.ui-paging-toolbar{padding:0}.ui-paging-container li.ui-paging-toolbar select{height:22px;border:1px solid #ddd;color:#666}.ui-paging-container li.ui-paging-toolbar input{vertical-align:top;line-height:20px;height:20px;padding:0;border:1px solid #ddd;text-align:center;width:30px;margin:0 0 0 5px}.ui-paging-container li.ui-paging-toolbar a{text-decoration:none;display:inline-block;height:20px;border:1px solid #ddd;vertical-align:top;border-radius:2px;line-height:20px;padding:0 3px;cursor:pointer;margin-left:5px;color:#666}.ui-paging-container li.ui-pager-disabled,.ui-paging-container li.ui-pager-disabled:hover{background-color:#f6f6f6;cursor:default;border:none;color:#ddd} -------------------------------------------------------------------------------- /src/paging.css: -------------------------------------------------------------------------------- 1 | .ui-paging-container{color:#666;font-size: 12px;} 2 | .ui-paging-container ul{overflow: hidden;text-align: center;} 3 | .ui-paging-container ul,.ui-paging-container li{list-style: none;} 4 | .ui-paging-container li{display: inline-block;padding:3px 6px;margin-left: 5px;color:#666;} 5 | .ui-paging-container li.ui-pager{cursor: pointer; border:1px solid #ddd;border-radius: 2px;} 6 | .ui-paging-container li.ui-pager:hover,.ui-paging-container li.focus{background-color: #288df0;color:#FFFFFF;} 7 | .ui-paging-container li.ui-paging-ellipse{border:none;} 8 | .ui-paging-container li.ui-paging-toolbar{padding:0;} 9 | .ui-paging-container li.ui-paging-toolbar select{height:22px;border:1px solid #ddd;color: #666;} 10 | .ui-paging-container li.ui-paging-toolbar input{vertical-align:top;line-height: 20px; height:20px;padding:0;border:1px solid #ddd;text-align: center;width: 30px;margin:0 0 0 5px;} 11 | .ui-paging-container li.ui-paging-toolbar a{vertical-align: middle; text-decoration: none;display: inline-block;height:20px;border:1px solid #ddd;vertical-align: top;border-radius: 2px;line-height: 20px;padding:0 3px;cursor: pointer;margin-left: 5px;color: #666;} 12 | .ui-paging-container li.ui-pager-disabled,.ui-paging-container li.ui-pager-disabled:hover{background-color: #f6f6f6;;cursor: default;border:none;color:#ddd;} 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # paging 2 | 分页控件paging 3 | 4 | 例子见:[http://tianxiangbing.github.io/paging/](http://tianxiangbing.github.io/paging/) *一个要仔细看例子的使用* 5 | 或 6 | [http://www.lovewebgames.com/jsmodule/paging.html](http://www.lovewebgames.com/jsmodule/paging.html) 7 | 8 | ![预览效果:](http://tianxiangbing.github.io/paging/paging.jpg "分页组件效果图") 9 | 10 | # 使用方法案例:(推荐使用这种方式) 11 |
12 | var p = new Paging(); 13 | p.init({target:'#pageTool',pagesize:10,count:100}); 14 | //重新渲染分页使用render 15 | p.render({count:100,pagesize:10,current:3}); 16 | # 或者 17 | var p = $('#pageTool').Paging({pagesize:10,count:100}); 18 | //返回的p是个数组,p[0]是第一个返回对象 19 | *** 20 | # npm安装方式 21 | ```bash 22 | npm install jq-page 23 | ``` 24 | # 属性和方法 25 | ## hash:false 26 | 27 | 是否用url hash值的形式来表达分页,默认为true,但如果出现两个分页时,为导致互相影响,应保证只有一个对应hash 28 | ## pagesize: 29 | 30 | 每页的条数 31 | ## current: 32 | 33 | 当前页码,默认为1 34 | ## prevTpl 35 | 36 | 上一页的模板,默认“上一页” 37 | ## nextTpl 38 | 39 | 下一页的模板,默认“下一页” 40 | ## firstTpl 41 | 42 | 首页的模板,默认“首页” 43 | ## lastTpl 44 | 45 | 末页的模板,默认“末页” 46 | ## ellipseTpl 47 | 48 | 省略号的模板,默认“...” 49 | ## toolbar: bool 50 | 51 | 是否显示工具栏,默认为false 52 | ## pageSizeList:[] 53 | 54 | 当显示工具栏时有效,可设置每页条数,默认为[5,10,15,20] 55 | ## callback:function(page,size,count) 56 | 57 | 翻页时的回调方法,page为当前页码,size为每页条数,count为总页数 58 | ## changePagesize:function(pagesize,currenpage,pagecount) 59 | 60 | 修改每页的条数,参数为int 61 | ## go:function(p) 62 | 63 | 跳转至某一页,默认到current 64 | ## render:function(ops) 65 | 66 | 重新渲染,ops:{count:int,pagesize:int,current:int,pagecount:int} -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Created with Sublime Text 2. 3 | * license: http://www.lovewebgames.com/jsmodule/index.html 4 | * User: 田想兵 5 | * Date: 2015-04-27 6 | * Time: 15:15:51 7 | * Contact: 55342775@qq.com 8 | */ 9 | var gulp = require('gulp'), 10 | rjs = require('gulp-requirejs'), 11 | uglify = require('gulp-uglify'), 12 | cssmin = require('gulp-minify-css'), 13 | concat = require('gulp-concat'), 14 | watchF = require('gulp-watch'); 15 | var paths = { 16 | script: 'src/*.js', 17 | css: 'src/*.css' 18 | }; 19 | gulp.task('js', function () { 20 | return gulp.src(['src/query.js', 'src/paging.js']).pipe(concat('paging.js')).pipe(uglify()).pipe(gulp.dest('dist')) 21 | .pipe(gulp.dest('docs')); 22 | }); 23 | gulp.task('css', function () { 24 | return gulp.src(paths.css) 25 | .pipe(cssmin({ 26 | compatibility: 'ie8' 27 | })) //兼容ie 28 | .pipe(gulp.dest('dist')) 29 | .pipe(gulp.dest('dest')) 30 | .pipe(gulp.dest('docs')); 31 | }); 32 | gulp.task('requirejs', function () { 33 | return rjs({ 34 | "name": "paging", 35 | "baseUrl": "src", 36 | "out": "paging.js", 37 | shim: { 38 | '$': { 39 | exports: '_' 40 | } 41 | }, 42 | "paths": { 43 | $: "jquery-1.11.2" 44 | }, 45 | exclude: ["$"], 46 | //这里不打包zepto 47 | // map: { 48 | // "*": { 49 | // "$": "jquery-private" 50 | // }, 51 | // "jquery-private": {} 52 | // } 53 | // ... more require.js options 54 | }).pipe(uglify()) 55 | .pipe(gulp.src(['src/jquery-1.11.2.js', 'src/require.js']).pipe(uglify())) 56 | .pipe(gulp.dest('dest')); // pipe it to the output DIR 57 | }); 58 | gulp.task('watch', function () { 59 | watchF(['src/*.*', 'html/*.*'], function () { 60 | gulp.start('default') 61 | }); 62 | }); 63 | gulp.task('default', ['js', 'css','requirejs']); -------------------------------------------------------------------------------- /http.js: -------------------------------------------------------------------------------- 1 | var PORT = 3000; 2 | 3 | var http = require('http'); 4 | var url=require('url'); 5 | var fs=require('fs'); 6 | var mine= { 7 | "css": "text/css", 8 | "gif": "image/gif", 9 | "html": "text/html", 10 | "ico": "image/x-icon", 11 | "jpeg": "image/jpeg", 12 | "jpg": "image/jpeg", 13 | "js": "text/javascript", 14 | "json": "application/json", 15 | "pdf": "application/pdf", 16 | "png": "image/png", 17 | "svg": "image/svg+xml", 18 | "swf": "application/x-shockwave-flash", 19 | "tiff": "image/tiff", 20 | "txt": "text/plain", 21 | "wav": "audio/x-wav", 22 | "wma": "audio/x-ms-wma", 23 | "wmv": "video/x-ms-wmv", 24 | "xml": "text/xml" 25 | }; 26 | var path=require('path'); 27 | var server = http.createServer(function (request, response) { 28 | var pathname = url.parse(request.url).pathname; 29 | console.log(pathname) 30 | var realPath = pathname.substr(1);//path.join("assets", pathname); 31 | console.log(realPath); 32 | var ext = path.extname(realPath); 33 | ext = ext ? ext.slice(1) : 'unknown'; 34 | fs.exists(realPath, function (exists) { 35 | if (!exists) { 36 | response.writeHead(404, { 37 | 'Content-Type': 'text/plain' 38 | }); 39 | 40 | response.write("This request URL " + pathname + " was not found on this server."); 41 | response.end(); 42 | } else { 43 | fs.readFile(realPath, "binary", function (err, file) { 44 | if (err) { 45 | response.writeHead(500, { 46 | 'Content-Type': 'text/plain' 47 | }); 48 | response.end(err); 49 | } else { 50 | var contentType = mine[ext] || "text/plain"; 51 | response.writeHead(200, { 52 | 'Content-Type': contentType 53 | }); 54 | response.write(file, "binary"); 55 | response.end(); 56 | } 57 | }); 58 | } 59 | }); 60 | }); 61 | server.listen(PORT); 62 | console.log("Server runing at port: " + PORT + "."); -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 分页插件paging by https://github.com/tianxiangbing/paging 13 | 14 | 15 | 16 | 17 | 18 | 19 |

github:https://github.com/tianxiangbing/paging

20 |

demo:http://www.lovewebgames.com/jsmodule/paging.html

21 |

ajax分页

22 |

23 | 24 |

25 |
26 |

hash记录页码的方式

27 |
28 | 29 | 30 | 82 |

See the Pen RgEMWq by 田想兵 (@tianxiangbing) on CodePen.

83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /src/query.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Created with Sublime Text 3. 3 | * demo地址: http://www.lovewebgames.com/jsmodule/index.html 4 | * github: https://github.com/tianxiangbing/query 5 | * User: 田想兵 6 | * Date: 2015-06-11 7 | * Time: 16:27:55 8 | * Contact: 55342775@qq.com 9 | * Desc: 确保代码最新及时修复bug,请去github上下载最新源码 https://github.com/tianxiangbing/query 10 | */ 11 | (function(root, factory) { 12 | //amd 13 | if (typeof define === 'function' && define.amd) { 14 | define(['jquery'], factory); 15 | } else if (typeof exports === 'object') { //umd 16 | module.exports = factory(); 17 | } else { 18 | root.Query = factory(window.Zepto || window.jQuery || $); 19 | } 20 | })(this, function($) { 21 | var Query = { 22 | getQuery: function(name, type, win) { 23 | var reg = new RegExp("(^|&|#)" + name + "=([^&]*)(&|$|#)", "i"); 24 | win = win || window; 25 | var Url = win.location.href; 26 | var u, g, StrBack = ''; 27 | if (type == "#") { 28 | u = Url.split("#"); 29 | } else { 30 | u = Url.split("?"); 31 | } 32 | if (u.length == 1) { 33 | g = ''; 34 | } else { 35 | g = u[1]; 36 | } 37 | if (g != '') { 38 | gg = g.split(/&|#/); 39 | var MaxI = gg.length; 40 | str = arguments[0] + "="; 41 | for (i = 0; i < MaxI; i++) { 42 | if (gg[i].indexOf(str) == 0) { 43 | StrBack = gg[i].replace(str, ""); 44 | break; 45 | } 46 | } 47 | } 48 | return decodeURI(StrBack); 49 | }, 50 | getForm: function(form) { 51 | var result = {}, 52 | tempObj = {}; 53 | $(form).find('*[name]').each(function(i, v) { 54 | var nameSpace, 55 | name = $(v).attr('name'), 56 | val = $.trim($(v).val()), 57 | tempArr = []; 58 | if (name == '' || $(v).hasClass('getvalued')) { 59 | return; 60 | } 61 | 62 | if ($(v).data('type') == "money") { 63 | val = val.replace(/\,/gi, ''); 64 | } 65 | 66 | //处理radio add by yhx 2014-06-18 67 | if ($(v).attr("type") == "radio") { 68 | var tempradioVal = null; 69 | $("input[name='" + name + "']:radio").each(function() { 70 | if ($(this).is(":checked")) 71 | tempradioVal = $.trim($(this).val()); 72 | }); 73 | if (tempradioVal) { 74 | val = tempradioVal; 75 | } else { 76 | val = ""; 77 | } 78 | } 79 | 80 | 81 | if ($(v).attr("type") == "checkbox") { 82 | var tempradioVal = []; 83 | $("input[name='" + name + "']:checkbox").each(function() { 84 | if ($(this).is(":checked")) 85 | tempradioVal.push($.trim($(this).val())); 86 | }); 87 | if (tempradioVal.length) { 88 | val = tempradioVal.join(','); 89 | } else { 90 | val = ""; 91 | } 92 | } 93 | 94 | if ($(v).attr('listvalue')) { 95 | if (!result[$(v).attr('listvalue')]) { 96 | result[$(v).attr('listvalue')] = []; 97 | $("input[listvalue='" + $(v).attr('listvalue') + "']").each(function() { 98 | if ($(this).val() != "") { 99 | var name = $(this).attr('name'); 100 | var obj = {}; 101 | if ($(this).data('type') == "json") { 102 | obj[name] = JSON.parse($(this).val()); 103 | } else { 104 | obj[name] = $.trim($(this).val()); 105 | } 106 | if ($(this).attr("paramquest")) { 107 | var o = JSON.parse($(this).attr("paramquest")); 108 | obj = $.extend(obj, o); 109 | } 110 | result[$(v).attr('listvalue')].push(obj); 111 | $(this).addClass('getvalued'); 112 | } 113 | }); 114 | } 115 | } 116 | 117 | if ($(v).attr('arrayvalue')) { 118 | if (!result[$(v).attr('arrayvalue')]) { 119 | result[$(v).attr('arrayvalue')] = []; 120 | $("input[arrayvalue='" + $(v).attr('arrayvalue') + "']").each(function() { 121 | if ($(this).val() != "") { 122 | var obj = {}; 123 | if ($(this).data('type') == "json") { 124 | obj = JSON.parse($(this).val()); 125 | } else { 126 | obj = $.trim($(this).val()); 127 | } 128 | if ($(this).attr("paramquest")) { 129 | var o = JSON.parse($(this).attr("paramquest")); 130 | obj = $.extend(obj, o); 131 | } 132 | result[$(v).attr('arrayvalue')].push(obj); 133 | } 134 | }); 135 | } 136 | } 137 | if (name == '' || $(v).hasClass('getvalued')) { 138 | return; 139 | } 140 | //构建参数 141 | if (name.match(/\./)) { 142 | tempArr = name.split('.'); 143 | nameSpace = tempArr[0]; 144 | if (tempArr.length == 3) { 145 | tempObj[tempArr[1]] = tempObj[tempArr[1]] || {}; 146 | tempObj[tempArr[1]][tempArr[2]] = val; 147 | } else { 148 | if ($(v).data('type') == "json") { 149 | tempObj[tempArr[1]] = JSON.parse(val); 150 | if ($(v).attr("paramquest")) { 151 | var o = JSON.parse($(v).attr("paramquest")); 152 | tempObj[tempArr[1]] = $.extend(tempObj[tempArr[1]], o); 153 | } 154 | } else { 155 | tempObj[tempArr[1]] = val; 156 | } 157 | } 158 | if (!result[nameSpace]) { 159 | result[nameSpace] = tempObj; 160 | } else { 161 | result[nameSpace] = $.extend({}, result[nameSpace], tempObj); 162 | } 163 | } else { 164 | result[name] = val; 165 | } 166 | 167 | }); 168 | var obj = {}; 169 | for (var o in result) { 170 | var v = result[o]; 171 | if (typeof v == "object") { 172 | obj[o] = JSON.stringify(v); 173 | } else { 174 | obj[o] = result[o] 175 | } 176 | } 177 | $('.getvalued').removeClass('getvalued'); 178 | return obj; 179 | }, 180 | setHash: function(obj) { 181 | var str = ''; 182 | obj = $.extend(this.getHash(), obj) 183 | var arr = []; 184 | for (var v in obj) { 185 | if(obj[v]!=''){ 186 | arr.push(v + '=' + encodeURIComponent(obj[v])); 187 | } 188 | } 189 | str+=arr.join('&'); 190 | location.hash = str; 191 | return this; 192 | }, 193 | getHash: function(name) { 194 | if (typeof name === "string") { 195 | return this.getQuery(name, "#"); 196 | } else { 197 | var obj = {}; 198 | var hash = location.hash; 199 | if(hash.length>0){ 200 | hash = hash.substr(1); 201 | var hashArr = hash.split('&'); 202 | for (var i = 0, l = hashArr.length; i < l; i++) { 203 | var a = hashArr[i].split('='); 204 | if (a.length > 0) { 205 | obj[a[0]] = decodeURI(a[1]) || ''; 206 | } 207 | } 208 | } 209 | return obj; 210 | } 211 | } 212 | }; 213 | return Query; 214 | }); -------------------------------------------------------------------------------- /dest/paging.js: -------------------------------------------------------------------------------- 1 | !function(t,i){"function"==typeof define&&define.amd?define(["$","query"],i):"object"==typeof exports?module.exports=i():t.Paging=i(window.Zepto||window.jQuery||$,Query)}(this,function(t,i){function e(){var t=Math.random().toString().replace(".","");this.id="Paging_"+t}return t.fn.Paging=function(i){var a=[];return t(this).each(function(){var s=t.extend({target:t(this)},i),n=new e;n.init(s),a.push(n)}),a},e.prototype={init:function(i){this.settings=t.extend({callback:null,pagesize:10,current:1,prevTpl:"上一页",nextTpl:"下一页",firstTpl:"首页",lastTpl:"末页",ellipseTpl:"...",toolbar:!1,hash:!1,pageSizeList:[5,10,15,20]},i),this.target=t(this.settings.target),this.container=t('
'),this.target.append(this.container),this.render(this.settings),this.format(),this.bindEvent()},render:function(t){void 0!==t.count?this.count=t.count:this.count=this.settings.count,void 0!==t.pagesize?this.pagesize=t.pagesize:this.pagesize=this.settings.pagesize,void 0!==t.current?this.current=t.current:this.current=this.settings.current,this.pagecount=Math.ceil(this.count/this.pagesize),this.format()},bindEvent:function(){var i=this;this.container.on("click","li.js-page-action,li.ui-pager",function(e){if(t(this).hasClass("ui-pager-disabled")||t(this).hasClass("focus"))return!1;t(this).hasClass("js-page-action")?(t(this).hasClass("js-page-first")&&(i.current=1),t(this).hasClass("js-page-prev")&&(i.current=Math.max(1,i.current-1)),t(this).hasClass("js-page-next")&&(i.current=Math.min(i.pagecount,i.current+1)),t(this).hasClass("js-page-last")&&(i.current=i.pagecount)):t(this).data("page")&&(i.current=parseInt(t(this).data("page"))),i.go()})},go:function(t){var e=this;this.current=t||this.current,this.current=Math.max(1,e.current),this.current=Math.min(this.current,e.pagecount),this.format(),this.settings.hash&&i.setHash({page:this.current}),this.settings.callback&&this.settings.callback(this.current,this.pagesize,this.pagecount)},changePagesize:function(t){this.render({pagesize:t})},format:function(){var i="",this.container.html(i),1==this.current&&(t(".js-page-prev",this.container).addClass("ui-pager-disabled"),t(".js-page-first",this.container).addClass("ui-pager-disabled")),this.current==this.pagecount&&(t(".js-page-next",this.container).addClass("ui-pager-disabled"),t(".js-page-last",this.container).addClass("ui-pager-disabled")),this.container.find('li[data-page="'+this.current+'"]').addClass("focus").siblings().removeClass("focus"),this.settings.toolbar&&this.bindToolbar()},bindToolbar:function(){for(var i=this,e=t('
  • 跳转
  • '),a=t(".ui-select-pagesize",e),s="",n=0,r=this.settings.pageSizeList.length;n'+this.settings.pageSizeList[n]+"条/页";a.html(s),a.val(this.pagesize),t("input",e).val(this.current),t("input",e).click(function(){t(this).select()}).keydown(function(e){if(13==e.keyCode){var a=parseInt(t(this).val())||1;i.go(a)}}),t("a",e).click(function(){var e=parseInt(t(this).prev().val())||1;i.go(e)}),a.change(function(){i.changePagesize(t(this).val())}),this.container.children("ul").append(e)}},e}),function(t,i){"function"==typeof define&&define.amd?define(["$"],i):"object"==typeof exports?module.exports=i():t.Query=i(window.Zepto||window.jQuery||$)}(this,function(t){return{getQuery:function(t,e,a){new RegExp("(^|&|#)"+t+"=([^&]*)(&|$|#)","i");a=a||window;var s,n,r=a.location.href,l="";if(s="#"==e?r.split("#"):r.split("?"),""!=(n=1==s.length?"":s[1])){gg=n.split(/&|#/);var h=gg.length;for(str=arguments[0]+"=",i=0;i0){e=e.substr(1);for(var a=e.split("&"),s=0,n=a.length;s0&&(i[r[0]]=decodeURI(r[1])||"")}}return i}}}); -------------------------------------------------------------------------------- /dist/paging.js: -------------------------------------------------------------------------------- 1 | !function(t,i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i():t.Query=i(window.Zepto||window.jQuery||$)}(this,function(t){return{getQuery:function(t,e,a){new RegExp("(^|&|#)"+t+"=([^&]*)(&|$|#)","i");a=a||window;var s,n,r=a.location.href,l="";if(s="#"==e?r.split("#"):r.split("?"),""!=(n=1==s.length?"":s[1])){gg=n.split(/&|#/);var h=gg.length;for(str=arguments[0]+"=",i=0;i0){e=e.substr(1);for(var a=e.split("&"),s=0,n=a.length;s0&&(i[r[0]]=decodeURI(r[1])||"")}}return i}}}),function(t,i){"function"==typeof define&&define.amd?define(["jquery","query"],i):"object"==typeof exports?module.exports=i():t.Paging=i(window.Zepto||window.jQuery||$,Query)}(this,function(t,i){function e(){var t=Math.random().toString().replace(".","");this.id="Paging_"+t}return t.fn.Paging=function(i){var a=[];return t(this).each(function(){var s=t.extend({target:t(this)},i),n=new e;n.init(s),a.push(n)}),a},e.prototype={init:function(i){this.settings=t.extend({callback:null,pagesize:10,current:1,prevTpl:"上一页",nextTpl:"下一页",firstTpl:"首页",lastTpl:"末页",ellipseTpl:"...",toolbar:!1,hash:!1,pageSizeList:[5,10,15,20]},i),this.target=t(this.settings.target),this.container=t('
    '),this.target.append(this.container),this.render(this.settings),this.format(),this.bindEvent()},render:function(t){void 0!==t.count?this.count=t.count:this.count=this.settings.count,void 0!==t.pagesize?this.pagesize=t.pagesize:this.pagesize=this.settings.pagesize,void 0!==t.current?this.current=t.current:this.current=this.settings.current,this.pagecount=Math.ceil(this.count/this.pagesize),this.format()},bindEvent:function(){var i=this;this.container.on("click","li.js-page-action,li.ui-pager",function(e){if(t(this).hasClass("ui-pager-disabled")||t(this).hasClass("focus"))return!1;t(this).hasClass("js-page-action")?(t(this).hasClass("js-page-first")&&(i.current=1),t(this).hasClass("js-page-prev")&&(i.current=Math.max(1,i.current-1)),t(this).hasClass("js-page-next")&&(i.current=Math.min(i.pagecount,i.current+1)),t(this).hasClass("js-page-last")&&(i.current=i.pagecount)):t(this).data("page")&&(i.current=parseInt(t(this).data("page"))),i.go()})},go:function(t){var e=this;this.current=t||this.current,this.current=Math.max(1,e.current),this.current=Math.min(this.current,e.pagecount),this.format(),this.settings.hash&&i.setHash({page:this.current}),this.settings.callback&&this.settings.callback(this.current,this.pagesize,this.pagecount)},changePagesize:function(t){this.render({pagesize:t}),this.settings.changePagesize&&this.settings.changePagesize.call(this,this.pagesize,this.current,this.pagecount)},format:function(){var i="
      ";if(i+='
    • '+this.settings.firstTpl+"
    • ",i+='
    • '+this.settings.prevTpl+"
    • ",this.pagecount>10){if(i+='
    • 1
    • ',this.current<5)i+='
    • 2
    • ',i+='
    • 3
    • ',i+='
    • 4
    • ',i+='
    • 5
    • ',i+='
    • '+this.settings.ellipseTpl+"
    • ";else if(this.current>=5&&this.current<=this.pagecount-5)this.current>=5&&(i+='
    • '+this.settings.ellipseTpl+"
    • "),i+='
    • '+(this.current-2)+"
    • ",i+='
    • '+(this.current-1)+"
    • ",i+='
    • '+this.current+"
    • ",i+='
    • '+(this.current+1)+"
    • ",i+='
    • '+(this.current+2)+"
    • ",this.current'+this.settings.ellipseTpl+"");else{i+='
    • '+this.settings.ellipseTpl+"
    • ";for(var e=this.pagecount-5;e'+e+""}i+='
    • '+this.pagecount+"
    • "}else for(var e=1;e<=this.pagecount;e++)i+='
    • '+e+"
    • ";i+='
    • '+this.settings.nextTpl+"
    • ",i+='
    • '+this.settings.lastTpl+"
    • ",i+="
    ",this.container.html(i),1==this.current&&(t(".js-page-prev",this.container).addClass("ui-pager-disabled"),t(".js-page-first",this.container).addClass("ui-pager-disabled")),this.current==this.pagecount&&(t(".js-page-next",this.container).addClass("ui-pager-disabled"),t(".js-page-last",this.container).addClass("ui-pager-disabled")),this.container.find('li[data-page="'+this.current+'"]').addClass("focus").siblings().removeClass("focus"),this.settings.toolbar&&this.bindToolbar()},bindToolbar:function(){for(var i=this,e=t('
  • 跳转
  • '),a=t(".ui-select-pagesize",e),s="",n=0,r=this.settings.pageSizeList.length;n'+this.settings.pageSizeList[n]+"条/页";a.html(s),a.val(this.pagesize),t("input",e).val(this.current),t("input",e).click(function(){t(this).select()}).keydown(function(e){if(13==e.keyCode){var a=parseInt(t(this).val())||1;i.go(a)}}),t("a",e).click(function(){var e=parseInt(t(this).prev().val())||1;i.go(e)}),a.change(function(){i.changePagesize(t(this).val())}),this.container.children("ul").append(e)}},e}); -------------------------------------------------------------------------------- /docs/paging.js: -------------------------------------------------------------------------------- 1 | !function(t,i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i():t.Query=i(window.Zepto||window.jQuery||$)}(this,function(t){return{getQuery:function(t,e,a){new RegExp("(^|&|#)"+t+"=([^&]*)(&|$|#)","i");a=a||window;var s,n,r=a.location.href,l="";if(s="#"==e?r.split("#"):r.split("?"),""!=(n=1==s.length?"":s[1])){gg=n.split(/&|#/);var h=gg.length;for(str=arguments[0]+"=",i=0;i0){e=e.substr(1);for(var a=e.split("&"),s=0,n=a.length;s0&&(i[r[0]]=decodeURI(r[1])||"")}}return i}}}),function(t,i){"function"==typeof define&&define.amd?define(["jquery","query"],i):"object"==typeof exports?module.exports=i():t.Paging=i(window.Zepto||window.jQuery||$,Query)}(this,function(t,i){function e(){var t=Math.random().toString().replace(".","");this.id="Paging_"+t}return t.fn.Paging=function(i){var a=[];return t(this).each(function(){var s=t.extend({target:t(this)},i),n=new e;n.init(s),a.push(n)}),a},e.prototype={init:function(i){this.settings=t.extend({callback:null,pagesize:10,current:1,prevTpl:"上一页",nextTpl:"下一页",firstTpl:"首页",lastTpl:"末页",ellipseTpl:"...",toolbar:!1,hash:!1,pageSizeList:[5,10,15,20]},i),this.target=t(this.settings.target),this.container=t('
    '),this.target.append(this.container),this.render(this.settings),this.format(),this.bindEvent()},render:function(t){void 0!==t.count?this.count=t.count:this.count=this.settings.count,void 0!==t.pagesize?this.pagesize=t.pagesize:this.pagesize=this.settings.pagesize,void 0!==t.current?this.current=t.current:this.current=this.settings.current,this.pagecount=Math.ceil(this.count/this.pagesize),this.format()},bindEvent:function(){var i=this;this.container.on("click","li.js-page-action,li.ui-pager",function(e){if(t(this).hasClass("ui-pager-disabled")||t(this).hasClass("focus"))return!1;t(this).hasClass("js-page-action")?(t(this).hasClass("js-page-first")&&(i.current=1),t(this).hasClass("js-page-prev")&&(i.current=Math.max(1,i.current-1)),t(this).hasClass("js-page-next")&&(i.current=Math.min(i.pagecount,i.current+1)),t(this).hasClass("js-page-last")&&(i.current=i.pagecount)):t(this).data("page")&&(i.current=parseInt(t(this).data("page"))),i.go()})},go:function(t){var e=this;this.current=t||this.current,this.current=Math.max(1,e.current),this.current=Math.min(this.current,e.pagecount),this.format(),this.settings.hash&&i.setHash({page:this.current}),this.settings.callback&&this.settings.callback(this.current,this.pagesize,this.pagecount)},changePagesize:function(t){this.render({pagesize:t}),this.settings.changePagesize&&this.settings.changePagesize.call(this,this.pagesize,this.current,this.pagecount)},format:function(){var i="
      ";if(i+='
    • '+this.settings.firstTpl+"
    • ",i+='
    • '+this.settings.prevTpl+"
    • ",this.pagecount>10){if(i+='
    • 1
    • ',this.current<5)i+='
    • 2
    • ',i+='
    • 3
    • ',i+='
    • 4
    • ',i+='
    • 5
    • ',i+='
    • '+this.settings.ellipseTpl+"
    • ";else if(this.current>=5&&this.current<=this.pagecount-5)this.current>=5&&(i+='
    • '+this.settings.ellipseTpl+"
    • "),i+='
    • '+(this.current-2)+"
    • ",i+='
    • '+(this.current-1)+"
    • ",i+='
    • '+this.current+"
    • ",i+='
    • '+(this.current+1)+"
    • ",i+='
    • '+(this.current+2)+"
    • ",this.current'+this.settings.ellipseTpl+"");else{i+='
    • '+this.settings.ellipseTpl+"
    • ";for(var e=this.pagecount-5;e'+e+""}i+='
    • '+this.pagecount+"
    • "}else for(var e=1;e<=this.pagecount;e++)i+='
    • '+e+"
    • ";i+='
    • '+this.settings.nextTpl+"
    • ",i+='
    • '+this.settings.lastTpl+"
    • ",i+="
    ",this.container.html(i),1==this.current&&(t(".js-page-prev",this.container).addClass("ui-pager-disabled"),t(".js-page-first",this.container).addClass("ui-pager-disabled")),this.current==this.pagecount&&(t(".js-page-next",this.container).addClass("ui-pager-disabled"),t(".js-page-last",this.container).addClass("ui-pager-disabled")),this.container.find('li[data-page="'+this.current+'"]').addClass("focus").siblings().removeClass("focus"),this.settings.toolbar&&this.bindToolbar()},bindToolbar:function(){for(var i=this,e=t('
  • 跳转
  • '),a=t(".ui-select-pagesize",e),s="",n=0,r=this.settings.pageSizeList.length;n'+this.settings.pageSizeList[n]+"条/页";a.html(s),a.val(this.pagesize),t("input",e).val(this.current),t("input",e).click(function(){t(this).select()}).keydown(function(e){if(13==e.keyCode){var a=parseInt(t(this).val())||1;i.go(a)}}),t("a",e).click(function(){var e=parseInt(t(this).prev().val())||1;i.go(e)}),a.change(function(){i.changePagesize(t(this).val())}),this.container.children("ul").append(e)}},e}); -------------------------------------------------------------------------------- /src/paging.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Created with Sublime Text 3. 3 | * demo地址: http://www.lovewebgames.com/jsmodule/index.html 4 | * github: https://github.com/tianxiangbing/paging 5 | * User: 田想兵 6 | * Date: 2015-06-11 7 | * Time: 16:27:55 8 | * Contact: 55342775@qq.com 9 | * Desc: 确保代码最新及时修复bug,请去github上下载最新源码 https://github.com/tianxiangbing/paging 10 | */ 11 | (function (root, factory) { 12 | //amd 13 | if (typeof define === 'function' && define.amd) { 14 | define(['jquery', 'query'], factory); 15 | } else if (typeof exports === 'object') { //umd 16 | module.exports = factory(); 17 | } else { 18 | root.Paging = factory(window.Zepto || window.jQuery || $, Query); 19 | } 20 | })(this, function ($, Query) { 21 | $.fn.Paging = function (settings) { 22 | var arr = []; 23 | $(this).each(function () { 24 | var options = $.extend({ 25 | target: $(this) 26 | }, settings); 27 | var lz = new Paging(); 28 | lz.init(options); 29 | arr.push(lz); 30 | }); 31 | return arr; 32 | }; 33 | 34 | function Paging() { 35 | var rnd = Math.random().toString().replace('.', ''); 36 | this.id = 'Paging_' + rnd; 37 | } 38 | Paging.prototype = { 39 | init: function (settings) { 40 | this.settings = $.extend({ 41 | callback: null, 42 | pagesize: 10, 43 | current: 1, 44 | prevTpl: "上一页", 45 | nextTpl: "下一页", 46 | firstTpl: "首页", 47 | lastTpl: "末页", 48 | ellipseTpl: "...", 49 | toolbar: false, 50 | hash: false, 51 | pageSizeList: [5, 10, 15, 20] 52 | }, settings); 53 | this.target = $(this.settings.target); 54 | this.container = $('
    '); 55 | this.target.append(this.container); 56 | this.render(this.settings); 57 | this.format(); 58 | this.bindEvent(); 59 | }, 60 | render: function (ops) { 61 | typeof ops.count !== 'undefined' ? this.count = ops.count : this.count =this.settings.count; 62 | typeof ops.pagesize!== 'undefined' ? this.pagesize = ops.pagesize : this.pagesize = this.settings.pagesize; 63 | typeof ops.current!== 'undefined' ? this.current = ops.current: this.current = this.settings.current; 64 | this.pagecount = Math.ceil(this.count / this.pagesize); 65 | this.format(); 66 | }, 67 | bindEvent: function () { 68 | var _this = this; 69 | this.container.on('click', 'li.js-page-action,li.ui-pager', function (e) { 70 | if ($(this).hasClass('ui-pager-disabled') || $(this).hasClass('focus')) { 71 | return false; 72 | } 73 | if ($(this).hasClass('js-page-action')) { 74 | if ($(this).hasClass('js-page-first')) { 75 | _this.current = 1; 76 | } 77 | if ($(this).hasClass('js-page-prev')) { 78 | _this.current = Math.max(1, _this.current - 1); 79 | } 80 | if ($(this).hasClass('js-page-next')) { 81 | _this.current = Math.min(_this.pagecount, _this.current + 1); 82 | } 83 | if ($(this).hasClass('js-page-last')) { 84 | _this.current = _this.pagecount; 85 | } 86 | } else if ($(this).data('page')) { 87 | _this.current = parseInt($(this).data('page')); 88 | } 89 | _this.go(); 90 | }); 91 | /* 92 | $(window).on('hashchange',function(){ 93 | var page= parseInt(Query.getHash('page')); 94 | if(_this.current !=page){ 95 | _this.go(page||1); 96 | } 97 | }) 98 | */ 99 | }, 100 | go: function (p) { 101 | var _this = this; 102 | this.current = p || this.current; 103 | this.current = Math.max(1, _this.current); 104 | this.current = Math.min(this.current, _this.pagecount); 105 | this.format(); 106 | if (this.settings.hash) { 107 | Query.setHash({ 108 | page: this.current 109 | }); 110 | } 111 | this.settings.callback && this.settings.callback(this.current, this.pagesize, this.pagecount); 112 | }, 113 | changePagesize: function (ps) { 114 | this.render({ 115 | pagesize: ps 116 | }); 117 | this.settings.changePagesize && this.settings.changePagesize.call(this, this.pagesize,this.current, this.pagecount); 118 | }, 119 | format: function () { 120 | var html = '
      ' 121 | html += '
    • ' + this.settings.firstTpl + '
    • '; 122 | html += '
    • ' + this.settings.prevTpl + '
    • '; 123 | if (this.pagecount > 10) { 124 | html += '
    • 1
    • '; 125 | if (this.current < 5) { 126 | html += '
    • 2
    • '; 127 | html += '
    • 3
    • '; 128 | html += '
    • 4
    • '; 129 | html += '
    • 5
    • '; 130 | html += '
    • ' + this.settings.ellipseTpl + '
    • '; 131 | } else 132 | if (this.current >= 5 && this.current <= this.pagecount - 5) { 133 | if (this.current >= 5) { 134 | html += '
    • ' + this.settings.ellipseTpl + '
    • '; 135 | } 136 | html += '
    • ' + (this.current - 2) + '
    • '; 137 | html += '
    • ' + (this.current - 1) + '
    • '; 138 | html += '
    • ' + this.current + '
    • '; 139 | html += '
    • ' + (this.current + 1) + '
    • '; 140 | html += '
    • ' + (this.current + 2) + '
    • '; 141 | if (this.current < this.pagecount - 4) { 142 | html += '
    • ' + this.settings.ellipseTpl + '
    • '; 143 | } 144 | } else { 145 | html += '
    • ' + this.settings.ellipseTpl + '
    • '; 146 | for (var i = this.pagecount - 5; i < this.pagecount; i++) { 147 | html += '
    • ' + i + '
    • ' 148 | } 149 | } 150 | html += '
    • ' + this.pagecount + '
    • '; 151 | } else { 152 | for (var i = 1; i <= this.pagecount; i++) { 153 | html += '
    • ' + i + '
    • ' 154 | } 155 | } 156 | html += '
    • ' + this.settings.nextTpl + '
    • '; 157 | html += '
    • ' + this.settings.lastTpl + '
    • '; 158 | html += '
    '; 159 | this.container.html(html); 160 | if (this.current == 1) { 161 | $('.js-page-prev', this.container).addClass('ui-pager-disabled'); 162 | $('.js-page-first', this.container).addClass('ui-pager-disabled'); 163 | } 164 | if (this.current == this.pagecount) { 165 | $('.js-page-next', this.container).addClass('ui-pager-disabled'); 166 | $('.js-page-last', this.container).addClass('ui-pager-disabled'); 167 | } 168 | this.container.find('li[data-page="' + this.current + '"]').addClass('focus').siblings().removeClass('focus'); 169 | if (this.settings.toolbar) { 170 | this.bindToolbar(); 171 | } 172 | }, 173 | bindToolbar: function () { 174 | var _this = this; 175 | var html = $('
  • 跳转
  • '); 176 | var sel = $('.ui-select-pagesize', html); 177 | var str = ''; 178 | for (var i = 0, l = this.settings.pageSizeList.length; i < l; i++) { 179 | str += ''; 180 | } 181 | sel.html(str); 182 | sel.val(this.pagesize); 183 | $('input', html).val(this.current); 184 | $('input', html).click(function () { 185 | $(this).select(); 186 | }).keydown(function (e) { 187 | if (e.keyCode == 13) { 188 | var current = parseInt($(this).val()) || 1; 189 | _this.go(current); 190 | } 191 | }); 192 | $('a', html).click(function () { 193 | var current = parseInt($(this).prev().val()) || 1; 194 | _this.go(current); 195 | }); 196 | sel.change(function () { 197 | _this.changePagesize($(this).val()); 198 | }); 199 | this.container.children('ul').append(html); 200 | } 201 | } 202 | return Paging; 203 | }); -------------------------------------------------------------------------------- /src/rpaging.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Created with Sublime Text 3. 3 | * demo地址: http://www.lovewebgames.com/jsmodule/index.html 4 | * github: https://github.com/tianxiangbing/paging 5 | * User: 田想兵 6 | * Date: 2015-06-11 7 | * Time: 16:27:55 8 | * Contact: 55342775@qq.com 9 | * Desc: 确保代码最新及时修复bug,请去github上下载最新源码 https://github.com/tianxiangbing/paging 10 | */ 11 | /* 12 | * Created with Sublime Text 3. 13 | * demo地址: http://www.lovewebgames.com/jsmodule/index.html 14 | * github: https://github.com/tianxiangbing/query 15 | * User: 田想兵 16 | * Date: 2015-06-11 17 | * Time: 16:27:55 18 | * Contact: 55342775@qq.com 19 | * Desc: 确保代码最新及时修复bug,请去github上下载最新源码 https://github.com/tianxiangbing/query 20 | */ 21 | define('$',function($){ 22 | var Query = { 23 | getQuery: function(name, type, win) { 24 | var reg = new RegExp("(^|&|#)" + name + "=([^&]*)(&|$|#)", "i"); 25 | win = win || window; 26 | var Url = win.location.href; 27 | var u, g, StrBack = ''; 28 | if (type == "#") { 29 | u = Url.split("#"); 30 | } else { 31 | u = Url.split("?"); 32 | } 33 | if (u.length == 1) { 34 | g = ''; 35 | } else { 36 | g = u[1]; 37 | } 38 | if (g != '') { 39 | gg = g.split(/&|#/); 40 | var MaxI = gg.length; 41 | str = arguments[0] + "="; 42 | for (i = 0; i < MaxI; i++) { 43 | if (gg[i].indexOf(str) == 0) { 44 | StrBack = gg[i].replace(str, ""); 45 | break; 46 | } 47 | } 48 | } 49 | return decodeURI(StrBack); 50 | }, 51 | getForm: function(form) { 52 | var result = {}, 53 | tempObj = {}; 54 | $(form).find('*[name]').each(function(i, v) { 55 | var nameSpace, 56 | name = $(v).attr('name'), 57 | val = $.trim($(v).val()), 58 | tempArr = []; 59 | if (name == '' || $(v).hasClass('getvalued')) { 60 | return; 61 | } 62 | 63 | if ($(v).data('type') == "money") { 64 | val = val.replace(/\,/gi, ''); 65 | } 66 | 67 | //处理radio add by yhx 2014-06-18 68 | if ($(v).attr("type") == "radio") { 69 | var tempradioVal = null; 70 | $("input[name='" + name + "']:radio").each(function() { 71 | if ($(this).is(":checked")) 72 | tempradioVal = $.trim($(this).val()); 73 | }); 74 | if (tempradioVal) { 75 | val = tempradioVal; 76 | } else { 77 | val = ""; 78 | } 79 | } 80 | 81 | 82 | if ($(v).attr("type") == "checkbox") { 83 | var tempradioVal = []; 84 | $("input[name='" + name + "']:checkbox").each(function() { 85 | if ($(this).is(":checked")) 86 | tempradioVal.push($.trim($(this).val())); 87 | }); 88 | if (tempradioVal.length) { 89 | val = tempradioVal.join(','); 90 | } else { 91 | val = ""; 92 | } 93 | } 94 | 95 | if ($(v).attr('listvalue')) { 96 | if (!result[$(v).attr('listvalue')]) { 97 | result[$(v).attr('listvalue')] = []; 98 | $("input[listvalue='" + $(v).attr('listvalue') + "']").each(function() { 99 | if ($(this).val() != "") { 100 | var name = $(this).attr('name'); 101 | var obj = {}; 102 | if ($(this).data('type') == "json") { 103 | obj[name] = JSON.parse($(this).val()); 104 | } else { 105 | obj[name] = $.trim($(this).val()); 106 | } 107 | if ($(this).attr("paramquest")) { 108 | var o = JSON.parse($(this).attr("paramquest")); 109 | obj = $.extend(obj, o); 110 | } 111 | result[$(v).attr('listvalue')].push(obj); 112 | $(this).addClass('getvalued'); 113 | } 114 | }); 115 | } 116 | } 117 | 118 | if ($(v).attr('arrayvalue')) { 119 | if (!result[$(v).attr('arrayvalue')]) { 120 | result[$(v).attr('arrayvalue')] = []; 121 | $("input[arrayvalue='" + $(v).attr('arrayvalue') + "']").each(function() { 122 | if ($(this).val() != "") { 123 | var obj = {}; 124 | if ($(this).data('type') == "json") { 125 | obj = JSON.parse($(this).val()); 126 | } else { 127 | obj = $.trim($(this).val()); 128 | } 129 | if ($(this).attr("paramquest")) { 130 | var o = JSON.parse($(this).attr("paramquest")); 131 | obj = $.extend(obj, o); 132 | } 133 | result[$(v).attr('arrayvalue')].push(obj); 134 | } 135 | }); 136 | } 137 | } 138 | if (name == '' || $(v).hasClass('getvalued')) { 139 | return; 140 | } 141 | //构建参数 142 | if (name.match(/\./)) { 143 | tempArr = name.split('.'); 144 | nameSpace = tempArr[0]; 145 | if (tempArr.length == 3) { 146 | tempObj[tempArr[1]] = tempObj[tempArr[1]] || {}; 147 | tempObj[tempArr[1]][tempArr[2]] = val; 148 | } else { 149 | if ($(v).data('type') == "json") { 150 | tempObj[tempArr[1]] = JSON.parse(val); 151 | if ($(v).attr("paramquest")) { 152 | var o = JSON.parse($(v).attr("paramquest")); 153 | tempObj[tempArr[1]] = $.extend(tempObj[tempArr[1]], o); 154 | } 155 | } else { 156 | tempObj[tempArr[1]] = val; 157 | } 158 | } 159 | if (!result[nameSpace]) { 160 | result[nameSpace] = tempObj; 161 | } else { 162 | result[nameSpace] = $.extend({}, result[nameSpace], tempObj); 163 | } 164 | } else { 165 | result[name] = val; 166 | } 167 | 168 | }); 169 | var obj = {}; 170 | for (var o in result) { 171 | var v = result[o]; 172 | if (typeof v == "object") { 173 | obj[o] = JSON.stringify(v); 174 | } else { 175 | obj[o] = result[o] 176 | } 177 | } 178 | $('.getvalued').removeClass('getvalued'); 179 | return obj; 180 | }, 181 | setHash: function(obj) { 182 | var str = ''; 183 | obj = $.extend(this.getHash(), obj) 184 | var arr = []; 185 | for (var v in obj) { 186 | if(obj[v]!=''){ 187 | arr.push(v + '=' + encodeURIComponent(obj[v])); 188 | } 189 | } 190 | str+=arr.join('&'); 191 | location.hash = str; 192 | return this; 193 | }, 194 | getHash: function(name) { 195 | if (typeof name === "string") { 196 | return this.getQuery(name, "#"); 197 | } else { 198 | var obj = {}; 199 | var hash = location.hash; 200 | if(hash.length>0){ 201 | hash = hash.substr(1); 202 | var hashArr = hash.split('&'); 203 | for (var i = 0, l = hashArr.length; i < l; i++) { 204 | var a = hashArr[i].split('='); 205 | if (a.length > 0) { 206 | obj[a[0]] = decodeURI(a[1]) || ''; 207 | } 208 | } 209 | } 210 | return obj; 211 | } 212 | } 213 | }; 214 | $.fn.Paging = function (settings) { 215 | var arr = []; 216 | $(this).each(function () { 217 | var options = $.extend({ 218 | target: $(this) 219 | }, settings); 220 | var lz = new Paging(); 221 | lz.init(options); 222 | arr.push(lz); 223 | }); 224 | return arr; 225 | }; 226 | 227 | function Paging() { 228 | var rnd = Math.random().toString().replace('.', ''); 229 | this.id = 'Paging_' + rnd; 230 | } 231 | Paging.prototype = { 232 | init: function (settings) { 233 | this.settings = $.extend({ 234 | callback: null, 235 | pagesize: 10, 236 | current: 1, 237 | prevTpl: "上一页", 238 | nextTpl: "下一页", 239 | firstTpl: "首页", 240 | lastTpl: "末页", 241 | ellipseTpl: "...", 242 | toolbar: false, 243 | hash: false, 244 | pageSizeList: [5, 10, 15, 20] 245 | }, settings); 246 | this.target = $(this.settings.target); 247 | this.container = $('
    '); 248 | this.target.append(this.container); 249 | this.render(this.settings); 250 | this.format(); 251 | this.bindEvent(); 252 | }, 253 | render: function (ops) { 254 | typeof ops.count !== 'undefined' ? this.count = ops.count : this.count =this.settings.count; 255 | typeof ops.pagesize!== 'undefined' ? this.pagesize = ops.pagesize : this.pagesize = this.settings.pagesize; 256 | typeof ops.current!== 'undefined' ? this.current = ops.current: this.current = this.settings.current; 257 | this.pagecount = Math.ceil(this.count / this.pagesize); 258 | this.format(); 259 | }, 260 | bindEvent: function () { 261 | var _this = this; 262 | this.container.on('click', 'li.js-page-action,li.ui-pager', function (e) { 263 | if ($(this).hasClass('ui-pager-disabled') || $(this).hasClass('focus')) { 264 | return false; 265 | } 266 | if ($(this).hasClass('js-page-action')) { 267 | if ($(this).hasClass('js-page-first')) { 268 | _this.current = 1; 269 | } 270 | if ($(this).hasClass('js-page-prev')) { 271 | _this.current = Math.max(1, _this.current - 1); 272 | } 273 | if ($(this).hasClass('js-page-next')) { 274 | _this.current = Math.min(_this.pagecount, _this.current + 1); 275 | } 276 | if ($(this).hasClass('js-page-last')) { 277 | _this.current = _this.pagecount; 278 | } 279 | } else if ($(this).data('page')) { 280 | _this.current = parseInt($(this).data('page')); 281 | } 282 | _this.go(); 283 | }); 284 | /* 285 | $(window).on('hashchange',function(){ 286 | var page= parseInt(Query.getHash('page')); 287 | if(_this.current !=page){ 288 | _this.go(page||1); 289 | } 290 | }) 291 | */ 292 | }, 293 | go: function (p) { 294 | var _this = this; 295 | this.current = p || this.current; 296 | this.current = Math.max(1, _this.current); 297 | this.current = Math.min(this.current, _this.pagecount); 298 | this.format(); 299 | if (this.settings.hash) { 300 | Query.setHash({ 301 | page: this.current 302 | }); 303 | } 304 | this.settings.callback && this.settings.callback(this.current, this.pagesize, this.pagecount); 305 | }, 306 | changePagesize: function (ps) { 307 | this.render({ 308 | pagesize: ps 309 | }); 310 | this.settings.changePagesize && this.settings.changePagesize.call(this, this.pagesize,this.current, this.pagecount); 311 | }, 312 | format: function () { 313 | var html = '
      ' 314 | html += '
    • ' + this.settings.firstTpl + '
    • '; 315 | html += '
    • ' + this.settings.prevTpl + '
    • '; 316 | if (this.pagecount > 6) { 317 | html += '
    • 1
    • '; 318 | if (this.current <= 2) { 319 | html += '
    • 2
    • '; 320 | html += '
    • 3
    • '; 321 | html += '
    • ' + this.settings.ellipseTpl + '
    • '; 322 | } else 323 | if (this.current > 2 && this.current <= this.pagecount - 2) { 324 | if (this.current > 3) { 325 | html += '
    • ' + this.settings.ellipseTpl + '
    • '; 326 | } 327 | html += '
    • ' + (this.current - 1) + '
    • '; 328 | html += '
    • ' + this.current + '
    • '; 329 | html += '
    • ' + (this.current + 1) + '
    • '; 330 | if (this.current < this.pagecount - 2) { 331 | html += '
    • ' + this.settings.ellipseTpl + '
    • '; 332 | } 333 | } else { 334 | html += '
    • ' + this.settings.ellipseTpl + '
    • '; 335 | for (var i = this.pagecount - 2; i < this.pagecount; i++) { 336 | html += '
    • ' + i + '
    • ' 337 | } 338 | } 339 | html += '
    • ' + this.pagecount + '
    • '; 340 | } else { 341 | for (var i = 1; i <= this.pagecount; i++) { 342 | html += '
    • ' + i + '
    • ' 343 | } 344 | } 345 | html += '
    • ' + this.settings.nextTpl + '
    • '; 346 | html += '
    • ' + this.settings.lastTpl + '
    • '; 347 | html += '
    '; 348 | this.container.html(html); 349 | if (this.current == 1) { 350 | $('.js-page-prev', this.container).addClass('ui-pager-disabled'); 351 | $('.js-page-first', this.container).addClass('ui-pager-disabled'); 352 | } 353 | if (this.current == this.pagecount) { 354 | $('.js-page-next', this.container).addClass('ui-pager-disabled'); 355 | $('.js-page-last', this.container).addClass('ui-pager-disabled'); 356 | } 357 | this.container.find('li[data-page="' + this.current + '"]').addClass('focus').siblings().removeClass('focus'); 358 | if (this.settings.toolbar) { 359 | this.bindToolbar(); 360 | } 361 | }, 362 | bindToolbar: function () { 363 | var _this = this; 364 | var html = $('
  • 跳转
  • '); 365 | var sel = $('.ui-select-pagesize', html); 366 | var str = ''; 367 | for (var i = 0, l = this.settings.pageSizeList.length; i < l; i++) { 368 | str += ''; 369 | } 370 | sel.html(str); 371 | sel.val(this.pagesize); 372 | $('input', html).val(this.current); 373 | $('input', html).click(function () { 374 | $(this).select(); 375 | }).keydown(function (e) { 376 | if (e.keyCode == 13) { 377 | var current = parseInt($(this).val()) || 1; 378 | _this.go(current); 379 | } 380 | }); 381 | $('a', html).click(function () { 382 | var current = parseInt($(this).prev().val()) || 1; 383 | _this.go(current); 384 | }); 385 | sel.change(function () { 386 | _this.changePagesize($(this).val()); 387 | }); 388 | this.container.children('ul').append(html); 389 | } 390 | } 391 | return Paging; 392 | }); -------------------------------------------------------------------------------- /dest/require.js: -------------------------------------------------------------------------------- 1 | var requirejs,require,define;!function(global){function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){if(e){var i;for(i=0;i-1&&(!e[i]||!t(e[i],i,e));i-=1);}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var i;for(i in e)if(hasProp(e,i)&&t(e[i],i))break}function mixin(e,t,i,r){return t&&eachProp(t,function(t,n){!i&&hasProp(e,n)||(!r||"object"!=typeof t||!t||isArray(t)||isFunction(t)||t instanceof RegExp?e[n]=t:(e[n]||(e[n]={}),mixin(e[n],t,i,r)))}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,i,r){var n=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return n.requireType=e,n.requireModules=r,i&&(n.originalError=i),n}function newContext(e){function t(e){var t,i,r=e.length;for(t=0;t0&&(e.splice(t-1,2),t-=2)}}function i(e,i,r){var n,a,o,s,c,u,p,d,f,l,h=i&&i.split("/"),m=h,g=y.map,v=g&&g["*"];if(e&&"."===e.charAt(0)&&(i?(m=h.slice(0,h.length-1),e=e.split("/"),u=e.length-1,y.nodeIdCompat&&jsSuffixRegExp.test(e[u])&&(e[u]=e[u].replace(jsSuffixRegExp,"")),e=m.concat(e),t(e),e=e.join("/")):0===e.indexOf("./")&&(e=e.substring(2))),r&&g&&(h||v)){a=e.split("/");e:for(o=a.length;o>0;o-=1){if(c=a.slice(0,o).join("/"),h)for(s=h.length;s>0;s-=1)if((n=getOwn(g,h.slice(0,s).join("/")))&&(n=getOwn(n,c))){p=n,d=o;break e}!f&&v&&getOwn(v,c)&&(f=getOwn(v,c),l=o)}!p&&f&&(p=f,d=l),p&&(a.splice(0,d,p),e=a.join("/"))}return getOwn(y.pkgs,e)||e}function r(e){isBrowser&&each(scripts(),function(t){if(t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===q.contextName)return t.parentNode.removeChild(t),!0})}function n(e){var t=getOwn(y.paths,e);if(t&&isArray(t)&&t.length>1)return t.shift(),q.require.undef(e),q.require([e]),!0}function a(e){var t,i=e?e.indexOf("!"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function o(e,t,r,n){var o,s,c,u,p=null,d=t?t.name:null,f=e,l=!0,h="";return e||(l=!1,e="_@r"+(A+=1)),u=a(e),p=u[0],e=u[1],p&&(p=i(p,d,n),s=getOwn(j,p)),e&&(p?h=s&&s.normalize?s.normalize(e,function(e){return i(e,d,n)}):i(e,d,n):(h=i(e,d,n),u=a(h),p=u[0],h=u[1],r=!0,o=q.nameToUrl(h))),c=!p||s||r?"":"_unnormalized"+(T+=1),{prefix:p,name:h,parentMap:t,unnormalized:!!c,url:o,originalName:f,isDefine:l,id:(p?p+"!"+h:h)+c}}function s(e){var t=e.id,i=getOwn(S,t);return i||(i=S[t]=new q.Module(e)),i}function c(e,t,i){var r=e.id,n=getOwn(S,r);!hasProp(j,r)||n&&!n.defineEmitComplete?(n=s(e),n.error&&"error"===t?i(n.error):n.on(t,i)):"defined"===t&&i(j[r])}function u(e,t){var i=e.requireModules,r=!1;t?t(e):(each(i,function(t){var i=getOwn(S,t);i&&(i.error=e,i.events.error&&(r=!0,i.emit("error",e)))}),r||req.onError(e))}function p(){globalDefQueue.length&&(apsp.apply(M,[M.length,0].concat(globalDefQueue)),globalDefQueue=[])}function d(e){delete S[e],delete k[e]}function f(e,t,i){var r=e.map.id;e.error?e.emit("error",e.error):(t[r]=!0,each(e.depMaps,function(r,n){var a=r.id,o=getOwn(S,a);!o||e.depMatched[n]||i[a]||(getOwn(t,a)?(e.defineDep(n,j[a]),e.check()):f(o,t,i))}),i[r]=!0)}function l(){var e,t,i=1e3*y.waitSeconds,a=i&&q.startTime+i<(new Date).getTime(),o=[],s=[],c=!1,p=!0;if(!x){if(x=!0,eachProp(k,function(e){var i=e.map,u=i.id;if(e.enabled&&(i.isDefine||s.push(e),!e.error))if(!e.inited&&a)n(u)?(t=!0,c=!0):(o.push(u),r(u));else if(!e.inited&&e.fetched&&i.isDefine&&(c=!0,!i.prefix))return p=!1}),a&&o.length)return e=makeError("timeout","Load timeout for modules: "+o,null,o),e.contextName=q.contextName,u(e);p&&each(s,function(e){f(e,{},{})}),a&&!t||!c||!isBrowser&&!isWebWorker||w||(w=setTimeout(function(){w=0,l()},50)),x=!1}}function h(e){hasProp(j,e[0])||s(o(e[0],null,!0)).init(e[1],e[2])}function m(e,t,i,r){e.detachEvent&&!isOpera?r&&e.detachEvent(r,t):e.removeEventListener(i,t,!1)}function g(e){var t=e.currentTarget||e.srcElement;return m(t,q.onScriptLoad,"load","onreadystatechange"),m(t,q.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function v(){var e;for(p();M.length;){if(e=M.shift(),null===e[0])return u(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));h(e)}}var x,b,q,E,w,y={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},S={},k={},O={},M=[],j={},P={},R={},A=1,T=1;return E={require:function(e){return e.require?e.require:e.require=q.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?j[e.map.id]=e.exports:e.exports=j[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(y.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},b=function(e){this.events=getOwn(O,e.id)||{},this.map=e,this.shim=getOwn(y.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},b.prototype={init:function(e,t,i,r){r=r||{},this.inited||(this.factory=t,i?this.on("error",i):this.events.error&&(i=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=i,this.inited=!0,this.ignore=r.ignore,r.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(!this.fetched){this.fetched=!0,q.startTime=(new Date).getTime();var e=this.map;if(!this.shim)return e.prefix?this.callPlugin():this.load();q.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}))}},load:function(){var e=this.map.url;P[e]||(P[e]=!0,q.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,i=this.map.id,r=this.depExports,n=this.exports,a=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(a)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{n=q.execCb(i,a,r,n)}catch(t){e=t}else n=q.execCb(i,a,r,n);if(this.map.isDefine&&void 0===n&&(t=this.module,t?n=t.exports:this.usingExports&&(n=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",u(this.error=e)}else n=a;this.exports=n,this.map.isDefine&&!this.ignore&&(j[i]=n,req.onResourceLoad&&req.onResourceLoad(q,this.map,this.depMaps)),d(i),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,r=o(e.prefix);this.depMaps.push(r),c(r,"defined",bind(this,function(r){var n,a,p,f=getOwn(R,this.map.id),l=this.map.name,h=this.map.parentMap?this.map.parentMap.name:null,m=q.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(r.normalize&&(l=r.normalize(l,function(e){return i(e,h,!0)})||""),a=o(e.prefix+"!"+l,this.map.parentMap),c(a,"defined",bind(this,function(e){this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),void((p=getOwn(S,a.id))&&(this.depMaps.push(a),this.events.error&&p.on("error",bind(this,function(e){this.emit("error",e)})),p.enable()))):f?(this.map.url=q.nameToUrl(f),void this.load()):(n=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),n.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(S,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&d(e.map.id)}),u(e)}),n.fromText=bind(this,function(i,r){var a=e.name,c=o(a),p=useInteractive;r&&(i=r),p&&(useInteractive=!1),s(c),hasProp(y.config,t)&&(y.config[a]=y.config[t]);try{req.exec(i)}catch(e){return u(makeError("fromtexteval","fromText eval for "+t+" failed: "+e,e,[t]))}p&&(useInteractive=!0),this.depMaps.push(c),q.completeLoad(a),m([a],n)}),void r.load(e.name,m,n,y))})),q.enable(r,this),this.pluginMaps[r.id]=r},enable:function(){k[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var i,r,n;if("string"==typeof e){if(e=o(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,n=getOwn(E,e.id))return void(this.depExports[t]=n(this));this.depCount+=1,c(e,"defined",bind(this,function(e){this.defineDep(t,e),this.check()})),this.errback&&c(e,"error",bind(this,this.errback))}i=e.id,r=S[i],hasProp(E,i)||!r||r.enabled||q.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(S,e.id);t&&!t.enabled&&q.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var i=this.events[e];i||(i=this.events[e]=[]),i.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},q={config:y,contextName:e,registry:S,defined:j,urlFetched:P,defQueue:M,Module:b,makeModuleMap:o,nextTick:req.nextTick,onError:u,configure:function(e){e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/");var t=y.shim,i={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){i[t]?(y[t]||(y[t]={}),mixin(y[t],e,!0,!0)):y[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(R[e]=t)})}),e.shim&&(eachProp(e.shim,function(e,i){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=q.makeShimExports(e)),t[i]=e}),y.shim=t),e.packages&&each(e.packages,function(e){var t,i;e="string"==typeof e?{name:e}:e,i=e.name,t=e.location,t&&(y.paths[i]=e.location),y.pkgs[i]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(S,function(e,t){e.inited||e.map.unnormalized||(e.map=o(t))}),(e.deps||e.callback)&&q.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,n){function a(i,r,c){var p,d,f;return n.enableBuildCallback&&r&&isFunction(r)&&(r.__requireJsBuild=!0),"string"==typeof i?isFunction(r)?u(makeError("requireargs","Invalid require call"),c):t&&hasProp(E,i)?E[i](S[t.id]):req.get?req.get(q,i,t,a):(d=o(i,t,!1,!0),p=d.id,hasProp(j,p)?j[p]:u(makeError("notloaded",'Module name "'+p+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(v(),q.nextTick(function(){v(),f=s(o(null,t)),f.skipMap=n.skipMap,f.init(i,r,c,{enabled:!0}),l()}),a)}return n=n||{},mixin(a,{isBrowser:isBrowser,toUrl:function(e){var r,n=e.lastIndexOf("."),a=e.split("/")[0],o="."===a||".."===a;return-1!==n&&(!o||n>1)&&(r=e.substring(n,e.length),e=e.substring(0,n)),q.nameToUrl(i(e,t&&t.id,!0),r,!0)},defined:function(e){return hasProp(j,o(e,t,!1,!0).id)},specified:function(e){return e=o(e,t,!1,!0).id,hasProp(j,e)||hasProp(S,e)}}),t||(a.undef=function(e){p();var i=o(e,t,!0),n=getOwn(S,e);r(e),delete j[e],delete P[i.url],delete O[e],eachReverse(M,function(t,i){t[0]===e&&M.splice(i,1)}),n&&(n.events.defined&&(O[e]=n.events),d(e))}),a},enable:function(e){getOwn(S,e.id)&&s(e).enable()},completeLoad:function(e){var t,i,r,a=getOwn(y.shim,e)||{},o=a.exports;for(p();M.length;){if(i=M.shift(),null===i[0]){if(i[0]=e,t)break;t=!0}else i[0]===e&&(t=!0);h(i)}if(r=getOwn(S,e),!t&&!hasProp(j,e)&&r&&!r.inited){if(!(!y.enforceDefine||o&&getGlobal(o)))return n(e)?void 0:u(makeError("nodefine","No define call for "+e,null,[e]));h([e,a.deps||[],a.exportsFn])}l()},nameToUrl:function(e,t,i){var r,n,a,o,s,c,u,p=getOwn(y.pkgs,e);if(p&&(e=p),u=getOwn(R,e))return q.nameToUrl(u,t,i);if(req.jsExtRegExp.test(e))s=e+(t||"");else{for(r=y.paths,n=e.split("/"),a=n.length;a>0;a-=1)if(o=n.slice(0,a).join("/"),c=getOwn(r,o)){isArray(c)&&(c=c[0]),n.splice(0,a,c);break}s=n.join("/"),s+=t||(/^data\:|\?/.test(s)||i?"":".js"),s=("/"===s.charAt(0)||s.match(/^[\w\+\.\-]+:/)?"":y.baseUrl)+s}return y.urlArgs?s+(-1===s.indexOf("?")?"?":"&")+y.urlArgs:s},load:function(e,t){req.load(q,e,t)},execCb:function(e,t,i,r){return t.apply(r,i)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=g(e);q.completeLoad(t.id)}},onScriptError:function(e){var t=g(e);if(!n(t.id))return u(makeError("scripterror","Script error for: "+t.id,e,[t.id]))}},q.require=q.makeRequire(),q}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState?interactiveScript:(eachReverse(scripts(),function(e){if("interactive"===e.readyState)return interactiveScript=e}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.1.11",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,apsp=ap.splice,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if(void 0===define){if(void 0!==requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}void 0===require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(e,t,i,r){var n,a,o=defContextName;return isArray(e)||"string"==typeof e||(a=e,isArray(t)?(e=t,t=i,i=r):e=[]),a&&a.context&&(o=a.context),n=getOwn(contexts,o),n||(n=contexts[o]=req.s.newContext(o)),a&&n.configure(a),n.require(e,t,i)},req.config=function(e){return req(e)},req.nextTick="undefined"!=typeof setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],(baseElement=document.getElementsByTagName("base")[0])&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,i){var r=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return r.type=e.scriptType||"text/javascript",r.charset="utf-8",r.async=!0,r},req.load=function(e,t,i){var r,n=e&&e.config||{};if(isBrowser)return r=req.createNode(n,t,i),r.setAttribute("data-requirecontext",e.contextName),r.setAttribute("data-requiremodule",t),!r.attachEvent||r.attachEvent.toString&&r.attachEvent.toString().indexOf("[native code")<0||isOpera?(r.addEventListener("load",e.onScriptLoad,!1),r.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,r.attachEvent("onreadystatechange",e.onScriptLoad)),r.src=i,currentlyAddingScript=r,baseElement?head.insertBefore(r,baseElement):head.appendChild(r),currentlyAddingScript=null,r;if(isWebWorker)try{importScripts(i),e.completeLoad(t)}catch(r){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+i,r,[t]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(e){if(head||(head=e.parentNode),dataMain=e.getAttribute("data-main"))return mainScript=dataMain,cfg.baseUrl||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(e,t,i){var r,n;"string"!=typeof e&&(i=t,t=e,e=null),isArray(t)||(i=t,t=null),!t&&isFunction(i)&&(t=[],i.length&&(i.toString().replace(commentRegExp,"").replace(cjsRequireRegExp,function(e,i){t.push(i)}),t=(1===i.length?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(r=currentlyAddingScript||getInteractiveScript())&&(e||(e=r.getAttribute("data-requiremodule")),n=contexts[r.getAttribute("data-requirecontext")]),(n?n.defQueue:globalDefQueue).push([e,t,i])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}}(this); -------------------------------------------------------------------------------- /dest/jquery-1.11.2.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"function"==typeof define&&define.amd?define([],function(){return t(e)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){function n(e){var t=e.length,n=ie.type(e);return"function"===n||ie.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function r(e,t,n){if(ie.isFunction(t))return ie.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return ie.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(fe.test(t))return ie.filter(t,e,n);t=ie.filter(t,e)}return ie.grep(e,function(e){return ie.inArray(e,t)>=0!==n})}function i(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function o(e){var t=xe[e]={};return ie.each(e.match(be)||[],function(e,n){t[n]=!0}),t}function a(){he.addEventListener?(he.removeEventListener("DOMContentLoaded",s,!1),e.removeEventListener("load",s,!1)):(he.detachEvent("onreadystatechange",s),e.detachEvent("onload",s))}function s(){(he.addEventListener||"load"===event.type||"complete"===he.readyState)&&(a(),ie.ready())}function u(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(Ee,"-$1").toLowerCase();if(n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Ne.test(n)?ie.parseJSON(n):n}catch(i){}ie.data(e,t,n)}else n=void 0}return n}function l(e){var t;for(t in e)if(("data"!==t||!ie.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,n,r){if(ie.acceptData(e)){var i,o,a=ie.expando,s=e.nodeType,u=s?ie.cache:e,l=s?e[a]:e[a]&&a;if(l&&u[l]&&(r||u[l].data)||void 0!==n||"string"!=typeof t)return l||(l=s?e[a]=J.pop()||ie.guid++:a),u[l]||(u[l]=s?{}:{toJSON:ie.noop}),("object"==typeof t||"function"==typeof t)&&(r?u[l]=ie.extend(u[l],t):u[l].data=ie.extend(u[l].data,t)),o=u[l],r||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[ie.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[ie.camelCase(t)])):i=o,i}}function d(e,t,n){if(ie.acceptData(e)){var r,i,o=e.nodeType,a=o?ie.cache:e,s=o?e[ie.expando]:ie.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){ie.isArray(t)?t=t.concat(ie.map(t,ie.camelCase)):t in r?t=[t]:(t=ie.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;for(;i--;)delete r[t[i]];if(n?!l(r):!ie.isEmptyObject(r))return}(n||(delete a[s].data,l(a[s])))&&(o?ie.cleanData([e],!0):ne.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}function f(){return!0}function p(){return!1}function h(){try{return he.activeElement}catch(e){}}function m(e){var t=Fe.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function g(e,t){var n,r,i=0,o=typeof e.getElementsByTagName!==Ce?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==Ce?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||ie.nodeName(r,t)?o.push(r):ie.merge(o,g(r,t));return void 0===t||t&&ie.nodeName(e,t)?ie.merge([e],o):o}function v(e){je.test(e.type)&&(e.defaultChecked=e.checked)}function y(e,t){return ie.nodeName(e,"table")&&ie.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function b(e){return e.type=(null!==ie.find.attr(e,"type"))+"/"+e.type,e}function x(e){var t=Ve.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function w(e,t){for(var n,r=0;null!=(n=e[r]);r++)ie._data(n,"globalEval",!t||ie._data(t[r],"globalEval"))}function T(e,t){if(1===t.nodeType&&ie.hasData(e)){var n,r,i,o=ie._data(e),a=ie._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)ie.event.add(t,n,s[n][r])}a.data&&(a.data=ie.extend({},a.data))}}function C(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!ne.noCloneEvent&&t[ie.expando]){i=ie._data(t);for(r in i.events)ie.removeEvent(t,r,i.handle);t.removeAttribute(ie.expando)}"script"===n&&t.text!==e.text?(b(t).text=e.text,x(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),ne.html5Clone&&e.innerHTML&&!ie.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&je.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}function N(t,n){var r,i=ie(n.createElement(t)).appendTo(n.body),o=e.getDefaultComputedStyle&&(r=e.getDefaultComputedStyle(i[0]))?r.display:ie.css(i[0],"display");return i.detach(),o}function E(e){var t=he,n=Ze[e];return n||(n=N(e,t),"none"!==n&&n||(Ke=(Ke||ie("