Skip to content

Instantly share code, notes, and snippets.

@bluishoul
Last active June 1, 2023 03:20
Show Gist options
  • Save bluishoul/390bf7f424a3805ee9f0e8480d212feb to your computer and use it in GitHub Desktop.
Save bluishoul/390bf7f424a3805ee9f0e8480d212feb to your computer and use it in GitHub Desktop.
gitee-icons 走查工具(支持企业版、社区版页面)
!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function i(t){return"function"==typeof t}function s(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function c(t,e){t.appendChild(e)}function r(t,e,n){const o=function(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;if(e&&e.host)return e;return t.ownerDocument}(t);if(!o.getElementById(e)){const t=d("style");t.id=e,t.textContent=n,function(t,e){c(t.head||t,e),e.sheet}(o,t)}}function a(t,e,n){t.insertBefore(e,n||null)}function l(t){t.parentNode.removeChild(t)}function d(t){return document.createElement(t)}function u(t){return document.createTextNode(t)}function b(){return u(" ")}function f(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function h(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}let p;function g(t){p=t}function m(t){(function(){if(!p)throw new Error("Function called outside component initialization");return p})().$$.on_mount.push(t)}const v=[],y=[],x=[],$=[],k=Promise.resolve();let w=!1;function _(t){x.push(t)}const E=new Set;let C=0;function L(){const t=p;do{for(;C<v.length;){const t=v[C];C++,g(t),z(t.$$)}for(g(null),v.length=0,C=0;y.length;)y.pop()();for(let t=0;t<x.length;t+=1){const e=x[t];E.has(e)||(E.add(e),e())}x.length=0}while(v.length);for(;$.length;)$.pop()();w=!1,E.clear(),g(t)}function z(t){if(null!==t.fragment){t.update(),o(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(_)}}const N=new Set;function O(t,e){-1===t.$$.dirty[0]&&(v.push(t),w||(w=!0,k.then(L)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function S(s,c,r,a,d,u,b,f=[-1]){const h=p;g(s);const m=s.$$={fragment:null,ctx:[],props:u,update:t,not_equal:d,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(c.context||(h?h.$$.context:[])),callbacks:n(),dirty:f,skip_bound:!1,root:c.target||h.$$.root};b&&b(m.root);let v=!1;if(m.ctx=r?r(s,c.props||{},((t,e,...n)=>{const o=n.length?n[0]:e;return m.ctx&&d(m.ctx[t],m.ctx[t]=o)&&(!m.skip_bound&&m.bound[t]&&m.bound[t](o),v&&O(s,t)),e})):[],m.update(),v=!0,o(m.before_update),m.fragment=!!a&&a(m.ctx),c.target){if(c.hydrate){const t=function(t){return Array.from(t.childNodes)}(c.target);m.fragment&&m.fragment.l(t),t.forEach(l)}else m.fragment&&m.fragment.c();c.intro&&((y=s.$$.fragment)&&y.i&&(N.delete(y),y.i(x))),function(t,n,s,c){const{fragment:r,after_update:a}=t.$$;r&&r.m(n,s),c||_((()=>{const n=t.$$.on_mount.map(e).filter(i);t.$$.on_destroy?t.$$.on_destroy.push(...n):o(n),t.$$.on_mount=[]})),a.forEach(_)}(s,c.target,c.anchor,c.customElement),L()}var y,x;g(h)}class j{$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(e,n){if(!i(n))return t;const o=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return o.push(n),()=>{const t=o.indexOf(n);-1!==t&&o.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function A(t){r(t,"svelte-ba3sbs",".toolbox.svelte-ba3sbs.svelte-ba3sbs{width:210px;position:fixed;right:10px;bottom:10px;border:1px solid #ccc;border-radius:10px;padding:10px;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,\n\t\t\t'Open Sans', 'Helvetica Neue', sans-serif;z-index:999;background:white}button.svelte-ba3sbs.svelte-ba3sbs{border:none;background:none;cursor:pointer;border-radius:5px}button.svelte-ba3sbs.svelte-ba3sbs:hover{background-color:#eee}.open.svelte-ba3sbs.svelte-ba3sbs{position:fixed;right:10px;bottom:10px;border:1px solid #ccc;z-index:999;display:flex;align-items:center;justify-content:center}.toolbox.svelte-ba3sbs h2.svelte-ba3sbs,.toolbox.svelte-ba3sbs h3.svelte-ba3sbs{padding:0;margin:0}.toolbox.svelte-ba3sbs h2.svelte-ba3sbs{font-size:18px;margin-bottom:10px}.toolbox.svelte-ba3sbs h3.svelte-ba3sbs{font-size:14px;margin-bottom:10px}.close.svelte-ba3sbs.svelte-ba3sbs{position:absolute;right:5px;top:5px;font-size:14px}.toolbox.svelte-ba3sbs ul.svelte-ba3sbs{list-style:none;padding:0;margin:0;font-size:14px}.toolbox.svelte-ba3sbs label span.svelte-ba3sbs{color:white;animation:none}.highlight-new-icon .iconify,.new-icon.svelte-ba3sbs.svelte-ba3sbs{--icon-color:#00ff00;animation:shine 1s ease-in-out infinite;background-color:var(--icon-color)}.highlight-old-icon .gitee-icon,.highlight-old-icon .old-icon-mark,.old-icon.svelte-ba3sbs.svelte-ba3sbs{--icon-color:#f66666;animation:shine 1s ease-in-out infinite;background-color:var(--icon-color)}.highlight-3rd-party-icon i.icon:not(.gitee-icon),.highlight-3rd-party-icon .third-party-icon,.highlight-3rd-party-icon i.file-icon,.highlight-3rd-party-icon .fui-icon,.highlight-3rd-party-icon .anticon,.third-party-icon.svelte-ba3sbs.svelte-ba3sbs{--icon-color:#b043b0;animation:shine 1s ease-in-out infinite;background-color:var(--icon-color)}@keyframes shine{from{background-color:calc(var(--icon-color) * 0.1)}to{background-color:var(--icon-color);box-shadow:0 0 6px 0 var(--icon-color)}}")}function M(e){let n,o,i;return{c(){n=d("button"),n.textContent="↖️",h(n,"class","open svelte-ba3sbs"),h(n,"title","打开图标替换走查工具")},m(t,s){a(t,n,s),o||(i=f(n,"click",e[8]),o=!0)},p:t,d(t){t&&l(n),o=!1,i()}}}function H(t){let e,n,i,s,r,p,g,m,v,y,x,$,k,w,_,E,C,L,z,N,O,S,j,A,M,H,I;return{c(){e=d("div"),n=d("h2"),n.textContent="图标替换走查工具",i=b(),s=d("button"),s.textContent="⬇️",r=b(),p=d("form"),g=d("h3"),m=u("高亮图标\n\t\t\t\t"),v=d("button"),v.textContent="🔄",y=b(),x=d("ul"),$=d("li"),k=d("input"),w=b(),_=d("label"),_.innerHTML='新图标(<span class="new-icon svelte-ba3sbs">绿色</span>)',E=b(),C=d("li"),L=d("input"),z=b(),N=d("label"),N.innerHTML='旧图标(<span class="old-icon svelte-ba3sbs">红色</span>)',O=b(),S=d("li"),j=d("input"),A=b(),M=d("label"),M.innerHTML='第三方图标(<span class="third-party-icon svelte-ba3sbs">紫色</span>)',h(n,"class","svelte-ba3sbs"),h(s,"class","close svelte-ba3sbs"),h(s,"title","最小化"),h(v,"class","refresh svelte-ba3sbs"),h(v,"title","刷新"),h(g,"class","svelte-ba3sbs"),h(k,"type","checkbox"),h(k,"id","new-icon"),h(k,"name","new-icon"),h(_,"for","new-icon"),h(L,"type","checkbox"),h(L,"id","old-icon"),h(L,"name","old-icon"),h(N,"for","old-icon"),h(j,"type","checkbox"),h(j,"id","3rd-party-icon"),h(j,"name","3rd-party-icon"),h(M,"for","3rd-party-icon"),h(x,"class","svelte-ba3sbs"),h(e,"class","toolbox svelte-ba3sbs")},m(o,l){var d;a(o,e,l),c(e,n),c(e,i),c(e,s),c(e,r),c(e,p),c(p,g),c(g,m),c(g,v),c(p,y),c(p,x),c(x,$),c($,k),k.checked=t[1]["new-icon"],c($,w),c($,_),c(x,E),c(x,C),c(C,L),L.checked=t[1]["old-icon"],c(C,z),c(C,N),c(x,O),c(x,S),c(S,j),j.checked=t[1]["3rd-party-icon"],c(S,A),c(S,M),H||(I=[f(s,"click",t[3]),f(v,"click",(d=B,function(t){return t.preventDefault(),d.call(this,t)})),f(k,"change",t[4]),f(L,"change",t[5]),f(j,"change",t[6]),f(p,"change",t[7])],H=!0)},p(t,e){2&e&&(k.checked=t[1]["new-icon"]),2&e&&(L.checked=t[1]["old-icon"]),2&e&&(j.checked=t[1]["3rd-party-icon"])},d(t){t&&l(e),H=!1,o(I)}}}function I(e){let n;function o(t,e){return t[0]?M:H}let i=o(e),s=i(e);return{c(){s.c(),n=u("")},m(t,e){s.m(t,e),a(t,n,e)},p(t,[e]){i===(i=o(t))&&s?s.p(t,e):(s.d(1),s=i(t),s&&(s.c(),s.m(n.parentNode,n)))},i:t,o:t,d(t){s.d(t),t&&l(n)}}}function T(t){if(!t)return;const e=window.getComputedStyle(t,"::before")?.fontFamily;switch(e){case"fluentui-icons":case"Icons":case"iconfont":t.classList.add("third-party-icon");break;case"gitee-icon":t.classList.add("old-icon-mark")}const n=t.children;n.length&&Array.from(n).forEach(T)}function B(){T(document.body)}function D(t,e,n){let o,i=!1;function s(t,e){e?document.body.classList.add(`highlight-${t}`):document.body.classList.remove(`highlight-${t}`),n(1,o[t]=e,o)}m((()=>{Object.keys(o).forEach((t=>{s(t,o[t])})),T(document.body),setInterval((()=>{T(document.body)}),3e3)}));return n(1,o={"new-icon":!0,"old-icon":!0,"3rd-party-icon":!0}),[i,o,s,()=>n(0,i=!0),function(){o["new-icon"]=this.checked,n(1,o)},function(){o["old-icon"]=this.checked,n(1,o)},function(){o["3rd-party-icon"]=this.checked,n(1,o)},t=>s(t.target?.name,t.target?.checked),()=>n(0,i=!1)]}new class extends j{constructor(t){super(),S(this,t,D,I,s,{},A)}}({target:document.body})}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment