diff --git a/public/assets/js/backend.js b/public/assets/js/backend.js index 5435b314..0541e212 100755 --- a/public/assets/js/backend.js +++ b/public/assets/js/backend.js @@ -104,7 +104,7 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) { refreshmenu: function () { top.window.$(".sidebar-menu").trigger("refresh"); }, - gettablecolumnbutton: function(options){ + gettablecolumnbutton: function (options) { if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') { var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions'); if (tableOptions) { @@ -226,8 +226,10 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) { }); } //tooltip和popover - $('body').tooltip({selector: '[data-toggle="tooltip"]'}); - $('body').tooltip({selector: '[data-toggle="popover"]'}); + if (!('ontouchstart' in document.documentElement)) { + $('body').tooltip({selector: '[data-toggle="tooltip"]'}); + } + $('body').popover({selector: '[data-toggle="popover"]'}); } }; Backend.api = $.extend(Fast.api, Backend.api); diff --git a/public/assets/js/frontend.js b/public/assets/js/frontend.js index d7ff9dd0..b0b9ae8c 100644 --- a/public/assets/js/frontend.js +++ b/public/assets/js/frontend.js @@ -50,8 +50,10 @@ define(['fast', 'template'], function (Fast, Template) { return false; }); //tooltip和popover - $('body').tooltip({selector: '[data-toggle="tooltip"]'}); - $('body').tooltip({selector: '[data-toggle="popover"]'}); + if (!('ontouchstart' in document.documentElement)) { + $('body').tooltip({selector: '[data-toggle="tooltip"]'}); + } + $('body').popover({selector: '[data-toggle="popover"]'}); } }; Frontend.api = $.extend(Fast.api, Frontend.api); diff --git a/public/assets/js/require-backend.min.js b/public/assets/js/require-backend.min.js index be24af4f..15650318 100644 --- a/public/assets/js/require-backend.min.js +++ b/public/assets/js/require-backend.min.js @@ -5330,7 +5330,7 @@ define('backend',['fast', 'template', 'moment'], function (Fast, Template, Momen refreshmenu: function () { top.window.$(".sidebar-menu").trigger("refresh"); }, - gettablecolumnbutton: function(options){ + gettablecolumnbutton: function (options) { if (typeof options.tableId !== 'undefined' && typeof options.fieldIndex !== 'undefined' && typeof options.buttonIndex !== 'undefined') { var tableOptions = $("#" + options.tableId).bootstrapTable('getOptions'); if (tableOptions) { @@ -5452,8 +5452,10 @@ define('backend',['fast', 'template', 'moment'], function (Fast, Template, Momen }); } //tooltip和popover - $('body').tooltip({selector: '[data-toggle="tooltip"]'}); - $('body').tooltip({selector: '[data-toggle="popover"]'}); + if (!('ontouchstart' in document.documentElement)) { + $('body').tooltip({selector: '[data-toggle="tooltip"]'}); + } + $('body').popover({selector: '[data-toggle="popover"]'}); } }; Backend.api = $.extend(Fast.api, Backend.api); @@ -10389,14 +10391,14 @@ define("drop", function(){}); 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 ajax = $(this).attr('ajax') === '1' || $(this).attr('ajax') === 'true'; var state = ({ url: url, title: title, id: id, content: content, ajax: ajax }); document.title = title; if (history.pushState && !$(this).data("pushstate")) { - var pushurl = url.indexOf("ref=addtabs") == -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url; + var pushurl = url.indexOf("ref=addtabs") === -1 ? (url + (url.indexOf("?") > -1 ? "&" : "?") + "ref=addtabs") : url; try { window.history.pushState(state, title, pushurl); } catch (e) { @@ -10414,27 +10416,27 @@ define("drop", function(){}); } }); - navobj.on('click', '.close-tab', function (e) { - id = $(this).prev("a").attr("aria-controls"); + navobj.on('click', '.close-tab', function () { + var id = $(this).prev("a").attr("aria-controls"); _close(id); return false; }); - navobj.on('dblclick', 'li[role=presentation]', function (e) { + navobj.on('dblclick', 'li[role=presentation]', function () { $(this).find(".close-tab").trigger("click"); }); - navobj.on('click', 'li[role=presentation]', function (e) { + navobj.on('click', 'li[role=presentation]', function () { $("a[addtabs=" + $("a", this).attr("node-id") + "]").trigger("click"); }); $(window).resize(function () { - if (typeof options.nav == 'object') { + if (typeof options.nav === 'object') { var siblingsWidth = 0; navobj.siblings().each(function () { siblingsWidth += $(this).outerWidth(); }); navobj.width(navobj.parent().width() - siblingsWidth); } else { - $("#nav").width($("#header > .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20); + $("#nav").width($("#header").find("> .navbar").width() - $(".sidebar-toggle").outerWidth() - $(".navbar-custom-menu").outerWidth() - 20); } _drop(); }); @@ -10446,36 +10448,41 @@ define("drop", function(){}); conid = 'con_' + opts.id; url = opts.url; url += (opts.url.indexOf("?") > -1 ? "&addtabs=1" : "?addtabs=1"); + + var tabitem = $('#' + tabid, navobj); + var conitem = $('#' + conid, tabobj); + navobj.find("[role='presentation']").removeClass('active'); tabobj.find("[role='tabpanel']").removeClass('active'); + //如果TAB不存在,创建一个新的TAB - if ($("#" + tabid).size() == 0) { + if (tabitem.size() === 0) { //创建新TAB的title - title = $('