优化公共代码

This commit is contained in:
Argo-Lenovo 2016-11-16 23:47:01 +08:00
parent 5fd28f71e3
commit ef99288e3a
2 changed files with 18 additions and 26 deletions

View File

@ -185,8 +185,8 @@
clickToSelect: false,
}, options);
$(this).bootstrapTable(settings);
$('.toolbar').insertBefore($('.bootstrap-table > .fixed-table-toolbar > .bs-bars'));
$('.toolbar a').click(function () {
$('div.toolbar').insertBefore($('div.bootstrap-table > div.fixed-table-toolbar > div.bs-bars'));
$('div.toolbar').on('click', 'a', function () {
var ctl = $('#' + $(this).attr('id').replace('tb_', 'btn_'));
ctl.trigger("click");
});
@ -195,23 +195,9 @@
})(jQuery);
$(function () {
// breadcrumb
var breadcrumb = $('.sidebar-menu > li > a.active > span').text();
if (breadcrumb === "") $('.breadcrumb > li + li').hide();
else $('.breadcrumb > li + li').text(breadcrumb);
if ($.isFunction($.validator)) {
jQuery.validator.addMethod("ip", function (value, element) {
return this.optional(element) || /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/.test(value);
}, "请填写正确的IP地址");
}
$(".go-top").click(function (e) {
e.preventDefault();
$('#main-content, .content-body, body').animate({
scrollTop: 0
}, 200);
});
$('.site-footer div span').text($('#footer').val());
});

View File

@ -1,5 +1,4 @@
/*---LEFT BAR ACCORDION----*/
$(function () {
$(function () {
$('#nav-accordion').dcAccordion({
eventType: 'click',
autoClose: true,
@ -11,10 +10,21 @@ $(function () {
// cookie: 'dcjq-accordion-1',
classExpand: 'dcjq-current-parent'
});
});
(function ($) {
// sidebar dropdown menu auto scrolling
// breadcrumb
var breadcrumb = $('.sidebar-menu > li > a.active > span').text();
if (breadcrumb === "") $('.breadcrumb > li + li').hide();
else $('.breadcrumb > li + li').text(breadcrumb);
$(".go-top").click(function (e) {
e.preventDefault();
$('#main-content, .content-body, body').animate({
scrollTop: 0
}, 200);
});
$('.site-footer div span').text($('#footer').val());
$('#sidebar .sub-menu > a').click(function () {
var o = ($(this).offset());
diff = 300 - o.top;
@ -35,8 +45,4 @@ $(function () {
// custom scrollbar
if (!$.browser.versions.ios) $("#sidebar").niceScroll({ styler: "fb", cursorcolor: "#e8403f", cursorwidth: '3', cursorborderradius: '10px', background: '#404040', spacebarenabled: false, cursorborder: '', scrollspeed: 60 });
//$("html").niceScroll({styler:"fb",cursorcolor:"#e8403f", cursorwidth: '6', cursorborderradius: '10px', background: '#404040', spacebarenabled:false, cursorborder: '', zindex: '1000', scrollspeed: 100, mousescrollstep: 60});
//$(".table-responsive").niceScroll({ styler: "fb", cursorcolor: "#e8403f", cursorwidth: '6', cursorborderradius: '10px', background: '#404040', spacebarenabled: false, cursorborder: '', zindex: '1000', horizrailenabled: true });
})(jQuery);
});