mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-04 09:53:56 +08:00
update 2026-10-20 17:03:51
This commit is contained in:
1 parent
ab408c1971
commit
57c1b033cd
278 files changed
+109653
-35
No files matched your search
+1
@@ -0,0 +1 @@
|
||||
"use strict";"require baseclass";const INDICATOR_ID="aurora-inbox",STYLE_ID="aurora-inbox-indicator",INBOX_PATH="admin/system/aurora/marketplace",INBOX_HASH="#inbox",ICON_CLASS="aurora-inbox-icon",INDICATOR='#indicators span[data-indicator="aurora-inbox"].'+ICON_CLASS,INDICATOR_CSS=INDICATOR+"{position:relative;order:1;--aurora-inbox-icon:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3e%3cpath d='M5.5 5.1 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.5-6.9A2 2 0 0 0 16.8 4H7.2a2 2 0 0 0-1.7 1.1z'/%3e%3c/svg%3e\")}"+INDICATOR+"::before{-webkit-mask:var(--aurora-inbox-icon) center/cover no-repeat;mask:var(--aurora-inbox-icon) center/cover no-repeat}"+INDICATOR+"[data-count]::after{content:attr(data-count);position:absolute;top:-2px;right:-2px;z-index:10;display:flex;align-items:center;justify-content:center;min-width:12px;min-height:12px;padding:0 2px;border-radius:99px;background:var(--danger);color:var(--on-brand);font-size:8px;font-weight:700;line-height:1;box-shadow:0 1px 2px rgba(0,0,0,.1)}",openInbox=()=>{window.location.href=L.url(INBOX_PATH)+"#inbox"},update=()=>Promise.all([L.require("utils.notices"),L.require("utils.hub-api"),L.require("ui")]).then(([e,t,n])=>{const o=e.badgeCount(t.noticesCache.getStale(),t.meCache.getStale(),t.inboxState());if(!o)return n.hideIndicator(INDICATOR_ID);if(!document.getElementById(STYLE_ID)){const e=E("style",{id:STYLE_ID});e.textContent=INDICATOR_CSS,document.head.appendChild(e)}n.showIndicator(INDICATOR_ID,_("Inbox")+" "+o,openInbox,"active");const a=document.querySelector('span[data-indicator="aurora-inbox"]');a&&(a.setAttribute("data-count",o),a.title=a.textContent,"0px"===window.getComputedStyle(a).fontSize&&a.classList.add(ICON_CLASS),a.parentNode.appendChild(a))}),run=()=>Promise.all([L.require("utils.notices"),L.require("utils.hub-api")]).then(([e,t])=>e.isDue(t.noticesCheckedAt(),Date.now())?t.refreshNotices().catch(()=>null):null).then(update);return baseclass.extend({INBOX_HASH:"#inbox",__init__(){L.env.sessionid&&document.addEventListener("luci-loaded",()=>(window.requestIdleCallback||window.setTimeout)(()=>Promise.resolve().then(run).catch(()=>{})),{once:!0})},update:()=>Promise.resolve().then(update).catch(()=>{})});
|
||||
Reference in new issue
Block a user