diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index 1e9153b37ee122381c7d04c132b5fc1fe69049f9..4e3c034e62a4eed342591f0cc4fb2d4a8338fe55 100644 --- a/application/admin/lang/zh-cn.php +++ b/application/admin/lang/zh-cn.php @@ -38,6 +38,7 @@ return [ 'Reset' => '重置', 'Execute' => '执行', 'Close' => '关闭', + 'Choose' => '选择', 'Search' => '搜索', 'Refresh' => '刷新', 'First' => '首页', @@ -84,6 +85,7 @@ return [ 'Network error' => '网络错误!', 'Issues & Wiki' => '问题交流', 'Advanced search' => '高级搜索', + 'Common search' => '普通搜索', '%d second%s ago' => '%d秒前', '%d minute%s ago' => '%d分钟前', '%d hour%s ago' => '%d小时前', diff --git a/application/extra/upload.php b/application/extra/upload.php index 93504bfae41a75db897ab71fd397699bb92b7ee6..d92c7faf8752e58fb7bd763b6a749810c23bf4d6 100644 --- a/application/extra/upload.php +++ b/application/extra/upload.php @@ -7,9 +7,9 @@ return [ */ 'uploadurl' => 'ajax/upload', /** - * 又拍云或本机的CDN地址 + * 本机的CDN地址或又拍云http://yourbucketname.b0.upaiyun.com */ - 'cdnurl' => 'http://yourbucketname.b0.upaiyun.com', + 'cdnurl' => '', /** * 上传成功后的通知地址 */ diff --git a/public/assets/js/backend/general/attachment.js b/public/assets/js/backend/general/attachment.js index a9ec03c818219cf22b1b7e2418c6adb7b4d9bd70..c8737eee1a1a6a388a7dbd1440254bf01ec8b1a7 100644 --- a/public/assets/js/backend/general/attachment.js +++ b/public/assets/js/backend/general/attachment.js @@ -35,7 +35,10 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table', 'config'], function ( {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime}, {field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate} ] - ] + ], + //普通搜索 + commonSearch: true, + titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索 }); // 为表格绑定事件 @@ -56,7 +59,8 @@ define(['jquery', 'bootstrap', 'backend', 'form', 'table', 'config'], function ( thumb: function (value, row, index) { //console.log(row); if (row.mimetype.indexOf("image") > -1) { - if (Config.upload.bucket.replace(/^\s+|\s+$/gm, '').length === 0) { + var reg = /ajax\/upload$/; + if (reg.test(Config.upload.uploadurl)) { return ''; } else { return ''; diff --git a/public/assets/js/backend/page.js b/public/assets/js/backend/page.js index 28118e133a4f4af1f4550aa10ac4d94454794c08..ebee2b6b658f78a8e813fac90da8b863f2a2c82f 100644 --- a/public/assets/js/backend/page.js +++ b/public/assets/js/backend/page.js @@ -23,25 +23,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin columns: [ [ {field: 'state', checkbox: true}, - {field: 'id', title: __('Id')}, - {field: 'category_id', title: __('Category_id')}, - {field: 'title', title: __('Title')}, - {field: 'keywords', title: __('Keywords')}, - {field: 'flag', title: __('Flag'), formatter: Table.api.formatter.flag}, - {field: 'image', title: __('Image'), formatter: Table.api.formatter.image}, - {field: 'icon', title: __('Icon'), formatter: Table.api.formatter.icon}, - {field: 'views', title: __('Views')}, - {field: 'comments', title: __('Comments')}, - {field: 'weigh', title: __('Weigh')}, - {field: 'status', title: __('Status'), formatter: Table.api.formatter.status}, + {field: 'id', title: __('Id'), operate: false}, + {field: 'category_id', title: __('Category_id'), operate: '='}, + {field: 'title', title: __('Title'), operate: 'LIKE %...%', placeholder: '标题,模糊搜索', style: 'width:200px'}, + {field: 'keywords', title: __('Keywords'), operate: 'LIKE %...%', placeholder: '关键字,模糊搜索'}, + {field: 'flag', title: __('Flag'), formatter: Table.api.formatter.flag, operate: false}, + {field: 'image', title: __('Image'), formatter: Table.api.formatter.image, operate: false}, + {field: 'icon', title: __('Icon'), formatter: Table.api.formatter.icon, operate: false}, + {field: 'views', title: __('Views'), operate: false}, + {field: 'comments', title: __('Comments'), operate: false}, + {field: 'weigh', title: __('Weigh'), operate: false}, + {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {'normal': '正常', 'hidden': '隐藏'}, style: 'min-width:100px;'}, + {field: 'createtime', title: __('Create Time'), formatter: Table.api.formatter.datetime, operate: 'BETWEEN', type: 'datetime', addclass: 'datetimepicker', data: 'data-date-format="YYYY-MM-DD"'}, {field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: Table.api.formatter.operate} ] - ] + ], + //普通搜索 + commonSearch: true, + titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索 }); // 为表格绑定事件 Table.api.bindevent(table); - parent.window.Backend.api.sidebar({'auth/admin':44}); }, add: function () { Controller.api.bindevent(); diff --git a/public/assets/js/bootstrap-table-advancedsearch.js b/public/assets/js/bootstrap-table-advancedsearch.js index a63258f25e354136b1e29c316aeaf9e658dc27c0..447401243e99441ea4758c651f4343720e495715 100644 --- a/public/assets/js/bootstrap-table-advancedsearch.js +++ b/public/assets/js/bootstrap-table-advancedsearch.js @@ -152,19 +152,19 @@ }); $.extend($.fn.bootstrapTable.locales, { formatAdvancedSearch: function () { - return 'Advanced search'; + return __('Advanced search'); }, formatAdvancedSubmitButton: function () { - return "Submit"; + return __("Submit"); }, formatAdvancedResetButton: function () { - return "Reset"; + return __("Reset"); }, formatAdvancedCloseButton: function () { - return "Close"; + return __("Close"); }, formatAdvancedChoose: function () { - return "Choose"; + return __("Choose"); } }); diff --git a/public/assets/js/bootstrap-table-commonsearch.js b/public/assets/js/bootstrap-table-commonsearch.js new file mode 100644 index 0000000000000000000000000000000000000000..1f03d75c63af47837b9500de2315dcca0648d5c3 --- /dev/null +++ b/public/assets/js/bootstrap-table-commonsearch.js @@ -0,0 +1,324 @@ +/** + * @author: pppscn <35696959@qq.com> + * @version: v0.0.1 + * + * @update 2017-05-07 + */ + +!function ($) { + 'use strict'; + + var firstLoad = false; + + var sprintf = $.fn.bootstrapTable.utils.sprintf; + + var showCommonSearch = function (pColumns, that) { + + var vFormCommon = createFormCommon(pColumns, that), timeoutId = 0; + + var vModal = sprintf("
", that.options.idTable); + vModal += vFormCommon.join(''); + vModal += "
"; + $("#myTabContent").before($(vModal)); + + if (that.options.sidePagination != 'server' || !that.options.url) { + $('#' + that.options.idForm).off('keyup blur', 'input').on('keyup blur', 'input', function (event) { + clearTimeout(timeoutId); + timeoutId = setTimeout(function () { + that.onColumnCommonSearch(event); + }, that.options.searchTimeOut); + }); + } + + //绑定日期时间元素事件 + var form = $("#" + that.options.idForm); + if ($(".datetimepicker", form).size() > 0) { + require(['bootstrap-datetimepicker'], function () { + $('.datetimepicker', form).parent().css('position', 'relative'); + $('.datetimepicker', form).datetimepicker({ + //format: 'YYYY-MM-DD', + icons: { + time: 'fa fa-clock-o', + date: 'fa fa-calendar', + up: 'fa fa-chevron-up', + down: 'fa fa-chevron-down', + previous: 'fa fa-chevron-left', + next: 'fa fa-chevron-right', + today: 'fa fa-history', + clear: 'fa fa-trash', + close: 'fa fa-remove' + }, + showTodayButton: true, + showClose: true + }); + }); + } + + // 提交搜索 + $("#btnSubmitCommon" + "_" + that.options.idTable).click(function (event) { + that.onColumnCommonSearch(); + }); + + // 重置搜索 + $("#btnResetCommon" + "_" + that.options.idTable).click(function () { + $("#commonSearchModalContent" + "_" + that.options.idTable + " form")[0].reset(); + that.onColumnCommonSearch(); + }); + + }; + + var createFormCommon = function (pColumns, that) { + var htmlForm = []; + var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL']; + //var selectList = []; + //for (var i = 0; i < opList.length; i++) { + // selectList.push(""); + //} + //var selectHtml = selectList.join(''); + htmlForm.push(sprintf('
', that.options.idForm, that.options.actionForm)); + htmlForm.push('
'); + if (that.options.titleForm.length > 0) + htmlForm.push(sprintf("%s", that.options.titleForm)); + for (var i in pColumns) { + var vObjCol = pColumns[i]; + if (!vObjCol.checkbox && vObjCol.field !== 'operate' && vObjCol.visible && vObjCol.searchable && vObjCol.operate !== false) { + htmlForm.push('
'); + htmlForm.push(sprintf('', vObjCol.field, vObjCol.title)); + if (that.options.sidePagination == 'server' && that.options.url) { + //htmlForm.push('
'); + //htmlForm.push(sprintf('', vObjCol.field, vObjCol.field, selectHtml)); + vObjCol.operate = (typeof vObjCol.operate === 'undefined' || $.inArray(vObjCol.operate, opList) === -1) ? '=' : vObjCol.operate; + htmlForm.push(sprintf('', vObjCol.field, vObjCol.field, vObjCol.operate)); + //htmlForm.push('
'); + } + + //htmlForm.push('
'); + var style = typeof vObjCol.style === 'undefined' ? '' : sprintf('style="%s"', vObjCol.style); + if (vObjCol.searchList) { + if (typeof vObjCol.searchList == 'function') { + htmlForm.push(vObjCol.searchList.call(this, vObjCol)); + } else { + var isArray = vObjCol.searchList.constructor === Array; + var searchList = []; + searchList.push(sprintf('', $.fn.bootstrapTable.locales.formatCommonChoose())); + $.each(vObjCol.searchList, function (key, value) { + searchList.push(""); + }); + htmlForm.push(sprintf('', vObjCol.field, style, searchList.join(''))); + } + } else { + var placeholder = typeof vObjCol.placeholder === 'undefined' ? vObjCol.title : vObjCol.placeholder; + var type = typeof vObjCol.type === 'undefined' ? 'text' : vObjCol.type; + var addclass = typeof vObjCol.addclass === 'undefined' ? 'form-control' : 'form-control ' + vObjCol.addclass; + var data = typeof vObjCol.data === 'undefined' ? '' : vObjCol.data; + htmlForm.push(sprintf('', type, addclass, vObjCol.field, placeholder, vObjCol.field, style, data)); + var reg = /BETWEEN$/; + if (reg.test(vObjCol.operate)) { + htmlForm.push(sprintf(' - ', type, addclass, vObjCol.field, placeholder, vObjCol.field, style, data)); + } + } + + //htmlForm.push('
'); + htmlForm.push('
'); + } + } + + htmlForm.push('
'); + htmlForm.push(createFormBtn(that).join('')); + htmlForm.push('
'); + htmlForm.push('
'); + htmlForm.push('
'); + + return htmlForm; + }; + + var createFormBtn = function (that) { + var htmlBtn = []; + var searchSubmit = that.options.formatCommonSubmitButton(); + var searchReset = that.options.formatCommonResetButton(); + var searchClose = that.options.formatCommonCloseButton(); + htmlBtn.push('
'); + htmlBtn.push('
'); + if (that.options.sidePagination == 'server' && that.options.url) { + htmlBtn.push(sprintf(' ', "_" + that.options.idTable, searchSubmit)); + htmlBtn.push(sprintf(' ', "_" + that.options.idTable, searchReset)); + } else { + htmlBtn.push(sprintf(' ', "_" + that.options.idTable, searchClose)); + } + htmlBtn.push('
'); + htmlBtn.push('
'); + return htmlBtn; + }; + + $.extend($.fn.bootstrapTable.defaults, { + commonSearch: false, + idForm: 'commonSearch', + titleForm: __("Common search"), + actionForm: '', + idTable: undefined, + onColumnCommonSearch: function (field, text) { + return false; + } + }); + + $.extend($.fn.bootstrapTable.defaults.icons, { + commonSearchIcon: 'glyphicon-search' + }); + + $.extend($.fn.bootstrapTable.Constructor.EVENTS, { + 'column-common-search.bs.table': 'onColumnCommonSearch' + }); + + $.extend($.fn.bootstrapTable.locales, { + formatCommonSearch: function () { + return __("Common search"); + }, + formatCommonSubmitButton: function () { + return __("Submit"); + }, + formatCommonResetButton: function () { + return __("Reset"); + }, + formatCommonCloseButton: function () { + return __("Close"); + }, + formatCommonChoose: function () { + return __("Choose"); + } + }); + + $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales); + + var BootstrapTable = $.fn.bootstrapTable.Constructor, + _initToolbar = BootstrapTable.prototype.initToolbar, + _load = BootstrapTable.prototype.load, + _initSearch = BootstrapTable.prototype.initSearch; + + BootstrapTable.prototype.initToolbar = function () { + _initToolbar.apply(this, Array.prototype.slice.apply(arguments)); + + if (!this.options.search) { + return; + } + + if (!this.options.commonSearch) { + return; + } + + if (!this.options.idTable) { + return; + } + + var that = this; + + showCommonSearch(that.columns, that); + }; + + BootstrapTable.prototype.load = function (data) { + _load.apply(this, Array.prototype.slice.apply(arguments)); + + if (!this.options.commonSearch) { + return; + } + + if (typeof this.options.idTable === 'undefined') { + return; + } else { + if (!firstLoad) { + var height = parseInt($(".bootstrap-table").height()); + height += 10; + $("#" + this.options.idTable).bootstrapTable("resetView", {height: height}); + firstLoad = true; + } + } + }; + + BootstrapTable.prototype.initSearch = function () { + _initSearch.apply(this, Array.prototype.slice.apply(arguments)); + + if (!this.options.commonSearch) { + return; + } + + var that = this; + var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial; + this.data = fp ? $.grep(this.data, function (item, i) { + for (var key in fp) { + var fval = fp[key].toLowerCase(); + var value = item[key]; + value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, + that.header.formatters[$.inArray(key, that.header.fields)], + [value, item, i], value); + + if (!($.inArray(key, that.header.fields) !== -1 && + (typeof value === 'string' || typeof value === 'number') && + (value + '').toLowerCase().indexOf(fval) !== -1)) { + return false; + } + } + return true; + }) : this.data; + }; + + BootstrapTable.prototype.onColumnCommonSearch = function (event) { + if (typeof event === 'undefined') { + var op = {}; + var filter = {}; + $("#commonSearchModalContent_" + this.options.idTable + " input.operate").each(function () { + var name = $(this).data("name"); + var sym = $(this).val(); + var obj = $("[name='" + name + "']"); + if (obj.size() == 0) + return true; + if (obj.size() > 1) { + if (/BETWEEN$/.test(sym)) { + var value_begin = $.trim($("[name='" + name + "']:first").val()), value_end = $.trim($("[name='" + name + "']:last").val()); + if (!value_begin.length || !value_end.length) { + return true; + } + //datetime类型字段转换成时间戳 + if ($("[name='" + name + "']:first").attr('type') === 'datetime') { + var datetimestamp = Date.parse(value_begin).toString(); + value_begin = datetimestamp.substr(0, datetimestamp.length - 3) - 28800; //TODO:Date.parse导致的时区差 + + datetimestamp = Date.parse(value_end).toString(); + value_end = datetimestamp.substr(0, datetimestamp.length - 3) - 28800; //TODO:Date.parse导致的时区差 + } + var value = value_begin + ',' + value_end; + } else { + var value = $("[name='" + name + "']:checked").val(); + } + } else { + var value = obj.val(); + } + + if (value == '' && sym.indexOf("NULL") == -1) { + return true; + } + + op[name] = sym; + filter[name] = value; + }); + // 追加查询关键字 + this.options.pageNumber = 1; + this.refresh({query: {filter: JSON.stringify(filter), op: JSON.stringify(op)}}); + + } else { + var text = $.trim($(event.currentTarget).val()); + var $field = $(event.currentTarget)[0].id; + + if ($.isEmptyObject(this.filterColumnsPartial)) { + this.filterColumnsPartial = {}; + } + if (text) { + this.filterColumnsPartial[$field] = text; + } else { + delete this.filterColumnsPartial[$field]; + } + this.options.pageNumber = 1; + this.onSearch(event); +// this.updatePagination(); + this.trigger('column-common-search', $field, text); + } + }; +}(jQuery); diff --git a/public/assets/js/require-backend.js b/public/assets/js/require-backend.js index 8e1dcb0c4ecd798f91a607dedfa0dc793f557d19..a8d665e0f8f1722a95f56d8bbf5c1a5a10604b8c 100644 --- a/public/assets/js/require-backend.js +++ b/public/assets/js/require-backend.js @@ -34,6 +34,7 @@ require.config({ 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min', 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile', 'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch', + 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch', 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN', 'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min', 'bloodhound': '../libs/typeahead.js/dist/bloodhound.min', @@ -78,6 +79,10 @@ require.config({ deps: ['bootstrap-table'], exports: '$.fn.bootstrapTable.defaults' }, + 'bootstrap-table-commonsearch': { + deps: ['bootstrap-table'], + exports: '$.fn.bootstrapTable.defaults' + }, 'tableexport': { deps: ['jquery'], exports: '$.fn.extend' diff --git a/public/assets/js/require-backend.min.js b/public/assets/js/require-backend.min.js index 186de16d1e30f9e51ccc21649c426eb24e5dfd9f..02fa2db5c8af03934cb9882a4ba49d1c82ce2108 100644 --- a/public/assets/js/require-backend.min.js +++ b/public/assets/js/require-backend.min.js @@ -51,6 +51,7 @@ require.config({ 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min', 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile', 'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch', + 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch', 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN', 'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min', 'bloodhound': '../libs/typeahead.js/dist/bloodhound.min', @@ -95,6 +96,10 @@ require.config({ deps: ['bootstrap-table'], exports: '$.fn.bootstrapTable.defaults' }, + 'bootstrap-table-commonsearch': { + deps: ['bootstrap-table'], + exports: '$.fn.bootstrapTable.defaults' + }, 'tableexport': { deps: ['jquery'], exports: '$.fn.extend' @@ -202,7 +207,7 @@ define('../libs/require-css/css.min',[],function(){if("undefined"==typeof window @Author:贤心 @Site:http://layer.layui.com @License:LGPL - + */ ;!function(window, undefined){ @@ -238,39 +243,39 @@ var layer = { layer.cache = ready.config = $.extend({}, ready.config, options); layer.path = ready.config.path || layer.path; typeof options.extend === 'string' && (options.extend = [options.extend]); - + if(ready.config.path) layer.ready(); - + if(!options.extend) return this; - - isLayui + + isLayui ? layui.addcss('modules/layer/' + options.extend) : layer.link('skin/' + options.extend); - + return this; }, - + //载入CSS配件 link: function(href, fn, cssname){ - + //未设置路径,则不主动加载css if(!layer.path) return; - + var head = $('head')[0], link = document.createElement('link'); if(typeof fn === 'string') cssname = fn; var app = (cssname || href).replace(/\.|\//g, ''); var id = 'layuicss-'+app, timeout = 0; - + link.rel = 'stylesheet'; link.href = layer.path + href; link.id = id; - + if(!$('#'+ id)[0]){ head.appendChild(link); } - + if(typeof fn !== 'function') return; - + //轮询css是否加载完毕 (function poll() { if(++timeout > 8 * 1000 / 100){ @@ -279,14 +284,14 @@ var layer = { parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100); }()); }, - + ready: function(callback){ var cssname = 'skinlayercss', ver = '1110'; isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname) : layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname); return this; }, - + //各种快捷引用 alert: function(content, options, yes){ var type = typeof options === 'function'; @@ -295,9 +300,9 @@ var layer = { content: content, yes: yes }, type ? {} : options)); - }, - - confirm: function(content, options, yes, cancel){ + }, + + confirm: function(content, options, yes, cancel){ var type = typeof options === 'function'; if(type){ cancel = yes; @@ -310,7 +315,7 @@ var layer = { btn2: cancel }, type ? {} : options)); }, - + msg: function(content, options, end){ //最常用提示层 var type = typeof options === 'function', rskin = ready.config.skin; var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg'; @@ -335,9 +340,9 @@ var layer = { options.skin = skin + ' ' + (options.skin||'layui-layer-hui'); } return options; - }())); + }())); }, - + load: function(icon, options){ return layer.open($.extend({ type: 3, @@ -345,8 +350,8 @@ var layer = { resize: false, shade: 0.01 }, options)); - }, - + }, + tips: function(content, follow, options){ return layer.open($.extend({ type: 4, @@ -361,7 +366,7 @@ var layer = { } }; -var Class = function(setings){ +var Class = function(setings){ var that = this; that.index = ++layer.index; that.config = $.extend({}, that.config, ready.config, setings); @@ -387,7 +392,7 @@ Class.pt.config = { area: 'auto', closeBtn: 1, time: 0, //0表示不自动关闭 - zIndex: 19891014, + zIndex: 19891014, maxWidth: 360, anim: 0, icon: -1, @@ -402,15 +407,15 @@ Class.pt.vessel = function(conType, callback){ var that = this, times = that.index, config = that.config; var zIndex = config.zIndex + times, titype = typeof config.title === 'object'; var ismax = config.maxmin && (config.type === 1 || config.type === 2); - var titleHTML = (config.title ? '
' - + (titype ? config.title[0] : config.title) + var titleHTML = (config.title ? '
' + + (titype ? config.title[0] : config.title) + '
' : ''); - + config.zIndex = zIndex; callback([ //遮罩 config.shade ? ('
') : '', - + //主体 '
' + (conType && config.type != 2 ? '' : titleHTML) @@ -445,22 +450,22 @@ Class.pt.creat = function(){ ,content = config.content ,conType = typeof content === 'object' ,body = $('body'); - + if($('#'+config.id)[0]) return; if(typeof config.area === 'string'){ config.area = config.area === 'auto' ? ['', ''] : [config.area, '']; } - + //anim兼容旧版shift if(config.shift){ config.anim = config.shift; } - + if(layer.ie == 6){ config.fixed = false; } - + switch(config.type){ case 0: config.btn = ('btn' in config) ? config.btn : ready.btn[0]; @@ -485,7 +490,7 @@ Class.pt.creat = function(){ config.tipsMore || layer.closeAll('tips'); break; } - + //建立容器 that.vessel(conType, function(html, titleHTML, moveElem){ body.append(html[0]); @@ -515,12 +520,12 @@ Class.pt.creat = function(){ config.type == 4 && that.tips(); }); } - + config.time <= 0 || setTimeout(function(){ layer.close(that.index) }, config.time); that.move().callback(); - + //为兼容jQuery3.0的css动画影响元素尺寸计算 if(doms.anim[config.anim]){ that.layero.addClass(doms.anim[config.anim]).data('anim', true); @@ -545,7 +550,7 @@ Class.pt.auto = function(index){ elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding'))|0)); } switch(config.type){ - case 2: + case 2: setHeight('iframe'); break; default: @@ -569,12 +574,12 @@ Class.pt.offset = function(){ var type = typeof config.offset === 'object'; that.offsetTop = (win.height() - area[1])/2; that.offsetLeft = (win.width() - area[0])/2; - + if(type){ that.offsetTop = config.offset[0]; that.offsetLeft = config.offset[1]||that.offsetLeft; } else if(config.offset !== 'auto'){ - + if(config.offset === 't'){ //上 that.offsetTop = 0; } else if(config.offset === 'r'){ //右 @@ -598,20 +603,20 @@ Class.pt.offset = function(){ } else { that.offsetTop = config.offset; } - + } - + if(!config.fixed){ - that.offsetTop = /%$/.test(that.offsetTop) ? + that.offsetTop = /%$/.test(that.offsetTop) ? win.height()*parseFloat(that.offsetTop)/100 : parseFloat(that.offsetTop); - that.offsetLeft = /%$/.test(that.offsetLeft) ? + that.offsetLeft = /%$/.test(that.offsetLeft) ? win.width()*parseFloat(that.offsetLeft)/100 : parseFloat(that.offsetLeft); that.offsetTop += win.scrollTop(); that.offsetLeft += win.scrollLeft(); } - + if(layero.attr('minLeft')){ that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0); that.offsetLeft = layero.css('left'); @@ -631,10 +636,10 @@ Class.pt.tips = function(){ top: follow.offset().top, left: follow.offset().left }, tipsG = layero.find('.layui-layer-TipsG'); - + var guide = config.tips[0]; config.tips[1] || tipsG.remove(); - + goal.autoLeft = function(){ if(goal.left + layArea[0] - win.width() > 0){ goal.tipLeft = goal.left + goal.width - layArea[0]; @@ -643,16 +648,16 @@ Class.pt.tips = function(){ goal.tipLeft = goal.left; }; }; - + //辨别tips的方位 - goal.where = [function(){ //上 + goal.where = [function(){ //上 goal.autoLeft(); goal.tipTop = goal.top - layArea[1] - 10; tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]); }, function(){ //右 goal.tipLeft = goal.left + goal.width + 10; goal.tipTop = goal.top; - tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]); + tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]); }, function(){ //下 goal.autoLeft(); goal.tipTop = goal.top + goal.height + 10; @@ -663,7 +668,7 @@ Class.pt.tips = function(){ tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]); }]; goal.where[guide-1](); - + /* 8*2为小三角形占据的空间 */ if(guide === 1){ goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2](); @@ -676,11 +681,11 @@ Class.pt.tips = function(){ } layero.find('.'+doms[5]).css({ - 'background-color': config.tips[1], + 'background-color': config.tips[1], 'padding-right': (config.closeBtn ? '30px' : '') }); layero.css({ - left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0), + left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0), top: goal.tipTop - (config.fixed ? win.scrollTop() : 0) }); } @@ -694,7 +699,7 @@ Class.pt.move = function(){ ,moveElem = layero.find(config.move) ,resizeElem = layero.find('.layui-layer-resize') ,dict = {}; - + if(config.move){ moveElem.css('cursor', 'move'); } @@ -710,7 +715,7 @@ Class.pt.move = function(){ ready.moveElem.css('cursor', 'move').show(); } }); - + resizeElem.on('mousedown', function(e){ e.preventDefault(); dict.resizeStart = true; @@ -721,7 +726,7 @@ Class.pt.move = function(){ ]; ready.moveElem.css('cursor', 'se-resize').show(); }); - + _DOC.on('mousemove', function(e){ //拖拽移动 @@ -729,35 +734,35 @@ Class.pt.move = function(){ var X = e.clientX - dict.offset[0] ,Y = e.clientY - dict.offset[1] ,fixed = layero.css('position') === 'fixed'; - + e.preventDefault(); - + dict.stX = fixed ? 0 : win.scrollLeft(); dict.stY = fixed ? 0 : win.scrollTop(); //控制元素不被拖出窗口外 if(!config.moveOut){ var setRig = win.width() - layero.outerWidth() + dict.stX - ,setBot = win.height() - layero.outerHeight() + dict.stY; + ,setBot = win.height() - layero.outerHeight() + dict.stY; X < dict.stX && (X = dict.stX); - X > setRig && (X = setRig); + X > setRig && (X = setRig); Y < dict.stY && (Y = dict.stY); Y > setBot && (Y = setBot); } - + layero.css({ left: X ,top: Y }); } - + //Resize if(config.resize && dict.resizeStart){ var X = e.clientX - dict.offset[0] ,Y = e.clientY - dict.offset[1]; - + e.preventDefault(); - + layer.style(that.index, { width: dict.area[0] + X ,height: dict.area[1] + Y @@ -775,7 +780,7 @@ Class.pt.move = function(){ ready.moveElem.hide(); } }); - + return that; }; @@ -792,7 +797,7 @@ Class.pt.callback = function(){ } } layer.ie == 6 && that.IE6(layero); - + //按钮 layero.find('.'+ doms[6]).children('a').on('click', function(){ var index = $(this).index(); @@ -809,29 +814,29 @@ Class.pt.callback = function(){ close === false || layer.close(that.index); } }); - + //取消 function cancel(){ var close = config.cancel && config.cancel(that.index, layero); close === false || layer.close(that.index); } - + //右上角关闭回调 layero.find('.'+ doms[7]).on('click', cancel); - + //点遮罩关闭 if(config.shadeClose){ $('#layui-layer-shade'+ that.index).on('click', function(){ layer.close(that.index); }); - } - + } + //最小化 layero.find('.layui-layer-min').on('click', function(){ var min = config.min && config.min(layero); - min === false || layer.min(that.index, config); + min === false || layer.min(that.index, config); }); - + //全屏/还原 layero.find('.layui-layer-max').on('click', function(){ if($(this).hasClass('layui-layer-maxmin')){ @@ -853,11 +858,11 @@ ready.reselect = function(){ $.each($('select'), function(index , value){ var sthis = $(this); if(!sthis.parents('.'+doms[0])[0]){ - (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show(); + (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show(); } sthis = null; }); -}; +}; Class.pt.IE6 = function(layero){ //隐藏select @@ -873,7 +878,7 @@ Class.pt.IE6 = function(layero){ //需依赖原型的对外方法 Class.pt.openLayer = function(){ var that = this; - + //置顶当前窗口 layer.zIndex = that.config.zIndex; layer.setTop = function(layero){ @@ -891,7 +896,7 @@ ready.record = function(layero){ var area = [ layero.width(), layero.height(), - layero.position().top, + layero.position().top, layero.position().left + parseFloat(layero.css('margin-left')) ]; layero.find('.layui-layer-max').addClass('layui-layer-maxmin'); @@ -916,7 +921,7 @@ window.layer = layer; //获取子iframe的DOM layer.getChildFrame = function(selector, index){ index = index || $('.'+doms[4]).attr('times'); - return $('#'+ doms[0] + index).find('iframe').contents().find(selector); + return $('#'+ doms[0] + index).find('iframe').contents().find(selector); }; //得到当前iframe层的索引,子iframe时使用 @@ -948,24 +953,24 @@ layer.style = function(index, options, limit){ ,titHeight = layero.find(doms[1]).outerHeight() || 0 ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0 ,minLeft = layero.attr('minLeft'); - + if(type === ready.type[3] || type === ready.type[4]){ return; } - + if(!limit){ if(parseFloat(options.width) <= 260){ options.width = 260; }; - + if(parseFloat(options.height) - titHeight - btnHeight <= 64){ options.height = 64 + titHeight + btnHeight; }; } - + layero.css(options); btnHeight = layero.find('.'+doms[6]).outerHeight(); - + if(type === ready.type[2]){ layero.find('iframe').css({ height: parseFloat(options.height) - titHeight - btnHeight @@ -985,16 +990,16 @@ layer.min = function(index, options){ ,titHeight = layero.find(doms[1]).outerHeight() || 0 ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px' ,position = layero.css('position'); - + ready.record(layero); - + if(ready.minLeft[0]){ left = ready.minLeft[0]; ready.minLeft.shift(); } - + layero.attr('position', position); - + layer.style(index, { width: 180 ,height: titHeight @@ -1007,7 +1012,7 @@ layer.min = function(index, options){ layero.find('.layui-layer-min').hide(); layero.attr('type') === 'page' && layero.find(doms[4]).hide(); ready.rescollbar(index); - + if(!layero.attr('minLeft')){ ready.minIndex++; } @@ -1019,9 +1024,9 @@ layer.restore = function(index){ var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(','); var type = layero.attr('type'); layer.style(index, { - width: parseFloat(area[0]), - height: parseFloat(area[1]), - top: parseFloat(area[2]), + width: parseFloat(area[0]), + height: parseFloat(area[1]), + top: parseFloat(area[2]), left: parseFloat(area[3]), position: layero.attr('position'), overflow: 'visible' @@ -1084,16 +1089,16 @@ layer.close = function(index){ layero.remove(); } }; - + if(layero.data('anim')){ layero.addClass(closeAnim); } - + $('#layui-layer-moves, #layui-layer-shade' + index).remove(); layer.ie == 6 && ready.reselect(); ready.rescollbar(index); typeof ready.end[index] === 'function' && ready.end[index](); - delete ready.end[index]; + delete ready.end[index]; if(layero.attr('minLeft')){ ready.minIndex--; ready.minLeft.push(layero.attr('minLeft')); @@ -1113,7 +1118,7 @@ layer.closeAll = function(type){ }); }; -/** +/** 拓展模块,layui开始合并在一起 @@ -1121,15 +1126,15 @@ layer.closeAll = function(type){ var cache = layer.cache||{}, skin = function(type){ return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : ''); -}; - +}; + //仿系统prompt layer.prompt = function(options, yes){ var style = ''; options = options || {}; - + if(typeof options === 'function') yes = options; - + if(options.area){ var area = options.area; style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"'; @@ -1138,7 +1143,7 @@ layer.prompt = function(options, yes){ var prompt, content = options.formType == 2 ? '' : function(){ return ''; }(); - + return layer.open($.extend({ type: 1 ,btn: ['确定','取消'] @@ -1214,7 +1219,7 @@ layer.photos = function(options, loop, key){ var photos = type ? options.photos : {}, data = photos.data || []; var start = photos.start || 0; dict.imgIndex = (start|0) + 1; - + options.img = options.img || 'img'; if(!type){ //页面直接获取 @@ -1231,13 +1236,13 @@ layer.photos = function(options, loop, key){ }); }) }; - + pushData(); - + if (data.length === 0) return; - + loop || parent.on('click', options.img, function(){ - var othis = $(this), index = othis.attr('layer-index'); + var othis = $(this), index = othis.attr('layer-index'); layer.photos($.extend(options, { photos: { start: index, @@ -1248,14 +1253,14 @@ layer.photos = function(options, loop, key){ }), true); pushData(); }) - + //不直接弹出 if(!loop) return; - + } else if (data.length === 0){ return layer.msg('没有图片'); } - + //上一张 dict.imgprev = function(key){ dict.imgIndex--; @@ -1264,7 +1269,7 @@ layer.photos = function(options, loop, key){ } dict.tabimg(key); }; - + //下一张 dict.imgnext = function(key,errorMsg){ dict.imgIndex++; @@ -1274,7 +1279,7 @@ layer.photos = function(options, loop, key){ } dict.tabimg(key) }; - + //方向键 dict.keyup = function(event){ if(!dict.end){ @@ -1289,7 +1294,7 @@ layer.photos = function(options, loop, key){ } } } - + //切换 dict.tabimg = function(key){ if(data.length <= 1) return; @@ -1297,7 +1302,7 @@ layer.photos = function(options, loop, key){ layer.close(dict.index); layer.photos(options, true, key); } - + //一些动作 dict.event = function(){ dict.bigimg.hover(function(){ @@ -1305,24 +1310,24 @@ layer.photos = function(options, loop, key){ }, function(){ dict.imgsee.hide(); }); - + dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){ event.preventDefault(); dict.imgprev(); - }); - - dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){ + }); + + dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){ event.preventDefault(); dict.imgnext(); }); - + $(document).on('keyup', dict.keyup); }; - + //图片预加载 - function loadImage(url, callback, error) { + function loadImage(url, callback, error) { var img = new Image(); - img.src = url; + img.src = url; if(img.complete){ return callback(img); } @@ -1333,9 +1338,9 @@ layer.photos = function(options, loop, key){ img.onerror = function(e){ img.onerror = null; error(e); - }; + }; }; - + dict.loadi = layer.load(1, { shade: 'shade' in options ? false : 0.9, scrollbar: false @@ -1347,7 +1352,7 @@ layer.photos = function(options, loop, key){ area: function(){ var imgarea = [img.width, img.height]; var winarea = [$(window).width() - 100, $(window).height() - 100]; - + //如果 实际图片的宽或者高比 屏幕大(那么进行缩放) if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){ var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例 @@ -1359,8 +1364,8 @@ layer.photos = function(options, loop, key){ imgarea[1] = imgarea[1]/wh[1]; } } - - return [imgarea[0]+'px', imgarea[1]+'px']; + + return [imgarea[0]+'px', imgarea[1]+'px']; }(), title: false, shade: 0.9, @@ -1392,8 +1397,8 @@ layer.photos = function(options, loop, key){ }, function(){ layer.close(dict.loadi); layer.msg('当前图片地址异常
是否继续查看下一张?', { - time: 30000, - btn: ['下一张', '不看了'], + time: 30000, + btn: ['下一张', '不看了'], yes: function(){ data.length > 1 && dict.imgnext(true,true); } @@ -6487,7 +6492,7 @@ define('moment', ['moment/moment'], function (main) { return main; }); * css: the stylesheet content to normalize * fromBasePath: the absolute base path of the css relative to any root (but without ../ backtracking) * toBasePath: the absolute new base path of the css relative to the same root - * + * * Absolute dependencies are left untouched. * * Urls in the CSS are picked up by regular expressions. @@ -6496,7 +6501,7 @@ define('moment', ['moment/moment'], function (main) { return main; }); * url(*) * url('*') * url("*") - * + * * @import '*' * @import "*" * @@ -6507,7 +6512,7 @@ define('moment', ['moment/moment'], function (main) { return main; }); */ define('../libs/require-css/normalize',[],function() { - + // regular expression for removing double slashes // eg http://www.example.com//my///url/here -> http://www.example.com/my/url/here var slashes = /([^:])\/+/g @@ -6528,12 +6533,12 @@ define('../libs/require-css/normalize',[],function() { var fromBaseProtocol = fromBase.match(protocolRegEx); if (fromBaseProtocol && (!toBaseProtocol || toBaseProtocol[1] != fromBaseProtocol[1] || toBaseProtocol[2] != fromBaseProtocol[2])) return absoluteURI(uri, fromBase); - + else { return relativeURI(absoluteURI(uri, fromBase), toBase); } }; - + // given a relative URI, calculate the absolute URI function absoluteURI(uri, base) { if (uri.substr(0, 2) == './') @@ -6542,25 +6547,25 @@ define('../libs/require-css/normalize',[],function() { // absolute urls are left in tact if (uri.match(absUrlRegEx) || uri.match(protocolRegEx)) return uri; - + var baseParts = base.split('/'); var uriParts = uri.split('/'); - + baseParts.pop(); - + while (curPart = uriParts.shift()) if (curPart == '..') baseParts.pop(); else baseParts.push(curPart); - + return baseParts.join('/'); }; // given an absolute URI, calculate the relative URI function relativeURI(uri, base) { - + // reduce base and uri strings to just their difference string var baseParts = base.split('/'); baseParts.pop(); @@ -6579,14 +6584,14 @@ define('../libs/require-css/normalize',[],function() { out = ''; while (baseParts.shift()) out += '../'; - + // finally add uri parts while (curPart = uriParts.shift()) out += curPart + '/'; - + return out.substr(0, out.length - 1); }; - + var normalizeCSS = function(source, fromBase, toBase) { fromBase = removeDoubleSlashes(fromBase); @@ -6603,14 +6608,14 @@ define('../libs/require-css/normalize',[],function() { source = source.substr(0, urlRegEx.lastIndex - url.length - quoteLen - 1) + newUrl + source.substr(urlRegEx.lastIndex - quoteLen - 1); urlRegEx.lastIndex = urlRegEx.lastIndex + (newUrl.length - url.length); } - + return source; }; - + normalizeCSS.convertURIBase = convertURIBase; normalizeCSS.absoluteURI = absoluteURI; normalizeCSS.relativeURI = relativeURI; - + return normalizeCSS; }); ; @@ -6829,67 +6834,67 @@ define("bootstrap-table-mobile", ["bootstrap-table"], (function (global) { }; }(this))); -/* - tableExport.jquery.plugin - - Copyright (c) 2015-2017 hhurz, https://github.com/hhurz/tableExport.jquery.plugin - Original work Copyright (c) 2014 Giri Raj, https://github.com/kayalshri/ - - Licensed under the MIT License, http://opensource.org/licenses/mit-license -*/ -(function(c){c.fn.extend({tableExport:function(u){function S(b){var a=[];c(b).find("thead").first().find("th").each(function(b,d){void 0!==c(d).attr("data-field")?a[b]=c(d).attr("data-field"):a[b]=b.toString()});return a}function z(b,h,e,d,w){if(-1==c.inArray(e,a.ignoreRow)&&-1==c.inArray(e-d,a.ignoreRow)){var q=c(b).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display")||"always"==c(this).closest("table").data("tableexport-display"))}).find(h), -l=0;q.each(function(b){if("always"==c(this).data("tableexport-display")||"none"!=c(this).css("display")&&"hidden"!=c(this).css("visibility")&&"none"!=c(this).data("tableexport-display")){var d=b,h=!1;0d&&"undefined"!=typeof H[d]&&-1!=c.inArray(H[d],a.ignoreColumn)&&(h=!0):"number"!=typeof a.ignoreColumn[0]||-1==c.inArray(d,a.ignoreColumn)&&-1==c.inArray(d-q.length,a.ignoreColumn)||(h=!0));if(!1===h&&"function"===typeof w){var h= -0,r,f=0;if("undefined"!=typeof A[e]&&0q&&(f=Math.min(b.width,this.width),k=this.height* -f/this.width);k/gi,"\u2060");b=c("
").html(f).contents();f="";c.each(b.text().split("\u2028"),function(b,a){0b?"-":"")+(a.numbers.output.thousandsSeparator?(k?g[0].substr(0,k)+a.numbers.output.thousandsSeparator:"")+g[0].substr(k).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):g[0])+(g[1].length?a.numbers.output.decimalMark+g[1]:"")}}!0===a.escape&&(d=escape(d));"function"===typeof a.onCellData&&(d=a.onCellData(w,h,e,d))}return d}function la(b,a,e){return a+"-"+e.toLowerCase()}function N(b, -a){var h=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b),d=a;h&&(d=[parseInt(h[1]),parseInt(h[2]),parseInt(h[3])]);return d}function fa(b){var a=E(b,"text-align"),e=E(b,"font-weight"),d=E(b,"font-style"),w="";"start"==a&&(a="rtl"==E(b,"direction")?"right":"left");700<=e&&(w="bold");"italic"==d&&(w+=d);""===w&&(w="normal");a={style:{align:a,bcolor:N(E(b,"background-color"),[255,255,255]),color:N(E(b,"color"),[0,0,0]),fstyle:w},colspan:parseInt(c(b).attr("colspan"))||0,rowspan:parseInt(c(b).attr("rowspan"))|| -0};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function E(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,la),window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:b.style[a]}catch(e){}return""}function O(b,a,e){a=E(b,a).match(/\d+/);if(null!==a){a=a[0];b=b.parentElement;var d=document.createElement("div");d.style.overflow="hidden";d.style.visibility="hidden";b.appendChild(d);d.style.width=100+e;e=100/ -d.offsetWidth;b.removeChild(d);return a*e}return 0}function T(){if(!(this instanceof T))return new T;this.SheetNames=[];this.Sheets={}}function ma(a){for(var b=new ArrayBuffer(a.length),e=new Uint8Array(b),d=0;d!=a.length;++d)e[d]=a.charCodeAt(d)&255;return b}function na(a){for(var b={},e={s:{c:1E7,r:1E7},e:{c:0,r:0}},d=0;d!=a.length;++d)for(var c=0;c!=a[d].length;++c){e.s.r>d&&(e.s.r=d);e.s.c>c&&(e.s.c=c);e.e.re.s.c&&(b["!ref"]=XLSX.utils.encode_range(e));return b}function ca(a){var b=0,c,d,f;if(0===a.length)return b;c=0;for(f=a.length;cg?d+=String.fromCharCode(g):(127g?d+=String.fromCharCode(g>>6|192):(d+=String.fromCharCode(g>>12|224),d+=String.fromCharCode(g>>6&63|128)),d+=String.fromCharCode(g&63|128));for(a=d;k>2,c=(c&3)<<4|d>>4,l=(d&15)<<2|f>>6,r=f&63,isNaN(d)?l=r=64:isNaN(f)&&(r=64),b=b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)+ -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(r);return b}var a={consoleLog:!1,csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,excelstyles:[],fileName:"tableExport",htmlContent:!1,ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20, -right:10,top:10,bottom:10},autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"left",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"center"},alternateRowStyles:{fillColor:245},tableExport:{onAfterAutotable:null,onBeforeAutotable:null,onTable:null,outputImages:!0}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onCellData:null, -onCellHtmlData:null,outputMode:"file",pdfmake:{enabled:!1},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"myTableName",type:"csv",worksheetName:"xlsWorksheetName"},t=this,Q=null,n=[],g=[],k=0,A=[],m="",H=[],y;c.extend(!0,a,u);H=S(t);if("csv"==a.type||"tsv"==a.type||"txt"==a.type){var D="",I=0,k=0,U=function(b,h,e){b.each(function(){m="";z(this,h,k,e+b.length,function(b,c,e){var d=m,h="";if(null!==b)if(b=x(b,c,e),c=null===b||""===b?"":b.toString(),"tsv"==a.type)b instanceof Date&& -b.toLocaleString(),h=P(c,"\t"," ");else if(b instanceof Date)h=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(h=P(c,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=h.indexOf(a.csvSeparator)||/[\r\n ]/g.test(h))h=a.csvEnclosure+h+a.csvEnclosure;m=d+(h+("tsv"==a.type?"\t":a.csvSeparator))});m=c.trim(m).substring(0,m.length-1);0', -B=B+"",n=c(t).find("thead").first().find(a.theadSelector);n.each(function(){z(this,"th,td",k,n.length,function(a,c,e){B+=""+x(a,c,e)+""});k++});var B=B+"",ga=1;c(t).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(t).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=1;m="";z(this,"td,th",k,n.length+g.length,function(b,c,d){m+=""+x(b,c,d)+"";a++});0"!=m&&(B+=''+m+"",ga++);k++});B+="";!0===a.consoleLog&&console.log(B);if("string"===a.outputMode)return B;if("base64"===a.outputMode)return F(B);try{y=new Blob([B],{type:"application/xml;charset=utf-8"}),saveAs(y,a.fileName+".xml")}catch(b){C(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",B)}}else if("excel"==a.type||"xls"==a.type||"word"==a.type||"doc"==a.type){u="excel"==a.type||"xls"==a.type?"excel": -"word";var K="excel"==u?"xls":"doc",p='xmlns:x="urn:schemas-microsoft-com:office:'+u+'"',G="";c(t).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b=c(this);k=0;H=S(this);G+="";n=b.find("thead").first().find(a.theadSelector);n.each(function(){m="";z(this,"th,td",k,n.length,function(b,e,d){if(null!==b){var h="";m+=""}});0"+m+"");k++});G+="";b.find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,b.find("tfoot").find(a.tfootSelector)); -c(g).each(function(){var b=c(this);m="";z(this,"td,th",k,n.length+g.length,function(e,d,h){if(null!==e){var f="",l=c(e).data("tableexport-msonumberformat");"undefined"==typeof l&&"function"===typeof a.onMsoNumberFormat&&(l=a.onMsoNumberFormat(e,d,h));"undefined"!=typeof l&&""!==l&&(f="style=\"mso-number-format:'"+l+"'");for(var g in a.excelstyles)a.excelstyles.hasOwnProperty(g)&&(l=c(e).css(a.excelstyles[g]),""===l&&(l=b.css(a.excelstyles[g])),""!==l&&"0px none rgb(0, 0, 0)"!=l&&"rgba(0, 0, 0, 0)"!= -l&&(f+=""===f?'style="':";",f+=a.excelstyles[g]+":"+l));m+="")+""}});0"+m+"");k++});a.displayTableName&&(G+="");G+="
"+x(c("

"+a.tableName+"

"))+"
";!0===a.consoleLog&&console.log(G)});p=''+('')+"";"excel"===u&&(p+="\x3c!--[if gte mso 9]>",p+="",p+="",p+="",p+="",p+="",p+=a.worksheetName,p+="",p+="",p+="",p+="",p+="",p+="",p+="",p+="",p+="br {mso-data-placement:same-cell;}";p+="";p+="";p+=G;p+="";p+="";!0===a.consoleLog&&console.log(p);if("string"===a.outputMode)return p;if("base64"===a.outputMode)return F(p);try{y=new Blob([p],{type:"application/vnd.ms-"+a.type}),saveAs(y,a.fileName+"."+K)}catch(b){C(a.fileName+"."+K,"data:application/vnd.ms-"+u+";base64,",p)}}else if("xlsx"==a.type){var ha=[],W=[],k=0,g=c(t).find("thead").first().find(a.theadSelector);c(t).find("tbody").each(function(){g.push.apply(g, -c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(t).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=[];z(this,"th,td",k,g.length,function(b,c,d){if("undefined"!==typeof b&&null!==b){var e=parseInt(b.getAttribute("colspan")),f=parseInt(b.getAttribute("rowspan"));b=x(b,c,d);""!==b&&b==+b&&(b=+b);W.forEach(function(b){if(k>=b.s.r&&k<=b.e.r&&a.length>=b.s.c&&a.length<=b.e.c)for(var c=0;c<=b.e.c-b.s.c;++c)a.push(null)});if(f||e)e=e||1,W.push({s:{r:k,c:a.length}, -e:{r:k+(f||1)-1,c:a.length+e-1}});a.push(""!==b?b:null);if(e)for(f=0;fja){a>L.a0[0]&&(R="a0",M="l");for(var f in L)L.hasOwnProperty(f)&& -L[f][1]>a&&(R=f,M="l",L[f][0]>a&&(M="p"));ja=a}}});a.jspdf.format=""===R?"a4":R;a.jspdf.orientation=""===M?"w":M}f.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);!0===f.outputImages&&(f.images={});"undefined"!=typeof f.images&&(c(t).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b=0;n=c(this).find("thead").find(a.theadSelector);c(this).find("tbody").each(function(){g.push.apply(g, -c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(this).find("tfoot").find(a.tfootSelector));c(g).each(function(){z(this,"td,th",n.length+b,n.length+g.length,function(a,b,d){"undefined"!==typeof a&&null!==a&&(b=c(a).children(),"undefined"!=typeof b&&0a.styles.rowHeight&&(a.styles.rowHeight=g)}"undefined"!=typeof e.style&&!0!==e.style.hidden&&(a.styles.halign=e.style.align,"inherit"===d.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}});"function"!==typeof d.createdCell&&(d.createdCell=function(a,b){var c=f.rowoptions[b.row.index+ -":"+b.column.dataKey];"undefined"!=typeof c&&"undefined"!=typeof c.style&&!0!==c.style.hidden&&(a.styles.halign=c.style.align,"inherit"===d.styles.fillColor&&(a.styles.fillColor=c.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=c.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=c.style.fstyle))});"function"!==typeof d.drawHeaderCell&&(d.drawHeaderCell=function(a,b){var c=f.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&& -0<=c.rowIndex?aa(a,b,c):!1});"function"!==typeof d.drawCell&&(d.drawCell=function(a,b){var c=f.rowoptions[b.row.index+":"+b.column.dataKey];if(aa(a,b,c)){f.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle);if("undefined"!=typeof c&&"undefined"!=typeof c.kids&&0f.dh||"undefined"==typeof f.dh)f.dh=d;f.dw=a.width/c.rect.width;da(a,c.kids,f)}f.doc.autoTableText(a.text,a.textPos.x,a.textPos.y,{halign:a.styles.halign,valign:a.styles.valign})}return!1}); -f.headerrows=[];n=c(this).find("thead").find(a.theadSelector);n.each(function(){b=0;f.headerrows[e]=[];z(this,"th,td",e,n.length,function(a,c,d){var g=fa(a);g.title=x(a,c,d);g.key=b++;g.rowIndex=e;f.headerrows[e].push(g)});e++});if(0d&&"undefined"!=typeof H[d]&&-1!=c.inArray(H[d],a.ignoreColumn)&&(h=!0):"number"!=typeof a.ignoreColumn[0]||-1==c.inArray(d,a.ignoreColumn)&&-1==c.inArray(d-q.length,a.ignoreColumn)||(h=!0));if(!1===h&&"function"===typeof w){var h= +0,r,f=0;if("undefined"!=typeof A[e]&&0q&&(f=Math.min(b.width,this.width),k=this.height* +f/this.width);k/gi,"\u2060");b=c("
").html(f).contents();f="";c.each(b.text().split("\u2028"),function(b,a){0b?"-":"")+(a.numbers.output.thousandsSeparator?(k?g[0].substr(0,k)+a.numbers.output.thousandsSeparator:"")+g[0].substr(k).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):g[0])+(g[1].length?a.numbers.output.decimalMark+g[1]:"")}}!0===a.escape&&(d=escape(d));"function"===typeof a.onCellData&&(d=a.onCellData(w,h,e,d))}return d}function la(b,a,e){return a+"-"+e.toLowerCase()}function N(b, +a){var h=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b),d=a;h&&(d=[parseInt(h[1]),parseInt(h[2]),parseInt(h[3])]);return d}function fa(b){var a=E(b,"text-align"),e=E(b,"font-weight"),d=E(b,"font-style"),w="";"start"==a&&(a="rtl"==E(b,"direction")?"right":"left");700<=e&&(w="bold");"italic"==d&&(w+=d);""===w&&(w="normal");a={style:{align:a,bcolor:N(E(b,"background-color"),[255,255,255]),color:N(E(b,"color"),[0,0,0]),fstyle:w},colspan:parseInt(c(b).attr("colspan"))||0,rowspan:parseInt(c(b).attr("rowspan"))|| +0};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function E(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,la),window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:b.style[a]}catch(e){}return""}function O(b,a,e){a=E(b,a).match(/\d+/);if(null!==a){a=a[0];b=b.parentElement;var d=document.createElement("div");d.style.overflow="hidden";d.style.visibility="hidden";b.appendChild(d);d.style.width=100+e;e=100/ +d.offsetWidth;b.removeChild(d);return a*e}return 0}function T(){if(!(this instanceof T))return new T;this.SheetNames=[];this.Sheets={}}function ma(a){for(var b=new ArrayBuffer(a.length),e=new Uint8Array(b),d=0;d!=a.length;++d)e[d]=a.charCodeAt(d)&255;return b}function na(a){for(var b={},e={s:{c:1E7,r:1E7},e:{c:0,r:0}},d=0;d!=a.length;++d)for(var c=0;c!=a[d].length;++c){e.s.r>d&&(e.s.r=d);e.s.c>c&&(e.s.c=c);e.e.re.s.c&&(b["!ref"]=XLSX.utils.encode_range(e));return b}function ca(a){var b=0,c,d,f;if(0===a.length)return b;c=0;for(f=a.length;cg?d+=String.fromCharCode(g):(127g?d+=String.fromCharCode(g>>6|192):(d+=String.fromCharCode(g>>12|224),d+=String.fromCharCode(g>>6&63|128)),d+=String.fromCharCode(g&63|128));for(a=d;k>2,c=(c&3)<<4|d>>4,l=(d&15)<<2|f>>6,r=f&63,isNaN(d)?l=r=64:isNaN(f)&&(r=64),b=b+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)+ +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(r);return b}var a={consoleLog:!1,csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,excelstyles:[],fileName:"tableExport",htmlContent:!1,ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20, +right:10,top:10,bottom:10},autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"left",valign:"middle"},headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"center"},alternateRowStyles:{fillColor:245},tableExport:{onAfterAutotable:null,onBeforeAutotable:null,onTable:null,outputImages:!0}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onCellData:null, +onCellHtmlData:null,outputMode:"file",pdfmake:{enabled:!1},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"myTableName",type:"csv",worksheetName:"xlsWorksheetName"},t=this,Q=null,n=[],g=[],k=0,A=[],m="",H=[],y;c.extend(!0,a,u);H=S(t);if("csv"==a.type||"tsv"==a.type||"txt"==a.type){var D="",I=0,k=0,U=function(b,h,e){b.each(function(){m="";z(this,h,k,e+b.length,function(b,c,e){var d=m,h="";if(null!==b)if(b=x(b,c,e),c=null===b||""===b?"":b.toString(),"tsv"==a.type)b instanceof Date&& +b.toLocaleString(),h=P(c,"\t"," ");else if(b instanceof Date)h=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(h=P(c,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=h.indexOf(a.csvSeparator)||/[\r\n ]/g.test(h))h=a.csvEnclosure+h+a.csvEnclosure;m=d+(h+("tsv"==a.type?"\t":a.csvSeparator))});m=c.trim(m).substring(0,m.length-1);0', +B=B+"",n=c(t).find("thead").first().find(a.theadSelector);n.each(function(){z(this,"th,td",k,n.length,function(a,c,e){B+=""+x(a,c,e)+""});k++});var B=B+"",ga=1;c(t).find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(t).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=1;m="";z(this,"td,th",k,n.length+g.length,function(b,c,d){m+=""+x(b,c,d)+"";a++});0"!=m&&(B+=''+m+"",ga++);k++});B+="";!0===a.consoleLog&&console.log(B);if("string"===a.outputMode)return B;if("base64"===a.outputMode)return F(B);try{y=new Blob([B],{type:"application/xml;charset=utf-8"}),saveAs(y,a.fileName+".xml")}catch(b){C(a.fileName+".xml","data:application/xml;charset=utf-8;base64,",B)}}else if("excel"==a.type||"xls"==a.type||"word"==a.type||"doc"==a.type){u="excel"==a.type||"xls"==a.type?"excel": +"word";var K="excel"==u?"xls":"doc",p='xmlns:x="urn:schemas-microsoft-com:office:'+u+'"',G="";c(t).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b=c(this);k=0;H=S(this);G+="";n=b.find("thead").first().find(a.theadSelector);n.each(function(){m="";z(this,"th,td",k,n.length,function(b,e,d){if(null!==b){var h="";m+=""}});0"+m+"");k++});G+="";b.find("tbody").each(function(){g.push.apply(g,c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,b.find("tfoot").find(a.tfootSelector)); +c(g).each(function(){var b=c(this);m="";z(this,"td,th",k,n.length+g.length,function(e,d,h){if(null!==e){var f="",l=c(e).data("tableexport-msonumberformat");"undefined"==typeof l&&"function"===typeof a.onMsoNumberFormat&&(l=a.onMsoNumberFormat(e,d,h));"undefined"!=typeof l&&""!==l&&(f="style=\"mso-number-format:'"+l+"'");for(var g in a.excelstyles)a.excelstyles.hasOwnProperty(g)&&(l=c(e).css(a.excelstyles[g]),""===l&&(l=b.css(a.excelstyles[g])),""!==l&&"0px none rgb(0, 0, 0)"!=l&&"rgba(0, 0, 0, 0)"!= +l&&(f+=""===f?'style="':";",f+=a.excelstyles[g]+":"+l));m+="")+""}});0"+m+"");k++});a.displayTableName&&(G+="");G+="
"+x(c("

