small-package/luci-theme-design/htdocs/luci-static/design/js/design.js

4 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-04-06 16:21:37 +08:00
(function($){const global=$('head #global-scroll');const isMobile=/phone|pad|pod|iPhone|iPod|ios|iOS|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone/i.test(navigator.userAgent);function settingGlobalScroll(){if(!isMobile&&global.length===0){const style=document.createElement('style');style.id='global-scroll';style.textContent=`*::-webkit-scrollbar { width: 4px;height: 4px; } *::-webkit-scrollbar-thumb { background: var(--scrollbarColor); border-radius: 2px; }`;$('head').append(style);}else if(isMobile&&global.length>0){global.remove();}}
2023-03-22 23:37:50 +08:00
function settingsStatusRealtimeOverflow(){if(self.location.pathname.includes("status/realtime")){const nodeStatusRealtime=$('.node-status-realtime');const selectorValues=['bandwidth','wifirate','wireless'];for(let i=0;i<selectorValues.length;i++){const value=selectorValues[i];const target=nodeStatusRealtime.find(`embed[src="/luci-static/resources/${value}.svg"] + div + br + table`);if(target.length){target.wrap('<div style="overflow-x: auto;"></div>');}}}}
$(document).ready(()=>{settingGlobalScroll();settingsStatusRealtimeOverflow();});$(window).on('resize',()=>{settingGlobalScroll();});$(window)})(jQuery);