From dc85c6989323905964d66ecf431fdcbf7bf46076 Mon Sep 17 00:00:00 2001 From: Catouse Date: Fri, 14 Nov 2014 17:50:55 +0800 Subject: [PATCH] * rebuilt js. --- dist/js/zui.js | 58 ++++++++++++++----------- dist/js/zui.lite.js | 7 +-- dist/js/zui.lite.min.js | 6 +-- dist/js/zui.min.js | 8 ++-- dist/lib/datatable/zui.datatable.js | 53 ++++++++++++---------- dist/lib/datatable/zui.datatable.min.js | 4 +- docs/javascript.html | 2 - docs/js/zui.js | 58 ++++++++++++++----------- docs/js/zui.min.js | 8 ++-- 9 files changed, 113 insertions(+), 91 deletions(-) diff --git a/dist/js/zui.js b/dist/js/zui.js index f685599c5..394488287 100644 --- a/dist/js/zui.js +++ b/dist/js/zui.js @@ -1,5 +1,5 @@ /*! - * ZUI - v1.2.0 - 2014-11-13 + * ZUI - v1.2.0 - 2014-11-14 * http://zui.sexy * GitHub: https://github.com/easysoft/zui.git * Copyright (c) 2014 cnezsoft.com; Licensed MIT @@ -1358,7 +1358,7 @@ var lsName = 'localStorage'; var storage = window[lsName], old = window.store, - pageName = 'page_' + window.location.pathname; + pageName = 'page_' + window.location.pathname + window.location.search; /* The Store object */ var Store = function() @@ -3427,6 +3427,8 @@ var $tip = this.tip() var target = this.getTarget() + if(this.options.id) $tip.attr('id', this.options.id) + if(target) { if(target.find('.arrow').length < 1) @@ -3435,7 +3437,6 @@ return } - var title = this.getTitle() var content = this.getContent() @@ -5978,6 +5979,9 @@ // Sort options sortable: false, // enable sorter + // storage + storage: true, // enable storage + // fixed header of columns fixedHeader: true, // fixed header fixedHeaderOffset: 0, // set top offset of header when fixed @@ -6510,7 +6514,7 @@ $datatable.toggleClass('scrolled-in', barLeft > 2) .toggleClass('scrolled-out', barLeft < flexWidth - scrollWidth - 2); - store.pageSet(scrollOffsetStoreName, barLeft); + if(options.storage) store.pageSet(scrollOffsetStoreName, barLeft); }; var resizeScrollbar = function() { @@ -6535,7 +6539,7 @@ }; // $scrollbar.resize(resizeScrollbar); // todo: unuseful? $flexArea.resize(resizeScrollbar); - resizeScrollbar(); + if(options.storage) resizeScrollbar(); var dragOptions = { move: false, @@ -6592,7 +6596,7 @@ }); $headSpans.find('.check-all').toggleClass('checked', checkedStatus.checkedAll); - store.pageSet(checkedStatusStoreName, checkedStatus); + if(options.storage) store.pageSet(checkedStatusStoreName, checkedStatus); that.callEvent('checksChanged', { @@ -6620,25 +6624,28 @@ syncChecks(); }); - var checkedStatus = store.pageGet(checkedStatusStoreName); - if (checkedStatus) + if(options.storage) { - $headSpans.find('.check-all').toggleClass('checked', checkedStatus.checkedAll); - if (checkedStatus.checkedAll) - { - $rows.addClass(checkedClass); - } - else + var checkedStatus = store.pageGet(checkedStatusStoreName); + if (checkedStatus) { - $rows.removeClass(checkedClass); - $.each(checkedStatus.checks, function(index, ele) + $headSpans.find('.check-all').toggleClass('checked', checkedStatus.checkedAll); + if (checkedStatus.checkedAll) { - $rows.filter('[data-id="' + ele + '"]').addClass(checkedClass); - }); - } - if (checkedStatus.checks.length) - { - syncChecks(); + $rows.addClass(checkedClass); + } + else + { + $rows.removeClass(checkedClass); + $.each(checkedStatus.checks, function(index, ele) + { + $rows.filter('[data-id="' + ele + '"]').addClass(checkedClass); + }); + } + if (checkedStatus.checks.length) + { + syncChecks(); + } } } } @@ -6689,9 +6696,10 @@ // Sort table DataTable.prototype.sortTable = function($th) { - var store = window.store; + var store = window.store, + options = this.options; var sorterStoreName = this.id + '_datatableSorter'; - var sorter = store.pageGet(sorterStoreName); + var sorter = options.storage ? store.pageGet(sorterStoreName) : null; if (!$th) { @@ -6797,7 +6805,7 @@ }; // save sort with local storage - store.pageSet(sorterStoreName, sorter); + if(options.storage) store.pageSet(sorterStoreName, sorter); this.callEvent('sort', { diff --git a/dist/js/zui.lite.js b/dist/js/zui.lite.js index 6ac2be093..b0a1840a8 100644 --- a/dist/js/zui.lite.js +++ b/dist/js/zui.lite.js @@ -1,5 +1,5 @@ /*! - * ZUI - v1.2.0 - 2014-11-13 + * ZUI - v1.2.0 - 2014-11-14 * http://zui.sexy * GitHub: https://github.com/easysoft/zui.git * Copyright (c) 2014 cnezsoft.com; Licensed MIT @@ -1068,7 +1068,7 @@ var lsName = 'localStorage'; var storage = window[lsName], old = window.store, - pageName = 'page_' + window.location.pathname; + pageName = 'page_' + window.location.pathname + window.location.search; /* The Store object */ var Store = function() @@ -2654,6 +2654,8 @@ var $tip = this.tip() var target = this.getTarget() + if(this.options.id) $tip.attr('id', this.options.id) + if(target) { if(target.find('.arrow').length < 1) @@ -2662,7 +2664,6 @@ return } - var title = this.getTitle() var content = this.getContent() diff --git a/dist/js/zui.lite.min.js b/dist/js/zui.lite.min.js index 7f210d326..b211a7ac2 100644 --- a/dist/js/zui.lite.min.js +++ b/dist/js/zui.lite.min.js @@ -1,5 +1,5 @@ /*! - * ZUI - v1.2.0 - 2014-11-13 + * ZUI - v1.2.0 - 2014-11-14 * http://zui.sexy * GitHub: https://github.com/easysoft/zui.git * Copyright (c) 2014 cnezsoft.com; Licensed MIT @@ -7,5 +7,5 @@ /* Some code copy from Bootstrap v3.0.0 by @fat and @mdo. (Copyright 2013 Twitter, Inc. Licensed under http://www.apache.org/licenses/)*/ -!function(a,b,c){"use strict";if("undefined"==typeof a)throw new Error("ZUI requires jQuery");a.extend({uuid:function(){for(var a=(new Date).getTime();1e16>a;)a*=10;return a+c.floor(9999*c.random())},getPropertyCount:function(a){return"object"!=typeof a||null===a?0:Object.getOwnPropertyNames(a).length},callEvent:function(b,c,d){return a.isFunction(b)?("undefined"!=typeof d&&(b=a.proxy(b,d)),c.result=b(c),!(void 0!==c.result&&!c.result)):1},clientLang:function(){var c;if("undefined"!=typeof b.config&&b.config.clientLang)c=b.config.clientLang;else{var d=a("html").attr("lang");c=d?d:navigator.userLanguage||navigator.userLanguage||"zh_cn"}return c.replace("-","_").toLowerCase()}}),a.fn.callEvent=function(b,c,d){var e=a(this),f=b.indexOf(".zui."),g=b;0>f&&d&&d.name?b+="."+d.name:g=b.substring(0,f);var h=a.Event(b,c);if("undefined"==typeof d&&f>0&&(d=e.data(b.substring(f+1))),d&&d.options){var i=d.options[g];a.isFunction(i)&&a.callEvent(d.options[g],h,d)}return h}}(jQuery,window,Math),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(window.jQuery),function(a,b){"use strict";var c=1200,d=992,e=768,f={desktop:"screen-desktop",desktopLg:"screen-desktop-wide",tablet:"screen-tablet",phone:"screen-phone",isMobile:"device-mobile",isDesktop:"device-desktop"},g=b(a),h=function(){var a=g.width();b("html").toggleClass(f.desktop,a>=d&&c>a).toggleClass(f.desktopLg,a>=c).toggleClass(f.tablet,a>=e&&d>a).toggleClass(f.phone,e>a).toggleClass(f.isMobile,d>a).toggleClass(f.isDesktop,a>=d)};g.resize(h),h()}(window,jQuery),function(a,b){"use strict";var c={zh_cn:'您的浏览器版本过低,无法体验所有功能,建议升级或者更换浏览器。 了解更多...',zh_tw:'您的瀏覽器版本過低,無法體驗所有功能,建議升級或者更换瀏覽器。了解更多...',en:'Your browser is too old, it has been unable to experience the colorful internet. We strongly recommend that you upgrade a better one. Learn more...'},d=function(){var a=this.isIE,b=a();if(b)for(var c=10;c>5;c--)if(a(c)){b=c;break}this.ie=b,this.cssHelper()};d.prototype.cssHelper=function(){var a=this.ie,c=b("html");c.toggleClass("ie",a).removeClass("ie-6 ie-7 ie-8 ie-9 ie-10"),a&&c.addClass("ie-"+a).toggleClass("gt-ie-7 gte-ie-8 support-ie",a>=8).toggleClass("lte-ie-7 lt-ie-8 outdated-ie",8>a).toggleClass("gt-ie-8 gte-ie-9",a>=9).toggleClass("lte-ie-8 lt-ie-9",9>a).toggleClass("gt-ie-9 gte-ie-10",a>=10).toggleClass("lte-ie-9 lt-ie-10",10>a)},d.prototype.tip=function(){if(this.ie&&this.ie<8){var a=b("#browseHappyTip");a.length||(a=b('
'),a.prependTo("body")),a.find(".content").html(this.browseHappyTip||c[b.clientLang()||"zh_cn"])}},d.prototype.isIE=function(a){var b=document.createElement("b");return b.innerHTML="",1===b.getElementsByTagName("i").length},d.prototype.isIE10=function(){return!1},a.browser=new d,b(function(){b("body").hasClass("disabled-browser-tip")||a.browser.tip()})}(window,jQuery),function(){"use strict";Date.ONEDAY_TICKS=864e5,Date.prototype.format=function(a){var b={"M+":this.getMonth()+1,"d+":this.getDate(),"h+":this.getHours(),"m+":this.getMinutes(),"s+":this.getSeconds(),"q+":Math.floor((this.getMonth()+3)/3),"S+":this.getMilliseconds()};/(y+)/i.test(a)&&(a=a.replace(RegExp.$1,(this.getFullYear()+"").substr(4-RegExp.$1.length)));for(var c in b)new RegExp("("+c+")").test(a)&&(a=a.replace(RegExp.$1,1==RegExp.$1.length?b[c]:("00"+b[c]).substr((""+b[c]).length)));return a},Date.prototype.addMilliseconds=function(a){return this.setTime(this.getTime()+a),this},Date.prototype.addDays=function(a){return this.addMilliseconds(a*Date.ONEDAY_TICKS),this},Date.prototype.clone=function(){var a=new Date;return a.setTime(this.getTime()),a},Date.isLeapYear=function(a){return a%4===0&&a%100!==0||a%400===0},Date.getDaysInMonth=function(a,b){return[31,Date.isLeapYear(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]},Date.prototype.isLeapYear=function(){return Date.isLeapYear(this.getFullYear())},Date.prototype.clearTime=function(){return this.setHours(0),this.setMinutes(0),this.setSeconds(0),this.setMilliseconds(0),this},Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())},Date.prototype.addMonths=function(a){var b=this.getDate();return this.setDate(1),this.setMonth(this.getMonth()+a),this.setDate(Math.min(b,this.getDaysInMonth())),this},Date.prototype.getLastWeekday=function(a){a=a||1;for(var b=this.clone();b.getDay()!=a;)b.addDays(-1);return b.clearTime(),b},Date.prototype.isSameDay=function(a){return a.toDateString()===this.toDateString()},Date.prototype.isSameWeek=function(a){var b=this.getLastWeekday(),c=b.clone().addDays(7);return a>=b&&c>a},Date.prototype.isSameYear=function(a){return this.getFullYear()===a.getFullYear()}}(),function(){"use strict";String.prototype.format=function(a){var b=this;if(arguments.length>0){var c;if(1==arguments.length&&"object"==typeof a)for(var d in a)void 0!==a[d]&&(c=new RegExp("({"+d+"})","g"),b=b.replace(c,a[d]));else for(var e=0;e=0;a--)delete this.page[c[a]];this.set(f,this.page)}},g.prototype.pageRemove=function(a){"undefined"!=typeof this.page[a]&&(this.page[a]=null,this.pageSave())},g.prototype.pageClear=function(){this.page={},this.pageSave()},g.prototype.pageGet=function(a,b){var c=this.page[a];return void 0===b||null!==c&&void 0!==c?c:b},g.prototype.pageSet=function(a,c){b.isPlainObject(a)?b.extend(!0,this.page,a):this.page[this.serialize(a)]=c,this.pageSave()},g.prototype.check=function(){if(!this.enable&&!this.slience)throw new Error("Browser not support localStorage or enable status been set true.");return this.enable},g.prototype.length=function(){return this.check()?d.getLength?d.getLength():d.length:0},g.prototype.removeItem=function(a){return d.removeItem(a),this},g.prototype.remove=function(a){return this.removeItem(a)},g.prototype.getItem=function(a){return d.getItem(a)},g.prototype.get=function(a,b){var c=this.deserialize(this.getItem(a));return void 0===b||"undefined"!=typeof c&&null!==c&&void 0!==c?c:b},g.prototype.key=function(a){return d.key(a)},g.prototype.setItem=function(a,b){return d.setItem(a,b),this},g.prototype.set=function(a,b){return void 0===b?this.remove(a):(this.setItem(a,this.serialize(b)),this)},g.prototype.clear=function(){return d.clear(),this},g.prototype.forEach=function(a){for(var b=d.length-1;b>=0;b--){var c=d.key(b);a(c,this.get(c))}return this},g.prototype.getAll=function(){var a={};return this.forEach(function(b,c){a[b]=c}),a},g.prototype.serialize=function(a){return"string"==typeof a?a:JSON.stringify(a)},g.prototype.deserialize=function(a){if("string"!=typeof a)return void 0;try{return JSON.parse(a)}catch(b){return a||void 0}};var h=new g;a.store=h,a.store.noConflict=function(){return a.store=e,h}}(window,jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(window.jQuery),+function(a){"use strict";function b(b,d,e){return this.each(function(){var f=a(this),g=f.data("zui.modal"),h=a.extend({},c.DEFAULTS,f.data(),"object"==typeof b&&b);g||f.data("zui.modal",g=new c(this,h)),"string"==typeof b?g[b](d,e):h.show&&g.show(d,e)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.zui.modal")},this))};c.VERSION="3.2.0",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0,position:"fit"},c.prototype.toggle=function(a,b){return this.isShown?this.hide():this.show(a,b)},c.prototype.ajustPosition=function(b){if("undefined"==typeof b&&(b=this.options.position),"undefined"!=typeof b){var c=this.$element.find(".modal-dialog"),d=Math.max(0,(a(window).height()-c.outerHeight())/2),e="fit"==b?2*d/3:"center"==b?d:b;c.css("margin-top",e)}},c.prototype.show=function(b,d){var e=this,f=a.Event("show.zui.modal",{relatedTarget:b});this.$element.trigger(f),this.isShown||f.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.zui.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var f=a.support.transition&&e.$element.hasClass("fade");e.$element.parent().length||e.$element.appendTo(e.$body),e.$element.show().scrollTop(0),f&&e.$element[0].offsetWidth,e.$element.addClass("in").attr("aria-hidden",!1),e.ajustPosition(d),e.enforceFocus();var g=a.Event("shown.zui.modal",{relatedTarget:b});f?e.$element.find(".modal-dialog").one("bsTransitionEnd",function(){e.$element.trigger("focus").trigger(g)}).emulateTransitionEnd(c.TRANSITION_DURATION):e.$element.trigger("focus").trigger(g)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.zui.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),a(document).off("focusin.zui.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.zui.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.zui.modal").on("focusin.zui.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?a(document).on("keydown.dismiss.zui.modal",a.proxy(function(b){if(27==b.which){var c=a.Event("escaping.bs.modal"),d=this.$element.triggerHandler(c,"esc");if(void 0!=d&&!d)return;this.hide()}},this)):this.isShown||a(document).off("keydown.dismiss.zui.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$element.trigger("hidden.zui.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a('