"+a.tableName+"

"))+"
";!0===a.consoleLog&&console.log(G)});p=''+('')+"";"excel"===u&&(p+="\x3c!--[if gte mso 9]>",p+="",p+="",p+="",p+="",p+="",p+=a.worksheetName,p+="",p+="",p+="",p+="",p+="",p+="",p+="",p+="",p+="br {mso-data-placement:same-cell;}";p+="";p+="";p+=G;p+="";p+="";!0===a.consoleLog&&console.log(p);if("string"===a.outputMode)return p;if("base64"===a.outputMode)return F(p);try{y=new Blob([p],{type:"application/vnd.ms-"+a.type}),saveAs(y,a.fileName+"."+K)}catch(b){C(a.fileName+"."+K,"data:application/vnd.ms-"+u+";base64,",p)}}else if("xlsx"==a.type){var ha=[],W=[],k=0,g=c(t).find("thead").first().find(a.theadSelector);c(t).find("tbody").each(function(){g.push.apply(g, +c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(t).find("tfoot").find(a.tfootSelector));c(g).each(function(){var a=[];z(this,"th,td",k,g.length,function(b,c,d){if("undefined"!==typeof b&&null!==b){var e=parseInt(b.getAttribute("colspan")),f=parseInt(b.getAttribute("rowspan"));b=x(b,c,d);""!==b&&b==+b&&(b=+b);W.forEach(function(b){if(k>=b.s.r&&k<=b.e.r&&a.length>=b.s.c&&a.length<=b.e.c)for(var c=0;c<=b.e.c-b.s.c;++c)a.push(null)});if(f||e)e=e||1,W.push({s:{r:k,c:a.length}, +e:{r:k+(f||1)-1,c:a.length+e-1}});a.push(""!==b?b:null);if(e)for(f=0;fja){a>L.a0[0]&&(R="a0",M="l");for(var f in L)L.hasOwnProperty(f)&& +L[f][1]>a&&(R=f,M="l",L[f][0]>a&&(M="p"));ja=a}}});a.jspdf.format=""===R?"a4":R;a.jspdf.orientation=""===M?"w":M}f.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);!0===f.outputImages&&(f.images={});"undefined"!=typeof f.images&&(c(t).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b=0;n=c(this).find("thead").find(a.theadSelector);c(this).find("tbody").each(function(){g.push.apply(g, +c(this).find(a.tbodySelector))});a.tfootSelector.length&&g.push.apply(g,c(this).find("tfoot").find(a.tfootSelector));c(g).each(function(){z(this,"td,th",n.length+b,n.length+g.length,function(a,b,d){"undefined"!==typeof a&&null!==a&&(b=c(a).children(),"undefined"!=typeof b&&0a.styles.rowHeight&&(a.styles.rowHeight=g)}"undefined"!=typeof e.style&&!0!==e.style.hidden&&(a.styles.halign=e.style.align,"inherit"===d.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}});"function"!==typeof d.createdCell&&(d.createdCell=function(a,b){var c=f.rowoptions[b.row.index+ +":"+b.column.dataKey];"undefined"!=typeof c&&"undefined"!=typeof c.style&&!0!==c.style.hidden&&(a.styles.halign=c.style.align,"inherit"===d.styles.fillColor&&(a.styles.fillColor=c.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=c.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=c.style.fstyle))});"function"!==typeof d.drawHeaderCell&&(d.drawHeaderCell=function(a,b){var c=f.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&& +0<=c.rowIndex?aa(a,b,c):!1});"function"!==typeof d.drawCell&&(d.drawCell=function(a,b){var c=f.rowoptions[b.row.index+":"+b.column.dataKey];if(aa(a,b,c)){f.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle);if("undefined"!=typeof c&&"undefined"!=typeof c.kids&&0f.dh||"undefined"==typeof f.dh)f.dh=d;f.dw=a.width/c.rect.width;da(a,c.kids,f)}f.doc.autoTableText(a.text,a.textPos.x,a.textPos.y,{halign:a.styles.halign,valign:a.styles.valign})}return!1}); +f.headerrows=[];n=c(this).find("thead").find(a.theadSelector);n.each(function(){b=0;f.headerrows[e]=[];z(this,"th,td",e,n.length,function(a,c,d){var g=fa(a);g.title=x(a,c,d);g.key=b++;g.rowIndex=e;f.headerrows[e].push(g)});e++});if(0 "; - - //listidx allows reference back to correct list variable instance - $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit); - this.styleDragHandlers(true); - }, - - uninit: function() { - var list = lists[$(this).attr("data-listidx")]; - $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit"); - list.styleDragHandlers(false); - }, - - getItems: function() { - return $(this.container).children(opts.itemSelector); - }, - - styleDragHandlers: function(cursor) { - this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : ""); - }, - - grabItem: function(e) { - var list = lists[$(this).attr("data-listidx")]; - var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0); - var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0; - - //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return - if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem) - return; - - //prevents selection, stops issue on Fx where dragging hyperlink doesn't work and on IE where it triggers mousemove even though mouse hasn't moved, - //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude - //e.preventDefault(); - - //change cursor to move while dragging - var dragHandle = e.target; - while (!$(dragHandle).is(opts.dragSelector)) { - if (dragHandle == this) return; - dragHandle = dragHandle.parentNode; - } - $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor")); - $(dragHandle).css("cursor", "move"); - - //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work - var listElem = this; - var trigger = function() { - list.dragStart.call(listElem, e); - $(list.container).unbind("mousemove", trigger); - }; - $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); }); - }, - - dragStart: function(e) { - if (list != null && list.draggedItem != null) - list.dropItem(); - - list = lists[$(this).attr("data-listidx")]; - list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName) - - //record current position so on dragend we know if the dragged item changed position or not, not using getItems to allow dragsort to restore dragged item to original location in relation to fixed items - list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem)); - - //calculate mouse offset relative to draggedItem - var mt = parseInt(list.draggedItem.css("marginTop")); - var ml = parseInt(list.draggedItem.css("marginLeft")); - list.offset = list.draggedItem.offset(); - list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1; - list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1; - - //calculate box the dragged item can't be dragged outside of - if (!opts.dragBetween) { - var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().size() * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight(); - list.offsetLimit = $(list.container).offset(); - list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth(); - list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight(); - } - - //create placeholder item - var h = list.draggedItem.height(); - var w = list.draggedItem.width(); - if (opts.tagName == "tr") { - list.draggedItem.children().each(function() { $(this).width($(this).width()); }); - list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true); - list.draggedItem.after(list.placeHolderItem); - //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html(" "); }); - list.placeHolderItem.children().each(function() { $(this).html(" "); }); - } else { - list.draggedItem.after(opts.placeHolderTemplate); - list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true); - } - - if (opts.tagName == "td") { - var listTable = list.draggedItem.closest("table").get(0); - $("
").appendTo("body").children().append(list.draggedItem); - } - - //style draggedItem while dragging - var orig = list.draggedItem.attr("style"); - list.draggedItem.attr("data-origstyle", orig ? orig : ""); - list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w }); - - //auto-scroll setup - list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() }; - list.scroll.scrollY = window.setInterval(function() { - if (opts.scrollContainer != window) { - $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY); - return; - } - var t = $(opts.scrollContainer).scrollTop(); - if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) { - $(opts.scrollContainer).scrollTop(t + list.scroll.moveY); - list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1); - } - }, 10); - list.scroll.scrollX = window.setInterval(function() { - if (opts.scrollContainer != window) { - $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX); - return; - } - var l = $(opts.scrollContainer).scrollLeft(); - if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) { - $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX); - list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1); - } - }, 10); - - //misc - $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); - list.setPos(e.pageX, e.pageY); - $(document).bind("mousemove", list.swapItems); - $(document).bind("mouseup", list.dropItem); - if (opts.scrollContainer != window) - $(window).bind("wheel", list.wheel); - }, - - //set position of draggedItem - setPos: function(x, y) { - //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner - var top = y - this.offset.top; - var left = x - this.offset.left; - - //limit top, left to within box draggedItem can't be dragged outside of - if (!opts.dragBetween) { - top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top)); - left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left)); - } - - //adjust top & left calculations to parent offset - var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin - if (parent != null) { - top -= parent.top; - left -= parent.left; - } - - //set x or y auto-scroll amount - if (opts.scrollContainer == window) { - y -= $(window).scrollTop(); - x -= $(window).scrollLeft(); - y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5); - x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5); - } else { - var cont = $(opts.scrollContainer); - var offset = cont.offset(); - y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top); - x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left); - } - - list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x); - list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y); - - //move draggedItem to new mouse cursor location - this.draggedItem.css({ top: top, left: left }); - }, - - //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over - wheel: function(e) { - if (list && opts.scrollContainer != window) { - var cont = $(opts.scrollContainer); - var offset = cont.offset(); - e = e.originalEvent; - if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) { - var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY; - cont.scrollTop(cont.scrollTop() + deltaY); - e.preventDefault(); - } - } - }, - - //build a table recording all the positions of the moveable list items - buildPositionTable: function() { - var pos = []; - this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) { - var loc = $(this).offset(); - loc.right = loc.left + $(this).outerWidth(); - loc.bottom = loc.top + $(this).outerHeight(); - loc.elm = this; - pos[i] = loc; - }); - this.pos = pos; - }, - - dropItem: function() { - if (list.draggedItem == null) - return; - - //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower - //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower) - var orig = list.draggedItem.attr("data-origstyle"); - list.draggedItem.attr("style", orig); - if (orig == "") - list.draggedItem.removeAttr("style"); - list.draggedItem.removeAttr("data-origstyle"); - - list.styleDragHandlers(true); - - list.placeHolderItem.before(list.draggedItem); - list.placeHolderItem.remove(); - - $("[data-droptarget], .dragSortItem").remove(); - - window.clearInterval(list.scroll.scrollY); - window.clearInterval(list.scroll.scrollX); - - //if position changed call dragEnd - if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem)) - if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order - var pos = list.draggedItem.attr("data-origpos").split('-'); - var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]); - if (nextItem.size() > 0) - nextItem.before(list.draggedItem); - else if (pos[1] == 0) //was the only item in list - $(lists[pos[0]].container).prepend(list.draggedItem); - else //was the last item in list - $(lists[pos[0]].container).append(list.draggedItem); - } - list.draggedItem.removeAttr("data-origpos"); - - list.draggedItem = null; - $(document).unbind("mousemove", list.swapItems); - $(document).unbind("mouseup", list.dropItem); - if (opts.scrollContainer != window) - $(window).unbind("wheel", list.wheel); - return false; - }, - - //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of - swapItems: function(e) { - if (list.draggedItem == null) - return false; - - //move draggedItem to mouse location - list.setPos(e.pageX, e.pageY); - - //retrieve list and item position mouse cursor is over - var ei = list.findPos(e.pageX, e.pageY); - var nlist = list; - for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) { - ei = lists[i].findPos(e.pageX, e.pageY); - nlist = lists[i]; - } - - //if not over another moveable list item return - if (ei == -1) - return false; - - //save fixed items locations - var children = function() { return $(nlist.container).children().not(nlist.draggedItem); }; - var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); }); - - //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after - if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left) - $(nlist.pos[ei].elm).before(list.placeHolderItem); - else - $(nlist.pos[ei].elm).after(list.placeHolderItem); - - //restore fixed items location - fixed.each(function() { - var elm = children().eq(this.idx).get(0); - if (this != elm && children().index(this) < this.idx) - $(this).insertAfter(elm); - else if (this != elm) - $(this).insertBefore(elm); - }); - - //misc - $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); - lastPos = list.draggedItem.offset(); - return false; - }, - - //returns the index of the list item the mouse is over - findPos: function(x, y) { - for (var i = 0; i < this.pos.length; i++) { - if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y) - return i; - } - return -1; - }, - - //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position - createDropTargets: function() { - if (!opts.dragBetween) - return; - - $(lists).each(function() { - var ph = $(this.container).find("[data-placeholder]"); - var dt = $(this.container).find("[data-droptarget]"); - if (ph.size() > 0 && dt.size() > 0) - dt.remove(); - else if (ph.size() == 0 && dt.size() == 0) { - if (opts.tagName == "td") - $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container); - else - //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8) - $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true)); - - list.placeHolderItem.attr("data-placeholder", true); - } - }); - } - }; - - newList.init(); - lists.push(newList); - }); - - return this; - }; - - $.fn.dragsort.defaults = { - itemSelector: "", - dragSelector: "", - dragSelectorExclude: "input, textarea", - dragEnd: function() { }, - dragBetween: false, - placeHolderTemplate: "", - scrollContainer: window, - scrollSpeed: 5 - }; - -})(jQuery); +// jQuery List DragSort v0.5.2 +// Website: http://dragsort.codeplex.com/ +// License: http://dragsort.codeplex.com/license + +(function($) { + + $.fn.dragsort = function(options) { + if (options == "destroy") { + $(this.selector).trigger("dragsort-uninit"); + return; + } + + var opts = $.extend({}, $.fn.dragsort.defaults, options); + var lists = []; + var list = null, lastPos = null; + + this.each(function(i, cont) { + + //if list container is table, the browser automatically wraps rows in tbody if not specified so change list container to tbody so that children returns rows as user expected + if ($(cont).is("table") && $(cont).children().size() == 1 && $(cont).children().is("tbody")) + cont = $(cont).children().get(0); + + var newList = { + draggedItem: null, + placeHolderItem: null, + pos: null, + offset: null, + offsetLimit: null, + scroll: null, + container: cont, + + init: function() { + //set options to default values if not set + opts.tagName = $(this.container).children().size() == 0 ? "li" : $(this.container).children().get(0).tagName.toLowerCase(); + if (opts.itemSelector == "") + opts.itemSelector = opts.tagName; + if (opts.dragSelector == "") + opts.dragSelector = opts.tagName; + if (opts.placeHolderTemplate == "") + opts.placeHolderTemplate = "<" + opts.tagName + "> "; + + //listidx allows reference back to correct list variable instance + $(this.container).attr("data-listidx", i).mousedown(this.grabItem).bind("dragsort-uninit", this.uninit); + this.styleDragHandlers(true); + }, + + uninit: function() { + var list = lists[$(this).attr("data-listidx")]; + $(list.container).unbind("mousedown", list.grabItem).unbind("dragsort-uninit"); + list.styleDragHandlers(false); + }, + + getItems: function() { + return $(this.container).children(opts.itemSelector); + }, + + styleDragHandlers: function(cursor) { + this.getItems().map(function() { return $(this).is(opts.dragSelector) ? this : $(this).find(opts.dragSelector).get(); }).css("cursor", cursor ? "pointer" : ""); + }, + + grabItem: function(e) { + var list = lists[$(this).attr("data-listidx")]; + var item = $(e.target).closest("[data-listidx] > " + opts.tagName).get(0); + var insideMoveableItem = list.getItems().filter(function() { return this == item; }).size() > 0; + + //if not left click or if clicked on excluded element (e.g. text box) or not a moveable list item return + if (e.which != 1 || $(e.target).is(opts.dragSelectorExclude) || $(e.target).closest(opts.dragSelectorExclude).size() > 0 || !insideMoveableItem) + return; + + //prevents selection, stops issue on Fx where dragging hyperlink doesn't work and on IE where it triggers mousemove even though mouse hasn't moved, + //does also stop being able to click text boxes hence dragging on text boxes by default is disabled in dragSelectorExclude + //e.preventDefault(); + + //change cursor to move while dragging + var dragHandle = e.target; + while (!$(dragHandle).is(opts.dragSelector)) { + if (dragHandle == this) return; + dragHandle = dragHandle.parentNode; + } + $(dragHandle).attr("data-cursor", $(dragHandle).css("cursor")); + $(dragHandle).css("cursor", "move"); + + //on mousedown wait for movement of mouse before triggering dragsort script (dragStart) to allow clicking of hyperlinks to work + var listElem = this; + var trigger = function() { + list.dragStart.call(listElem, e); + $(list.container).unbind("mousemove", trigger); + }; + $(list.container).mousemove(trigger).mouseup(function() { $(list.container).unbind("mousemove", trigger); $(dragHandle).css("cursor", $(dragHandle).attr("data-cursor")); }); + }, + + dragStart: function(e) { + if (list != null && list.draggedItem != null) + list.dropItem(); + + list = lists[$(this).attr("data-listidx")]; + list.draggedItem = $(e.target).closest("[data-listidx] > " + opts.tagName) + + //record current position so on dragend we know if the dragged item changed position or not, not using getItems to allow dragsort to restore dragged item to original location in relation to fixed items + list.draggedItem.attr("data-origpos", $(this).attr("data-listidx") + "-" + $(list.container).children().index(list.draggedItem)); + + //calculate mouse offset relative to draggedItem + var mt = parseInt(list.draggedItem.css("marginTop")); + var ml = parseInt(list.draggedItem.css("marginLeft")); + list.offset = list.draggedItem.offset(); + list.offset.top = e.pageY - list.offset.top + (isNaN(mt) ? 0 : mt) - 1; + list.offset.left = e.pageX - list.offset.left + (isNaN(ml) ? 0 : ml) - 1; + + //calculate box the dragged item can't be dragged outside of + if (!opts.dragBetween) { + var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().size() * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight(); + list.offsetLimit = $(list.container).offset(); + list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth(); + list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight(); + } + + //create placeholder item + var h = list.draggedItem.height(); + var w = list.draggedItem.width(); + if (opts.tagName == "tr") { + list.draggedItem.children().each(function() { $(this).width($(this).width()); }); + list.placeHolderItem = list.draggedItem.clone().attr("data-placeholder", true); + list.draggedItem.after(list.placeHolderItem); + //list.placeHolderItem.children().each(function() { $(this).css({ borderWidth:0, width: $(this).width() + 1, height: $(this).height() + 1 }).html(" "); }); + list.placeHolderItem.children().each(function() { $(this).html(" "); }); + } else { + list.draggedItem.after(opts.placeHolderTemplate); + list.placeHolderItem = list.draggedItem.next().css({ height: h, width: w }).attr("data-placeholder", true); + } + + if (opts.tagName == "td") { + var listTable = list.draggedItem.closest("table").get(0); + $("
").appendTo("body").children().append(list.draggedItem); + } + + //style draggedItem while dragging + var orig = list.draggedItem.attr("style"); + list.draggedItem.attr("data-origstyle", orig ? orig : ""); + list.draggedItem.css({ position: "absolute", opacity: 0.8, "z-index": 999, height: h, width: w }); + + //auto-scroll setup + list.scroll = { moveX: 0, moveY: 0, maxX: $(document).width() - $(window).width(), maxY: $(document).height() - $(window).height() }; + list.scroll.scrollY = window.setInterval(function() { + if (opts.scrollContainer != window) { + $(opts.scrollContainer).scrollTop($(opts.scrollContainer).scrollTop() + list.scroll.moveY); + return; + } + var t = $(opts.scrollContainer).scrollTop(); + if (list.scroll.moveY > 0 && t < list.scroll.maxY || list.scroll.moveY < 0 && t > 0) { + $(opts.scrollContainer).scrollTop(t + list.scroll.moveY); + list.draggedItem.css("top", list.draggedItem.offset().top + list.scroll.moveY + 1); + } + }, 10); + list.scroll.scrollX = window.setInterval(function() { + if (opts.scrollContainer != window) { + $(opts.scrollContainer).scrollLeft($(opts.scrollContainer).scrollLeft() + list.scroll.moveX); + return; + } + var l = $(opts.scrollContainer).scrollLeft(); + if (list.scroll.moveX > 0 && l < list.scroll.maxX || list.scroll.moveX < 0 && l > 0) { + $(opts.scrollContainer).scrollLeft(l + list.scroll.moveX); + list.draggedItem.css("left", list.draggedItem.offset().left + list.scroll.moveX + 1); + } + }, 10); + + //misc + $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); + list.setPos(e.pageX, e.pageY); + $(document).bind("mousemove", list.swapItems); + $(document).bind("mouseup", list.dropItem); + if (opts.scrollContainer != window) + $(window).bind("wheel", list.wheel); + }, + + //set position of draggedItem + setPos: function(x, y) { + //remove mouse offset so mouse cursor remains in same place on draggedItem instead of top left corner + var top = y - this.offset.top; + var left = x - this.offset.left; + + //limit top, left to within box draggedItem can't be dragged outside of + if (!opts.dragBetween) { + top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top)); + left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left)); + } + + //adjust top & left calculations to parent offset + var parent = this.draggedItem.offsetParent().not("body").offset(); //offsetParent returns body even when it's static, if not static offset is only factoring margin + if (parent != null) { + top -= parent.top; + left -= parent.left; + } + + //set x or y auto-scroll amount + if (opts.scrollContainer == window) { + y -= $(window).scrollTop(); + x -= $(window).scrollLeft(); + y = Math.max(0, y - $(window).height() + 5) + Math.min(0, y - 5); + x = Math.max(0, x - $(window).width() + 5) + Math.min(0, x - 5); + } else { + var cont = $(opts.scrollContainer); + var offset = cont.offset(); + y = Math.max(0, y - cont.height() - offset.top) + Math.min(0, y - offset.top); + x = Math.max(0, x - cont.width() - offset.left) + Math.min(0, x - offset.left); + } + + list.scroll.moveX = x == 0 ? 0 : x * opts.scrollSpeed / Math.abs(x); + list.scroll.moveY = y == 0 ? 0 : y * opts.scrollSpeed / Math.abs(y); + + //move draggedItem to new mouse cursor location + this.draggedItem.css({ top: top, left: left }); + }, + + //if scroll container is a div allow mouse wheel to scroll div instead of window when mouse is hovering over + wheel: function(e) { + if (list && opts.scrollContainer != window) { + var cont = $(opts.scrollContainer); + var offset = cont.offset(); + e = e.originalEvent; + if (e.clientX > offset.left && e.clientX < offset.left + cont.width() && e.clientY > offset.top && e.clientY < offset.top + cont.height()) { + var deltaY = (e.deltaMode == 0 ? 1 : 10) * e.deltaY; + cont.scrollTop(cont.scrollTop() + deltaY); + e.preventDefault(); + } + } + }, + + //build a table recording all the positions of the moveable list items + buildPositionTable: function() { + var pos = []; + this.getItems().not([list.draggedItem[0], list.placeHolderItem[0]]).each(function(i) { + var loc = $(this).offset(); + loc.right = loc.left + $(this).outerWidth(); + loc.bottom = loc.top + $(this).outerHeight(); + loc.elm = this; + pos[i] = loc; + }); + this.pos = pos; + }, + + dropItem: function() { + if (list.draggedItem == null) + return; + + //list.draggedItem.attr("style", "") doesn't work on IE8 and jQuery 1.5 or lower + //list.draggedItem.removeAttr("style") doesn't work on chrome and jQuery 1.6 (works jQuery 1.5 or lower) + var orig = list.draggedItem.attr("data-origstyle"); + list.draggedItem.attr("style", orig); + if (orig == "") + list.draggedItem.removeAttr("style"); + list.draggedItem.removeAttr("data-origstyle"); + + list.styleDragHandlers(true); + + list.placeHolderItem.before(list.draggedItem); + list.placeHolderItem.remove(); + + $("[data-droptarget], .dragSortItem").remove(); + + window.clearInterval(list.scroll.scrollY); + window.clearInterval(list.scroll.scrollX); + + //if position changed call dragEnd + if (list.draggedItem.attr("data-origpos") != $(lists).index(list) + "-" + $(list.container).children().index(list.draggedItem)) + if (opts.dragEnd.apply(list.draggedItem) == false) { //if dragEnd returns false revert order + var pos = list.draggedItem.attr("data-origpos").split('-'); + var nextItem = $(lists[pos[0]].container).children().not(list.draggedItem).eq(pos[1]); + if (nextItem.size() > 0) + nextItem.before(list.draggedItem); + else if (pos[1] == 0) //was the only item in list + $(lists[pos[0]].container).prepend(list.draggedItem); + else //was the last item in list + $(lists[pos[0]].container).append(list.draggedItem); + } + list.draggedItem.removeAttr("data-origpos"); + + list.draggedItem = null; + $(document).unbind("mousemove", list.swapItems); + $(document).unbind("mouseup", list.dropItem); + if (opts.scrollContainer != window) + $(window).unbind("wheel", list.wheel); + return false; + }, + + //swap the draggedItem (represented visually by placeholder) with the list item the it has been dragged on top of + swapItems: function(e) { + if (list.draggedItem == null) + return false; + + //move draggedItem to mouse location + list.setPos(e.pageX, e.pageY); + + //retrieve list and item position mouse cursor is over + var ei = list.findPos(e.pageX, e.pageY); + var nlist = list; + for (var i = 0; ei == -1 && opts.dragBetween && i < lists.length; i++) { + ei = lists[i].findPos(e.pageX, e.pageY); + nlist = lists[i]; + } + + //if not over another moveable list item return + if (ei == -1) + return false; + + //save fixed items locations + var children = function() { return $(nlist.container).children().not(nlist.draggedItem); }; + var fixed = children().not(opts.itemSelector).each(function(i) { this.idx = children().index(this); }); + + //if moving draggedItem up or left place placeHolder before list item the dragged item is hovering over otherwise place it after + if (lastPos == null || lastPos.top > list.draggedItem.offset().top || lastPos.left > list.draggedItem.offset().left) + $(nlist.pos[ei].elm).before(list.placeHolderItem); + else + $(nlist.pos[ei].elm).after(list.placeHolderItem); + + //restore fixed items location + fixed.each(function() { + var elm = children().eq(this.idx).get(0); + if (this != elm && children().index(this) < this.idx) + $(this).insertAfter(elm); + else if (this != elm) + $(this).insertBefore(elm); + }); + + //misc + $(lists).each(function(i, l) { l.createDropTargets(); l.buildPositionTable(); }); + lastPos = list.draggedItem.offset(); + return false; + }, + + //returns the index of the list item the mouse is over + findPos: function(x, y) { + for (var i = 0; i < this.pos.length; i++) { + if (this.pos[i].left < x && this.pos[i].right > x && this.pos[i].top < y && this.pos[i].bottom > y) + return i; + } + return -1; + }, + + //create drop targets which are placeholders at the end of other lists to allow dragging straight to the last position + createDropTargets: function() { + if (!opts.dragBetween) + return; + + $(lists).each(function() { + var ph = $(this.container).find("[data-placeholder]"); + var dt = $(this.container).find("[data-droptarget]"); + if (ph.size() > 0 && dt.size() > 0) + dt.remove(); + else if (ph.size() == 0 && dt.size() == 0) { + if (opts.tagName == "td") + $(opts.placeHolderTemplate).attr("data-droptarget", true).appendTo(this.container); + else + //list.placeHolderItem.clone().removeAttr("data-placeholder") crashes in IE7 and jquery 1.5.1 (doesn't in jquery 1.4.2 or IE8) + $(this.container).append(list.placeHolderItem.removeAttr("data-placeholder").clone().attr("data-droptarget", true)); + + list.placeHolderItem.attr("data-placeholder", true); + } + }); + } + }; + + newList.init(); + lists.push(newList); + }); + + return this; + }; + + $.fn.dragsort.defaults = { + itemSelector: "", + dragSelector: "", + dragSelectorExclude: "input, textarea", + dragEnd: function() { }, + dragBetween: false, + placeHolderTemplate: "", + scrollContainer: window, + scrollSpeed: 5 + }; + +})(jQuery); define("dragsort", function(){}); -/*! +/*! * jquery.event.drag - v 2.2 * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com * Open Source MIT License - http://threedubmedia.com/code/license @@ -8897,7 +8902,7 @@ define("dragsort", function(){}); ;(function(e){e.fn.drag=function(k,g,j){var i=typeof k=="string"?k:"",h=e.isFunction(k)?k:e.isFunction(g)?g:null;if(i.indexOf("drag")!==0){i="drag"+i}j=(k==h?g:j)||{};return h?this.bind(i,j,h):this.trigger(i)};var b=e.event,a=b.special,d=a.drag={defaults:{which:1,distance:0,not:":input",handle:null,relative:false,drop:true,click:false},datakey:"dragdata",noBubble:true,add:function(i){var h=e.data(this,d.datakey),g=i.data||{};h.related+=1;e.each(d.defaults,function(j,k){if(g[j]!==undefined){h[j]=g[j]}})},remove:function(){e.data(this,d.datakey).related-=1},setup:function(){if(e.data(this,d.datakey)){return}var g=e.extend({related:0},d.defaults);e.data(this,d.datakey,g);b.add(this,"touchstart mousedown",d.init,g);if(this.attachEvent){this.attachEvent("ondragstart",d.dontstart)}},teardown:function(){var g=e.data(this,d.datakey)||{};if(g.related){return}e.removeData(this,d.datakey);b.remove(this,"touchstart mousedown",d.init);d.textselect(true);if(this.detachEvent){this.detachEvent("ondragstart",d.dontstart)}},init:function(i){if(d.touched){return}var g=i.data,h;if(i.which!=0&&g.which>0&&i.which!=g.which){return}if(e(i.target).is(g.not)){return}if(g.handle&&!e(i.target).closest(g.handle,i.currentTarget).length){return}d.touched=i.type=="touchstart"?this:null;g.propagates=1;g.mousedown=this;g.interactions=[d.interaction(this,g)];g.target=i.target;g.pageX=i.pageX;g.pageY=i.pageY;g.dragging=null;h=d.hijack(i,"draginit",g);if(!g.propagates){return}h=d.flatten(h);if(h&&h.length){g.interactions=[];e.each(h,function(){g.interactions.push(d.interaction(this,g))})}g.propagates=g.interactions.length;if(g.drop!==false&&a.drop){a.drop.handler(i,g)}d.textselect(false);if(d.touched){b.add(d.touched,"touchmove touchend",d.handler,g)}else{b.add(document,"mousemove mouseup",d.handler,g)}if(!d.touched||g.live){return false}},interaction:function(h,g){var i=e(h)[g.relative?"position":"offset"]()||{top:0,left:0};return{drag:h,callback:new d.callback(),droppable:[],offset:i}},handler:function(h){var g=h.data;switch(h.type){case !g.dragging&&"touchmove":h.preventDefault();case !g.dragging&&"mousemove":if(Math.pow(h.pageX-g.pageX,2)+Math.pow(h.pageY-g.pageY,2)0){e.removeData(this,"suppress."+g.type);return}return f.apply(this,arguments)};var c=b.fixHooks.touchstart=b.fixHooks.touchmove=b.fixHooks.touchend=b.fixHooks.touchcancel={props:"clientX clientY pageX pageY screenX screenY".split(" "),filter:function(h,i){if(i){var g=(i.touches&&i.touches[0])||(i.changedTouches&&i.changedTouches[0])||null;if(g){e.each(c.props,function(j,k){h[k]=g[k]})}}return h}};a.draginit=a.dragstart=a.dragend=d})(jQuery); define("drag", function(){}); -/*! +/*! * jquery.event.drop - v 2.2 * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com * Open Source MIT License - http://threedubmedia.com/code/license @@ -8905,190 +8910,190 @@ define("drag", function(){}); ;(function(d){d.fn.drop=function(i,e,h){var g=typeof i=="string"?i:"",f=d.isFunction(i)?i:d.isFunction(e)?e:null;if(g.indexOf("drop")!==0){g="drop"+g}h=(i==f?e:h)||{};return f?this.bind(g,h,f):this.trigger(g)};d.drop=function(e){e=e||{};b.multi=e.multi===true?Infinity:e.multi===false?1:!isNaN(e.multi)?e.multi:b.multi;b.delay=e.delay||b.delay;b.tolerance=d.isFunction(e.tolerance)?e.tolerance:e.tolerance===null?null:b.tolerance;b.mode=e.mode||b.mode||"intersect"};var c=d.event,a=c.special,b=d.event.special.drop={multi:1,delay:20,mode:"overlap",targets:[],datakey:"dropdata",noBubble:true,add:function(f){var e=d.data(this,b.datakey);e.related+=1},remove:function(){d.data(this,b.datakey).related-=1},setup:function(){if(d.data(this,b.datakey)){return}var e={related:0,active:[],anyactive:0,winner:0,location:{}};d.data(this,b.datakey,e);b.targets.push(this);return false},teardown:function(){var f=d.data(this,b.datakey)||{};if(f.related){return}d.removeData(this,b.datakey);var e=this;b.targets=d.grep(b.targets,function(g){return(g!==e)})},handler:function(g,e){var f,h;if(!e){return}switch(g.type){case"mousedown":case"touchstart":h=d(b.targets);if(typeof e.drop=="string"){h=h.filter(e.drop)}h.each(function(){var i=d.data(this,b.datakey);i.active=[];i.anyactive=0;i.winner=0});e.droppable=h;a.drag.hijack(g,"dropinit",e);break;case"mousemove":case"touchmove":b.event=g;if(!b.timer){b.tolerate(e)}break;case"mouseup":case"touchend":b.timer=clearTimeout(b.timer);if(e.propagates){a.drag.hijack(g,"drop",e);a.drag.hijack(g,"dropend",e)}break}},locate:function(k,h){var l=d.data(k,b.datakey),g=d(k),i=g.offset()||{},e=g.outerHeight(),j=g.outerWidth(),f={elem:k,width:j,height:e,top:i.top,left:i.left,right:i.left+j,bottom:i.top+e};if(l){l.location=f;l.index=h;l.elem=k}return f},contains:function(e,f){return((f[0]||f.left)>=e.left&&(f[0]||f.right)<=e.right&&(f[1]||f.top)>=e.top&&(f[1]||f.bottom)<=e.bottom)},modes:{intersect:function(f,e,g){return this.contains(g,[f.pageX,f.pageY])?1000000000:this.modes.overlap.apply(this,arguments)},overlap:function(f,e,g){return Math.max(0,Math.min(g.bottom,e.bottom)-Math.max(g.top,e.top))*Math.max(0,Math.min(g.right,e.right)-Math.max(g.left,e.left))},fit:function(f,e,g){return this.contains(g,e)?1:0},middle:function(f,e,g){return this.contains(g,[e.left+e.width*0.5,e.top+e.height*0.5])?1:0}},sort:function(f,e){return(e.winner-f.winner)||(f.index-e.index)},tolerate:function(q){var k,e,n,j,l,m,g,p=0,f,h=q.interactions.length,r=[b.event.pageX,b.event.pageY],o=b.tolerance||b.modes[b.mode];do{if(f=q.interactions[p]){if(!f){return}f.drop=[];l=[];m=f.droppable.length;if(o){n=b.locate(f.proxy)}k=0;do{if(g=f.droppable[k]){j=d.data(g,b.datakey);e=j.location;if(!e){continue}j.winner=o?o.call(b,b.event,n,e):b.contains(e,r)?1:0;l.push(j)}}while(++k .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20); - _drop(); - }); - - _add = function (opts) { - id = 'tab_' + opts.id; - url = opts.url; - url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1"); - navobj.find("[role='presentation']").removeClass('active'); - tabobj.find("[role='tabpanel']").removeClass('active'); - //如果TAB不存在,创建一个新的TAB - if ($("#" + id).size() == 0) { - //创建新TAB的title - title = $(''); - //是否允许关闭 - if (options.close) { - title.append(' '); - } - //创建新TAB的内容 - content = $('
'); - //是否指定TAB内容 - if (opts.content) { - content.append(opts.content); - } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接 - var height = options.iframeHeight; - content.append('
'); - } else { - $.get(url, function (data) { - content.append(data); - }); - } - //加入TABS - if ($('.tabdrop li').size() > 0) { - $('.tabdrop ul').append(title); - } else { - navobj.append(title); - } - tabobj.append(content); - } - - //激活TAB - $("#tab_" + id).addClass('active'); - $("#" + id).addClass("active"); - _drop(); - }; - - _close = function (id) { - //如果关闭的是当前激活的TAB,激活他的前一个TAB - if (obj.find("li.active").attr('id') == "tab_" + id) { - if ($("#tab_" + id).prev().not(".tabdrop").size() > 0) { - $("#tab_" + id).prev().not(".tabdrop").find("a").trigger("click"); - } else if ($("#tab_" + id).next().size() > 0) { - $("#tab_" + id).next().trigger("click"); - } - } - //关闭TAB - $("#tab_" + id).remove(); - $("#" + id).remove(); - _drop(); - options.callback(); - }; - - _drop = function () { - //创建下拉标签 - var dropdown = $(''); - //检测是否已增加 - if (!$('.tabdrop').html()) { - dropdown.prependTo(navobj); - } else { - dropdown = navobj.find('.tabdrop'); - } - //检测是否有下拉样式 - if (navobj.parent().is('.tabs-below')) { - dropdown.addClass('dropup'); - } - var collection = 0; - - var maxwidth = navobj.width() - 60; - - var liwidth = 0; - //检查超过一行的标签页 - var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop'); - var lisize = litabs.size(); - litabs.each(function (i, j) { - liwidth += $(this).width(); - if (collection == 0 && i == lisize - 1 && liwidth <= navobj.width()) { - return true; - } - if (liwidth > maxwidth) { - dropdown.find('ul').append($(this)); - collection++; - } - }); - //如果有超出的,显示下拉标签 - if (collection > 0) { - dropdown.removeClass('hide'); - if (dropdown.find('.active').length == 1) { - dropdown.addClass('active'); - } else { - dropdown.removeClass('active'); - } - } else { - dropdown.addClass('hide'); - } - }; -}; +/** + * http://git.oschina.net/hbbcs/bootStrap-addTabs + * Created by joe on 2015-12-19. + * @param {type} options { + * content string||html 直接指定内容 + * close bool 是否可以关闭 + * monitor 监视的区域 + * } + * + * @returns + */ +$.fn.addtabs = function (options) { + var obj = $(this); + options = $.extend({ + content: '', //直接指定所有页面TABS内容 + close: true, //是否可以关闭 + monitor: 'body', //监视的区域 + nav: '.nav-addtabs', + tab: '.tab-addtabs', + iframeUse: true, //使用iframe还是ajax + iframeHeight: $(window).height() - 50, //固定TAB中IFRAME高度,根据需要自己修改 + callback: function () { + //关闭后回调函数 + } + }, options || {}); + var navobj = $(options.nav); + var tabobj = $(options.tab); + if (history.pushState) { + //浏览器前进后退事件 + $(window).on("popstate", function (e) { + var state = e.originalEvent.state; + $("a[addtabs=" + state.id + "]", options.monitor).data("pushstate", true).trigger("click"); + }); + } + $(options.monitor).on('click', '[addtabs]', function (e) { + if ($(this).attr('url').indexOf("javascript") !== 0) { + if ($(this).is("a")) { + e.preventDefault(); + } + var id = $(this).attr('addtabs'); + var title = $(this).attr('title') ? $(this).attr('title') : $.trim($(this).text()); + var url = $(this).attr('url'); + var content = options.content ? options.content : $(this).attr('content'); + var ajax = $(this).attr('ajax') ? true : false; + var state = ({ + url: url, title: title, id: id, content: content, ajax: ajax + }); + + document.title = title; + if (history.pushState && !$(this).data("pushstate")) { + window.history.pushState(state, title, url); + } + $(this).data("pushstate", null); + _add({ + id: id, + title: $(this).attr('title') ? $(this).attr('title') : $(this).html(), + content: content, + url: url, + ajax: ajax + }); + } + }); + + navobj.on('click', '.close-tab', function (e) { + id = $(this).prev("a").attr("aria-controls"); + _close(id); + return false; + }); + navobj.on('dblclick', 'li[role=presentation]', function (e) { + $(this).find(".close-tab").trigger("click"); + }); + navobj.on('click', 'li[role=presentation]', function (e) { + $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click"); + }); + + $(window).resize(function () { + $("#nav").width($("#header > .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20); + _drop(); + }); + + _add = function (opts) { + id = 'tab_' + opts.id; + url = opts.url; + url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1"); + navobj.find("[role='presentation']").removeClass('active'); + tabobj.find("[role='tabpanel']").removeClass('active'); + //如果TAB不存在,创建一个新的TAB + if ($("#" + id).size() == 0) { + //创建新TAB的title + title = $(''); + //是否允许关闭 + if (options.close) { + title.append(' '); + } + //创建新TAB的内容 + content = $('
'); + //是否指定TAB内容 + if (opts.content) { + content.append(opts.content); + } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接 + var height = options.iframeHeight; + content.append('
'); + } else { + $.get(url, function (data) { + content.append(data); + }); + } + //加入TABS + if ($('.tabdrop li').size() > 0) { + $('.tabdrop ul').append(title); + } else { + navobj.append(title); + } + tabobj.append(content); + } + + //激活TAB + $("#tab_" + id).addClass('active'); + $("#" + id).addClass("active"); + _drop(); + }; + + _close = function (id) { + //如果关闭的是当前激活的TAB,激活他的前一个TAB + if (obj.find("li.active").attr('id') == "tab_" + id) { + if ($("#tab_" + id).prev().not(".tabdrop").size() > 0) { + $("#tab_" + id).prev().not(".tabdrop").find("a").trigger("click"); + } else if ($("#tab_" + id).next().size() > 0) { + $("#tab_" + id).next().trigger("click"); + } + } + //关闭TAB + $("#tab_" + id).remove(); + $("#" + id).remove(); + _drop(); + options.callback(); + }; + + _drop = function () { + //创建下拉标签 + var dropdown = $(''); + //检测是否已增加 + if (!$('.tabdrop').html()) { + dropdown.prependTo(navobj); + } else { + dropdown = navobj.find('.tabdrop'); + } + //检测是否有下拉样式 + if (navobj.parent().is('.tabs-below')) { + dropdown.addClass('dropup'); + } + var collection = 0; + + var maxwidth = navobj.width() - 60; + + var liwidth = 0; + //检查超过一行的标签页 + var litabs = navobj.append(dropdown.find('li')).find('>li').not('.tabdrop'); + var lisize = litabs.size(); + litabs.each(function (i, j) { + liwidth += $(this).width(); + if (collection == 0 && i == lisize - 1 && liwidth <= navobj.width()) { + return true; + } + if (liwidth > maxwidth) { + dropdown.find('ul').append($(this)); + collection++; + } + }); + //如果有超出的,显示下拉标签 + if (collection > 0) { + dropdown.removeClass('hide'); + if (dropdown.find('.active').length == 1) { + dropdown.addClass('active'); + } else { + dropdown.removeClass('active'); + } + } else { + dropdown.addClass('hide'); + } + }; +}; define("addtabs", function(){}); diff --git a/public/assets/js/require-frontend.js b/public/assets/js/require-frontend.js index 48eddd30410ffae4b4ec60dcd68c876c8a5c5ff5..64111642fcda68bba9db5893ab9fa2ffe44d88f8 100644 --- a/public/assets/js/require-frontend.js +++ b/public/assets/js/require-frontend.js @@ -34,6 +34,7 @@ require.config({ 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min', 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile', 'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch', + 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch', 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN', 'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min', 'bloodhound': '../libs/typeahead.js/dist/bloodhound.min', @@ -78,6 +79,10 @@ require.config({ deps: ['bootstrap-table'], exports: '$.fn.bootstrapTable.defaults' }, + 'bootstrap-table-commonsearch': { + deps: ['bootstrap-table'], + exports: '$.fn.bootstrapTable.defaults' + }, 'tableexport': { deps: ['jquery'], exports: '$.fn.extend' diff --git a/public/assets/js/require-frontend.min.js b/public/assets/js/require-frontend.min.js index 87f947aa11352c7707620fe07811840f18190d5d..647934d99d71d9e7adb604ee73946cf315efd4cb 100644 --- a/public/assets/js/require-frontend.min.js +++ b/public/assets/js/require-frontend.min.js @@ -51,6 +51,7 @@ require.config({ 'bootstrap-table-export': '../libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min', 'bootstrap-table-mobile': '../libs/bootstrap-table/dist/extensions/mobile/bootstrap-table-mobile', 'bootstrap-table-advancedsearch': 'bootstrap-table-advancedsearch', + 'bootstrap-table-commonsearch': 'bootstrap-table-commonsearch', 'bootstrap-table-lang': '../libs/bootstrap-table/dist/locale/bootstrap-table-zh-CN', 'typeahead': '../libs/typeahead.js/dist/typeahead.jquery.min', 'bloodhound': '../libs/typeahead.js/dist/bloodhound.min', @@ -95,6 +96,10 @@ require.config({ deps: ['bootstrap-table'], exports: '$.fn.bootstrapTable.defaults' }, + 'bootstrap-table-commonsearch': { + deps: ['bootstrap-table'], + exports: '$.fn.bootstrapTable.defaults' + }, 'tableexport': { deps: ['jquery'], exports: '$.fn.extend' @@ -203,7 +208,7 @@ define('../libs/require-css/css.min',[],function(){if("undefined"==typeof window @Author:贤心 @Site:http://layer.layui.com @License:LGPL - + */ ;!function(window, undefined){ @@ -239,39 +244,39 @@ var layer = { layer.cache = ready.config = $.extend({}, ready.config, options); layer.path = ready.config.path || layer.path; typeof options.extend === 'string' && (options.extend = [options.extend]); - + if(ready.config.path) layer.ready(); - + if(!options.extend) return this; - - isLayui + + isLayui ? layui.addcss('modules/layer/' + options.extend) : layer.link('skin/' + options.extend); - + return this; }, - + //载入CSS配件 link: function(href, fn, cssname){ - + //未设置路径,则不主动加载css if(!layer.path) return; - + var head = $('head')[0], link = document.createElement('link'); if(typeof fn === 'string') cssname = fn; var app = (cssname || href).replace(/\.|\//g, ''); var id = 'layuicss-'+app, timeout = 0; - + link.rel = 'stylesheet'; link.href = layer.path + href; link.id = id; - + if(!$('#'+ id)[0]){ head.appendChild(link); } - + if(typeof fn !== 'function') return; - + //轮询css是否加载完毕 (function poll() { if(++timeout > 8 * 1000 / 100){ @@ -280,14 +285,14 @@ var layer = { parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100); }()); }, - + ready: function(callback){ var cssname = 'skinlayercss', ver = '1110'; isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname) : layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname); return this; }, - + //各种快捷引用 alert: function(content, options, yes){ var type = typeof options === 'function'; @@ -296,9 +301,9 @@ var layer = { content: content, yes: yes }, type ? {} : options)); - }, - - confirm: function(content, options, yes, cancel){ + }, + + confirm: function(content, options, yes, cancel){ var type = typeof options === 'function'; if(type){ cancel = yes; @@ -311,7 +316,7 @@ var layer = { btn2: cancel }, type ? {} : options)); }, - + msg: function(content, options, end){ //最常用提示层 var type = typeof options === 'function', rskin = ready.config.skin; var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg'; @@ -336,9 +341,9 @@ var layer = { options.skin = skin + ' ' + (options.skin||'layui-layer-hui'); } return options; - }())); + }())); }, - + load: function(icon, options){ return layer.open($.extend({ type: 3, @@ -346,8 +351,8 @@ var layer = { resize: false, shade: 0.01 }, options)); - }, - + }, + tips: function(content, follow, options){ return layer.open($.extend({ type: 4, @@ -362,7 +367,7 @@ var layer = { } }; -var Class = function(setings){ +var Class = function(setings){ var that = this; that.index = ++layer.index; that.config = $.extend({}, that.config, ready.config, setings); @@ -388,7 +393,7 @@ Class.pt.config = { area: 'auto', closeBtn: 1, time: 0, //0表示不自动关闭 - zIndex: 19891014, + zIndex: 19891014, maxWidth: 360, anim: 0, icon: -1, @@ -403,15 +408,15 @@ Class.pt.vessel = function(conType, callback){ var that = this, times = that.index, config = that.config; var zIndex = config.zIndex + times, titype = typeof config.title === 'object'; var ismax = config.maxmin && (config.type === 1 || config.type === 2); - var titleHTML = (config.title ? '
' - + (titype ? config.title[0] : config.title) + var titleHTML = (config.title ? '
' + + (titype ? config.title[0] : config.title) + '
' : ''); - + config.zIndex = zIndex; callback([ //遮罩 config.shade ? ('
') : '', - + //主体 '
' + (conType && config.type != 2 ? '' : titleHTML) @@ -446,22 +451,22 @@ Class.pt.creat = function(){ ,content = config.content ,conType = typeof content === 'object' ,body = $('body'); - + if($('#'+config.id)[0]) return; if(typeof config.area === 'string'){ config.area = config.area === 'auto' ? ['', ''] : [config.area, '']; } - + //anim兼容旧版shift if(config.shift){ config.anim = config.shift; } - + if(layer.ie == 6){ config.fixed = false; } - + switch(config.type){ case 0: config.btn = ('btn' in config) ? config.btn : ready.btn[0]; @@ -486,7 +491,7 @@ Class.pt.creat = function(){ config.tipsMore || layer.closeAll('tips'); break; } - + //建立容器 that.vessel(conType, function(html, titleHTML, moveElem){ body.append(html[0]); @@ -516,12 +521,12 @@ Class.pt.creat = function(){ config.type == 4 && that.tips(); }); } - + config.time <= 0 || setTimeout(function(){ layer.close(that.index) }, config.time); that.move().callback(); - + //为兼容jQuery3.0的css动画影响元素尺寸计算 if(doms.anim[config.anim]){ that.layero.addClass(doms.anim[config.anim]).data('anim', true); @@ -546,7 +551,7 @@ Class.pt.auto = function(index){ elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding'))|0)); } switch(config.type){ - case 2: + case 2: setHeight('iframe'); break; default: @@ -570,12 +575,12 @@ Class.pt.offset = function(){ var type = typeof config.offset === 'object'; that.offsetTop = (win.height() - area[1])/2; that.offsetLeft = (win.width() - area[0])/2; - + if(type){ that.offsetTop = config.offset[0]; that.offsetLeft = config.offset[1]||that.offsetLeft; } else if(config.offset !== 'auto'){ - + if(config.offset === 't'){ //上 that.offsetTop = 0; } else if(config.offset === 'r'){ //右 @@ -599,20 +604,20 @@ Class.pt.offset = function(){ } else { that.offsetTop = config.offset; } - + } - + if(!config.fixed){ - that.offsetTop = /%$/.test(that.offsetTop) ? + that.offsetTop = /%$/.test(that.offsetTop) ? win.height()*parseFloat(that.offsetTop)/100 : parseFloat(that.offsetTop); - that.offsetLeft = /%$/.test(that.offsetLeft) ? + that.offsetLeft = /%$/.test(that.offsetLeft) ? win.width()*parseFloat(that.offsetLeft)/100 : parseFloat(that.offsetLeft); that.offsetTop += win.scrollTop(); that.offsetLeft += win.scrollLeft(); } - + if(layero.attr('minLeft')){ that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0); that.offsetLeft = layero.css('left'); @@ -632,10 +637,10 @@ Class.pt.tips = function(){ top: follow.offset().top, left: follow.offset().left }, tipsG = layero.find('.layui-layer-TipsG'); - + var guide = config.tips[0]; config.tips[1] || tipsG.remove(); - + goal.autoLeft = function(){ if(goal.left + layArea[0] - win.width() > 0){ goal.tipLeft = goal.left + goal.width - layArea[0]; @@ -644,16 +649,16 @@ Class.pt.tips = function(){ goal.tipLeft = goal.left; }; }; - + //辨别tips的方位 - goal.where = [function(){ //上 + goal.where = [function(){ //上 goal.autoLeft(); goal.tipTop = goal.top - layArea[1] - 10; tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]); }, function(){ //右 goal.tipLeft = goal.left + goal.width + 10; goal.tipTop = goal.top; - tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]); + tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]); }, function(){ //下 goal.autoLeft(); goal.tipTop = goal.top + goal.height + 10; @@ -664,7 +669,7 @@ Class.pt.tips = function(){ tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]); }]; goal.where[guide-1](); - + /* 8*2为小三角形占据的空间 */ if(guide === 1){ goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2](); @@ -677,11 +682,11 @@ Class.pt.tips = function(){ } layero.find('.'+doms[5]).css({ - 'background-color': config.tips[1], + 'background-color': config.tips[1], 'padding-right': (config.closeBtn ? '30px' : '') }); layero.css({ - left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0), + left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0), top: goal.tipTop - (config.fixed ? win.scrollTop() : 0) }); } @@ -695,7 +700,7 @@ Class.pt.move = function(){ ,moveElem = layero.find(config.move) ,resizeElem = layero.find('.layui-layer-resize') ,dict = {}; - + if(config.move){ moveElem.css('cursor', 'move'); } @@ -711,7 +716,7 @@ Class.pt.move = function(){ ready.moveElem.css('cursor', 'move').show(); } }); - + resizeElem.on('mousedown', function(e){ e.preventDefault(); dict.resizeStart = true; @@ -722,7 +727,7 @@ Class.pt.move = function(){ ]; ready.moveElem.css('cursor', 'se-resize').show(); }); - + _DOC.on('mousemove', function(e){ //拖拽移动 @@ -730,35 +735,35 @@ Class.pt.move = function(){ var X = e.clientX - dict.offset[0] ,Y = e.clientY - dict.offset[1] ,fixed = layero.css('position') === 'fixed'; - + e.preventDefault(); - + dict.stX = fixed ? 0 : win.scrollLeft(); dict.stY = fixed ? 0 : win.scrollTop(); //控制元素不被拖出窗口外 if(!config.moveOut){ var setRig = win.width() - layero.outerWidth() + dict.stX - ,setBot = win.height() - layero.outerHeight() + dict.stY; + ,setBot = win.height() - layero.outerHeight() + dict.stY; X < dict.stX && (X = dict.stX); - X > setRig && (X = setRig); + X > setRig && (X = setRig); Y < dict.stY && (Y = dict.stY); Y > setBot && (Y = setBot); } - + layero.css({ left: X ,top: Y }); } - + //Resize if(config.resize && dict.resizeStart){ var X = e.clientX - dict.offset[0] ,Y = e.clientY - dict.offset[1]; - + e.preventDefault(); - + layer.style(that.index, { width: dict.area[0] + X ,height: dict.area[1] + Y @@ -776,7 +781,7 @@ Class.pt.move = function(){ ready.moveElem.hide(); } }); - + return that; }; @@ -793,7 +798,7 @@ Class.pt.callback = function(){ } } layer.ie == 6 && that.IE6(layero); - + //按钮 layero.find('.'+ doms[6]).children('a').on('click', function(){ var index = $(this).index(); @@ -810,29 +815,29 @@ Class.pt.callback = function(){ close === false || layer.close(that.index); } }); - + //取消 function cancel(){ var close = config.cancel && config.cancel(that.index, layero); close === false || layer.close(that.index); } - + //右上角关闭回调 layero.find('.'+ doms[7]).on('click', cancel); - + //点遮罩关闭 if(config.shadeClose){ $('#layui-layer-shade'+ that.index).on('click', function(){ layer.close(that.index); }); - } - + } + //最小化 layero.find('.layui-layer-min').on('click', function(){ var min = config.min && config.min(layero); - min === false || layer.min(that.index, config); + min === false || layer.min(that.index, config); }); - + //全屏/还原 layero.find('.layui-layer-max').on('click', function(){ if($(this).hasClass('layui-layer-maxmin')){ @@ -854,11 +859,11 @@ ready.reselect = function(){ $.each($('select'), function(index , value){ var sthis = $(this); if(!sthis.parents('.'+doms[0])[0]){ - (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show(); + (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show(); } sthis = null; }); -}; +}; Class.pt.IE6 = function(layero){ //隐藏select @@ -874,7 +879,7 @@ Class.pt.IE6 = function(layero){ //需依赖原型的对外方法 Class.pt.openLayer = function(){ var that = this; - + //置顶当前窗口 layer.zIndex = that.config.zIndex; layer.setTop = function(layero){ @@ -892,7 +897,7 @@ ready.record = function(layero){ var area = [ layero.width(), layero.height(), - layero.position().top, + layero.position().top, layero.position().left + parseFloat(layero.css('margin-left')) ]; layero.find('.layui-layer-max').addClass('layui-layer-maxmin'); @@ -917,7 +922,7 @@ window.layer = layer; //获取子iframe的DOM layer.getChildFrame = function(selector, index){ index = index || $('.'+doms[4]).attr('times'); - return $('#'+ doms[0] + index).find('iframe').contents().find(selector); + return $('#'+ doms[0] + index).find('iframe').contents().find(selector); }; //得到当前iframe层的索引,子iframe时使用 @@ -949,24 +954,24 @@ layer.style = function(index, options, limit){ ,titHeight = layero.find(doms[1]).outerHeight() || 0 ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0 ,minLeft = layero.attr('minLeft'); - + if(type === ready.type[3] || type === ready.type[4]){ return; } - + if(!limit){ if(parseFloat(options.width) <= 260){ options.width = 260; }; - + if(parseFloat(options.height) - titHeight - btnHeight <= 64){ options.height = 64 + titHeight + btnHeight; }; } - + layero.css(options); btnHeight = layero.find('.'+doms[6]).outerHeight(); - + if(type === ready.type[2]){ layero.find('iframe').css({ height: parseFloat(options.height) - titHeight - btnHeight @@ -986,16 +991,16 @@ layer.min = function(index, options){ ,titHeight = layero.find(doms[1]).outerHeight() || 0 ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px' ,position = layero.css('position'); - + ready.record(layero); - + if(ready.minLeft[0]){ left = ready.minLeft[0]; ready.minLeft.shift(); } - + layero.attr('position', position); - + layer.style(index, { width: 180 ,height: titHeight @@ -1008,7 +1013,7 @@ layer.min = function(index, options){ layero.find('.layui-layer-min').hide(); layero.attr('type') === 'page' && layero.find(doms[4]).hide(); ready.rescollbar(index); - + if(!layero.attr('minLeft')){ ready.minIndex++; } @@ -1020,9 +1025,9 @@ layer.restore = function(index){ var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(','); var type = layero.attr('type'); layer.style(index, { - width: parseFloat(area[0]), - height: parseFloat(area[1]), - top: parseFloat(area[2]), + width: parseFloat(area[0]), + height: parseFloat(area[1]), + top: parseFloat(area[2]), left: parseFloat(area[3]), position: layero.attr('position'), overflow: 'visible' @@ -1085,16 +1090,16 @@ layer.close = function(index){ layero.remove(); } }; - + if(layero.data('anim')){ layero.addClass(closeAnim); } - + $('#layui-layer-moves, #layui-layer-shade' + index).remove(); layer.ie == 6 && ready.reselect(); ready.rescollbar(index); typeof ready.end[index] === 'function' && ready.end[index](); - delete ready.end[index]; + delete ready.end[index]; if(layero.attr('minLeft')){ ready.minIndex--; ready.minLeft.push(layero.attr('minLeft')); @@ -1114,7 +1119,7 @@ layer.closeAll = function(type){ }); }; -/** +/** 拓展模块,layui开始合并在一起 @@ -1122,15 +1127,15 @@ layer.closeAll = function(type){ var cache = layer.cache||{}, skin = function(type){ return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : ''); -}; - +}; + //仿系统prompt layer.prompt = function(options, yes){ var style = ''; options = options || {}; - + if(typeof options === 'function') yes = options; - + if(options.area){ var area = options.area; style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"'; @@ -1139,7 +1144,7 @@ layer.prompt = function(options, yes){ var prompt, content = options.formType == 2 ? '' : function(){ return ''; }(); - + return layer.open($.extend({ type: 1 ,btn: ['确定','取消'] @@ -1215,7 +1220,7 @@ layer.photos = function(options, loop, key){ var photos = type ? options.photos : {}, data = photos.data || []; var start = photos.start || 0; dict.imgIndex = (start|0) + 1; - + options.img = options.img || 'img'; if(!type){ //页面直接获取 @@ -1232,13 +1237,13 @@ layer.photos = function(options, loop, key){ }); }) }; - + pushData(); - + if (data.length === 0) return; - + loop || parent.on('click', options.img, function(){ - var othis = $(this), index = othis.attr('layer-index'); + var othis = $(this), index = othis.attr('layer-index'); layer.photos($.extend(options, { photos: { start: index, @@ -1249,14 +1254,14 @@ layer.photos = function(options, loop, key){ }), true); pushData(); }) - + //不直接弹出 if(!loop) return; - + } else if (data.length === 0){ return layer.msg('没有图片'); } - + //上一张 dict.imgprev = function(key){ dict.imgIndex--; @@ -1265,7 +1270,7 @@ layer.photos = function(options, loop, key){ } dict.tabimg(key); }; - + //下一张 dict.imgnext = function(key,errorMsg){ dict.imgIndex++; @@ -1275,7 +1280,7 @@ layer.photos = function(options, loop, key){ } dict.tabimg(key) }; - + //方向键 dict.keyup = function(event){ if(!dict.end){ @@ -1290,7 +1295,7 @@ layer.photos = function(options, loop, key){ } } } - + //切换 dict.tabimg = function(key){ if(data.length <= 1) return; @@ -1298,7 +1303,7 @@ layer.photos = function(options, loop, key){ layer.close(dict.index); layer.photos(options, true, key); } - + //一些动作 dict.event = function(){ dict.bigimg.hover(function(){ @@ -1306,24 +1311,24 @@ layer.photos = function(options, loop, key){ }, function(){ dict.imgsee.hide(); }); - + dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){ event.preventDefault(); dict.imgprev(); - }); - - dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){ + }); + + dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){ event.preventDefault(); dict.imgnext(); }); - + $(document).on('keyup', dict.keyup); }; - + //图片预加载 - function loadImage(url, callback, error) { + function loadImage(url, callback, error) { var img = new Image(); - img.src = url; + img.src = url; if(img.complete){ return callback(img); } @@ -1334,9 +1339,9 @@ layer.photos = function(options, loop, key){ img.onerror = function(e){ img.onerror = null; error(e); - }; + }; }; - + dict.loadi = layer.load(1, { shade: 'shade' in options ? false : 0.9, scrollbar: false @@ -1348,7 +1353,7 @@ layer.photos = function(options, loop, key){ area: function(){ var imgarea = [img.width, img.height]; var winarea = [$(window).width() - 100, $(window).height() - 100]; - + //如果 实际图片的宽或者高比 屏幕大(那么进行缩放) if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){ var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例 @@ -1360,8 +1365,8 @@ layer.photos = function(options, loop, key){ imgarea[1] = imgarea[1]/wh[1]; } } - - return [imgarea[0]+'px', imgarea[1]+'px']; + + return [imgarea[0]+'px', imgarea[1]+'px']; }(), title: false, shade: 0.9, @@ -1393,8 +1398,8 @@ layer.photos = function(options, loop, key){ }, function(){ layer.close(dict.loadi); layer.msg('当前图片地址异常
是否继续查看下一张?', { - time: 30000, - btn: ['下一张', '不看了'], + time: 30000, + btn: ['下一张', '不看了'], yes: function(){ data.length > 1 && dict.imgnext(true,true); } diff --git a/public/assets/js/require-table.js b/public/assets/js/require-table.js index 4d212af8a5e486bd051cff804e2d1870bfd4da77..beabb5f3e5d4a5b34432a28aa19c03ddcab8a961 100644 --- a/public/assets/js/require-table.js +++ b/public/assets/js/require-table.js @@ -1,4 +1,4 @@ -define(['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'moment', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-advancedsearch'], function ($, undefined, Backend, Config, Toastr, Moment) { +define(['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'moment', 'bootstrap-table', 'bootstrap-table-lang', 'bootstrap-table-mobile', 'bootstrap-table-export', 'bootstrap-table-advancedsearch', 'bootstrap-table-commonsearch'], function ($, undefined, Backend, Config, Toastr, Moment) { var Table = { list: {}, @@ -10,7 +10,9 @@ define(['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'moment', 'bootstr toolbar: "#toolbar", search: true, cache: false, - advancedSearch: true, + advancedSearch: false, + commonSearch: false, + titleForm: '', //为空则不显示标题,不定义默认显示:普通搜索 idTable: 'advancedTable', showExport: true, exportDataType: "all",