优化公共代码

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, clickToSelect: false,
}, options); }, options);
$(this).bootstrapTable(settings); $(this).bootstrapTable(settings);
$('.toolbar').insertBefore($('.bootstrap-table > .fixed-table-toolbar > .bs-bars')); $('div.toolbar').insertBefore($('div.bootstrap-table > div.fixed-table-toolbar > div.bs-bars'));
$('.toolbar a').click(function () { $('div.toolbar').on('click', 'a', function () {
var ctl = $('#' + $(this).attr('id').replace('tb_', 'btn_')); var ctl = $('#' + $(this).attr('id').replace('tb_', 'btn_'));
ctl.trigger("click"); ctl.trigger("click");
}); });
@ -195,23 +195,9 @@
})(jQuery); })(jQuery);
$(function () { $(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)) { if ($.isFunction($.validator)) {
jQuery.validator.addMethod("ip", function (value, element) { 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); 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地址"); }, "请填写正确的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({ $('#nav-accordion').dcAccordion({
eventType: 'click', eventType: 'click',
autoClose: true, autoClose: true,
@ -11,10 +10,21 @@ $(function () {
// cookie: 'dcjq-accordion-1', // cookie: 'dcjq-accordion-1',
classExpand: 'dcjq-current-parent' classExpand: 'dcjq-current-parent'
}); });
});
(function ($) { // breadcrumb
// sidebar dropdown menu auto scrolling 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 () { $('#sidebar .sub-menu > a').click(function () {
var o = ($(this).offset()); var o = ($(this).offset());
diff = 300 - o.top; diff = 300 - o.top;
@ -35,8 +45,4 @@ $(function () {
// custom scrollbar // custom scrollbar
if (!$.browser.versions.ios) $("#sidebar").niceScroll({ styler: "fb", cursorcolor: "#e8403f", cursorwidth: '3', cursorborderradius: '10px', background: '#404040', spacebarenabled: false, cursorborder: '', scrollspeed: 60 }); 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);