// ==UserScript== // @name V2EX Polish - 体验更现代化的 V2EX // @namespace LeoKu(https://leoku.top) // @version 1.3.5 // @description 一款专为 V2EX 用户设计的浏览器插件,提供了丰富的扩展功能,让原生页面焕然一新! // @author LeoKu // @match https://*.v2ex.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=v2ex.com // @run-at document-start // @grant GM_addStyle // @license MIT // @downloadURL none // ==/UserScript== "use strict";var w=(o,t)=>()=>(o&&(t=o(o=0)),t);var po,it,Po,at,nn,Lo,vo,S=w(()=>{"use strict";po="V2EX_Polish",it=[{title:"\u5C0F\u9EC4\u8138",list:["\u{1F600}","\u{1F601}","\u{1F602}","\u{1F923}","\u{1F605}","\u{1F60A}","\u{1F60B}","\u{1F618}","\u{1F970}","\u{1F617}","\u{1F929}","\u{1F914}","\u{1F928}","\u{1F610}","\u{1F611}","\u{1F644}","\u{1F60F}","\u{1F62A}","\u{1F62B}","\u{1F971}","\u{1F61C}","\u{1F612}","\u{1F614}","\u{1F628}","\u{1F630}","\u{1F631}","\u{1F975}","\u{1F621}","\u{1F973}","\u{1F97A}","\u{1F92D}","\u{1F9D0}","\u{1F60E}","\u{1F913}","\u{1F62D}","\u{1F911}","\u{1F92E}"]},{title:"\u624B\u52BF",list:["\u{1F64B}","\u{1F64E}","\u{1F645}","\u{1F647}","\u{1F937}","\u{1F90F}","\u{1F449}","\u270C\uFE0F","\u{1F918}","\u{1F919}","\u{1F44C}","\u{1F90C}","\u{1F44D}","\u{1F44E}","\u{1F44B}","\u{1F91D}","\u{1F64F}","\u{1F44F}"]},{title:"\u5E86\u795D",list:["\u2728","\u{1F389}","\u{1F38A}"]},{title:"\u5176\u4ED6",list:["\u{1F47B}","\u{1F921}","\u{1F414}","\u{1F440}","\u{1F4A9}","\u{1F434}","\u{1F984}","\u{1F427}","\u{1F436}","\u{1F412}","\u{1F648}","\u{1F649}","\u{1F64A}","\u{1F435}"]}],Po=250,at=550,nn=60*60*1e3,Lo=["3107b9ef8b316f3","442b04f26eefc8a","59cfebe717c09e4","60605aad4a62882","6c65ab1d3f5452a","83e123737849aa9","9311f6be1c10160","c4a4a563f698595","81be04b9e4a08ce"],vo={openInNewTab:!1,autoCheckIn:{enabled:!0},theme:{autoSwitch:!1},replyContent:{autoFold:!0},nestedReply:{display:"indent"}}});var ct,to,lt,fo,st,pt,dt,vt,ft,mo,mt,gt,ut,bt,ht,xt,F=w(()=>{"use strict";ct=``,to=``,lt=``,fo=``,st=``,pt=``,dt=``,vt=``,ft=``,mo=``,mt=``,gt=``,ut=``,bt=``,ht=``,xt=``});function yt(o){return typeof o=="object"&&o!==null}function Do(o,t){let n={};for(let e in o)yt(o[e])&&yt(t[e])?n[e]=Do(o[e],t[e]):Reflect.has(t,e)?n[e]=t[e]:n[e]=o[e];for(let e in t)Reflect.has(o,e)||(n[e]=t[e]);return n}var wt=w(()=>{"use strict"});function kt(){let o=window.navigator.userAgent.toLowerCase(),t=/(macintosh|macintel|macppc|mac68k|macos)/i,n=/(win32|win64|windows|wince)/i,e=/(iphone|ipad|ipod)/i,r=null;return t.test(o)?r="macos":e.test(o)?r="ios":n.test(o)?r="windows":o.includes("android")?r="android":o.includes("linux")&&(r="linux"),r}function go(o,{format:t="YMD"}={}){let n=new Date(o.toString().length===10?o*1e3:o),e=n.getFullYear().toString(),r=(n.getMonth()+1).toString().padStart(2,"0"),i=n.getDate().toString().padStart(2,"0"),a=`${e}-${r}-${i}`;if(t==="YMDHMS"){let c=n.getHours().toString().padStart(2,"0"),l=n.getMinutes().toString().padStart(2,"0"),s=n.getSeconds().toString().padStart(2,"0");return`${a} ${c}:${l}:${s}`}return a}function $t(o,t){let n=new Date(o),e=new Date(t);return n.getFullYear()===e.getFullYear()&&n.getMonth()===e.getMonth()&&n.getDate()===e.getDate()}function eo(){return typeof chrome<"u"&&typeof chrome.extension<"u"?"chrome":null}function T(o=!0){return new Promise((t,n)=>{if(o&&typeof window<"u"&&window.__V2P_StorageCache&&t(window.__V2P_StorageCache),eo()!=="chrome")return t({["options"]:vo});chrome.storage.sync.get().then(r=>{let i,a=r["options"];a?i={...r,["options"]:Do(vo,a)}:i={...r,["options"]:vo},typeof window<"u"&&(window.__V2P_StorageCache=i),t(i)}).catch(r=>{n(r)})})}function J(){let o=window.__V2P_StorageCache;if(!o)throw new Error(`${po}: \u65E0\u53EF\u7528\u7684 Storage \u7F13\u5B58\u6570\u636E\u3002`);return o}async function no(o,t){switch(o){case"options":case"api":case"daily":case"member-tag":case"settings-sync":await chrome.storage.sync.set({[o]:t});break;default:throw new Error("")}}function uo(o){return o.replace(/[<>&"'']/g,t=>{switch(t){case"<":return"<";case">":return">";case"&":return"&";case'"':return""";case"'":return"'";default:return t}})}var A=w(()=>{"use strict";S();wt()});var ye={};var Ct=w(()=>{"use strict";S();F();A();(async()=>{if((await T())["options"].theme.autoSwitch){let n=window.matchMedia("(prefers-color-scheme: dark)");n.matches&&$("#Wrapper").addClass("Night"),n.addEventListener("change",({matches:e})=>{e?$("#Wrapper").addClass("Night"):$("#Wrapper").removeClass("Night")})}$("#Top .site-nav .tools > .top").addClass("v2p-hover-btn");{let n=$("#Rightbar .light-toggle").addClass("v2p-color-mode-toggle"),e=n.find("> img");e.prop("alt")==="Light"&&(n.prop("title","\u4F7F\u7528\u6DF1\u8272\u4E3B\u9898"),e.replaceWith(xt)),e.prop("alt")==="Dark"&&(n.prop("title","\u4F7F\u7528\u6D45\u8272\u4E3B\u9898"),e.replaceWith(ht))}{let n=$(`
`);$(`\u8BE5\u4E3B\u9898\u6CA1\u6709\u6B63\u6587\u5185\u5BB9