From fcc4b5a27722f8c349d98ee899ee0a6fb1944cf8 Mon Sep 17 00:00:00 2001 From: superRaytin Date: Sun, 18 Jan 2015 18:21:37 +0800 Subject: [PATCH 1/4] Optimize the object type detection method. --- dist/pagination.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dist/pagination.js b/dist/pagination.js index 3a9b55d..cb00383 100644 --- a/dist/pagination.js +++ b/dist/pagination.js @@ -1,5 +1,5 @@ /* - * pagination.js 2.0.3 + * pagination.js 2.0.5 * A jQuery plugin to provide simple yet fully customisable pagination. * https://github.com/superRaytin/paginationjs * @@ -236,7 +236,7 @@ } else{ if(attributes.showFirstOnEllipsisShow){ - html += '
  • 1<\/a><\/li>'; + html += '
  • 1<\/a><\/li>'; } html += '
  • '+ ellipsisText +'<\/a><\/li>'; @@ -261,7 +261,7 @@ html += '
  • '+ ellipsisText +'<\/a><\/li>'; if(attributes.showLastOnEllipsisShow){ - html += '
  • '+ totalPage +'<\/a><\/li>'; + html += '
  • '+ totalPage +'<\/a><\/li>'; } } } @@ -1070,9 +1070,13 @@ } // Object type detection + function getObjectType(object) { + var tmp; + return ( (tmp = typeof(object)) == "object" ? object == null && "null" || Object.prototype.toString.call(object).slice(8, -1) : tmp ).toLowerCase(); + } $.each(['Object', 'Array'], function(index, name){ Helpers['is' + name] = function(object){ - return toString.call(object) === '[object ' + name + ']'; + return getObjectType(object) === name.toLowerCase(); }; }); From fd0719f329a02103339c484f756c4c786aa45136 Mon Sep 17 00:00:00 2001 From: superRaytin Date: Sun, 18 Jan 2015 18:23:03 +0800 Subject: [PATCH 2/4] Css files moved to 'dist' directory. --- dist/pagination.css | 329 +++++++++++++++++++++++++ {examples/css => dist}/pagination.less | 106 ++++++-- examples/css/pagination.css | 297 ---------------------- 3 files changed, 409 insertions(+), 323 deletions(-) create mode 100644 dist/pagination.css rename {examples/css => dist}/pagination.less (84%) delete mode 100644 examples/css/pagination.css diff --git a/dist/pagination.css b/dist/pagination.css new file mode 100644 index 0000000..51d7d76 --- /dev/null +++ b/dist/pagination.css @@ -0,0 +1,329 @@ +.paginationjs { + line-height: 1.6; + font-family: "Marmelad", "Lucida Grande", "Arial", "Hiragino Sans GB", Georgia, sans-serif; + font-size: 14px; + box-sizing: initial; +} +.paginationjs:after { + display: table; + content: " "; + clear: both; +} +.paginationjs .paginationjs-pages { + float: left; +} +.paginationjs .paginationjs-pages ul { + float: left; + margin: 0; + padding: 0; +} +.paginationjs .paginationjs-pages li { + float: left; + border: 1px solid #aaaaaa; + border-right: none; + list-style: none; +} +.paginationjs .paginationjs-pages li > a { + min-width: 30px; + height: 28px; + line-height: 28px; + display: block; + background: #fff; + font-size: 14px; + color: #333; + text-decoration: none; + text-align: center; +} +.paginationjs .paginationjs-pages li > a:hover { + background: #eee; +} +.paginationjs .paginationjs-pages li.active { + border: none; +} +.paginationjs .paginationjs-pages li.active > a { + height: 30px; + line-height: 30px; + background: #aaaaaa; + color: #fff; +} +.paginationjs .paginationjs-pages li.disabled > a { + opacity: .3; +} +.paginationjs .paginationjs-pages li.disabled > a:hover { + background: none; +} +.paginationjs .paginationjs-pages li:first-child { + border-radius: 3px 0 0 3px; +} +.paginationjs .paginationjs-pages li:first-child > a { + border-radius: 3px 0 0 3px; +} +.paginationjs .paginationjs-pages li:last-child { + border-right: 1px solid #aaaaaa; + border-radius: 0 3px 3px 0; +} +.paginationjs .paginationjs-pages li:last-child > a { + border-radius: 0 3px 3px 0; +} +.paginationjs .paginationjs-go-input { + float: left; + margin-left: 10px; + font-size: 14px; +} +.paginationjs .paginationjs-go-input > input[type="text"] { + width: 30px; + height: 28px; + background: #fff; + border-radius: 3px; + border: 1px solid #aaaaaa; + padding: 0; + font-size: 14px; + text-align: center; + vertical-align: baseline; + outline: none; + box-shadow: none; + box-sizing: initial; +} +.paginationjs .paginationjs-go-button { + float: left; + margin-left: 10px; + font-size: 14px; +} +.paginationjs .paginationjs-go-button > input[type="button"] { + min-width: 40px; + height: 30px; + line-height: 28px; + background: #fff; + border-radius: 3px; + border: 1px solid #aaaaaa; + text-align: center; + padding: 0 8px; + font-size: 14px; + vertical-align: baseline; + outline: none; + box-shadow: none; + color: #333; + cursor: pointer; +} +.paginationjs .paginationjs-go-button > input[type="button"]:hover { + background-color: #f8f8f8; +} +.paginationjs .paginationjs-nav { + float: left; + height: 30px; + line-height: 30px; + margin-left: 10px; + font-size: 14px; +} +.paginationjs.paginationjs-small { + font-size: 12px; +} +.paginationjs.paginationjs-small .paginationjs-pages li > a { + min-width: 26px; + height: 24px; + line-height: 24px; + font-size: 12px; +} +.paginationjs.paginationjs-small .paginationjs-pages li.active > a { + height: 26px; + line-height: 26px; +} +.paginationjs.paginationjs-small .paginationjs-go-input { + font-size: 12px; +} +.paginationjs.paginationjs-small .paginationjs-go-input > input[type="text"] { + width: 26px; + height: 24px; + font-size: 12px; +} +.paginationjs.paginationjs-small .paginationjs-go-button { + font-size: 12px; +} +.paginationjs.paginationjs-small .paginationjs-go-button > input[type="button"] { + min-width: 30px; + height: 26px; + line-height: 24px; + padding: 0 6px; + font-size: 12px; +} +.paginationjs.paginationjs-small .paginationjs-nav { + height: 26px; + line-height: 26px; + font-size: 12px; +} +.paginationjs.paginationjs-big { + font-size: 16px; +} +.paginationjs.paginationjs-big .paginationjs-pages li > a { + min-width: 36px; + height: 34px; + line-height: 34px; + font-size: 16px; +} +.paginationjs.paginationjs-big .paginationjs-pages li.active > a { + height: 36px; + line-height: 36px; +} +.paginationjs.paginationjs-big .paginationjs-go-input { + font-size: 16px; +} +.paginationjs.paginationjs-big .paginationjs-go-input > input[type="text"] { + width: 36px; + height: 34px; + font-size: 16px; +} +.paginationjs.paginationjs-big .paginationjs-go-button { + font-size: 16px; +} +.paginationjs.paginationjs-big .paginationjs-go-button > input[type="button"] { + min-width: 50px; + height: 36px; + line-height: 34px; + padding: 0 12px; + font-size: 16px; +} +.paginationjs.paginationjs-big .paginationjs-nav { + height: 36px; + line-height: 36px; + font-size: 16px; +} +.paginationjs.paginationjs-theme-blue .paginationjs-pages li { + border-color: #289de9; +} +.paginationjs.paginationjs-theme-blue .paginationjs-pages li > a { + color: #289de9; +} +.paginationjs.paginationjs-theme-blue .paginationjs-pages li > a:hover { + background: #e9f4fc; +} +.paginationjs.paginationjs-theme-blue .paginationjs-pages li.active > a { + background: #289de9; + color: #fff; +} +.paginationjs.paginationjs-theme-blue .paginationjs-pages li.disabled > a:hover { + background: none; +} +.paginationjs.paginationjs-theme-blue .paginationjs-go-input > input[type="text"] { + border-color: #289de9; +} +.paginationjs.paginationjs-theme-blue .paginationjs-go-button > input[type="button"] { + background: #289de9; + border-color: #289de9; + color: #fff; +} +.paginationjs.paginationjs-theme-blue .paginationjs-go-button > input[type="button"]:hover { + background-color: #3ca5ea; +} +.paginationjs.paginationjs-theme-green .paginationjs-pages li { + border-color: #449d44; +} +.paginationjs.paginationjs-theme-green .paginationjs-pages li > a { + color: #449d44; +} +.paginationjs.paginationjs-theme-green .paginationjs-pages li > a:hover { + background: #ebf4eb; +} +.paginationjs.paginationjs-theme-green .paginationjs-pages li.active > a { + background: #449d44; + color: #fff; +} +.paginationjs.paginationjs-theme-green .paginationjs-pages li.disabled > a:hover { + background: none; +} +.paginationjs.paginationjs-theme-green .paginationjs-go-input > input[type="text"] { + border-color: #449d44; +} +.paginationjs.paginationjs-theme-green .paginationjs-go-button > input[type="button"] { + background: #449d44; + border-color: #449d44; + color: #fff; +} +.paginationjs.paginationjs-theme-green .paginationjs-go-button > input[type="button"]:hover { + background-color: #55a555; +} +.paginationjs.paginationjs-theme-yellow .paginationjs-pages li { + border-color: #ec971f; +} +.paginationjs.paginationjs-theme-yellow .paginationjs-pages li > a { + color: #ec971f; +} +.paginationjs.paginationjs-theme-yellow .paginationjs-pages li > a:hover { + background: #fdf5e9; +} +.paginationjs.paginationjs-theme-yellow .paginationjs-pages li.active > a { + background: #ec971f; + color: #fff; +} +.paginationjs.paginationjs-theme-yellow .paginationjs-pages li.disabled > a:hover { + background: none; +} +.paginationjs.paginationjs-theme-yellow .paginationjs-go-input > input[type="text"] { + border-color: #ec971f; +} +.paginationjs.paginationjs-theme-yellow .paginationjs-go-button > input[type="button"] { + background: #ec971f; + border-color: #ec971f; + color: #fff; +} +.paginationjs.paginationjs-theme-yellow .paginationjs-go-button > input[type="button"]:hover { + background-color: #eea135; +} +.paginationjs.paginationjs-theme-red .paginationjs-pages li { + border-color: #c9302c; +} +.paginationjs.paginationjs-theme-red .paginationjs-pages li > a { + color: #c9302c; +} +.paginationjs.paginationjs-theme-red .paginationjs-pages li > a:hover { + background: #faeaea; +} +.paginationjs.paginationjs-theme-red .paginationjs-pages li.active > a { + background: #c9302c; + color: #fff; +} +.paginationjs.paginationjs-theme-red .paginationjs-pages li.disabled > a:hover { + background: none; +} +.paginationjs.paginationjs-theme-red .paginationjs-go-input > input[type="text"] { + border-color: #c9302c; +} +.paginationjs.paginationjs-theme-red .paginationjs-go-button > input[type="button"] { + background: #c9302c; + border-color: #c9302c; + color: #fff; +} +.paginationjs.paginationjs-theme-red .paginationjs-go-button > input[type="button"]:hover { + background-color: #ce4541; +} +/* Hacks for IE 6~9 */ +.paginationjs .paginationjs-pages li.paginationjs-next { + *border-right: 1px solid #aaaaaa; + border-right: 1px solid #aaa\0; +} +.paginationjs .paginationjs-go-input { + *margin-left: 5px; + margin-left: 5px\0; +} +.paginationjs .paginationjs-go-input > input[type="text"] { + *line-height: 28px; + line-height: 28px\0; + *vertical-align: middle; + vertical-align: middle\0; +} +.paginationjs .paginationjs-go-button { + *margin-left: 5px; + margin-left: 5px\0; +} +.paginationjs .paginationjs-go-button > input[type="button"] { + *vertical-align: middle; + vertical-align: middle\0; +} +.paginationjs.paginationjs-big .paginationjs-pages li > a { + line-height: 36px\0; +} +.paginationjs.paginationjs-big .paginationjs-go-input > input[type="text"] { + *height: 35px; + height: 36px\0; + *line-height: 36px; + line-height: 36px\0; +} diff --git a/examples/css/pagination.less b/dist/pagination.less similarity index 84% rename from examples/css/pagination.less rename to dist/pagination.less index 95b9b7b..48023c1 100644 --- a/examples/css/pagination.less +++ b/dist/pagination.less @@ -71,9 +71,9 @@ @B_navHeight: @B_activeHeight; -.paginationjs:not(.custom-paginationjs){ +.paginationjs{ line-height: 1.6; - font-family: "Marmelad", "Lucida Grande", 'Arial', "Hiragino Sans GB", Georgia, sans-serif; + font-family: "Marmelad", "Lucida Grande", "Arial", "Hiragino Sans GB", Georgia, sans-serif; font-size: @N_fontSize; box-sizing: initial; &:after{ @@ -192,17 +192,19 @@ &.paginationjs-small{ font-size: @S_fontSize; - li{ - > a{ - min-width: @S_minWidth; - height: @S_height; - line-height: @S_lineHeight; - font-size: @S_fontSize; - } - &.active{ + .paginationjs-pages{ + li{ > a{ - height: @S_activeHeight; - line-height: @S_activeHeight; + min-width: @S_minWidth; + height: @S_height; + line-height: @S_lineHeight; + font-size: @S_fontSize; + } + &.active{ + > a{ + height: @S_activeHeight; + line-height: @S_activeHeight; + } } } } @@ -232,17 +234,19 @@ } &.paginationjs-big{ font-size: @B_fontSize; - li{ - > a{ - min-width: @B_minWidth; - height: @B_height; - line-height: @B_lineHeight; - font-size: @B_fontSize; - } - &.active{ + .paginationjs-pages{ + li{ > a{ - height: @B_activeHeight; - line-height: @B_activeHeight; + min-width: @B_minWidth; + height: @B_height; + line-height: @B_lineHeight; + font-size: @B_fontSize; + } + &.active{ + > a{ + height: @B_activeHeight; + line-height: @B_activeHeight; + } } } } @@ -272,7 +276,7 @@ } } -.paginationjs:not(.custom-paginationjs){ +.paginationjs{ &.paginationjs-theme-blue{ .paginationjs-pages{ li{ @@ -312,7 +316,7 @@ } } -.paginationjs:not(.custom-paginationjs){ +.paginationjs{ &.paginationjs-theme-green{ .paginationjs-pages{ li{ @@ -352,7 +356,7 @@ } } -.paginationjs:not(.custom-paginationjs){ +.paginationjs{ &.paginationjs-theme-yellow{ .paginationjs-pages{ li{ @@ -392,7 +396,7 @@ } } -.paginationjs:not(.custom-paginationjs){ +.paginationjs{ &.paginationjs-theme-red{ .paginationjs-pages{ li{ @@ -431,3 +435,53 @@ } } } + +/* Hacks for IE 6~9 */ +.paginationjs{ + .paginationjs-pages{ + li{ + > a{ + + } + &.paginationjs-next{ + *border-right: 1px solid @borderColor; + border-right: 1px solid #aaa\0; + } + } + } + .paginationjs-go-input{ + *margin-left: 5px; + margin-left: 5px\0; + > input[type="text"]{ + *line-height: @N_inputHeight; + line-height: 28px\0; + *vertical-align: middle; + vertical-align: middle\0; + } + } + .paginationjs-go-button{ + *margin-left: 5px; + margin-left: 5px\0; + > input[type="button"]{ + *vertical-align: middle; + vertical-align: middle\0; + } + } + &.paginationjs-big{ + .paginationjs-pages{ + li{ + > a{ + line-height: 36px\0; + } + } + } + .paginationjs-go-input{ + > input[type="text"]{ + *height: 35px; + height: 36px\0; + *line-height: 36px; + line-height: 36px\0; + } + } + } +} diff --git a/examples/css/pagination.css b/examples/css/pagination.css deleted file mode 100644 index 4acc72e..0000000 --- a/examples/css/pagination.css +++ /dev/null @@ -1,297 +0,0 @@ -.paginationjs:not(.custom-paginationjs) { - line-height: 1.6; - font-family: "Marmelad", "Lucida Grande", 'Arial', "Hiragino Sans GB", Georgia, sans-serif; - font-size: 14px; - box-sizing: initial; -} -.paginationjs:not(.custom-paginationjs):after { - display: table; - content: " "; - clear: both; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages { - float: left; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages ul { - float: left; - margin: 0; - padding: 0; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages li { - float: left; - border: 1px solid #aaaaaa; - border-right: none; - list-style: none; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages li > a { - min-width: 30px; - height: 28px; - line-height: 28px; - display: block; - background: #fff; - font-size: 14px; - color: #333; - text-decoration: none; - text-align: center; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages li > a:hover { - background: #eee; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.active { - border: none; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.active > a { - height: 30px; - line-height: 30px; - background: #aaaaaa; - color: #fff; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.disabled > a { - opacity: .3; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.disabled > a:hover { - background: none; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:first-child { - border-radius: 3px 0 0 3px; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:first-child > a { - border-radius: 3px 0 0 3px; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:last-child { - border-right: 1px solid #aaaaaa; - border-radius: 0 3px 3px 0; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:last-child > a { - border-radius: 0 3px 3px 0; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-go-input { - float: left; - margin-left: 10px; - font-size: 14px; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-go-input > input[type="text"] { - width: 30px; - height: 28px; - background: #fff; - border-radius: 3px; - border: 1px solid #aaaaaa; - padding: 0; - font-size: 14px; - text-align: center; - vertical-align: baseline; - outline: none; - box-shadow: none; - box-sizing: initial; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-go-button { - float: left; - margin-left: 10px; - font-size: 14px; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-go-button > input[type="button"] { - min-width: 40px; - height: 30px; - line-height: 28px; - background: #fff; - border-radius: 3px; - border: 1px solid #aaaaaa; - text-align: center; - padding: 0 8px; - font-size: 14px; - vertical-align: baseline; - outline: none; - box-shadow: none; - color: #333; - cursor: pointer; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-go-button > input[type="button"]:hover { - background-color: #f8f8f8; -} -.paginationjs:not(.custom-paginationjs) .paginationjs-nav { - float: left; - height: 30px; - line-height: 30px; - margin-left: 10px; - font-size: 14px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-small { - font-size: 12px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-small li > a { - min-width: 26px; - height: 24px; - line-height: 24px; - font-size: 12px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-small li.active > a { - height: 26px; - line-height: 26px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-input { - font-size: 12px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-input > input[type="text"] { - width: 26px; - height: 24px; - font-size: 12px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-button { - font-size: 12px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-button > input[type="button"] { - min-width: 30px; - height: 26px; - line-height: 24px; - padding: 0 6px; - font-size: 12px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-nav { - height: 26px; - line-height: 26px; - font-size: 12px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-big { - font-size: 16px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-big li > a { - min-width: 36px; - height: 34px; - line-height: 34px; - font-size: 16px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-big li.active > a { - height: 36px; - line-height: 36px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-input { - font-size: 16px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-input > input[type="text"] { - width: 36px; - height: 34px; - font-size: 16px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-button { - font-size: 16px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-button > input[type="button"] { - min-width: 50px; - height: 36px; - line-height: 34px; - padding: 0 12px; - font-size: 16px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-nav { - height: 36px; - line-height: 36px; - font-size: 16px; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li { - border-color: #289de9; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li > a { - color: #289de9; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li > a:hover { - background: #e9f4fc; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li.active > a { - background: #289de9; - color: #fff; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li.disabled > a:hover { - background: none; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-input > input[type="text"] { - border-color: #289de9; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-button > input[type="button"] { - background: #289de9; - border-color: #289de9; - color: #fff; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-button > input[type="button"]:hover { - background-color: #3ca5ea; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li { - border-color: #449d44; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li > a { - color: #449d44; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li > a:hover { - background: #ebf4eb; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li.active > a { - background: #449d44; - color: #fff; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li.disabled > a:hover { - background: none; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-input > input[type="text"] { - border-color: #449d44; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-button > input[type="button"] { - background: #449d44; - border-color: #449d44; - color: #fff; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-button > input[type="button"]:hover { - background-color: #55a555; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li { - border-color: #ec971f; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li > a { - color: #ec971f; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li > a:hover { - background: #fdf5e9; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li.active > a { - background: #ec971f; - color: #fff; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li.disabled > a:hover { - background: none; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-input > input[type="text"] { - border-color: #ec971f; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-button > input[type="button"] { - background: #ec971f; - border-color: #ec971f; - color: #fff; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-button > input[type="button"]:hover { - background-color: #eea135; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li { - border-color: #c9302c; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li > a { - color: #c9302c; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li > a:hover { - background: #faeaea; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li.active > a { - background: #c9302c; - color: #fff; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li.disabled > a:hover { - background: none; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-input > input[type="text"] { - border-color: #c9302c; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-button > input[type="button"] { - background: #c9302c; - border-color: #c9302c; - color: #fff; -} -.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-button > input[type="button"]:hover { - background-color: #ce4541; -} From 98760fd764e54e0e4a9f072710d6b2a1241dcb7b Mon Sep 17 00:00:00 2001 From: superRaytin Date: Sun, 18 Jan 2015 18:23:54 +0800 Subject: [PATCH 3/4] Add special className for the first & last button. --- dist/pagination-with-styles.js | 14 +++++++++----- dist/pagination-with-styles.min.js | 2 +- dist/pagination.min.js | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/dist/pagination-with-styles.js b/dist/pagination-with-styles.js index 73b9c64..033530b 100644 --- a/dist/pagination-with-styles.js +++ b/dist/pagination-with-styles.js @@ -1,5 +1,5 @@ /* - * pagination.js 2.0.3 + * pagination.js 2.0.5 * A jQuery plugin to provide simple yet fully customisable pagination. * https://github.com/superRaytin/paginationjs * @@ -241,7 +241,7 @@ } else{ if(attributes.showFirstOnEllipsisShow){ - html += '
  • 1<\/a><\/li>'; + html += '
  • 1<\/a><\/li>'; } html += '
  • '+ ellipsisText +'<\/a><\/li>'; @@ -266,7 +266,7 @@ html += '
  • '+ ellipsisText +'<\/a><\/li>'; if(attributes.showLastOnEllipsisShow){ - html += '
  • '+ totalPage +'<\/a><\/li>'; + html += '
  • '+ totalPage +'<\/a><\/li>'; } } } @@ -1075,9 +1075,13 @@ } // Object type detection + function getObjectType(object) { + var tmp; + return ( (tmp = typeof(object)) == "object" ? object == null && "null" || Object.prototype.toString.call(object).slice(8, -1) : tmp ).toLowerCase(); + } $.each(['Object', 'Array'], function(index, name){ Helpers['is' + name] = function(object){ - return toString.call(object) === '[object ' + name + ']'; + return getObjectType(object) === name.toLowerCase(); }; }); @@ -1087,7 +1091,7 @@ if(styleElement.length) return; - var cssText = '.paginationjs:not(.custom-paginationjs){line-height: 1.6; font-family: "Marmelad", "Lucida Grande", "Arial", "Hiragino Sans GB", Georgia, sans-serif; font-size: 14px; box-sizing: initial;}.paginationjs:not(.custom-paginationjs):after{display: table; content: " "; clear: both;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages{float: left;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages ul{float: left; margin: 0; padding: 0;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li{float: left; border: 1px solid #aaaaaa; border-right: none; list-style: none;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li > a{min-width: 30px; height: 28px; line-height: 28px; display: block; background: #fff; font-size: 14px; color: #333; text-decoration: none; text-align: center;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li > a:hover{background: #eee;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.active{border: none;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.active > a{height: 30px; line-height: 30px; background: #aaaaaa; color: #fff;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.disabled > a{opacity: .3;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:first-child{border-radius: 3px 0 0 3px;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:first-child > a{border-radius: 3px 0 0 3px;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:last-child{border-right: 1px solid #aaaaaa; border-radius: 0 3px 3px 0;}.paginationjs:not(.custom-paginationjs) .paginationjs-pages li:last-child > a{border-radius: 0 3px 3px 0;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-input{float: left; margin-left: 10px; font-size: 14px;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-input > input[type="text"]{width: 30px; height: 28px; background: #fff; border-radius: 3px; border: 1px solid #aaaaaa; padding: 0; font-size: 14px; text-align: center; vertical-align: baseline; outline: none; box-shadow: none; box-sizing: initial;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-button{float: left; margin-left: 10px; font-size: 14px;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-button > input[type="button"]{min-width: 40px; height: 30px; line-height: 28px; background: #fff; border-radius: 3px; border: 1px solid #aaaaaa; text-align: center; padding: 0 8px; font-size: 14px; vertical-align: baseline; outline: none; box-shadow: none; color: #333; cursor: pointer;}.paginationjs:not(.custom-paginationjs) .paginationjs-go-button > input[type="button"]:hover{background-color: #f8f8f8;}.paginationjs:not(.custom-paginationjs) .paginationjs-nav{float: left; height: 30px; line-height: 30px; margin-left: 10px; font-size: 14px;}.paginationjs:not(.custom-paginationjs).paginationjs-small{font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small li > a{min-width: 26px; height: 24px; line-height: 24px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small li.active > a{height: 26px; line-height: 26px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-input{font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-input > input[type="text"]{width: 26px; height: 24px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-button{font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-go-button > input[type="button"]{min-width: 30px; height: 26px; line-height: 24px; padding: 0 6px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-small .paginationjs-nav{height: 26px; line-height: 26px; font-size: 12px;}.paginationjs:not(.custom-paginationjs).paginationjs-big{font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big li > a{min-width: 36px; height: 34px; line-height: 34px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big li.active > a{height: 36px; line-height: 36px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-input{font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-input > input[type="text"]{width: 36px; height: 34px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-button{font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-go-button > input[type="button"]{min-width: 50px; height: 36px; line-height: 34px; padding: 0 12px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-big .paginationjs-nav{height: 36px; line-height: 36px; font-size: 16px;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li{border-color: #289de9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li > a{color: #289de9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li > a:hover{background: #e9f4fc;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li.active > a{background: #289de9; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-input > input[type="text"]{border-color: #289de9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-button > input[type="button"]{background: #289de9; border-color: #289de9; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-blue .paginationjs-go-button > input[type="button"]:hover{background-color: #3ca5ea;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li{border-color: #449d44;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li > a{color: #449d44;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li > a:hover{background: #ebf4eb;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li.active > a{background: #449d44; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-input > input[type="text"]{border-color: #449d44;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-button > input[type="button"]{background: #449d44; border-color: #449d44; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-green .paginationjs-go-button > input[type="button"]:hover{background-color: #55a555;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li{border-color: #ec971f;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li > a{color: #ec971f;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li > a:hover{background: #fdf5e9;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li.active > a{background: #ec971f; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-input > input[type="text"]{border-color: #ec971f;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-button > input[type="button"]{background: #ec971f; border-color: #ec971f; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-yellow .paginationjs-go-button > input[type="button"]:hover{background-color: #eea135;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li{border-color: #c9302c;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li > a{color: #c9302c;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li > a:hover{background: #faeaea;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li.active > a{background: #c9302c; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-pages li.disabled > a:hover{background: none;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-input > input[type="text"]{border-color: #c9302c;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-button > input[type="button"]{background: #c9302c; border-color: #c9302c; color: #fff;}.paginationjs:not(.custom-paginationjs).paginationjs-theme-red .paginationjs-go-button > input[type="button"]:hover{background-color: #ce4541;}'; + var cssText = '.paginationjs{line-height:1.6;font-family:"Marmelad","Lucida Grande","Arial","Hiragino Sans GB",Georgia,sans-serif;font-size:14px;box-sizing:initial}.paginationjs:after{display:table;content:" ";clear:both}.paginationjs .paginationjs-pages{float:left}.paginationjs .paginationjs-pages ul{float:left;margin:0;padding:0}.paginationjs .paginationjs-pages li{float:left;border:1px solid #aaa;border-right:0;list-style:none}.paginationjs .paginationjs-pages li>a{min-width:30px;height:28px;line-height:28px;display:block;background:#fff;font-size:14px;color:#333;text-decoration:none;text-align:center}.paginationjs .paginationjs-pages li>a:hover{background:#eee}.paginationjs .paginationjs-pages li.active{border:0}.paginationjs .paginationjs-pages li.active>a{height:30px;line-height:30px;background:#aaa;color:#fff}.paginationjs .paginationjs-pages li.disabled>a{opacity:.3}.paginationjs .paginationjs-pages li.disabled>a:hover{background:0}.paginationjs .paginationjs-pages li:first-child{border-radius:3px 0 0 3px}.paginationjs .paginationjs-pages li:first-child>a{border-radius:3px 0 0 3px}.paginationjs .paginationjs-pages li:last-child{border-right:1px solid #aaa;border-radius:0 3px 3px 0}.paginationjs .paginationjs-pages li:last-child>a{border-radius:0 3px 3px 0}.paginationjs .paginationjs-go-input{float:left;margin-left:10px;font-size:14px}.paginationjs .paginationjs-go-input>input[type="text"]{width:30px;height:28px;background:#fff;border-radius:3px;border:1px solid #aaa;padding:0;font-size:14px;text-align:center;vertical-align:baseline;outline:0;box-shadow:none;box-sizing:initial}.paginationjs .paginationjs-go-button{float:left;margin-left:10px;font-size:14px}.paginationjs .paginationjs-go-button>input[type="button"]{min-width:40px;height:30px;line-height:28px;background:#fff;border-radius:3px;border:1px solid #aaa;text-align:center;padding:0 8px;font-size:14px;vertical-align:baseline;outline:0;box-shadow:none;color:#333;cursor:pointer}.paginationjs .paginationjs-go-button>input[type="button"]:hover{background-color:#f8f8f8}.paginationjs .paginationjs-nav{float:left;height:30px;line-height:30px;margin-left:10px;font-size:14px}.paginationjs.paginationjs-small{font-size:12px}.paginationjs.paginationjs-small .paginationjs-pages li>a{min-width:26px;height:24px;line-height:24px;font-size:12px}.paginationjs.paginationjs-small .paginationjs-pages li.active>a{height:26px;line-height:26px}.paginationjs.paginationjs-small .paginationjs-go-input{font-size:12px}.paginationjs.paginationjs-small .paginationjs-go-input>input[type="text"]{width:26px;height:24px;font-size:12px}.paginationjs.paginationjs-small .paginationjs-go-button{font-size:12px}.paginationjs.paginationjs-small .paginationjs-go-button>input[type="button"]{min-width:30px;height:26px;line-height:24px;padding:0 6px;font-size:12px}.paginationjs.paginationjs-small .paginationjs-nav{height:26px;line-height:26px;font-size:12px}.paginationjs.paginationjs-big{font-size:16px}.paginationjs.paginationjs-big .paginationjs-pages li>a{min-width:36px;height:34px;line-height:34px;font-size:16px}.paginationjs.paginationjs-big .paginationjs-pages li.active>a{height:36px;line-height:36px}.paginationjs.paginationjs-big .paginationjs-go-input{font-size:16px}.paginationjs.paginationjs-big .paginationjs-go-input>input[type="text"]{width:36px;height:34px;font-size:16px}.paginationjs.paginationjs-big .paginationjs-go-button{font-size:16px}.paginationjs.paginationjs-big .paginationjs-go-button>input[type="button"]{min-width:50px;height:36px;line-height:34px;padding:0 12px;font-size:16px}.paginationjs.paginationjs-big .paginationjs-nav{height:36px;line-height:36px;font-size:16px}.paginationjs.paginationjs-theme-blue .paginationjs-pages li{border-color:#289de9}.paginationjs.paginationjs-theme-blue .paginationjs-pages li>a{color:#289de9}.paginationjs.paginationjs-theme-blue .paginationjs-pages li>a:hover{background:#e9f4fc}.paginationjs.paginationjs-theme-blue .paginationjs-pages li.active>a{background:#289de9;color:#fff}.paginationjs.paginationjs-theme-blue .paginationjs-pages li.disabled>a:hover{background:0}.paginationjs.paginationjs-theme-blue .paginationjs-go-input>input[type="text"]{border-color:#289de9}.paginationjs.paginationjs-theme-blue .paginationjs-go-button>input[type="button"]{background:#289de9;border-color:#289de9;color:#fff}.paginationjs.paginationjs-theme-blue .paginationjs-go-button>input[type="button"]:hover{background-color:#3ca5ea}.paginationjs.paginationjs-theme-green .paginationjs-pages li{border-color:#449d44}.paginationjs.paginationjs-theme-green .paginationjs-pages li>a{color:#449d44}.paginationjs.paginationjs-theme-green .paginationjs-pages li>a:hover{background:#ebf4eb}.paginationjs.paginationjs-theme-green .paginationjs-pages li.active>a{background:#449d44;color:#fff}.paginationjs.paginationjs-theme-green .paginationjs-pages li.disabled>a:hover{background:0}.paginationjs.paginationjs-theme-green .paginationjs-go-input>input[type="text"]{border-color:#449d44}.paginationjs.paginationjs-theme-green .paginationjs-go-button>input[type="button"]{background:#449d44;border-color:#449d44;color:#fff}.paginationjs.paginationjs-theme-green .paginationjs-go-button>input[type="button"]:hover{background-color:#55a555}.paginationjs.paginationjs-theme-yellow .paginationjs-pages li{border-color:#ec971f}.paginationjs.paginationjs-theme-yellow .paginationjs-pages li>a{color:#ec971f}.paginationjs.paginationjs-theme-yellow .paginationjs-pages li>a:hover{background:#fdf5e9}.paginationjs.paginationjs-theme-yellow .paginationjs-pages li.active>a{background:#ec971f;color:#fff}.paginationjs.paginationjs-theme-yellow .paginationjs-pages li.disabled>a:hover{background:0}.paginationjs.paginationjs-theme-yellow .paginationjs-go-input>input[type="text"]{border-color:#ec971f}.paginationjs.paginationjs-theme-yellow .paginationjs-go-button>input[type="button"]{background:#ec971f;border-color:#ec971f;color:#fff}.paginationjs.paginationjs-theme-yellow .paginationjs-go-button>input[type="button"]:hover{background-color:#eea135}.paginationjs.paginationjs-theme-red .paginationjs-pages li{border-color:#c9302c}.paginationjs.paginationjs-theme-red .paginationjs-pages li>a{color:#c9302c}.paginationjs.paginationjs-theme-red .paginationjs-pages li>a:hover{background:#faeaea}.paginationjs.paginationjs-theme-red .paginationjs-pages li.active>a{background:#c9302c;color:#fff}.paginationjs.paginationjs-theme-red .paginationjs-pages li.disabled>a:hover{background:0}.paginationjs.paginationjs-theme-red .paginationjs-go-input>input[type="text"]{border-color:#c9302c}.paginationjs.paginationjs-theme-red .paginationjs-go-button>input[type="button"]{background:#c9302c;border-color:#c9302c;color:#fff}.paginationjs.paginationjs-theme-red .paginationjs-go-button>input[type="button"]:hover{background-color:#ce4541}.paginationjs .paginationjs-pages li.paginationjs-next{*border-right:1px solid #aaa;border-right:1px solid #aaa\\0}.paginationjs .paginationjs-go-input{*margin-left:5px;margin-left:5px\\0}.paginationjs .paginationjs-go-input>input[type="text"]{*line-height:28px;line-height:28px\\0;*vertical-align:middle;vertical-align:middle\\0}.paginationjs .paginationjs-go-button{*margin-left:5px;margin-left:5px\\\0}.paginationjs .paginationjs-go-button>input[type="button"]{*vertical-align:middle;vertical-align:middle\\0}.paginationjs.paginationjs-big .paginationjs-pages li>a{line-height:36px\\0}.paginationjs.paginationjs-big .paginationjs-go-input>input[type="text"]{*height:35px;height:36px\\0;*line-height:36px;line-height:36px\\0}'; $('head').append('")}}"undefined"==typeof b&&c("Pagination requires jQuery.");var f="pagination",g="addHook",h="__pagination-";b.fn.pagination&&(f="pagination2"),b.fn[f]=function(f){if("undefined"==typeof f)return this;var g=b(this),j={initialize:function(){var a=this;if(g.data("pagination")||g.data("pagination",{}),a.callHook("beforeInit")!==!1){g.data("pagination").initialized&&b(".paginationjs",g).remove(),l.inlineStyle===!0&&e();var c=a.model={pageRange:l.pageRange,pageSize:l.pageSize};a.parseDataSource(l.dataSource,function(b){if(a.sync=i.isArray(b),a.sync&&(c.totalNumber=l.totalNumber=b.length),c.totalPage=a.getTotalPage(),!(l.hideWhenLessThanOnePage&&c.totalPage<=1)){var d=a.render(!0);l.className&&d.addClass(l.className),c.el=d,g["bottom"===l.position?"append":"prepend"](d),a.observer(),g.data("pagination").initialized=!0,a.callHook("afterInit",d)}})}},render:function(a){var c=this,d=c.model,e=d.el||b('
    '),f=a!==!0;c.callHook("beforeRender",f);var g=d.pageNumber||l.pageNumber,h=l.pageRange,i=d.totalPage,j=g-h,k=g+h;return k>i&&(k=i,j=i-2*h,j=1>j?1:j),1>=j&&(j=1,k=Math.min(2*h+1,i)),e.html(c.createTemplate({currentPage:g,pageRange:h,totalPage:i,rangeStart:j,rangeEnd:k})),c.callHook("afterRender",f),e},createTemplate:function(a){var c,d,e=this,f=a.currentPage,g=a.totalPage,h=a.rangeStart,i=a.rangeEnd,j=l.totalNumber,k=l.showPrevious,m=l.showNext,n=l.showPageNumbers,o=l.showNavigator,p=l.showGoInput,q=l.showGoButton,r=l.pageLink,s=l.prevText,t=l.nextText,u=l.ellipsisText,v=l.goButtonText,w=l.classPrefix,x=l.activeClassName,y=l.disableClassName,z=l.ulClassName,A=b.isFunction(l.formatNavigator)?l.formatNavigator():l.formatNavigator,B=b.isFunction(l.formatGoInput)?l.formatGoInput():l.formatGoInput,C=b.isFunction(l.formatGoButton)?l.formatGoButton():l.formatGoButton,D=b.isFunction(l.autoHidePrevious)?l.autoHidePrevious():l.autoHidePrevious,E=b.isFunction(l.autoHideNext)?l.autoHideNext():l.autoHideNext,F=b.isFunction(l.header)?l.header():l.header,G=b.isFunction(l.footer)?l.footer():l.footer,H="",I='',J='';if(F&&(c=e.replaceVariables(F,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),k||n||m){if(H+='
    ',H+=z?'
    "}return o&&A&&(c=e.replaceVariables(A,{currentPage:f,totalPage:g,totalNumber:j}),H+='
    '+c+"
    "),p&&B&&(c=e.replaceVariables(B,{currentPage:f,totalPage:g,totalNumber:j,input:I}),H+='
    '+c+"
    "),q&&C&&(c=e.replaceVariables(C,{currentPage:f,totalPage:g,totalNumber:j,button:J}),H+='
    '+c+"
    "),G&&(c=e.replaceVariables(G,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),H},go:function(a,c){function d(a){if(f.direction="undefined"==typeof f.pageNumber?0:h>f.pageNumber?1:-1,f.pageNumber=h,e.render(),e.disabled&&!e.sync&&e.enable(),g.data("pagination").model=f,b.isFunction(l.formatResult)){var d=b.extend(!0,[],a);i.isArray(a=l.formatResult(d))||(a=d)}g.data("pagination").currentPageData=a,e.callHook("beforePaging"),e.doCallback(a,c),e.callHook("afterPaging"),1==h&&e.callHook("afterIsFirstPage"),h==f.totalPage&&e.callHook("afterIsLastPage")}var e=this,f=e.model;if(!e.disabled){var h=a,j=l.pageSize,k=f.totalPage;if(h=parseInt(h),!(!h||1>h||h>k)){if(e.sync)return void d(e.getDataSegment(h));var m={},n=l.alias||{};m[n.pageSize?n.pageSize:"pageSize"]=j,m[n.pageNumber?n.pageNumber:"pageNumber"]=h;var o={type:"get",cache:!1,data:{},contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"json",async:!0};b.extend(!0,o,l.ajax),b.extend(o.data||{},m),o.url=l.dataSource,o.success=function(a){d(e.filterDataByLocator(a))},o.error=function(a,b,c){l.formatAjaxError&&l.formatAjaxError(a,b,c),e.enable()},e.disable(),b.ajax(o)}}},doCallback:function(a,c){var d=this,e=d.model;b.isFunction(c)?c(a,e):b.isFunction(l.callback)&&l.callback(a,e)},destroy:function(){this.callHook("beforeDestroy")!==!1&&(this.model.el.remove(),g.off(),b("#paginationjs-style").remove(),this.callHook("afterDestroy"))},previous:function(a){this.go(this.model.pageNumber-1,a)},next:function(a){this.go(this.model.pageNumber+1,a)},disable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeDisable",b)!==!1&&(a.disabled=!0,a.model.disabled=!0,a.callHook("afterDisable",b))},enable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeEnable",b)!==!1&&(a.disabled=!1,a.model.disabled=!1,a.callHook("afterEnable",b))},show:function(){var a=this;a.model.el.is(":visible")||a.model.el.show()},hide:function(){var a=this;a.model.el.is(":visible")&&a.model.el.hide()},replaceVariables:function(a,b){var c;for(var d in b){var e=b[d],f=new RegExp("<%=\\s*"+d+"\\s*%>","img");c=(c||a).replace(f,e)}return c},getDataSegment:function(a){var b=l.pageSize,c=l.dataSource,d=l.totalNumber,e=b*(a-1)+1,f=Math.min(a*b,d);return c.slice(e-1,f)},getTotalPage:function(){return Math.ceil(l.totalNumber/l.pageSize)},getLocator:function(a){var d;return"string"==typeof a?d=a:b.isFunction(a)?d=a():c('"locator" is incorrect. (String | Function)'),d},filterDataByLocator:function(a){var d,e=this.getLocator(l.locator);if(i.isObject(a)){try{b.each(e.split("."),function(b,c){d=(d?d:a)[c]})}catch(f){}d?i.isArray(d)||c("dataSource."+e+" must be an Array."):c("dataSource."+e+" is undefined.")}return d||a},parseDataSource:function(a,d){var e=this,f=arguments;i.isObject(a)?d(l.dataSource=e.filterDataByLocator(a)):i.isArray(a)?d(l.dataSource=a):b.isFunction(a)?l.dataSource(function(a){b.isFunction(a)&&c('Unexpect parameter of the "done" Function.'),f.callee.call(e,a,d)}):"string"==typeof a?(/^https?|file:/.test(a)&&(l.ajaxDataType="jsonp"),d(a)):c('Unexpect data type of the "dataSource".')},callHook:function(c){var d,e=g.data("pagination"),f=Array.prototype.slice.apply(arguments);return f.shift(),l[c]&&b.isFunction(l[c])&&l[c].apply(a,f)===!1&&(d=!1),e.hooks&&e.hooks[c]&&b.each(e.hooks[c],function(b,c){c.apply(a,f)===!1&&(d=!1)}),d!==!1},observer:function(){var a=this,d=a.model.el;g.on(h+"go",function(d,e,f){e=parseInt(b.trim(e)),e&&(b.isNumeric(e)||c('"pageNumber" is incorrect. (Number)'),a.go(e,f))}),d.delegate(".J-paginationjs-page","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return!e||d.hasClass(l.disableClassName)||d.hasClass(l.activeClassName)?void 0:a.callHook("beforePageOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPageOnClick",c),l.pageLink?void 0:!1)}),d.delegate(".J-paginationjs-previous","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(l.disableClassName)?a.callHook("beforePreviousOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPreviousOnClick",c),l.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-next","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(l.disableClassName)?a.callHook("beforeNextOnClick",c)===!1?!1:(a.go(e),a.callHook("afterNextOnClick",c),l.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-go-button","click",function(){var c=b(".J-paginationjs-go-pagenumber",d).val();return a.callHook("beforeGoButtonOnClick",event,c)===!1?!1:(g.trigger(h+"go",c),void a.callHook("afterGoButtonOnClick",event,c))}),d.delegate(".J-paginationjs-go-pagenumber","keyup",function(c){if(13===c.which){var e=b(c.currentTarget).val();if(a.callHook("beforeGoInputOnEnter",c,e)===!1)return!1;g.trigger(h+"go",e),b(".J-paginationjs-go-pagenumber",d).focus(),a.callHook("afterGoInputOnEnter",c,e)}}),g.on(h+"previous",function(b,c){a.previous(c)}),g.on(h+"next",function(b,c){a.next(c)}),g.on(h+"disable",function(){a.disable()}),g.on(h+"enable",function(){a.enable()}),g.on(h+"show",function(){a.show()}),g.on(h+"hide",function(){a.hide()}),g.on(h+"destroy",function(){a.destroy()}),(j.sync||l.triggerPagingOnInit)&&g.trigger(h+"go",Math.min(l.pageNumber,a.model.totalPage))}};if(g.data("pagination")&&g.data("pagination").initialized===!0){if(b.isNumeric(f))return g.trigger.call(this,h+"go",f,arguments[1]),this;if("string"==typeof f){var k=Array.prototype.slice.apply(arguments);switch(k[0]=h+k[0],f){case"previous":case"next":case"go":case"disable":case"enable":case"show":case"hide":case"destroy":g.trigger.apply(this,k);break;case"getSelectedPageNum":return g.data("pagination").model?g.data("pagination").model.pageNumber:g.data("pagination").attributes.pageNumber;case"getTotalPage":return g.data("pagination").model.totalPage;case"getSelectedPageData":return g.data("pagination").currentPageData;case"isDisabled":return g.data("pagination").model.disabled===!0;default:c("Pagination do not provide action: "+f)}return this}}else i.isObject(f)||c("options is illegal");var l=b.extend({},arguments.callee.defaults,f);return d(l),j.initialize(),this},b.fn[f].defaults={totalNumber:1,pageNumber:1,pageSize:10,pageRange:2,showPrevious:!0,showNext:!0,showPageNumbers:!0,showNavigator:!1,showGoInput:!1,showGoButton:!1,pageLink:"",prevText:"«",nextText:"»",ellipsisText:"...",goButtonText:"Go",classPrefix:"paginationjs",activeClassName:"active",disableClassName:"disabled",inlineStyle:!0,formatNavigator:"<%= currentPage %> / <%= totalPage %>",formatGoInput:"<%= input %>",formatGoButton:"<%= button %>",position:"bottom",autoHidePrevious:!1,autoHideNext:!1,triggerPagingOnInit:!0,hideWhenLessThanOnePage:!1,showFirstOnEllipsisShow:!0,showLastOnEllipsisShow:!0,callback:function(){}},b.fn[g]=function(a,d){arguments.length<2&&c("Missing argument."),b.isFunction(d)||c("callback must be a function.");var e=b(this),f=e.data("pagination");f||(e.data("pagination",{}),f=e.data("pagination")),!f.hooks&&(f.hooks={}),f.hooks[a]=f.hooks[a]||[],f.hooks[a].push(d)},b[f]=function(a,d){arguments.length<2&&c("Requires two parameters.");var e;return e="string"!=typeof a&&a instanceof jQuery?a:b(a),e.length?(e.pagination(d),e):void 0};var i={};b.each(["Object","Array"],function(a,b){i["is"+b]=function(a){return toString.call(a)==="[object "+b+"]"}}),"function"==typeof define&&(define.amd||define.cmd)&&define(function(){return b})}(this,window.jQuery); \ No newline at end of file +!function(a,b){function c(a){throw new Error("Pagination: "+a)}function d(a){a.dataSource||c('"dataSource" is required.'),"string"==typeof a.dataSource?"undefined"==typeof a.totalNumber?c('"totalNumber" is required.'):b.isNumeric(a.totalNumber)||c('"totalNumber" is incorrect. (Number)'):j.isObject(a.dataSource)&&("undefined"==typeof a.locator?c('"dataSource" is a Object, please specify "locator".'):"string"==typeof a.locator||b.isFunction(a.locator)||c(""+a.locator+" is incorrect. (String | Function)"))}function e(a){var b;return("object"==(b=typeof a)?null==a&&"null"||Object.prototype.toString.call(a).slice(8,-1):b).toLowerCase()}function f(){var a=b("#paginationjs-style");if(!a.length){var c='.paginationjs{line-height:1.6;font-family:"Marmelad","Lucida Grande","Arial","Hiragino Sans GB",Georgia,sans-serif;font-size:14px;box-sizing:initial}.paginationjs:after{display:table;content:" ";clear:both}.paginationjs .paginationjs-pages{float:left}.paginationjs .paginationjs-pages ul{float:left;margin:0;padding:0}.paginationjs .paginationjs-pages li{float:left;border:1px solid #aaa;border-right:0;list-style:none}.paginationjs .paginationjs-pages li>a{min-width:30px;height:28px;line-height:28px;display:block;background:#fff;font-size:14px;color:#333;text-decoration:none;text-align:center}.paginationjs .paginationjs-pages li>a:hover{background:#eee}.paginationjs .paginationjs-pages li.active{border:0}.paginationjs .paginationjs-pages li.active>a{height:30px;line-height:30px;background:#aaa;color:#fff}.paginationjs .paginationjs-pages li.disabled>a{opacity:.3}.paginationjs .paginationjs-pages li.disabled>a:hover{background:0}.paginationjs .paginationjs-pages li:first-child{border-radius:3px 0 0 3px}.paginationjs .paginationjs-pages li:first-child>a{border-radius:3px 0 0 3px}.paginationjs .paginationjs-pages li:last-child{border-right:1px solid #aaa;border-radius:0 3px 3px 0}.paginationjs .paginationjs-pages li:last-child>a{border-radius:0 3px 3px 0}.paginationjs .paginationjs-go-input{float:left;margin-left:10px;font-size:14px}.paginationjs .paginationjs-go-input>input[type="text"]{width:30px;height:28px;background:#fff;border-radius:3px;border:1px solid #aaa;padding:0;font-size:14px;text-align:center;vertical-align:baseline;outline:0;box-shadow:none;box-sizing:initial}.paginationjs .paginationjs-go-button{float:left;margin-left:10px;font-size:14px}.paginationjs .paginationjs-go-button>input[type="button"]{min-width:40px;height:30px;line-height:28px;background:#fff;border-radius:3px;border:1px solid #aaa;text-align:center;padding:0 8px;font-size:14px;vertical-align:baseline;outline:0;box-shadow:none;color:#333;cursor:pointer}.paginationjs .paginationjs-go-button>input[type="button"]:hover{background-color:#f8f8f8}.paginationjs .paginationjs-nav{float:left;height:30px;line-height:30px;margin-left:10px;font-size:14px}.paginationjs.paginationjs-small{font-size:12px}.paginationjs.paginationjs-small .paginationjs-pages li>a{min-width:26px;height:24px;line-height:24px;font-size:12px}.paginationjs.paginationjs-small .paginationjs-pages li.active>a{height:26px;line-height:26px}.paginationjs.paginationjs-small .paginationjs-go-input{font-size:12px}.paginationjs.paginationjs-small .paginationjs-go-input>input[type="text"]{width:26px;height:24px;font-size:12px}.paginationjs.paginationjs-small .paginationjs-go-button{font-size:12px}.paginationjs.paginationjs-small .paginationjs-go-button>input[type="button"]{min-width:30px;height:26px;line-height:24px;padding:0 6px;font-size:12px}.paginationjs.paginationjs-small .paginationjs-nav{height:26px;line-height:26px;font-size:12px}.paginationjs.paginationjs-big{font-size:16px}.paginationjs.paginationjs-big .paginationjs-pages li>a{min-width:36px;height:34px;line-height:34px;font-size:16px}.paginationjs.paginationjs-big .paginationjs-pages li.active>a{height:36px;line-height:36px}.paginationjs.paginationjs-big .paginationjs-go-input{font-size:16px}.paginationjs.paginationjs-big .paginationjs-go-input>input[type="text"]{width:36px;height:34px;font-size:16px}.paginationjs.paginationjs-big .paginationjs-go-button{font-size:16px}.paginationjs.paginationjs-big .paginationjs-go-button>input[type="button"]{min-width:50px;height:36px;line-height:34px;padding:0 12px;font-size:16px}.paginationjs.paginationjs-big .paginationjs-nav{height:36px;line-height:36px;font-size:16px}.paginationjs.paginationjs-theme-blue .paginationjs-pages li{border-color:#289de9}.paginationjs.paginationjs-theme-blue .paginationjs-pages li>a{color:#289de9}.paginationjs.paginationjs-theme-blue .paginationjs-pages li>a:hover{background:#e9f4fc}.paginationjs.paginationjs-theme-blue .paginationjs-pages li.active>a{background:#289de9;color:#fff}.paginationjs.paginationjs-theme-blue .paginationjs-pages li.disabled>a:hover{background:0}.paginationjs.paginationjs-theme-blue .paginationjs-go-input>input[type="text"]{border-color:#289de9}.paginationjs.paginationjs-theme-blue .paginationjs-go-button>input[type="button"]{background:#289de9;border-color:#289de9;color:#fff}.paginationjs.paginationjs-theme-blue .paginationjs-go-button>input[type="button"]:hover{background-color:#3ca5ea}.paginationjs.paginationjs-theme-green .paginationjs-pages li{border-color:#449d44}.paginationjs.paginationjs-theme-green .paginationjs-pages li>a{color:#449d44}.paginationjs.paginationjs-theme-green .paginationjs-pages li>a:hover{background:#ebf4eb}.paginationjs.paginationjs-theme-green .paginationjs-pages li.active>a{background:#449d44;color:#fff}.paginationjs.paginationjs-theme-green .paginationjs-pages li.disabled>a:hover{background:0}.paginationjs.paginationjs-theme-green .paginationjs-go-input>input[type="text"]{border-color:#449d44}.paginationjs.paginationjs-theme-green .paginationjs-go-button>input[type="button"]{background:#449d44;border-color:#449d44;color:#fff}.paginationjs.paginationjs-theme-green .paginationjs-go-button>input[type="button"]:hover{background-color:#55a555}.paginationjs.paginationjs-theme-yellow .paginationjs-pages li{border-color:#ec971f}.paginationjs.paginationjs-theme-yellow .paginationjs-pages li>a{color:#ec971f}.paginationjs.paginationjs-theme-yellow .paginationjs-pages li>a:hover{background:#fdf5e9}.paginationjs.paginationjs-theme-yellow .paginationjs-pages li.active>a{background:#ec971f;color:#fff}.paginationjs.paginationjs-theme-yellow .paginationjs-pages li.disabled>a:hover{background:0}.paginationjs.paginationjs-theme-yellow .paginationjs-go-input>input[type="text"]{border-color:#ec971f}.paginationjs.paginationjs-theme-yellow .paginationjs-go-button>input[type="button"]{background:#ec971f;border-color:#ec971f;color:#fff}.paginationjs.paginationjs-theme-yellow .paginationjs-go-button>input[type="button"]:hover{background-color:#eea135}.paginationjs.paginationjs-theme-red .paginationjs-pages li{border-color:#c9302c}.paginationjs.paginationjs-theme-red .paginationjs-pages li>a{color:#c9302c}.paginationjs.paginationjs-theme-red .paginationjs-pages li>a:hover{background:#faeaea}.paginationjs.paginationjs-theme-red .paginationjs-pages li.active>a{background:#c9302c;color:#fff}.paginationjs.paginationjs-theme-red .paginationjs-pages li.disabled>a:hover{background:0}.paginationjs.paginationjs-theme-red .paginationjs-go-input>input[type="text"]{border-color:#c9302c}.paginationjs.paginationjs-theme-red .paginationjs-go-button>input[type="button"]{background:#c9302c;border-color:#c9302c;color:#fff}.paginationjs.paginationjs-theme-red .paginationjs-go-button>input[type="button"]:hover{background-color:#ce4541}.paginationjs .paginationjs-pages li.paginationjs-next{*border-right:1px solid #aaa;border-right:1px solid #aaa\\0}.paginationjs .paginationjs-go-input{*margin-left:5px;margin-left:5px\\0}.paginationjs .paginationjs-go-input>input[type="text"]{*line-height:28px;line-height:28px\\0;*vertical-align:middle;vertical-align:middle\\0}.paginationjs .paginationjs-go-button{*margin-left:5px;margin-left:5px\\\x00}.paginationjs .paginationjs-go-button>input[type="button"]{*vertical-align:middle;vertical-align:middle\\0}.paginationjs.paginationjs-big .paginationjs-pages li>a{line-height:36px\\0}.paginationjs.paginationjs-big .paginationjs-go-input>input[type="text"]{*height:35px;height:36px\\0;*line-height:36px;line-height:36px\\0}';b("head").append('")}}"undefined"==typeof b&&c("Pagination requires jQuery.");var g="pagination",h="addHook",i="__pagination-";b.fn.pagination&&(g="pagination2"),b.fn[g]=function(e){if("undefined"==typeof e)return this;var g=b(this),h={initialize:function(){var a=this;if(g.data("pagination")||g.data("pagination",{}),a.callHook("beforeInit")!==!1){g.data("pagination").initialized&&b(".paginationjs",g).remove(),l.inlineStyle===!0&&f();var c=a.model={pageRange:l.pageRange,pageSize:l.pageSize};a.parseDataSource(l.dataSource,function(b){if(a.sync=j.isArray(b),a.sync&&(c.totalNumber=l.totalNumber=b.length),c.totalPage=a.getTotalPage(),!(l.hideWhenLessThanOnePage&&c.totalPage<=1)){var d=a.render(!0);l.className&&d.addClass(l.className),c.el=d,g["bottom"===l.position?"append":"prepend"](d),a.observer(),g.data("pagination").initialized=!0,a.callHook("afterInit",d)}})}},render:function(a){var c=this,d=c.model,e=d.el||b('
    '),f=a!==!0;c.callHook("beforeRender",f);var g=d.pageNumber||l.pageNumber,h=l.pageRange,i=d.totalPage,j=g-h,k=g+h;return k>i&&(k=i,j=i-2*h,j=1>j?1:j),1>=j&&(j=1,k=Math.min(2*h+1,i)),e.html(c.createTemplate({currentPage:g,pageRange:h,totalPage:i,rangeStart:j,rangeEnd:k})),c.callHook("afterRender",f),e},createTemplate:function(a){var c,d,e=this,f=a.currentPage,g=a.totalPage,h=a.rangeStart,i=a.rangeEnd,j=l.totalNumber,k=l.showPrevious,m=l.showNext,n=l.showPageNumbers,o=l.showNavigator,p=l.showGoInput,q=l.showGoButton,r=l.pageLink,s=l.prevText,t=l.nextText,u=l.ellipsisText,v=l.goButtonText,w=l.classPrefix,x=l.activeClassName,y=l.disableClassName,z=l.ulClassName,A=b.isFunction(l.formatNavigator)?l.formatNavigator():l.formatNavigator,B=b.isFunction(l.formatGoInput)?l.formatGoInput():l.formatGoInput,C=b.isFunction(l.formatGoButton)?l.formatGoButton():l.formatGoButton,D=b.isFunction(l.autoHidePrevious)?l.autoHidePrevious():l.autoHidePrevious,E=b.isFunction(l.autoHideNext)?l.autoHideNext():l.autoHideNext,F=b.isFunction(l.header)?l.header():l.header,G=b.isFunction(l.footer)?l.footer():l.footer,H="",I='',J='';if(F&&(c=e.replaceVariables(F,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),k||n||m){if(H+='
    ',H+=z?'
      ':"
        ",k&&(1===f?D||(H+='
      • '+s+"
      • "):H+='
      • '+s+"
      • "),n){if(3>=h)for(d=1;h>d;d++)H+=d==f?'
      • '+d+"
      • ":'
      • '+d+"
      • ";else l.showFirstOnEllipsisShow&&(H+='
      • 1
      • '),H+='
      • '+u+"
      • ";for(d=h;i>=d;d++)H+=d==f?'
      • '+d+"
      • ":'
      • '+d+"
      • ";if(i>=g-2)for(d=i+1;g>=d;d++)H+='
      • '+d+"
      • ";else H+='
      • '+u+"
      • ",l.showLastOnEllipsisShow&&(H+='
      • '+g+"
      • ")}m&&(f==g?E||(H+='
      • '+t+"
      • "):H+='
      • '+t+"
      • "),H+="
    "}return o&&A&&(c=e.replaceVariables(A,{currentPage:f,totalPage:g,totalNumber:j}),H+='
    '+c+"
    "),p&&B&&(c=e.replaceVariables(B,{currentPage:f,totalPage:g,totalNumber:j,input:I}),H+='
    '+c+"
    "),q&&C&&(c=e.replaceVariables(C,{currentPage:f,totalPage:g,totalNumber:j,button:J}),H+='
    '+c+"
    "),G&&(c=e.replaceVariables(G,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),H},go:function(a,c){function d(a){if(f.direction="undefined"==typeof f.pageNumber?0:h>f.pageNumber?1:-1,f.pageNumber=h,e.render(),e.disabled&&!e.sync&&e.enable(),g.data("pagination").model=f,b.isFunction(l.formatResult)){var d=b.extend(!0,[],a);j.isArray(a=l.formatResult(d))||(a=d)}g.data("pagination").currentPageData=a,e.callHook("beforePaging"),e.doCallback(a,c),e.callHook("afterPaging"),1==h&&e.callHook("afterIsFirstPage"),h==f.totalPage&&e.callHook("afterIsLastPage")}var e=this,f=e.model;if(!e.disabled){var h=a,i=l.pageSize,k=f.totalPage;if(h=parseInt(h),!(!h||1>h||h>k)){if(e.sync)return void d(e.getDataSegment(h));var m={},n=l.alias||{};m[n.pageSize?n.pageSize:"pageSize"]=i,m[n.pageNumber?n.pageNumber:"pageNumber"]=h;var o={type:"get",cache:!1,data:{},contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"json",async:!0};b.extend(!0,o,l.ajax),b.extend(o.data||{},m),o.url=l.dataSource,o.success=function(a){d(e.filterDataByLocator(a))},o.error=function(a,b,c){l.formatAjaxError&&l.formatAjaxError(a,b,c),e.enable()},e.disable(),b.ajax(o)}}},doCallback:function(a,c){var d=this,e=d.model;b.isFunction(c)?c(a,e):b.isFunction(l.callback)&&l.callback(a,e)},destroy:function(){this.callHook("beforeDestroy")!==!1&&(this.model.el.remove(),g.off(),b("#paginationjs-style").remove(),this.callHook("afterDestroy"))},previous:function(a){this.go(this.model.pageNumber-1,a)},next:function(a){this.go(this.model.pageNumber+1,a)},disable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeDisable",b)!==!1&&(a.disabled=!0,a.model.disabled=!0,a.callHook("afterDisable",b))},enable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeEnable",b)!==!1&&(a.disabled=!1,a.model.disabled=!1,a.callHook("afterEnable",b))},show:function(){var a=this;a.model.el.is(":visible")||a.model.el.show()},hide:function(){var a=this;a.model.el.is(":visible")&&a.model.el.hide()},replaceVariables:function(a,b){var c;for(var d in b){var e=b[d],f=new RegExp("<%=\\s*"+d+"\\s*%>","img");c=(c||a).replace(f,e)}return c},getDataSegment:function(a){var b=l.pageSize,c=l.dataSource,d=l.totalNumber,e=b*(a-1)+1,f=Math.min(a*b,d);return c.slice(e-1,f)},getTotalPage:function(){return Math.ceil(l.totalNumber/l.pageSize)},getLocator:function(a){var d;return"string"==typeof a?d=a:b.isFunction(a)?d=a():c('"locator" is incorrect. (String | Function)'),d},filterDataByLocator:function(a){var d,e=this.getLocator(l.locator);if(j.isObject(a)){try{b.each(e.split("."),function(b,c){d=(d?d:a)[c]})}catch(f){}d?j.isArray(d)||c("dataSource."+e+" must be an Array."):c("dataSource."+e+" is undefined.")}return d||a},parseDataSource:function(a,d){var e=this,f=arguments;j.isObject(a)?d(l.dataSource=e.filterDataByLocator(a)):j.isArray(a)?d(l.dataSource=a):b.isFunction(a)?l.dataSource(function(a){b.isFunction(a)&&c('Unexpect parameter of the "done" Function.'),f.callee.call(e,a,d)}):"string"==typeof a?(/^https?|file:/.test(a)&&(l.ajaxDataType="jsonp"),d(a)):c('Unexpect data type of the "dataSource".')},callHook:function(c){var d,e=g.data("pagination"),f=Array.prototype.slice.apply(arguments);return f.shift(),l[c]&&b.isFunction(l[c])&&l[c].apply(a,f)===!1&&(d=!1),e.hooks&&e.hooks[c]&&b.each(e.hooks[c],function(b,c){c.apply(a,f)===!1&&(d=!1)}),d!==!1},observer:function(){var a=this,d=a.model.el;g.on(i+"go",function(d,e,f){e=parseInt(b.trim(e)),e&&(b.isNumeric(e)||c('"pageNumber" is incorrect. (Number)'),a.go(e,f))}),d.delegate(".J-paginationjs-page","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return!e||d.hasClass(l.disableClassName)||d.hasClass(l.activeClassName)?void 0:a.callHook("beforePageOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPageOnClick",c),l.pageLink?void 0:!1)}),d.delegate(".J-paginationjs-previous","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(l.disableClassName)?a.callHook("beforePreviousOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPreviousOnClick",c),l.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-next","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(l.disableClassName)?a.callHook("beforeNextOnClick",c)===!1?!1:(a.go(e),a.callHook("afterNextOnClick",c),l.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-go-button","click",function(){var c=b(".J-paginationjs-go-pagenumber",d).val();return a.callHook("beforeGoButtonOnClick",event,c)===!1?!1:(g.trigger(i+"go",c),void a.callHook("afterGoButtonOnClick",event,c))}),d.delegate(".J-paginationjs-go-pagenumber","keyup",function(c){if(13===c.which){var e=b(c.currentTarget).val();if(a.callHook("beforeGoInputOnEnter",c,e)===!1)return!1;g.trigger(i+"go",e),b(".J-paginationjs-go-pagenumber",d).focus(),a.callHook("afterGoInputOnEnter",c,e)}}),g.on(i+"previous",function(b,c){a.previous(c)}),g.on(i+"next",function(b,c){a.next(c)}),g.on(i+"disable",function(){a.disable()}),g.on(i+"enable",function(){a.enable()}),g.on(i+"show",function(){a.show()}),g.on(i+"hide",function(){a.hide()}),g.on(i+"destroy",function(){a.destroy()}),(h.sync||l.triggerPagingOnInit)&&g.trigger(i+"go",Math.min(l.pageNumber,a.model.totalPage))}};if(g.data("pagination")&&g.data("pagination").initialized===!0){if(b.isNumeric(e))return g.trigger.call(this,i+"go",e,arguments[1]),this;if("string"==typeof e){var k=Array.prototype.slice.apply(arguments);switch(k[0]=i+k[0],e){case"previous":case"next":case"go":case"disable":case"enable":case"show":case"hide":case"destroy":g.trigger.apply(this,k);break;case"getSelectedPageNum":return g.data("pagination").model?g.data("pagination").model.pageNumber:g.data("pagination").attributes.pageNumber;case"getTotalPage":return g.data("pagination").model.totalPage;case"getSelectedPageData":return g.data("pagination").currentPageData;case"isDisabled":return g.data("pagination").model.disabled===!0;default:c("Pagination do not provide action: "+e)}return this}}else j.isObject(e)||c("options is illegal");var l=b.extend({},arguments.callee.defaults,e);return d(l),h.initialize(),this},b.fn[g].defaults={totalNumber:1,pageNumber:1,pageSize:10,pageRange:2,showPrevious:!0,showNext:!0,showPageNumbers:!0,showNavigator:!1,showGoInput:!1,showGoButton:!1,pageLink:"",prevText:"«",nextText:"»",ellipsisText:"...",goButtonText:"Go",classPrefix:"paginationjs",activeClassName:"active",disableClassName:"disabled",inlineStyle:!0,formatNavigator:"<%= currentPage %> / <%= totalPage %>",formatGoInput:"<%= input %>",formatGoButton:"<%= button %>",position:"bottom",autoHidePrevious:!1,autoHideNext:!1,triggerPagingOnInit:!0,hideWhenLessThanOnePage:!1,showFirstOnEllipsisShow:!0,showLastOnEllipsisShow:!0,callback:function(){}},b.fn[h]=function(a,d){arguments.length<2&&c("Missing argument."),b.isFunction(d)||c("callback must be a function.");var e=b(this),f=e.data("pagination");f||(e.data("pagination",{}),f=e.data("pagination")),!f.hooks&&(f.hooks={}),f.hooks[a]=f.hooks[a]||[],f.hooks[a].push(d)},b[g]=function(a,d){arguments.length<2&&c("Requires two parameters.");var e;return e="string"!=typeof a&&a instanceof jQuery?a:b(a),e.length?(e.pagination(d),e):void 0};var j={};b.each(["Object","Array"],function(a,b){j["is"+b]=function(a){return e(a)===b.toLowerCase()}}),"function"==typeof define&&(define.amd||define.cmd)&&define(function(){return b})}(this,window.jQuery); \ No newline at end of file diff --git a/dist/pagination.min.js b/dist/pagination.min.js index 86b1d8a..74520ca 100644 --- a/dist/pagination.min.js +++ b/dist/pagination.min.js @@ -8,4 +8,4 @@ * Copyright 2014-2100, superRaytin * Released under the MIT license. */ -!function(a,b){function c(a){throw new Error("Pagination: "+a)}function d(a){a.dataSource||c('"dataSource" is required.'),"string"==typeof a.dataSource?"undefined"==typeof a.totalNumber?c('"totalNumber" is required.'):b.isNumeric(a.totalNumber)||c('"totalNumber" is incorrect. (Number)'):h.isObject(a.dataSource)&&("undefined"==typeof a.locator?c('"dataSource" is a Object, please specify "locator".'):"string"==typeof a.locator||b.isFunction(a.locator)||c(""+a.locator+" is incorrect. (String | Function)"))}"undefined"==typeof b&&c("Pagination requires jQuery.");var e="pagination",f="addHook",g="__pagination-";b.fn.pagination&&(e="pagination2"),b.fn[e]=function(e){if("undefined"==typeof e)return this;var f=b(this),i={initialize:function(){var a=this;if(f.data("pagination")||f.data("pagination",{}),a.callHook("beforeInit")!==!1){f.data("pagination").initialized&&b(".paginationjs",f).remove();var c=a.model={pageRange:k.pageRange,pageSize:k.pageSize};a.parseDataSource(k.dataSource,function(b){if(a.sync=h.isArray(b),a.sync&&(c.totalNumber=k.totalNumber=b.length),c.totalPage=a.getTotalPage(),!(k.hideWhenLessThanOnePage&&c.totalPage<=1)){var d=a.render(!0);k.className&&d.addClass(k.className),c.el=d,f["bottom"===k.position?"append":"prepend"](d),a.observer(),f.data("pagination").initialized=!0,a.callHook("afterInit",d)}})}},render:function(a){var c=this,d=c.model,e=d.el||b('
    '),f=a!==!0;c.callHook("beforeRender",f);var g=d.pageNumber||k.pageNumber,h=k.pageRange,i=d.totalPage,j=g-h,l=g+h;return l>i&&(l=i,j=i-2*h,j=1>j?1:j),1>=j&&(j=1,l=Math.min(2*h+1,i)),e.html(c.createTemplate({currentPage:g,pageRange:h,totalPage:i,rangeStart:j,rangeEnd:l})),c.callHook("afterRender",f),e},createTemplate:function(a){var c,d,e=this,f=a.currentPage,g=a.totalPage,h=a.rangeStart,i=a.rangeEnd,j=k.totalNumber,l=k.showPrevious,m=k.showNext,n=k.showPageNumbers,o=k.showNavigator,p=k.showGoInput,q=k.showGoButton,r=k.pageLink,s=k.prevText,t=k.nextText,u=k.ellipsisText,v=k.goButtonText,w=k.classPrefix,x=k.activeClassName,y=k.disableClassName,z=k.ulClassName,A=b.isFunction(k.formatNavigator)?k.formatNavigator():k.formatNavigator,B=b.isFunction(k.formatGoInput)?k.formatGoInput():k.formatGoInput,C=b.isFunction(k.formatGoButton)?k.formatGoButton():k.formatGoButton,D=b.isFunction(k.autoHidePrevious)?k.autoHidePrevious():k.autoHidePrevious,E=b.isFunction(k.autoHideNext)?k.autoHideNext():k.autoHideNext,F=b.isFunction(k.header)?k.header():k.header,G=b.isFunction(k.footer)?k.footer():k.footer,H="",I='',J='';if(F&&(c=e.replaceVariables(F,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),l||n||m){if(H+='
    ',H+=z?'
      ':"
        ",l&&(1===f?D||(H+='
      • '+s+"
      • "):H+='
      • '+s+"
      • "),n){if(3>=h)for(d=1;h>d;d++)H+=d==f?'
      • '+d+"
      • ":'
      • '+d+"
      • ";else k.showFirstOnEllipsisShow&&(H+='
      • 1
      • '),H+='
      • '+u+"
      • ";for(d=h;i>=d;d++)H+=d==f?'
      • '+d+"
      • ":'
      • '+d+"
      • ";if(i>=g-2)for(d=i+1;g>=d;d++)H+='
      • '+d+"
      • ";else H+='
      • '+u+"
      • ",k.showLastOnEllipsisShow&&(H+='
      • '+g+"
      • ")}m&&(f==g?E||(H+='
      • '+t+"
      • "):H+='
      • '+t+"
      • "),H+="
    "}return o&&A&&(c=e.replaceVariables(A,{currentPage:f,totalPage:g,totalNumber:j}),H+='
    '+c+"
    "),p&&B&&(c=e.replaceVariables(B,{currentPage:f,totalPage:g,totalNumber:j,input:I}),H+='
    '+c+"
    "),q&&C&&(c=e.replaceVariables(C,{currentPage:f,totalPage:g,totalNumber:j,button:J}),H+='
    '+c+"
    "),G&&(c=e.replaceVariables(G,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),H},go:function(a,c){function d(a){if(g.direction="undefined"==typeof g.pageNumber?0:i>g.pageNumber?1:-1,g.pageNumber=i,e.render(),e.disabled&&!e.sync&&e.enable(),f.data("pagination").model=g,b.isFunction(k.formatResult)){var d=b.extend(!0,[],a);h.isArray(a=k.formatResult(d))||(a=d)}f.data("pagination").currentPageData=a,e.callHook("beforePaging"),e.doCallback(a,c),e.callHook("afterPaging"),1==i&&e.callHook("afterIsFirstPage"),i==g.totalPage&&e.callHook("afterIsLastPage")}var e=this,g=e.model;if(!e.disabled){var i=a,j=k.pageSize,l=g.totalPage;if(i=parseInt(i),!(!i||1>i||i>l)){if(e.sync)return void d(e.getDataSegment(i));var m={},n=k.alias||{};m[n.pageSize?n.pageSize:"pageSize"]=j,m[n.pageNumber?n.pageNumber:"pageNumber"]=i;var o={type:"get",cache:!1,data:{},contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"json",async:!0};b.extend(!0,o,k.ajax),b.extend(o.data||{},m),o.url=k.dataSource,o.success=function(a){d(e.filterDataByLocator(a))},o.error=function(a,b,c){k.formatAjaxError&&k.formatAjaxError(a,b,c),e.enable()},e.disable(),b.ajax(o)}}},doCallback:function(a,c){var d=this,e=d.model;b.isFunction(c)?c(a,e):b.isFunction(k.callback)&&k.callback(a,e)},destroy:function(){this.callHook("beforeDestroy")!==!1&&(this.model.el.remove(),f.off(),b("#paginationjs-style").remove(),this.callHook("afterDestroy"))},previous:function(a){this.go(this.model.pageNumber-1,a)},next:function(a){this.go(this.model.pageNumber+1,a)},disable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeDisable",b)!==!1&&(a.disabled=!0,a.model.disabled=!0,a.callHook("afterDisable",b))},enable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeEnable",b)!==!1&&(a.disabled=!1,a.model.disabled=!1,a.callHook("afterEnable",b))},show:function(){var a=this;a.model.el.is(":visible")||a.model.el.show()},hide:function(){var a=this;a.model.el.is(":visible")&&a.model.el.hide()},replaceVariables:function(a,b){var c;for(var d in b){var e=b[d],f=new RegExp("<%=\\s*"+d+"\\s*%>","img");c=(c||a).replace(f,e)}return c},getDataSegment:function(a){var b=k.pageSize,c=k.dataSource,d=k.totalNumber,e=b*(a-1)+1,f=Math.min(a*b,d);return c.slice(e-1,f)},getTotalPage:function(){return Math.ceil(k.totalNumber/k.pageSize)},getLocator:function(a){var d;return"string"==typeof a?d=a:b.isFunction(a)?d=a():c('"locator" is incorrect. (String | Function)'),d},filterDataByLocator:function(a){var d,e=this.getLocator(k.locator);if(h.isObject(a)){try{b.each(e.split("."),function(b,c){d=(d?d:a)[c]})}catch(f){}d?h.isArray(d)||c("dataSource."+e+" must be an Array."):c("dataSource."+e+" is undefined.")}return d||a},parseDataSource:function(a,d){var e=this,f=arguments;h.isObject(a)?d(k.dataSource=e.filterDataByLocator(a)):h.isArray(a)?d(k.dataSource=a):b.isFunction(a)?k.dataSource(function(a){b.isFunction(a)&&c('Unexpect parameter of the "done" Function.'),f.callee.call(e,a,d)}):"string"==typeof a?(/^https?|file:/.test(a)&&(k.ajaxDataType="jsonp"),d(a)):c('Unexpect data type of the "dataSource".')},callHook:function(c){var d,e=f.data("pagination"),g=Array.prototype.slice.apply(arguments);return g.shift(),k[c]&&b.isFunction(k[c])&&k[c].apply(a,g)===!1&&(d=!1),e.hooks&&e.hooks[c]&&b.each(e.hooks[c],function(b,c){c.apply(a,g)===!1&&(d=!1)}),d!==!1},observer:function(){var a=this,d=a.model.el;f.on(g+"go",function(d,e,f){e=parseInt(b.trim(e)),e&&(b.isNumeric(e)||c('"pageNumber" is incorrect. (Number)'),a.go(e,f))}),d.delegate(".J-paginationjs-page","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return!e||d.hasClass(k.disableClassName)||d.hasClass(k.activeClassName)?void 0:a.callHook("beforePageOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPageOnClick",c),k.pageLink?void 0:!1)}),d.delegate(".J-paginationjs-previous","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(k.disableClassName)?a.callHook("beforePreviousOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPreviousOnClick",c),k.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-next","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(k.disableClassName)?a.callHook("beforeNextOnClick",c)===!1?!1:(a.go(e),a.callHook("afterNextOnClick",c),k.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-go-button","click",function(){var c=b(".J-paginationjs-go-pagenumber",d).val();return a.callHook("beforeGoButtonOnClick",event,c)===!1?!1:(f.trigger(g+"go",c),void a.callHook("afterGoButtonOnClick",event,c))}),d.delegate(".J-paginationjs-go-pagenumber","keyup",function(c){if(13===c.which){var e=b(c.currentTarget).val();if(a.callHook("beforeGoInputOnEnter",c,e)===!1)return!1;f.trigger(g+"go",e),b(".J-paginationjs-go-pagenumber",d).focus(),a.callHook("afterGoInputOnEnter",c,e)}}),f.on(g+"previous",function(b,c){a.previous(c)}),f.on(g+"next",function(b,c){a.next(c)}),f.on(g+"disable",function(){a.disable()}),f.on(g+"enable",function(){a.enable()}),f.on(g+"show",function(){a.show()}),f.on(g+"hide",function(){a.hide()}),f.on(g+"destroy",function(){a.destroy()}),(i.sync||k.triggerPagingOnInit)&&f.trigger(g+"go",Math.min(k.pageNumber,a.model.totalPage))}};if(f.data("pagination")&&f.data("pagination").initialized===!0){if(b.isNumeric(e))return f.trigger.call(this,g+"go",e,arguments[1]),this;if("string"==typeof e){var j=Array.prototype.slice.apply(arguments);switch(j[0]=g+j[0],e){case"previous":case"next":case"go":case"disable":case"enable":case"show":case"hide":case"destroy":f.trigger.apply(this,j);break;case"getSelectedPageNum":return f.data("pagination").model?f.data("pagination").model.pageNumber:f.data("pagination").attributes.pageNumber;case"getTotalPage":return f.data("pagination").model.totalPage;case"getSelectedPageData":return f.data("pagination").currentPageData;case"isDisabled":return f.data("pagination").model.disabled===!0;default:c("Pagination do not provide action: "+e)}return this}}else h.isObject(e)||c("options is illegal");var k=b.extend({},arguments.callee.defaults,e);return d(k),i.initialize(),this},b.fn[e].defaults={totalNumber:1,pageNumber:1,pageSize:10,pageRange:2,showPrevious:!0,showNext:!0,showPageNumbers:!0,showNavigator:!1,showGoInput:!1,showGoButton:!1,pageLink:"",prevText:"«",nextText:"»",ellipsisText:"...",goButtonText:"Go",classPrefix:"paginationjs",activeClassName:"active",disableClassName:"disabled",inlineStyle:!0,formatNavigator:"<%= currentPage %> / <%= totalPage %>",formatGoInput:"<%= input %>",formatGoButton:"<%= button %>",position:"bottom",autoHidePrevious:!1,autoHideNext:!1,triggerPagingOnInit:!0,hideWhenLessThanOnePage:!1,showFirstOnEllipsisShow:!0,showLastOnEllipsisShow:!0,callback:function(){}},b.fn[f]=function(a,d){arguments.length<2&&c("Missing argument."),b.isFunction(d)||c("callback must be a function.");var e=b(this),f=e.data("pagination");f||(e.data("pagination",{}),f=e.data("pagination")),!f.hooks&&(f.hooks={}),f.hooks[a]=f.hooks[a]||[],f.hooks[a].push(d)},b[e]=function(a,d){arguments.length<2&&c("Requires two parameters.");var e;return e="string"!=typeof a&&a instanceof jQuery?a:b(a),e.length?(e.pagination(d),e):void 0};var h={};b.each(["Object","Array"],function(a,b){h["is"+b]=function(a){return toString.call(a)==="[object "+b+"]"}}),"function"==typeof define&&(define.amd||define.cmd)&&define(function(){return b})}(this,window.jQuery); \ No newline at end of file +!function(a,b){function c(a){throw new Error("Pagination: "+a)}function d(a){a.dataSource||c('"dataSource" is required.'),"string"==typeof a.dataSource?"undefined"==typeof a.totalNumber?c('"totalNumber" is required.'):b.isNumeric(a.totalNumber)||c('"totalNumber" is incorrect. (Number)'):i.isObject(a.dataSource)&&("undefined"==typeof a.locator?c('"dataSource" is a Object, please specify "locator".'):"string"==typeof a.locator||b.isFunction(a.locator)||c(""+a.locator+" is incorrect. (String | Function)"))}function e(a){var b;return("object"==(b=typeof a)?null==a&&"null"||Object.prototype.toString.call(a).slice(8,-1):b).toLowerCase()}"undefined"==typeof b&&c("Pagination requires jQuery.");var f="pagination",g="addHook",h="__pagination-";b.fn.pagination&&(f="pagination2"),b.fn[f]=function(e){if("undefined"==typeof e)return this;var f=b(this),g={initialize:function(){var a=this;if(f.data("pagination")||f.data("pagination",{}),a.callHook("beforeInit")!==!1){f.data("pagination").initialized&&b(".paginationjs",f).remove();var c=a.model={pageRange:k.pageRange,pageSize:k.pageSize};a.parseDataSource(k.dataSource,function(b){if(a.sync=i.isArray(b),a.sync&&(c.totalNumber=k.totalNumber=b.length),c.totalPage=a.getTotalPage(),!(k.hideWhenLessThanOnePage&&c.totalPage<=1)){var d=a.render(!0);k.className&&d.addClass(k.className),c.el=d,f["bottom"===k.position?"append":"prepend"](d),a.observer(),f.data("pagination").initialized=!0,a.callHook("afterInit",d)}})}},render:function(a){var c=this,d=c.model,e=d.el||b('
    '),f=a!==!0;c.callHook("beforeRender",f);var g=d.pageNumber||k.pageNumber,h=k.pageRange,i=d.totalPage,j=g-h,l=g+h;return l>i&&(l=i,j=i-2*h,j=1>j?1:j),1>=j&&(j=1,l=Math.min(2*h+1,i)),e.html(c.createTemplate({currentPage:g,pageRange:h,totalPage:i,rangeStart:j,rangeEnd:l})),c.callHook("afterRender",f),e},createTemplate:function(a){var c,d,e=this,f=a.currentPage,g=a.totalPage,h=a.rangeStart,i=a.rangeEnd,j=k.totalNumber,l=k.showPrevious,m=k.showNext,n=k.showPageNumbers,o=k.showNavigator,p=k.showGoInput,q=k.showGoButton,r=k.pageLink,s=k.prevText,t=k.nextText,u=k.ellipsisText,v=k.goButtonText,w=k.classPrefix,x=k.activeClassName,y=k.disableClassName,z=k.ulClassName,A=b.isFunction(k.formatNavigator)?k.formatNavigator():k.formatNavigator,B=b.isFunction(k.formatGoInput)?k.formatGoInput():k.formatGoInput,C=b.isFunction(k.formatGoButton)?k.formatGoButton():k.formatGoButton,D=b.isFunction(k.autoHidePrevious)?k.autoHidePrevious():k.autoHidePrevious,E=b.isFunction(k.autoHideNext)?k.autoHideNext():k.autoHideNext,F=b.isFunction(k.header)?k.header():k.header,G=b.isFunction(k.footer)?k.footer():k.footer,H="",I='',J='';if(F&&(c=e.replaceVariables(F,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),l||n||m){if(H+='
    ',H+=z?'
      ':"
        ",l&&(1===f?D||(H+='
      • '+s+"
      • "):H+='
      • '+s+"
      • "),n){if(3>=h)for(d=1;h>d;d++)H+=d==f?'
      • '+d+"
      • ":'
      • '+d+"
      • ";else k.showFirstOnEllipsisShow&&(H+='
      • 1
      • '),H+='
      • '+u+"
      • ";for(d=h;i>=d;d++)H+=d==f?'
      • '+d+"
      • ":'
      • '+d+"
      • ";if(i>=g-2)for(d=i+1;g>=d;d++)H+='
      • '+d+"
      • ";else H+='
      • '+u+"
      • ",k.showLastOnEllipsisShow&&(H+='
      • '+g+"
      • ")}m&&(f==g?E||(H+='
      • '+t+"
      • "):H+='
      • '+t+"
      • "),H+="
    "}return o&&A&&(c=e.replaceVariables(A,{currentPage:f,totalPage:g,totalNumber:j}),H+='
    '+c+"
    "),p&&B&&(c=e.replaceVariables(B,{currentPage:f,totalPage:g,totalNumber:j,input:I}),H+='
    '+c+"
    "),q&&C&&(c=e.replaceVariables(C,{currentPage:f,totalPage:g,totalNumber:j,button:J}),H+='
    '+c+"
    "),G&&(c=e.replaceVariables(G,{currentPage:f,totalPage:g,totalNumber:j}),H+=c),H},go:function(a,c){function d(a){if(g.direction="undefined"==typeof g.pageNumber?0:h>g.pageNumber?1:-1,g.pageNumber=h,e.render(),e.disabled&&!e.sync&&e.enable(),f.data("pagination").model=g,b.isFunction(k.formatResult)){var d=b.extend(!0,[],a);i.isArray(a=k.formatResult(d))||(a=d)}f.data("pagination").currentPageData=a,e.callHook("beforePaging"),e.doCallback(a,c),e.callHook("afterPaging"),1==h&&e.callHook("afterIsFirstPage"),h==g.totalPage&&e.callHook("afterIsLastPage")}var e=this,g=e.model;if(!e.disabled){var h=a,j=k.pageSize,l=g.totalPage;if(h=parseInt(h),!(!h||1>h||h>l)){if(e.sync)return void d(e.getDataSegment(h));var m={},n=k.alias||{};m[n.pageSize?n.pageSize:"pageSize"]=j,m[n.pageNumber?n.pageNumber:"pageNumber"]=h;var o={type:"get",cache:!1,data:{},contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"json",async:!0};b.extend(!0,o,k.ajax),b.extend(o.data||{},m),o.url=k.dataSource,o.success=function(a){d(e.filterDataByLocator(a))},o.error=function(a,b,c){k.formatAjaxError&&k.formatAjaxError(a,b,c),e.enable()},e.disable(),b.ajax(o)}}},doCallback:function(a,c){var d=this,e=d.model;b.isFunction(c)?c(a,e):b.isFunction(k.callback)&&k.callback(a,e)},destroy:function(){this.callHook("beforeDestroy")!==!1&&(this.model.el.remove(),f.off(),b("#paginationjs-style").remove(),this.callHook("afterDestroy"))},previous:function(a){this.go(this.model.pageNumber-1,a)},next:function(a){this.go(this.model.pageNumber+1,a)},disable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeDisable",b)!==!1&&(a.disabled=!0,a.model.disabled=!0,a.callHook("afterDisable",b))},enable:function(){var a=this,b=a.sync?"sync":"async";a.callHook("beforeEnable",b)!==!1&&(a.disabled=!1,a.model.disabled=!1,a.callHook("afterEnable",b))},show:function(){var a=this;a.model.el.is(":visible")||a.model.el.show()},hide:function(){var a=this;a.model.el.is(":visible")&&a.model.el.hide()},replaceVariables:function(a,b){var c;for(var d in b){var e=b[d],f=new RegExp("<%=\\s*"+d+"\\s*%>","img");c=(c||a).replace(f,e)}return c},getDataSegment:function(a){var b=k.pageSize,c=k.dataSource,d=k.totalNumber,e=b*(a-1)+1,f=Math.min(a*b,d);return c.slice(e-1,f)},getTotalPage:function(){return Math.ceil(k.totalNumber/k.pageSize)},getLocator:function(a){var d;return"string"==typeof a?d=a:b.isFunction(a)?d=a():c('"locator" is incorrect. (String | Function)'),d},filterDataByLocator:function(a){var d,e=this.getLocator(k.locator);if(i.isObject(a)){try{b.each(e.split("."),function(b,c){d=(d?d:a)[c]})}catch(f){}d?i.isArray(d)||c("dataSource."+e+" must be an Array."):c("dataSource."+e+" is undefined.")}return d||a},parseDataSource:function(a,d){var e=this,f=arguments;i.isObject(a)?d(k.dataSource=e.filterDataByLocator(a)):i.isArray(a)?d(k.dataSource=a):b.isFunction(a)?k.dataSource(function(a){b.isFunction(a)&&c('Unexpect parameter of the "done" Function.'),f.callee.call(e,a,d)}):"string"==typeof a?(/^https?|file:/.test(a)&&(k.ajaxDataType="jsonp"),d(a)):c('Unexpect data type of the "dataSource".')},callHook:function(c){var d,e=f.data("pagination"),g=Array.prototype.slice.apply(arguments);return g.shift(),k[c]&&b.isFunction(k[c])&&k[c].apply(a,g)===!1&&(d=!1),e.hooks&&e.hooks[c]&&b.each(e.hooks[c],function(b,c){c.apply(a,g)===!1&&(d=!1)}),d!==!1},observer:function(){var a=this,d=a.model.el;f.on(h+"go",function(d,e,f){e=parseInt(b.trim(e)),e&&(b.isNumeric(e)||c('"pageNumber" is incorrect. (Number)'),a.go(e,f))}),d.delegate(".J-paginationjs-page","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return!e||d.hasClass(k.disableClassName)||d.hasClass(k.activeClassName)?void 0:a.callHook("beforePageOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPageOnClick",c),k.pageLink?void 0:!1)}),d.delegate(".J-paginationjs-previous","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(k.disableClassName)?a.callHook("beforePreviousOnClick",c)===!1?!1:(a.go(e),a.callHook("afterPreviousOnClick",c),k.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-next","click",function(c){var d=b(c.currentTarget),e=b.trim(d.attr("data-num"));return e&&!d.hasClass(k.disableClassName)?a.callHook("beforeNextOnClick",c)===!1?!1:(a.go(e),a.callHook("afterNextOnClick",c),k.pageLink?void 0:!1):void 0}),d.delegate(".J-paginationjs-go-button","click",function(){var c=b(".J-paginationjs-go-pagenumber",d).val();return a.callHook("beforeGoButtonOnClick",event,c)===!1?!1:(f.trigger(h+"go",c),void a.callHook("afterGoButtonOnClick",event,c))}),d.delegate(".J-paginationjs-go-pagenumber","keyup",function(c){if(13===c.which){var e=b(c.currentTarget).val();if(a.callHook("beforeGoInputOnEnter",c,e)===!1)return!1;f.trigger(h+"go",e),b(".J-paginationjs-go-pagenumber",d).focus(),a.callHook("afterGoInputOnEnter",c,e)}}),f.on(h+"previous",function(b,c){a.previous(c)}),f.on(h+"next",function(b,c){a.next(c)}),f.on(h+"disable",function(){a.disable()}),f.on(h+"enable",function(){a.enable()}),f.on(h+"show",function(){a.show()}),f.on(h+"hide",function(){a.hide()}),f.on(h+"destroy",function(){a.destroy()}),(g.sync||k.triggerPagingOnInit)&&f.trigger(h+"go",Math.min(k.pageNumber,a.model.totalPage))}};if(f.data("pagination")&&f.data("pagination").initialized===!0){if(b.isNumeric(e))return f.trigger.call(this,h+"go",e,arguments[1]),this;if("string"==typeof e){var j=Array.prototype.slice.apply(arguments);switch(j[0]=h+j[0],e){case"previous":case"next":case"go":case"disable":case"enable":case"show":case"hide":case"destroy":f.trigger.apply(this,j);break;case"getSelectedPageNum":return f.data("pagination").model?f.data("pagination").model.pageNumber:f.data("pagination").attributes.pageNumber;case"getTotalPage":return f.data("pagination").model.totalPage;case"getSelectedPageData":return f.data("pagination").currentPageData;case"isDisabled":return f.data("pagination").model.disabled===!0;default:c("Pagination do not provide action: "+e)}return this}}else i.isObject(e)||c("options is illegal");var k=b.extend({},arguments.callee.defaults,e);return d(k),g.initialize(),this},b.fn[f].defaults={totalNumber:1,pageNumber:1,pageSize:10,pageRange:2,showPrevious:!0,showNext:!0,showPageNumbers:!0,showNavigator:!1,showGoInput:!1,showGoButton:!1,pageLink:"",prevText:"«",nextText:"»",ellipsisText:"...",goButtonText:"Go",classPrefix:"paginationjs",activeClassName:"active",disableClassName:"disabled",inlineStyle:!0,formatNavigator:"<%= currentPage %> / <%= totalPage %>",formatGoInput:"<%= input %>",formatGoButton:"<%= button %>",position:"bottom",autoHidePrevious:!1,autoHideNext:!1,triggerPagingOnInit:!0,hideWhenLessThanOnePage:!1,showFirstOnEllipsisShow:!0,showLastOnEllipsisShow:!0,callback:function(){}},b.fn[g]=function(a,d){arguments.length<2&&c("Missing argument."),b.isFunction(d)||c("callback must be a function.");var e=b(this),f=e.data("pagination");f||(e.data("pagination",{}),f=e.data("pagination")),!f.hooks&&(f.hooks={}),f.hooks[a]=f.hooks[a]||[],f.hooks[a].push(d)},b[f]=function(a,d){arguments.length<2&&c("Requires two parameters.");var e;return e="string"!=typeof a&&a instanceof jQuery?a:b(a),e.length?(e.pagination(d),e):void 0};var i={};b.each(["Object","Array"],function(a,b){i["is"+b]=function(a){return e(a)===b.toLowerCase()}}),"function"==typeof define&&(define.amd||define.cmd)&&define(function(){return b})}(this,window.jQuery); \ No newline at end of file From 753cc9bfdee5e2800fe4fd460a8a16fb45caa189 Mon Sep 17 00:00:00 2001 From: superRaytin Date: Sun, 18 Jan 2015 18:25:17 +0800 Subject: [PATCH 4/4] Update to 2.0.5. --- bower.json | 2 +- component.json | 11 +++++++++-- dist/pagination-with-styles.min.js | 2 +- dist/pagination.min.js | 2 +- examples/pagination.html | 12 ++++++------ package.json | 2 +- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/bower.json b/bower.json index 3c92137..dba5ff3 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "paginationjs", - "version": "2.0.0", + "version": "2.0.5", "main": "./pagination.min.js", "ignore": [ "**/.*", diff --git a/component.json b/component.json index 5040c80..8eaf11a 100644 --- a/component.json +++ b/component.json @@ -1,6 +1,6 @@ { "name": "paginationjs", - "version": "2.0.0", + "version": "2.0.5", "repo": "superRaytin/paginationjs", "description": "A jQuery plugin to provide simple yet fully customisable pagination", "keywords": [ @@ -11,6 +11,13 @@ "jquery pagination" ], "main": "dist/pagination.min.js", - "scripts": ["dist/pagination.min.js", "dist/pagination.js"], + "scripts": [ + "dist/pagination.min.js", + "dist/pagination.js", + "dist/pagination-with-styles.min.js", + "dist/pagination-with-styles.js", + "dist/pagination.css", + "dist/pagination.less" + ], "license": "MIT" } diff --git a/dist/pagination-with-styles.min.js b/dist/pagination-with-styles.min.js index 8ac519a..35148b7 100644 --- a/dist/pagination-with-styles.min.js +++ b/dist/pagination-with-styles.min.js @@ -1,5 +1,5 @@ /* - * pagination.js 2.0.3 + * pagination.js 2.0.5 * A jQuery plugin to provide simple yet fully customisable pagination * https://github.com/superRaytin/paginationjs diff --git a/dist/pagination.min.js b/dist/pagination.min.js index 74520ca..b189d90 100644 --- a/dist/pagination.min.js +++ b/dist/pagination.min.js @@ -1,5 +1,5 @@ /* - * pagination.js 2.0.3 + * pagination.js 2.0.5 * A jQuery plugin to provide simple yet fully customisable pagination * https://github.com/superRaytin/paginationjs diff --git a/examples/pagination.html b/examples/pagination.html index 1ddf74e..ce6f143 100644 --- a/examples/pagination.html +++ b/examples/pagination.html @@ -4,7 +4,7 @@ Paginationjs example