Gadget:avatar.js:修订间差异

添加301字节 、​ 2023年7月24日 (星期一)
// Edit via Wikiplus
(// Edit via Wikiplus)
(// Edit via Wikiplus)
 
(未显示同一用户的6个中间版本)
第1行: 第1行:
$(function(){
$( function () {
if (!mw.user.isAnon()) {
if ( !mw.user.isAnon() ) {
var img = $("<img>").attr(
const $img = $( '<img>' ).attr(
  "src",
'src',
  mw.config.get("wgScriptPath") +
mw.config.get( 'wgScriptPath' ) +
    "/index.php?title=Special:Avatar&wpUsername=" +
        '/index.php?title=Special:Avatar&wpUsername=' +
    mw.user.id()
        mw.user.id()
).attr("width",28).attr("height",28);
).attr( 'width', 28 ).attr( 'height', 28 );
var link = $("<a>")
const $link = $( '<a>' )
  .attr("href", mw.util.getUrl("Special:UploadAvatar"))
.attr( 'href', mw.util.getUrl( 'Special:UploadAvatar' ) )
  .append(img);
.append( $img );
  if (!document.body.classList.contains("skin-vector-legacy")) {
if ( !document.body.classList.contains( 'skin-vector-legacy' ) ) {
    $("#pt-userpage-2").before($('<li id="pt-avatar"></li>').append(link));
$( '#pt-userpage-2' ).before( $( '<li>' ).attr( 'id', 'pt-avatar' ).append( $link ) );
  } else {
} else {
    $("#pt-userpage").before($('<li id="pt-avatar"></li>').append(link));
$( '#pt-userpage' ).before( $( '<li>' ).attr( 'id', 'pt-avatar' ).append( $link ) );
  }
}
}
}
$(".mw-userlink").each(function (_, item) {
function setAvatar() {
  item = $(item);
$( 'a.mw-userlink:not(.mw-anonuserlink)' ).each( function ( _, item ) {
  item.prepend(
item.prepend(
    $("<img/>")
$( '<img>' )
      .addClass("userlink-avatar")
.addClass( 'userlink-avatar' )
      .attr(
.attr( 'src', mw.config.get( 'wgScriptPath' ) + '/index.php?title=Special:Avatar&wpUsername=' + item.textContent )[ 0 ]
        "src",
);
        mw.config.get("wgScriptPath") +
} );
          "/index.php?title=Special:Avatar&wpUsername=" +
}
          item.text()
mw.hook( 'wikipage.content' ).add( function ( e ) {
      )
 
  );
if ( e.attr( 'id' ) === 'mw-content-text' ) {
});});
setAvatar();
return;
}
if ( e.hasClass( 'mw-changeslist' ) ) {
setAvatar();
}
 
} );
} );
维护员、​界面管理员、​巡查员、​监督员、​小部件编辑者
3,469

个编辑