打开/关闭搜索
搜索
打开/关闭菜单
1399
1.8万
83
7.6万
导航
首页
最近更改
特殊页面
上传文件
随机页面
随机页面
随机歌曲
随机P主
编辑相关
帮助
讨论版
公共沙盒
待修改页面
批量上传文件
友情链接
VCPedia
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
创建账号
登录
创建条目推荐使用
幻梦术力口wiki工具
!
编辑P主歌曲列表前往
Vocawiki数据库打标网站
!
查看“︁Widget:LatestArticleList”︁的源代码
来自Vocawiki
更多语言
查看
阅读
查看源代码
查看历史
associated-pages
Widget
讨论
更多操作
←
Widget:LatestArticleList
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您没有权限编辑
Widget
命名空间内的页面。
您可以查看和复制此页面的源代码。
<noinclude> 供{{tl|首页/最新条目}}使用。 本页面为自动生成,请勿直接修改!否则你的编辑将被覆盖!!!请至 https://github.com/Vocawiki/wiki-frontend/blob/main/src/widgets/LatestArticleList/index.ts 修改源代码。 </noinclude><includeonly><!--{if !isset($LatestArticleList_called) || !$LatestArticleList_called}--><!--{assign var="LatestArticleList_called" value=true scope="global"}--><script type="module">/*! Fast Average Color | © 2025 Denis Seleznev | MIT License | https://github.com/fast-average-color/fast-average-color */ function e(e){var t=e.toString(16);return t.length===1?`0`+t:t}function t(t){return`#`+t.map(e).join(``)}function n(e){return(e[0]*299+e[1]*587+e[2]*114)/1e3<128}function r(e){return e?i(e)?e:[e]:[]}function i(e){return Array.isArray(e[0])}function a(e,t,n){for(var r=0;r<n.length;r++)if(o(e,t,n[r]))return!0;return!1}function o(e,t,n){switch(n.length){case 3:if(s(e,t,n))return!0;break;case 4:if(c(e,t,n))return!0;break;case 5:if(u(e,t,n))return!0;break;default:return!1}}function s(e,t,n){return e[t+3]!==255||e[t]===n[0]&&e[t+1]===n[1]&&e[t+2]===n[2]}function c(e,t,n){return e[t+3]&&n[3]?e[t]===n[0]&&e[t+1]===n[1]&&e[t+2]===n[2]&&e[t+3]===n[3]:e[t+3]===n[3]}function l(e,t,n){return e>=t-n&&e<=t+n}function u(e,t,n){var r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=e[t+3],u=l(c,o,s);return o?!!(!c&&u||l(e[t],r,s)&&l(e[t+1],i,s)&&l(e[t+2],a,s)&&u):u}var d=24;function f(e,t,n){for(var r={},i=n.dominantDivider||d,o=n.ignoredColor,s=n.step,c=[0,0,0,0,0],l=0;l<t;l+=s){var u=e[l],f=e[l+1],p=e[l+2],m=e[l+3];if(!(o&&a(e,l,o))){var h=Math.round(u/i)+`,`+Math.round(f/i)+`,`+Math.round(p/i);r[h]?r[h]=[r[h][0]+u*m,r[h][1]+f*m,r[h][2]+p*m,r[h][3]+m,r[h][4]+1]:r[h]=[u*m,f*m,p*m,m,1],c[4]<r[h][4]&&(c=r[h])}}var g=c[0],_=c[1],v=c[2],y=c[3],b=c[4];return y?[Math.round(g/y),Math.round(_/y),Math.round(v/y),Math.round(y/b)]:n.defaultColor}function p(e,t,n){for(var r=0,i=0,o=0,s=0,c=0,l=n.ignoredColor,u=n.step,d=0;d<t;d+=u){var f=e[d+3],p=e[d]*f,m=e[d+1]*f,h=e[d+2]*f;l&&a(e,d,l)||(r+=p,i+=m,o+=h,s+=f,c++)}return s?[Math.round(r/s),Math.round(i/s),Math.round(o/s),Math.round(s/c)]:n.defaultColor}function m(e,t,n){for(var r=0,i=0,o=0,s=0,c=0,l=n.ignoredColor,u=n.step,d=0;d<t;d+=u){var f=e[d],p=e[d+1],m=e[d+2],h=e[d+3];l&&a(e,d,l)||(r+=f*f*h,i+=p*p*h,o+=m*m*h,s+=h,c++)}return s?[Math.round(Math.sqrt(r/s)),Math.round(Math.sqrt(i/s)),Math.round(Math.sqrt(o/s)),Math.round(s/c)]:n.defaultColor}function h(e){return g(e,`defaultColor`,[0,0,0,0])}function g(e,t,n){return e[t]===void 0?n:e[t]}var _=10,v=100;function y(e){return e.search(/\.svg(\?|$)/i)!==-1}function b(e){if(S(e)){var t=e.naturalWidth,n=e.naturalHeight;return!e.naturalWidth&&y(e.src)&&(t=n=v),{width:t,height:n}}return T(e)?{width:e.videoWidth,height:e.videoHeight}:E(e)?{width:e.codedWidth,height:e.codedHeight}:{width:e.width,height:e.height}}function x(e){return D(e)?`canvas`:w(e)?`offscreencanvas`:E(e)?`videoframe`:O(e)?`imagebitmap`:e.src}function S(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement}var C=typeof OffscreenCanvas<`u`;function w(e){return C&&e instanceof OffscreenCanvas}function T(e){return typeof HTMLVideoElement<`u`&&e instanceof HTMLVideoElement}function E(e){return typeof VideoFrame<`u`&&e instanceof VideoFrame}function D(e){return typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement}function O(e){return typeof ImageBitmap<`u`&&e instanceof ImageBitmap}function k(e,t){var n=g(t,`left`,0),r=g(t,`top`,0),i=g(t,`width`,e.width),a=g(t,`height`,e.height),o=i,s=a;if(t.mode===`precision`)return{srcLeft:n,srcTop:r,srcWidth:i,srcHeight:a,destWidth:o,destHeight:s};var c;return i>a?(c=i/a,o=v,s=Math.round(o/c)):(c=a/i,s=v,o=Math.round(s/c)),(o>i||s>a||o<_||s<_)&&(o=i,s=a),{srcLeft:n,srcTop:r,srcWidth:i,srcHeight:a,destWidth:o,destHeight:s}}var A=typeof window>`u`;function j(){return A?C?new OffscreenCanvas(1,1):null:document.createElement(`canvas`)}var M=`FastAverageColor: `;function N(e){return Error(M+e)}function P(e,t){t||console.error(e)}var F=function(){function e(){this.canvas=null,this.ctx=null}return e.prototype.getColorAsync=function(e,t){if(!e)return Promise.reject(N(`call .getColorAsync() without resource`));if(typeof e==`string`){if(typeof Image>`u`)return Promise.reject(N(`resource as string is not supported in this environment`));var n=new Image;return n.crossOrigin=t&&t.crossOrigin||``,n.src=e,this.bindImageEvents(n,t)}else if(S(e)&&!e.complete)return this.bindImageEvents(e,t);else{var r=this.getColor(e,t);return r.error?Promise.reject(r.error):Promise.resolve(r)}},e.prototype.getColor=function(e,t){t=t||{};var n=h(t);if(!e){var r=N(`call .getColor() without resource`);return P(r,t.silent),this.prepareResult(n,r)}var i=k(b(e),t);if(!i.srcWidth||!i.srcHeight||!i.destWidth||!i.destHeight){var r=N(`incorrect sizes for resource "${x(e)}"`);return P(r,t.silent),this.prepareResult(n,r)}if(!this.canvas&&(this.canvas=j(),!this.canvas)){var r=N(`OffscreenCanvas is not supported in this browser`);return P(r,t.silent),this.prepareResult(n,r)}if(!this.ctx){if(this.ctx=this.canvas.getContext(`2d`,{willReadFrequently:!0}),!this.ctx){var r=N(`Canvas Context 2D is not supported in this browser`);return P(r,t.silent),this.prepareResult(n)}this.ctx.imageSmoothingEnabled=!1}this.canvas.width=i.destWidth,this.canvas.height=i.destHeight;try{this.ctx.clearRect(0,0,i.destWidth,i.destHeight),this.ctx.drawImage(e,i.srcLeft,i.srcTop,i.srcWidth,i.srcHeight,0,0,i.destWidth,i.destHeight);var a=this.ctx.getImageData(0,0,i.destWidth,i.destHeight).data;return this.prepareResult(this.getColorFromArray4(a,t))}catch(i){var r=N(`security error (CORS) for resource ${x(e)}. Details: https://developer.mozilla.org/en/docs/Web/HTML/CORS_enabled_image`);return P(r,t.silent),t.silent||console.error(i),this.prepareResult(n,r)}},e.prototype.getColorFromArray4=function(e,t){t=t||{};var n=4,i=e.length,a=h(t);if(i<n)return a;var o=i-i%n,s=(t.step||1)*n,c;switch(t.algorithm||`sqrt`){case`simple`:c=p;break;case`sqrt`:c=m;break;case`dominant`:c=f;break;default:throw N(`${t.algorithm} is unknown algorithm`)}return c(e,o,{defaultColor:a,ignoredColor:r(t.ignoredColor),step:s,dominantDivider:t.dominantDivider})},e.prototype.prepareResult=function(e,r){var i=e.slice(0,3),a=[e[0],e[1],e[2],e[3]/255],o=n(e);return{value:[e[0],e[1],e[2],e[3]],rgb:`rgb(`+i.join(`,`)+`)`,rgba:`rgba(`+a.join(`,`)+`)`,hex:t(i),hexa:t(e),isDark:o,isLight:!o,error:r}},e.prototype.destroy=function(){this.canvas&&(this.canvas.width=1,this.canvas.height=1,this.canvas=null),this.ctx=null},e.prototype.bindImageEvents=function(e,t){var n=this;return new Promise(function(r,i){var a=function(){c();var a=n.getColor(e,t);a.error?i(a.error):r(a)},o=function(){c(),i(N(`Error loading image "${e.src}"`))},s=function(){c(),i(N(`Image "${e.src}" loading aborted`))},c=function(){e.removeEventListener(`load`,a),e.removeEventListener(`error`,o),e.removeEventListener(`abort`,s)};e.addEventListener(`load`,a),e.addEventListener(`error`,o),e.addEventListener(`abort`,s)})},e}();const I=window.RLQ||(window.RLQ=[]),L=(e,t)=>{I.push([e,t])},R=String.fromCodePoint(60),z=String.fromCodePoint(62);async function B(e){if(e.length===0)return{};let t=await new mw.Api().get({action:`query`,format:`json`,formatversion:`2`,prop:`pageimages`,pithumbsize:128,piprop:`thumbnail`,pilicense:`any`,titles:e});return Object.fromEntries(t.query.pages.filter(e=>e.thumbnail).map(e=>[e.title,e.thumbnail]))}function V(){let e=[...document.querySelectorAll(`.latest-article-list li`)].map(e=>{let t=e.querySelector(`a[href^="/"]`);return t!=null&&t.title?{liElem:e,anchorElem:t,title:t.textContent}:null}).filter(e=>e!==null);return e.forEach(({anchorElem:e})=>{e.innerHTML=`${R}div class="latest-article-title"${z}${e.innerHTML}${R}/div${z}`}),[...document.querySelectorAll(`.latest-article-list ol`)].forEach(e=>{e.insertAdjacentHTML(`beforeend`,`${R}li class="latest-article-list-view-more"${z}${R}a href="/Special:%E6%9C%80%E6%96%B0%E9%A1%B5%E9%9D%A2"${z}${R}div class="latest-article-title"${z}查看更多${R}/div${z}${R}/a${z}${R}/li${z}`)}),e}async function H(e){let t=new F,n=await B([...new Set(e.map(e=>e.title))]);e.forEach(({anchorElem:e,title:r})=>{let i=n[r];if(!i)return;e.insertAdjacentHTML(`afterbegin`,`${R}div class="latest-article-image" style="-webkit-mask-image: -webkit-linear-gradient(0deg, #fff 1em, transparent); mask-image: linear-gradient(90deg, #fff 1em, transparent);"${z}${R}img src="${i.source}" loading="lazy" alt=""${z}${R}/div${z}`),e.classList.add(`has-image`);let a=e.querySelector(`img`);t.getColorAsync(a,{algorithm:`dominant`,mode:`speed`,left:128*.5,width:128*.5}).then(t=>{e.style.backgroundColor=t.rgb,e.style.color=t.isDark?`#fff`:`#000`})})}L(`mediawiki.api`,()=>H(V()));</script><!--{/if}--></includeonly>
该页面使用的模板:
Template:Tl
(
查看源代码
)
返回
Widget:LatestArticleList
。
查看“︁Widget:LatestArticleList”︁的源代码
来自Vocawiki