diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index 1e9153b..4e3c034 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 93504bf..d92c7fa 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 a9ec03c..c8737ee 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 '<a href="' + Config.upload.cdnurl + value + '" target="_blank"><img src="' + Config.upload.cdnurl + value + '" alt="" style="max-height:90px;max-width:120px"></a>'; } else { return '<a href="' + Config.upload.cdnurl + value + '" target="_blank"><img src="' + Config.upload.cdnurl + value + '!/fwfh/50x50" alt=""></a>'; diff --git a/public/assets/js/backend/page.js b/public/assets/js/backend/page.js index 28118e1..ebee2b6 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 a63258f..4474012 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 0000000..1f03d75 --- /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 <http://git.oschina.net/pp/fastadmin> + */ + +!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("<div id=\"commonSearchModalContent_%s\" class=\"well bs-component\">", that.options.idTable); + vModal += vFormCommon.join(''); + vModal += "</div>"; + $("#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("<option value='" + opList[i] + "'>" + opList[i] + "</option>"); + //} + //var selectHtml = selectList.join(''); + htmlForm.push(sprintf('<form class="form-inline" id="%s" action="%s" >', that.options.idForm, that.options.actionForm)); + htmlForm.push('<fieldset>'); + if (that.options.titleForm.length > 0) + htmlForm.push(sprintf("<legend>%s</legend>", 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('<div class="form-group" style="margin:0 5px;">'); + htmlForm.push(sprintf('<label for="%s" class="control-label" style="padding:0 10px">%s</label>', vObjCol.field, vObjCol.title)); + if (that.options.sidePagination == 'server' && that.options.url) { + //htmlForm.push('<div class="col-sm-2">'); + //htmlForm.push(sprintf('<select class="form-control" name="field-%s" data-name="%s">%s</select>', vObjCol.field, vObjCol.field, selectHtml)); + vObjCol.operate = (typeof vObjCol.operate === 'undefined' || $.inArray(vObjCol.operate, opList) === -1) ? '=' : vObjCol.operate; + htmlForm.push(sprintf('<input type="hidden" class="form-control operate" name="field-%s" data-name="%s" value="%s" readonly>', vObjCol.field, vObjCol.field, vObjCol.operate)); + //htmlForm.push('</div>'); + } + + //htmlForm.push('<div class="col-sm-8">'); + 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('<option value="">%s</option>', $.fn.bootstrapTable.locales.formatCommonChoose())); + $.each(vObjCol.searchList, function (key, value) { + searchList.push("<option value='" + (isArray ? value : key) + "'>" + value + "</option>"); + }); + htmlForm.push(sprintf('<select class="form-control" name="%s" %s>%s</select>', 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('<input type="%s" class="%s" name="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, placeholder, vObjCol.field, style, data)); + var reg = /BETWEEN$/; + if (reg.test(vObjCol.operate)) { + htmlForm.push(sprintf(' - <input type="%s" class="%s" name="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, placeholder, vObjCol.field, style, data)); + } + } + + //htmlForm.push('</div>'); + htmlForm.push('</div>'); + } + } + + htmlForm.push('<div class="form-group" style="margin:0 5px;">'); + htmlForm.push(createFormBtn(that).join('')); + htmlForm.push('</div>'); + htmlForm.push('</fieldset>'); + htmlForm.push('</form>'); + + 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('<div class="form-group">'); + htmlBtn.push('<div class="col-sm-12 text-center">'); + if (that.options.sidePagination == 'server' && that.options.url) { + htmlBtn.push(sprintf('<button type="button" id="btnSubmitCommon%s" class="btn btn-success" >%s</button> ', "_" + that.options.idTable, searchSubmit)); + htmlBtn.push(sprintf('<button type="button" id="btnResetCommon%s" class="btn btn-default" >%s</button> ', "_" + that.options.idTable, searchReset)); + } else { + htmlBtn.push(sprintf('<button type="button" id="btnCloseCommon%s" data-dismiss="modal" class="btn btn-default" >%s</button> ', "_" + that.options.idTable, searchClose)); + } + htmlBtn.push('</div>'); + htmlBtn.push('</div>'); + 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 8e1dcb0..a8d665e 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 186de16..02fa2db 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 ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">' - + (titype ? config.title[0] : config.title) + var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">' + + (titype ? config.title[0] : config.title) + '</div>' : ''); - + config.zIndex = zIndex; callback([ //遮罩 config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '', - + //主体 '<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">' + (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 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){ return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">'; }(); - + 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('当前图片地址异常<br>是否继续查看下一张?', { - 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;0<a.ignoreColumn.length&&("string"==typeof a.ignoreColumn[0]?H.length>d&&"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]&&0<A[e].length)for(d=0;d<=b;d++)"undefined"!=typeof A[e][d]&&(w(null,e,d),delete A[e][d],b++);c(this).is("[colspan]")&&(h=parseInt(c(this).attr("colspan")),l+=0<h?h-1:0);c(this).is("[rowspan]")&&(f=parseInt(c(this).attr("rowspan")));w(this,e,b);for(d=0;d<h-1;d++)w(null,e,b+d);if(f)for(r=1;r<f;r++)for("undefined"==typeof A[e+r]&&(A[e+r]=[]),A[e+r][b+l]="",d=1;d<h;d++)A[e+r][b+l-d]=""}}});if("undefined"!=typeof A[e]&&0<A[e].length)for(b=0;b<=A[e].length;b++)"undefined"!= -typeof A[e][b]&&(w(null,e,b),delete A[e][b])}}function Z(b,h){!0===a.consoleLog&&console.log(b.output());if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return F(b.output());if("window"===a.outputMode)window.open(URL.createObjectURL(b.output("blob")));else try{var e=b.output("blob");saveAs(e,a.fileName+".pdf")}catch(d){C(a.fileName+".pdf","data:application/pdf"+(h?"":";base64")+",",h?e:b.output())}}function aa(b,a,e){var d=0;"undefined"!=typeof e&&(d=e.colspan);if(0<=d){for(var h= -b.width,c=b.textPos.x,l=a.table.columns.indexOf(a.column),r=1;r<d;r++)h+=a.table.columns[l+r].width;1<d&&("right"===b.styles.halign?c=b.textPos.x+h-b.width:"center"===b.styles.halign&&(c=b.textPos.x+(h-b.width)/2));b.width=h;b.textPos.x=c;"undefined"!=typeof e&&1<e.rowspan&&(b.height*=e.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)e=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<e&&(b.textPos.y-=(2-1.15)/2*a.row.styles.fontSize*(e-2)/3);return!0}return!1} -function ba(b,a,e){"undefined"!=typeof e.images&&a.each(function(){var a=c(this).children();if(c(this).is("img")){var h=ca(this.src);e.images[h]={url:this.src,src:this.src}}"undefined"!=typeof a&&0<a.length&&ba(b,a,e)})}function ka(b,a){function h(b){if(b.url){var d=new Image;c=++q;d.crossOrigin="Anonymous";d.onerror=d.onload=function(){if(d.complete&&(0===d.src.indexOf("data:image/")&&(d.width=b.width||d.width||0,d.height=b.height||d.height||0),d.width+d.height)){var h=document.createElement("canvas"), -e=h.getContext("2d");h.width=d.width;h.height=d.height;e.drawImage(d,0,0);b.src=h.toDataURL("image/jpeg")}--q||a(c)};d.src=b.url}}var d,c=0,q=0;if("undefined"!=typeof b.images)for(d in b.images)b.images.hasOwnProperty(d)&&h(b.images[d]);(d=q)||(a(c),d=void 0);return d}function da(b,h,e){h.each(function(){var d=c(this).children();if(c(this).is("div")){var h=N(E(this,"background-color"),[255,255,255]),q=N(E(this,"border-top-color"),[0,0,0]),l=O(this,"border-top-width",a.jspdf.unit),r=this.getBoundingClientRect(), -f=this.offsetLeft*e.dw,g=this.offsetTop*e.dh,k=r.width*e.dw,r=r.height*e.dh;e.doc.setDrawColor.apply(void 0,q);e.doc.setFillColor.apply(void 0,h);e.doc.setLineWidth(l);e.doc.rect(b.x+f,b.y+g,k,r,l?"FD":"F")}else if(c(this).is("img")&&"undefined"!=typeof e.images&&(g=ca(this.src),h=e.images[g],"undefined"!=typeof h)){q=b.width/b.height;l=this.width/this.height;f=b.width;k=b.height;g=0;l<q?(k=Math.min(b.height,this.height),f=this.width*k/this.height):l>q&&(f=Math.min(b.width,this.width),k=this.height* -f/this.width);k<b.height&&(g=(b.height-k)/2);try{e.doc.addImage(h.src,b.textPos.x,b.y+g,f,k)}catch(oa){}b.textPos.x+=f}"undefined"!=typeof d&&0<d.length&&da(b,d,e)})}function P(b,a,e){return b.replace(new RegExp(a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function ea(b){b=P(b||"0",a.numbers.html.thousandsSeparator,"");b=P(b,a.numbers.html.decimalMark,".");return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function x(b,h,e){var d="";if(null!==b){var w=c(b),q;if(w[0].hasAttribute("data-tableexport-value"))q= -w.data("tableexport-value");else if(q=w.html(),"function"===typeof a.onCellHtmlData)q=a.onCellHtmlData(w,h,e,q);else if(""!=q){b=c.parseHTML(q);var l=0,r=0;q="";c.each(b,function(){if(c(this).is("input"))q+=w.find("input").eq(l++).val();else if(c(this).is("select"))q+=w.find("select option:selected").eq(r++).text();else if("undefined"===typeof c(this).html())q+=c(this).text();else if(void 0===jQuery().bootstrapTable||!0!==c(this).hasClass("filterControl"))q+=c(this).html()})}if(!0===a.htmlContent)d= -c.trim(q);else if(""!=q){var f=q.replace(/\n/g,"\u2028").replace(/<br\s*[\/]?>/gi,"\u2060");b=c("<div/>").html(f).contents();f="";c.each(b.text().split("\u2028"),function(b,a){0<b&&(f+=" ");f+=c.trim(a)});c.each(f.split("\u2060"),function(b,a){0<b&&(d+="\n");d+=c.trim(a).replace(/\u00AD/g,"")});if("json"==a.type||!1===a.numbers.output)b=ea(d),!1!==b&&(d=Number(b));else if(a.numbers.html.decimalMark!=a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!=a.numbers.output.thousandsSeparator)if(b= -ea(d),!1!==b){var g=(""+b).split(".");1==g.length&&(g[1]="");var k=3<g[0].length?g[0].length%3:0,d=(0>b?"-":"")+(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.r<d&&(e.e.r=d);e.e.c<c&&(e.e.c=c);var f={v:a[d][c]};if(null!==f.v){var l=XLSX.utils.encode_cell({c:c, -r:d});if("number"===typeof f.v)f.t="n";else if("boolean"===typeof f.v)f.t="b";else if(f.v instanceof Date){f.t="n";f.z=XLSX.SSF._table[14];var r=f,g;g=(Date.parse(f.v)-new Date(Date.UTC(1899,11,30)))/864E5;r.v=g}else f.t="s";b[l]=f}}1E7>e.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;c<f;c++)d=a.charCodeAt(c),b=(b<<5)-b+d,b|=0;return b}function C(a,c,e){var b=window.navigator.userAgent;if(!1!==a&&(0<b.indexOf("MSIE ")|| -b.match(/Trident.*rv\:11\./)))if(window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([e]),a);else{if(c=document.createElement("iframe"))document.body.appendChild(c),c.setAttribute("style","display:none"),c.contentDocument.open("txt/html","replace"),c.contentDocument.write(e),c.contentDocument.close(),c.focus(),c.contentDocument.execCommand("SaveAs",!0,a),document.body.removeChild(c)}else if(b=document.createElement("a")){var h=null;b.style.display="none";!1!==a?b.download= -a:b.target="_blank";"object"==typeof e?(h=window.URL.createObjectURL(e),b.href=h):0<=c.toLowerCase().indexOf("base64,")?b.href=c+F(e):b.href=c+encodeURIComponent(e);document.body.appendChild(b);if(document.createEvent)null===Q&&(Q=document.createEvent("MouseEvents")),Q.initEvent("click",!0,!1),b.dispatchEvent(Q);else if(document.createEventObject)b.fireEvent("onclick");else if("function"==typeof b.onclick)b.onclick();h&&window.URL.revokeObjectURL(h);document.body.removeChild(b)}}function F(a){var b= -"",c,d,f,g,l,r,k=0;a=a.replace(/\x0d\x0a/g,"\n");d="";for(f=0;f<a.length;f++)g=a.charCodeAt(f),128>g?d+=String.fromCharCode(g):(127<g&&2048>g?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<a.length;)c=a.charCodeAt(k++),d=a.charCodeAt(k++),f=a.charCodeAt(k++),g=c>>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<m.length&&(0<D.length&&(D+="\n"),D+=m);k++});return b.length},I=I+U(c(t).find("thead").first().find(a.theadSelector),"th,td",I);c(t).find("tbody").each(function(){I+= -U(c(this).find(a.tbodySelector),"td,th",I)});a.tfootSelector.length&&U(c(t).find("tfoot").first().find(a.tfootSelector),"td,th",I);D+="\n";!0===a.consoleLog&&console.log(D);if("string"===a.outputMode)return D;if("base64"===a.outputMode)return F(D);if("window"===a.outputMode){C(!1,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,",D);return}try{y=new Blob([D],{type:"text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8"}),saveAs(y,a.fileName+"."+a.type,"csv"!=a.type||!1===a.csvUseBOM)}catch(b){C(a.fileName+ -"."+a.type,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,"+("csv"==a.type&&a.csvUseBOM?"\ufeff":""),D)}}else if("sql"==a.type){var k=0,v="INSERT INTO `"+a.tableName+"` (",n=c(t).find("thead").first().find(a.theadSelector);n.each(function(){z(this,"th,td",k,n.length,function(a,c,e){v+="'"+x(a,c,e)+"',"});k++;v=c.trim(v);v=c.trim(v).substring(0,v.length-1)});v+=") VALUES ";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(){m="";z(this,"td,th",k,n.length+g.length,function(a,c,e){m+="'"+x(a,c,e)+"',"});3<m.length&&(v+="("+m,v=c.trim(v).substring(0,v.length-1),v+="),");k++});v=c.trim(v).substring(0,v.length-1);v+=";";!0===a.consoleLog&&console.log(v);if("string"===a.outputMode)return v;if("base64"===a.outputMode)return F(v);try{y=new Blob([v],{type:"text/plain;charset=utf-8"}),saveAs(y,a.fileName+".sql")}catch(b){C(a.fileName+".sql","data:application/sql;charset=utf-8,", -v)}}else if("json"==a.type){var J=[],n=c(t).find("thead").first().find(a.theadSelector);n.each(function(){var a=[];z(this,"th,td",k,n.length,function(b,c,d){a.push(x(b,c,d))});J.push(a)});var V=[];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={},h=0;z(this,"td,th",k,n.length+g.length,function(b,c,f){J.length?a[J[J.length-1][h]]=x(b,c,f):a[h]=x(b,c,f);h++}); -!1===c.isEmptyObject(a)&&V.push(a);k++});u="";u="head"==a.jsonScope?JSON.stringify(J):"data"==a.jsonScope?JSON.stringify(V):JSON.stringify({header:J,data:V});!0===a.consoleLog&&console.log(u);if("string"===a.outputMode)return u;if("base64"===a.outputMode)return F(u);try{y=new Blob([u],{type:"application/json;charset=utf-8"}),saveAs(y,a.fileName+".json")}catch(b){C(a.fileName+".json","data:application/json;charset=utf-8;base64,",u)}}else if("xml"===a.type){var k=0,B='<?xml version="1.0" encoding="utf-8"?>', -B=B+"<tabledata><fields>",n=c(t).find("thead").first().find(a.theadSelector);n.each(function(){z(this,"th,td",k,n.length,function(a,c,e){B+="<field>"+x(a,c,e)+"</field>"});k++});var B=B+"</fields><data>",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+="<column-"+a+">"+x(b,c,d)+"</column-"+a+ -">";a++});0<m.length&&"<column-1></column-1>"!=m&&(B+='<row id="'+ga+'">'+m+"</row>",ga++);k++});B+="</data></tabledata>";!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+="<table><thead>";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+="<th";for(var f in a.excelstyles)if(a.excelstyles.hasOwnProperty(f)){var l= -c(b).css(a.excelstyles[f]);""!==l&&"0px none rgb(0, 0, 0)"!=l&&"rgba(0, 0, 0, 0)"!=l&&(h+=""===h?'style="':";",h+=a.excelstyles[f]+":"+l)}""!==h&&(m+=" "+h+'"');c(b).is("[colspan]")&&(m+=' colspan="'+c(b).attr("colspan")+'"');c(b).is("[rowspan]")&&(m+=' rowspan="'+c(b).attr("rowspan")+'"');m+=">"+x(b,e,d)+"</th>"}});0<m.length&&(G+="<tr>"+m+"</tr>");k++});G+="</thead><tbody>";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+="<td";""!==f&&(m+=" "+f+'"');c(e).is("[colspan]")&&(m+=' colspan="'+c(e).attr("colspan")+'"');c(e).is("[rowspan]")&&(m+=' rowspan="'+c(e).attr("rowspan")+'"');m+=">"+x(e,d,h).replace(/\n/g,"<br>")+"</td>"}});0<m.length&&(G+="<tr>"+m+"</tr>");k++});a.displayTableName&&(G+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+x(c("<p>"+a.tableName+"</p>"))+"</td></tr>");G+="</tbody></table>";!0===a.consoleLog&&console.log(G)});p='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+ -p+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+u+'; charset=UTF-8">')+"<head>";"excel"===u&&(p+="\x3c!--[if gte mso 9]>",p+="<xml>",p+="<x:ExcelWorkbook>",p+="<x:ExcelWorksheets>",p+="<x:ExcelWorksheet>",p+="<x:Name>",p+=a.worksheetName,p+="</x:Name>",p+="<x:WorksheetOptions>",p+="<x:DisplayGridlines/>",p+="</x:WorksheetOptions>",p+="</x:ExcelWorksheet>",p+="</x:ExcelWorksheets>",p+="</x:ExcelWorkbook>",p+="</xml>",p+="<![endif]--\x3e"); -p+="<style>br {mso-data-placement:same-cell;}</style>";p+="</head>";p+="<body>";p+=G;p+="</body>";p+="</html>";!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;f<e-1;++f)a.push(null)}});ha.push(a);k++});u=new T;K=na(ha);K["!merges"]=W;u.SheetNames.push(a.worksheetName);u.Sheets[a.worksheetName]=K;u=XLSX.write(u,{bookType:a.type,bookSST:!1,type:"binary"});try{y=new Blob([ma(u)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),saveAs(y,a.fileName+"."+a.type)}catch(b){C(a.fileName+"."+a.type,"data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8,", -y)}}else if("png"==a.type)html2canvas(c(t)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),e=new ArrayBuffer(c.length),d=new Uint8Array(e),f=0;f<c.length;f++)d[f]=c.charCodeAt(f);!0===a.consoleLog&&console.log(c);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return F(b);if("window"===a.outputMode)window.open(b);else try{y=new Blob([e],{type:"image/png"}),saveAs(y,a.fileName+".png")}catch(q){C(a.fileName+".png","data:image/png,",y)}});else if("pdf"==a.type)if(!0=== -a.pdfmake.enabled){var X=[],Y=[],k=0,n=c(this).find("thead").first().find(a.theadSelector);n.each(function(){var a=[];z(this,"th,td",k,n.length,function(b,c,f){a.push(x(b,c,f))});a.length&&Y.push(a);for(var c=X.length;c<a.length;c++)X.push("*");k++});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(){var a=[];z(this,"td,th",k,n.length+g.length,function(b,c,d){a.push(x(b, -c,d))});a.length&&Y.push(a);k++});pdfMake.createPdf({pageOrientation:"landscape",content:[{table:{headerRows:n.length,widths:X,body:Y}}]}).getBuffer(function(b){try{var c=new Blob([b],{type:"application/pdf"});saveAs(c,a.fileName+".pdf")}catch(e){C(a.fileName+".pdf","data:application/pdf;base64,",b)}})}else if(!1===a.jspdf.autotable){u={dim:{w:O(c(t).first().get(0),"width","mm"),h:O(c(t).first().get(0),"height","mm")},pagesplit:!1};var ia=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format); -ia.addHTML(c(t).first(),a.jspdf.margins.left,a.jspdf.margins.top,u,function(){Z(ia,!1)})}else{var f=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var L={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89]},R="",M="",ja=0;c(t).filter(":visible").each(function(){if("none"!=c(this).css("display")){var a=O(c(this).get(0),"width","pt");if(a>ja){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&&0<b.length&&ba(a,b,f))});b++})}),n=[],g=[]);ka(f,function(b){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, -e=0;H=S(this);f.columns=[];f.rows=[];f.rowoptions={};if("function"===typeof f.onTable&&!1===f.onTable(c(this),a))return!0;a.jspdf.autotable.tableExport=null;var d=c.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=f;d.margin={};c.extend(!0,d.margin,a.jspdf.margins);d.tableExport=f;"function"!==typeof d.beforePageContent&&(d.beforePageContent=function(a){1==a.pageCount&&a.table.rows.concat(a.table.headerRow).forEach(function(b){0<b.height&&(b.height+=(2-1.15)/2*b.styles.fontSize,a.table.height+= -(2-1.15)/2*b.styles.fontSize)})});"function"!==typeof d.createdHeaderCell&&(d.createdHeaderCell=function(a,b){a.styles=c.extend({},b.row.styles);if("undefined"!=typeof f.columns[b.column.dataKey]){var e=f.columns[b.column.dataKey];if("undefined"!=typeof e.rect){var g;a.contentWidth=e.rect.width;if("undefined"==typeof f.heightRatio||0===f.heightRatio)g=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height, -f.heightRatio=a.styles.rowHeight/g;g=b.row.raw[b.column.dataKey].rect.height*f.heightRatio;g>a.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&&0<c.kids.length){var d=a.height/c.rect.height;if(d>f.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<e)for(var k=e-1;0<=k;)c.each(f.headerrows[k],function(){var a=this;0<k&&null===this.rect&&(a=f.headerrows[k-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&f.columns.push(a)}),k=0<f.columns.length?-1:k-1;var m=0;g= -[];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(){var a=[];b=0;z(this,"td,th",e,n.length+g.length,function(d,e,g){if("undefined"===typeof f.columns[b]){var h={title:"",key:b,style:{hidden:!0}};f.columns.push(h)}"undefined"!==typeof d&&null!==d?(h=fa(d),h.kids=c(d).children()):(h=c.extend(!0,{},f.rowoptions[m+":"+(b-1)]),h.colspan=-1);f.rowoptions[m+":"+b++]= -h;a.push(x(d,e,g))});a.length&&(f.rows.push(a),m++);e++});if("function"===typeof f.onBeforeAutotable)f.onBeforeAutotable(c(this),f.columns,f.rows,d);f.doc.autoTable(f.columns,f.rows,d);if("function"===typeof f.onAfterAutotable)f.onAfterAutotable(c(this),d);a.jspdf.autotable.startY=f.doc.autoTableEndPosY()+d.margin.top});Z(f.doc,"undefined"!=typeof f.images&&!1===jQuery.isEmptyObject(f.images));"undefined"!=typeof f.headerrows&&(f.headerrows.length=0);"undefined"!=typeof f.columns&&(f.columns.length= -0);"undefined"!=typeof f.rows&&(f.rows.length=0);delete f.doc;f.doc=null})}return this}})})(jQuery); +/* + 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;0<a.ignoreColumn.length&&("string"==typeof a.ignoreColumn[0]?H.length>d&&"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]&&0<A[e].length)for(d=0;d<=b;d++)"undefined"!=typeof A[e][d]&&(w(null,e,d),delete A[e][d],b++);c(this).is("[colspan]")&&(h=parseInt(c(this).attr("colspan")),l+=0<h?h-1:0);c(this).is("[rowspan]")&&(f=parseInt(c(this).attr("rowspan")));w(this,e,b);for(d=0;d<h-1;d++)w(null,e,b+d);if(f)for(r=1;r<f;r++)for("undefined"==typeof A[e+r]&&(A[e+r]=[]),A[e+r][b+l]="",d=1;d<h;d++)A[e+r][b+l-d]=""}}});if("undefined"!=typeof A[e]&&0<A[e].length)for(b=0;b<=A[e].length;b++)"undefined"!= +typeof A[e][b]&&(w(null,e,b),delete A[e][b])}}function Z(b,h){!0===a.consoleLog&&console.log(b.output());if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return F(b.output());if("window"===a.outputMode)window.open(URL.createObjectURL(b.output("blob")));else try{var e=b.output("blob");saveAs(e,a.fileName+".pdf")}catch(d){C(a.fileName+".pdf","data:application/pdf"+(h?"":";base64")+",",h?e:b.output())}}function aa(b,a,e){var d=0;"undefined"!=typeof e&&(d=e.colspan);if(0<=d){for(var h= +b.width,c=b.textPos.x,l=a.table.columns.indexOf(a.column),r=1;r<d;r++)h+=a.table.columns[l+r].width;1<d&&("right"===b.styles.halign?c=b.textPos.x+h-b.width:"center"===b.styles.halign&&(c=b.textPos.x+(h-b.width)/2));b.width=h;b.textPos.x=c;"undefined"!=typeof e&&1<e.rowspan&&(b.height*=e.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)e=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<e&&(b.textPos.y-=(2-1.15)/2*a.row.styles.fontSize*(e-2)/3);return!0}return!1} +function ba(b,a,e){"undefined"!=typeof e.images&&a.each(function(){var a=c(this).children();if(c(this).is("img")){var h=ca(this.src);e.images[h]={url:this.src,src:this.src}}"undefined"!=typeof a&&0<a.length&&ba(b,a,e)})}function ka(b,a){function h(b){if(b.url){var d=new Image;c=++q;d.crossOrigin="Anonymous";d.onerror=d.onload=function(){if(d.complete&&(0===d.src.indexOf("data:image/")&&(d.width=b.width||d.width||0,d.height=b.height||d.height||0),d.width+d.height)){var h=document.createElement("canvas"), +e=h.getContext("2d");h.width=d.width;h.height=d.height;e.drawImage(d,0,0);b.src=h.toDataURL("image/jpeg")}--q||a(c)};d.src=b.url}}var d,c=0,q=0;if("undefined"!=typeof b.images)for(d in b.images)b.images.hasOwnProperty(d)&&h(b.images[d]);(d=q)||(a(c),d=void 0);return d}function da(b,h,e){h.each(function(){var d=c(this).children();if(c(this).is("div")){var h=N(E(this,"background-color"),[255,255,255]),q=N(E(this,"border-top-color"),[0,0,0]),l=O(this,"border-top-width",a.jspdf.unit),r=this.getBoundingClientRect(), +f=this.offsetLeft*e.dw,g=this.offsetTop*e.dh,k=r.width*e.dw,r=r.height*e.dh;e.doc.setDrawColor.apply(void 0,q);e.doc.setFillColor.apply(void 0,h);e.doc.setLineWidth(l);e.doc.rect(b.x+f,b.y+g,k,r,l?"FD":"F")}else if(c(this).is("img")&&"undefined"!=typeof e.images&&(g=ca(this.src),h=e.images[g],"undefined"!=typeof h)){q=b.width/b.height;l=this.width/this.height;f=b.width;k=b.height;g=0;l<q?(k=Math.min(b.height,this.height),f=this.width*k/this.height):l>q&&(f=Math.min(b.width,this.width),k=this.height* +f/this.width);k<b.height&&(g=(b.height-k)/2);try{e.doc.addImage(h.src,b.textPos.x,b.y+g,f,k)}catch(oa){}b.textPos.x+=f}"undefined"!=typeof d&&0<d.length&&da(b,d,e)})}function P(b,a,e){return b.replace(new RegExp(a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function ea(b){b=P(b||"0",a.numbers.html.thousandsSeparator,"");b=P(b,a.numbers.html.decimalMark,".");return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function x(b,h,e){var d="";if(null!==b){var w=c(b),q;if(w[0].hasAttribute("data-tableexport-value"))q= +w.data("tableexport-value");else if(q=w.html(),"function"===typeof a.onCellHtmlData)q=a.onCellHtmlData(w,h,e,q);else if(""!=q){b=c.parseHTML(q);var l=0,r=0;q="";c.each(b,function(){if(c(this).is("input"))q+=w.find("input").eq(l++).val();else if(c(this).is("select"))q+=w.find("select option:selected").eq(r++).text();else if("undefined"===typeof c(this).html())q+=c(this).text();else if(void 0===jQuery().bootstrapTable||!0!==c(this).hasClass("filterControl"))q+=c(this).html()})}if(!0===a.htmlContent)d= +c.trim(q);else if(""!=q){var f=q.replace(/\n/g,"\u2028").replace(/<br\s*[\/]?>/gi,"\u2060");b=c("<div/>").html(f).contents();f="";c.each(b.text().split("\u2028"),function(b,a){0<b&&(f+=" ");f+=c.trim(a)});c.each(f.split("\u2060"),function(b,a){0<b&&(d+="\n");d+=c.trim(a).replace(/\u00AD/g,"")});if("json"==a.type||!1===a.numbers.output)b=ea(d),!1!==b&&(d=Number(b));else if(a.numbers.html.decimalMark!=a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!=a.numbers.output.thousandsSeparator)if(b= +ea(d),!1!==b){var g=(""+b).split(".");1==g.length&&(g[1]="");var k=3<g[0].length?g[0].length%3:0,d=(0>b?"-":"")+(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.r<d&&(e.e.r=d);e.e.c<c&&(e.e.c=c);var f={v:a[d][c]};if(null!==f.v){var l=XLSX.utils.encode_cell({c:c, +r:d});if("number"===typeof f.v)f.t="n";else if("boolean"===typeof f.v)f.t="b";else if(f.v instanceof Date){f.t="n";f.z=XLSX.SSF._table[14];var r=f,g;g=(Date.parse(f.v)-new Date(Date.UTC(1899,11,30)))/864E5;r.v=g}else f.t="s";b[l]=f}}1E7>e.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;c<f;c++)d=a.charCodeAt(c),b=(b<<5)-b+d,b|=0;return b}function C(a,c,e){var b=window.navigator.userAgent;if(!1!==a&&(0<b.indexOf("MSIE ")|| +b.match(/Trident.*rv\:11\./)))if(window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([e]),a);else{if(c=document.createElement("iframe"))document.body.appendChild(c),c.setAttribute("style","display:none"),c.contentDocument.open("txt/html","replace"),c.contentDocument.write(e),c.contentDocument.close(),c.focus(),c.contentDocument.execCommand("SaveAs",!0,a),document.body.removeChild(c)}else if(b=document.createElement("a")){var h=null;b.style.display="none";!1!==a?b.download= +a:b.target="_blank";"object"==typeof e?(h=window.URL.createObjectURL(e),b.href=h):0<=c.toLowerCase().indexOf("base64,")?b.href=c+F(e):b.href=c+encodeURIComponent(e);document.body.appendChild(b);if(document.createEvent)null===Q&&(Q=document.createEvent("MouseEvents")),Q.initEvent("click",!0,!1),b.dispatchEvent(Q);else if(document.createEventObject)b.fireEvent("onclick");else if("function"==typeof b.onclick)b.onclick();h&&window.URL.revokeObjectURL(h);document.body.removeChild(b)}}function F(a){var b= +"",c,d,f,g,l,r,k=0;a=a.replace(/\x0d\x0a/g,"\n");d="";for(f=0;f<a.length;f++)g=a.charCodeAt(f),128>g?d+=String.fromCharCode(g):(127<g&&2048>g?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<a.length;)c=a.charCodeAt(k++),d=a.charCodeAt(k++),f=a.charCodeAt(k++),g=c>>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<m.length&&(0<D.length&&(D+="\n"),D+=m);k++});return b.length},I=I+U(c(t).find("thead").first().find(a.theadSelector),"th,td",I);c(t).find("tbody").each(function(){I+= +U(c(this).find(a.tbodySelector),"td,th",I)});a.tfootSelector.length&&U(c(t).find("tfoot").first().find(a.tfootSelector),"td,th",I);D+="\n";!0===a.consoleLog&&console.log(D);if("string"===a.outputMode)return D;if("base64"===a.outputMode)return F(D);if("window"===a.outputMode){C(!1,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,",D);return}try{y=new Blob([D],{type:"text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8"}),saveAs(y,a.fileName+"."+a.type,"csv"!=a.type||!1===a.csvUseBOM)}catch(b){C(a.fileName+ +"."+a.type,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,"+("csv"==a.type&&a.csvUseBOM?"\ufeff":""),D)}}else if("sql"==a.type){var k=0,v="INSERT INTO `"+a.tableName+"` (",n=c(t).find("thead").first().find(a.theadSelector);n.each(function(){z(this,"th,td",k,n.length,function(a,c,e){v+="'"+x(a,c,e)+"',"});k++;v=c.trim(v);v=c.trim(v).substring(0,v.length-1)});v+=") VALUES ";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(){m="";z(this,"td,th",k,n.length+g.length,function(a,c,e){m+="'"+x(a,c,e)+"',"});3<m.length&&(v+="("+m,v=c.trim(v).substring(0,v.length-1),v+="),");k++});v=c.trim(v).substring(0,v.length-1);v+=";";!0===a.consoleLog&&console.log(v);if("string"===a.outputMode)return v;if("base64"===a.outputMode)return F(v);try{y=new Blob([v],{type:"text/plain;charset=utf-8"}),saveAs(y,a.fileName+".sql")}catch(b){C(a.fileName+".sql","data:application/sql;charset=utf-8,", +v)}}else if("json"==a.type){var J=[],n=c(t).find("thead").first().find(a.theadSelector);n.each(function(){var a=[];z(this,"th,td",k,n.length,function(b,c,d){a.push(x(b,c,d))});J.push(a)});var V=[];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={},h=0;z(this,"td,th",k,n.length+g.length,function(b,c,f){J.length?a[J[J.length-1][h]]=x(b,c,f):a[h]=x(b,c,f);h++}); +!1===c.isEmptyObject(a)&&V.push(a);k++});u="";u="head"==a.jsonScope?JSON.stringify(J):"data"==a.jsonScope?JSON.stringify(V):JSON.stringify({header:J,data:V});!0===a.consoleLog&&console.log(u);if("string"===a.outputMode)return u;if("base64"===a.outputMode)return F(u);try{y=new Blob([u],{type:"application/json;charset=utf-8"}),saveAs(y,a.fileName+".json")}catch(b){C(a.fileName+".json","data:application/json;charset=utf-8;base64,",u)}}else if("xml"===a.type){var k=0,B='<?xml version="1.0" encoding="utf-8"?>', +B=B+"<tabledata><fields>",n=c(t).find("thead").first().find(a.theadSelector);n.each(function(){z(this,"th,td",k,n.length,function(a,c,e){B+="<field>"+x(a,c,e)+"</field>"});k++});var B=B+"</fields><data>",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+="<column-"+a+">"+x(b,c,d)+"</column-"+a+ +">";a++});0<m.length&&"<column-1></column-1>"!=m&&(B+='<row id="'+ga+'">'+m+"</row>",ga++);k++});B+="</data></tabledata>";!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+="<table><thead>";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+="<th";for(var f in a.excelstyles)if(a.excelstyles.hasOwnProperty(f)){var l= +c(b).css(a.excelstyles[f]);""!==l&&"0px none rgb(0, 0, 0)"!=l&&"rgba(0, 0, 0, 0)"!=l&&(h+=""===h?'style="':";",h+=a.excelstyles[f]+":"+l)}""!==h&&(m+=" "+h+'"');c(b).is("[colspan]")&&(m+=' colspan="'+c(b).attr("colspan")+'"');c(b).is("[rowspan]")&&(m+=' rowspan="'+c(b).attr("rowspan")+'"');m+=">"+x(b,e,d)+"</th>"}});0<m.length&&(G+="<tr>"+m+"</tr>");k++});G+="</thead><tbody>";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+="<td";""!==f&&(m+=" "+f+'"');c(e).is("[colspan]")&&(m+=' colspan="'+c(e).attr("colspan")+'"');c(e).is("[rowspan]")&&(m+=' rowspan="'+c(e).attr("rowspan")+'"');m+=">"+x(e,d,h).replace(/\n/g,"<br>")+"</td>"}});0<m.length&&(G+="<tr>"+m+"</tr>");k++});a.displayTableName&&(G+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+x(c("<p>"+a.tableName+"</p>"))+"</td></tr>");G+="</tbody></table>";!0===a.consoleLog&&console.log(G)});p='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+ +p+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+u+'; charset=UTF-8">')+"<head>";"excel"===u&&(p+="\x3c!--[if gte mso 9]>",p+="<xml>",p+="<x:ExcelWorkbook>",p+="<x:ExcelWorksheets>",p+="<x:ExcelWorksheet>",p+="<x:Name>",p+=a.worksheetName,p+="</x:Name>",p+="<x:WorksheetOptions>",p+="<x:DisplayGridlines/>",p+="</x:WorksheetOptions>",p+="</x:ExcelWorksheet>",p+="</x:ExcelWorksheets>",p+="</x:ExcelWorkbook>",p+="</xml>",p+="<![endif]--\x3e"); +p+="<style>br {mso-data-placement:same-cell;}</style>";p+="</head>";p+="<body>";p+=G;p+="</body>";p+="</html>";!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;f<e-1;++f)a.push(null)}});ha.push(a);k++});u=new T;K=na(ha);K["!merges"]=W;u.SheetNames.push(a.worksheetName);u.Sheets[a.worksheetName]=K;u=XLSX.write(u,{bookType:a.type,bookSST:!1,type:"binary"});try{y=new Blob([ma(u)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),saveAs(y,a.fileName+"."+a.type)}catch(b){C(a.fileName+"."+a.type,"data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8,", +y)}}else if("png"==a.type)html2canvas(c(t)[0]).then(function(b){b=b.toDataURL();for(var c=atob(b.substring(22)),e=new ArrayBuffer(c.length),d=new Uint8Array(e),f=0;f<c.length;f++)d[f]=c.charCodeAt(f);!0===a.consoleLog&&console.log(c);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return F(b);if("window"===a.outputMode)window.open(b);else try{y=new Blob([e],{type:"image/png"}),saveAs(y,a.fileName+".png")}catch(q){C(a.fileName+".png","data:image/png,",y)}});else if("pdf"==a.type)if(!0=== +a.pdfmake.enabled){var X=[],Y=[],k=0,n=c(this).find("thead").first().find(a.theadSelector);n.each(function(){var a=[];z(this,"th,td",k,n.length,function(b,c,f){a.push(x(b,c,f))});a.length&&Y.push(a);for(var c=X.length;c<a.length;c++)X.push("*");k++});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(){var a=[];z(this,"td,th",k,n.length+g.length,function(b,c,d){a.push(x(b, +c,d))});a.length&&Y.push(a);k++});pdfMake.createPdf({pageOrientation:"landscape",content:[{table:{headerRows:n.length,widths:X,body:Y}}]}).getBuffer(function(b){try{var c=new Blob([b],{type:"application/pdf"});saveAs(c,a.fileName+".pdf")}catch(e){C(a.fileName+".pdf","data:application/pdf;base64,",b)}})}else if(!1===a.jspdf.autotable){u={dim:{w:O(c(t).first().get(0),"width","mm"),h:O(c(t).first().get(0),"height","mm")},pagesplit:!1};var ia=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format); +ia.addHTML(c(t).first(),a.jspdf.margins.left,a.jspdf.margins.top,u,function(){Z(ia,!1)})}else{var f=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var L={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89]},R="",M="",ja=0;c(t).filter(":visible").each(function(){if("none"!=c(this).css("display")){var a=O(c(this).get(0),"width","pt");if(a>ja){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&&0<b.length&&ba(a,b,f))});b++})}),n=[],g=[]);ka(f,function(b){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, +e=0;H=S(this);f.columns=[];f.rows=[];f.rowoptions={};if("function"===typeof f.onTable&&!1===f.onTable(c(this),a))return!0;a.jspdf.autotable.tableExport=null;var d=c.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=f;d.margin={};c.extend(!0,d.margin,a.jspdf.margins);d.tableExport=f;"function"!==typeof d.beforePageContent&&(d.beforePageContent=function(a){1==a.pageCount&&a.table.rows.concat(a.table.headerRow).forEach(function(b){0<b.height&&(b.height+=(2-1.15)/2*b.styles.fontSize,a.table.height+= +(2-1.15)/2*b.styles.fontSize)})});"function"!==typeof d.createdHeaderCell&&(d.createdHeaderCell=function(a,b){a.styles=c.extend({},b.row.styles);if("undefined"!=typeof f.columns[b.column.dataKey]){var e=f.columns[b.column.dataKey];if("undefined"!=typeof e.rect){var g;a.contentWidth=e.rect.width;if("undefined"==typeof f.heightRatio||0===f.heightRatio)g=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height, +f.heightRatio=a.styles.rowHeight/g;g=b.row.raw[b.column.dataKey].rect.height*f.heightRatio;g>a.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&&0<c.kids.length){var d=a.height/c.rect.height;if(d>f.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<e)for(var k=e-1;0<=k;)c.each(f.headerrows[k],function(){var a=this;0<k&&null===this.rect&&(a=f.headerrows[k-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&f.columns.push(a)}),k=0<f.columns.length?-1:k-1;var m=0;g= +[];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(){var a=[];b=0;z(this,"td,th",e,n.length+g.length,function(d,e,g){if("undefined"===typeof f.columns[b]){var h={title:"",key:b,style:{hidden:!0}};f.columns.push(h)}"undefined"!==typeof d&&null!==d?(h=fa(d),h.kids=c(d).children()):(h=c.extend(!0,{},f.rowoptions[m+":"+(b-1)]),h.colspan=-1);f.rowoptions[m+":"+b++]= +h;a.push(x(d,e,g))});a.length&&(f.rows.push(a),m++);e++});if("function"===typeof f.onBeforeAutotable)f.onBeforeAutotable(c(this),f.columns,f.rows,d);f.doc.autoTable(f.columns,f.rows,d);if("function"===typeof f.onAfterAutotable)f.onAfterAutotable(c(this),d);a.jspdf.autotable.startY=f.doc.autoTableEndPosY()+d.margin.top});Z(f.doc,"undefined"!=typeof f.images&&!1===jQuery.isEmptyObject(f.images));"undefined"!=typeof f.headerrows&&(f.headerrows.length=0);"undefined"!=typeof f.columns&&(f.columns.length= +0);"undefined"!=typeof f.rows&&(f.rows.length=0);delete f.doc;f.doc=null})}return this}})})(jQuery); define("tableexport", ["jquery"], (function (global) { return function () { @@ -8506,390 +8511,390 @@ define('form',['jquery', 'bootstrap', 'backend', 'config', 'toastr', 'upload', ' }; return Form; }); -// 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 + "> </" + 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); - $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").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 + "> </" + 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); + $("<table id='" + listTable.id + "' style='border-width: 0px;' class='dragSortItem " + listTable.className + "'><tr></tr></table>").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)<Math.pow(g.distance,2)){break}h.target=g.target;d.hijack(h,"dragstart",g);if(g.propagates){g.dragging=true}case"touchmove":h.preventDefault();case"mousemove":if(g.dragging){d.hijack(h,"drag",g);if(g.propagates){if(g.drop!==false&&a.drop){a.drop.handler(h,g)}break}h.type="mouseup"}case"touchend":case"mouseup":default:if(d.touched){b.remove(d.touched,"touchmove touchend",d.handler)}else{b.remove(document,"mousemove mouseup",d.handler)}if(g.dragging){if(g.drop!==false&&a.drop){a.drop.handler(h,g)}d.hijack(h,"dragend",g)}d.textselect(true);if(g.click===false&&g.dragging){e.data(g.mousedown,"suppress.click",new Date().getTime()+5)}g.dragging=d.touched=false;break}},hijack:function(h,o,r,p,k){if(!r){return}var q={event:h.originalEvent,type:h.type},m=o.indexOf("drop")?"drag":"drop",t,l=p||0,j,g,s,n=!isNaN(p)?p:r.interactions.length;h.type=o;h.originalEvent=null;r.results=[];do{if(j=r.interactions[l]){if(o!=="dragend"&&j.cancelled){continue}s=d.properties(h,r,j);j.results=[];e(k||j[m]||r.droppable).each(function(u,i){s.target=i;h.isPropagationStopped=function(){return false};t=i?b.dispatch.call(i,h,s):null;if(t===false){if(m=="drag"){j.cancelled=true;r.propagates-=1}if(o=="drop"){j[m][u]=null}}else{if(o=="dropinit"){j.droppable.push(d.element(t)||i)}}if(o=="dragstart"){j.proxy=e(d.element(t)||j.drag)[0]}j.results.push(t);delete h.result;if(o!=="dropinit"){return t}});r.results[l]=d.flatten(j.results);if(o=="dropinit"){j.droppable=d.flatten(j.droppable)}if(o=="dragstart"&&!j.cancelled){s.update()}}}while(++l<n);h.type=q.type;h.originalEvent=q.event;return d.flatten(r.results)},properties:function(i,g,h){var j=h.callback;j.drag=h.drag;j.proxy=h.proxy||h.drag;j.startX=g.pageX;j.startY=g.pageY;j.deltaX=i.pageX-g.pageX;j.deltaY=i.pageY-g.pageY;j.originalX=h.offset.left;j.originalY=h.offset.top;j.offsetX=j.originalX+j.deltaX;j.offsetY=j.originalY+j.deltaY;j.drop=d.flatten((h.drop||[]).slice());j.available=d.flatten((h.droppable||[]).slice());return j},element:function(g){if(g&&(g.jquery||g.nodeType==1)){return g}},flatten:function(g){return e.map(g,function(h){return h&&h.jquery?e.makeArray(h):h&&h.length?d.flatten(h):h})},textselect:function(g){e(document)[g?"unbind":"bind"]("selectstart",d.dontstart).css("MozUserSelect",g?"":"none");document.unselectable=g?"off":"on"},dontstart:function(){return false},callback:function(){}};d.callback.prototype={update:function(){if(a.drop&&this.available.length){e.each(this.available,function(g){a.drop.locate(this,g)})}}};var f=b.dispatch;b.dispatch=function(g){if(e.data(this,"suppress."+g.type)-new Date().getTime()>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<m);l.sort(b.sort);k=0;do{if(j=l[k]){if(j.winner&&f.drop.length<b.multi){if(!j.active[p]&&!j.anyactive){if(a.drag.hijack(b.event,"dropstart",q,p,j.elem)[0]!==false){j.active[p]=1;j.anyactive+=1}else{j.winner=0}}if(j.winner){f.drop.push(j.elem)}}else{if(j.active[p]&&j.anyactive==1){a.drag.hijack(b.event,"dropend",q,p,j.elem);j.active[p]=0;j.anyactive-=1}}}}while(++k<m)}}while(++p<h);if(b.last&&r[0]==b.last.pageX&&r[1]==b.last.pageY){delete b.timer}else{b.timer=setTimeout(function(){b.tolerate(q)},b.delay)}b.last=b.event}};a.dropinit=a.dropstart=a.dropend=b})(jQuery); define("drop", function(){}); -/** - * 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 = $('<li role="presentation" id="tab_' + id + '"><a href="#' + id + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>'); - //是否允许关闭 - if (options.close) { - title.append(' <i class="close-tab fa fa-remove"></i>'); - } - //创建新TAB的内容 - content = $('<div role="tabpanel" class="tab-pane" id="' + id + '"></div>'); - //是否指定TAB内容 - if (opts.content) { - content.append(opts.content); - } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接 - var height = options.iframeHeight; - content.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>'); - } 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 = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' + - '<i class="glyphicon glyphicon-align-justify"></i>' + - ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>'); - //检测是否已增加 - 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 = $('<li role="presentation" id="tab_' + id + '"><a href="#' + id + '" node-id="' + opts.id + '" aria-controls="' + id + '" role="tab" data-toggle="tab">' + opts.title + '</a></li>'); + //是否允许关闭 + if (options.close) { + title.append(' <i class="close-tab fa fa-remove"></i>'); + } + //创建新TAB的内容 + content = $('<div role="tabpanel" class="tab-pane" id="' + id + '"></div>'); + //是否指定TAB内容 + if (opts.content) { + content.append(opts.content); + } else if (options.iframeUse && !opts.ajax) {//没有内容,使用IFRAME打开链接 + var height = options.iframeHeight; + content.append('<iframe src="' + url + '" width="100%" height="' + height + '" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe></div>'); + } 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 = $('<li class="dropdown pull-right hide tabdrop"><a class="dropdown-toggle" data-toggle="dropdown" href="javascript:;">' + + '<i class="glyphicon glyphicon-align-justify"></i>' + + ' <b class="caret"></b></a><ul class="dropdown-menu"></ul></li>'); + //检测是否已增加 + 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 48eddd3..6411164 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 87f947a..647934d 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 ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">' - + (titype ? config.title[0] : config.title) + var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">' + + (titype ? config.title[0] : config.title) + '</div>' : ''); - + config.zIndex = zIndex; callback([ //遮罩 config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '', - + //主体 '<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">' + (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 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){ return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">'; }(); - + 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('当前图片地址异常<br>是否继续查看下一张?', { - 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 4d212af..beabb5f 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",