Gadget:avatar.js:修订间差异

添加79字节 、​ 2023年7月23日 (星期日)
// Edit via Wikiplus
(// Edit via Wikiplus)
(// Edit via Wikiplus)
第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) {
$( '.mw-userlink' ).each( function ( _, item ) {
  item = $(item);
item.prepend(
  item.prepend(
$( '<img>' )
    $("<img/>")
.addClass( 'userlink-avatar' )
      .addClass("userlink-avatar")
.attr(
      .attr(
'src',
        "src",
mw.config.get( 'wgScriptPath' ) +
        mw.config.get("wgScriptPath") +
              '/index.php?title=Special:Avatar&wpUsername=' +
          "/index.php?title=Special:Avatar&wpUsername=" +
              item.text()
          item.text()
)[ 0 ]
      )
);
  );
} );
});});
} );
维护员、​界面管理员、​巡查员、​监督员、​小部件编辑者
3,469

个编辑