打开/关闭菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

MediaWiki:Common.js:修订间差异

MediaWiki界面页面
无编辑摘要
标签:已被回退
撤销Junchnzy(讨论)的修订版本1870
标签:撤销
 
第34行: 第34行:
   inner.scrollLeft = left;
   inner.scrollLeft = left;
});
});
mw.hook( 'wikipage.content' ).add( function ( content ) {
/*
    * Tippy.js
    * @see https://atomiks.github.io/tippyjs/
    */
// content is a jQuery object, content[0] returns the bodyContent element
// Select top-level tooltips
const tooltips = content[ 0 ].querySelectorAll( '.tooltip:not( .tooltip .tooltip )' );
if ( tooltips ) {
mw.loader.getScript( 'https://unpkg.com/@popperjs/core@2' ).then( function () {
mw.loader.getScript( ' https://unpkg.com/tippy.js@6' ).then( function () {
// Load styles for shift-away animation
mw.loader.load( 'https://unpkg.com/tippy.js@6/animations/shift-away.css', 'text/css' );
const createTippy = function ( element, position ) {
const tooltipContent = element.querySelector( ':scope > .tooltiptext' );
tippy( element, {
content: tooltipContent.innerHTML,
placement: position
} );
// Make tooltip focusable by keyboard
element.setAttribute( 'tabindex' ,  '0' );
};
tippy.setDefaultProps( {
animation: 'shift-away',
allowHTML: true,
appendTo: document.body,
ignoreAttributes: true,
interactive: true
} );
tooltips.forEach( function ( tooltip ) {
createTippy( tooltip, 'top' );
const nestedTooltip = tooltip.querySelector( '.tooltip' );
if ( nestedTooltip ) {
createTippy( nestedTooltip, 'bottom' );
}
} );
},
function ( e ) {
mw.log.error( e.message );
}
);
},
function ( e ) {
mw.log.error( e.message );
} );
}
} );

2026年8月13日 (四) 21:22的最新版本

/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
/* 用于信息栏折叠面板 */
/*window.onload = function () {
  var infoboxtitle = document.getElementById('infobox-toggleTitle');
  var infoboxcontent = document.getElementById('infobox-content');
  infoboxtitle.addEventListener('click', function() {
    (infoboxcontent.style.display === 'table') ? 'none' : 'table';
  });
};*/

$(document).ready(function(){
  $("#infobox-toggleTitle").click(function(){
    $("#infobox-content").toggle(100);
    if ($("#infobox-arrow").hasClass('infobox-rotate')) {
    $("#infobox-arrow").removeClass('infobox-rotate');
  } else {
    $("#infobox-arrow").addClass('infobox-rotate');
  }
  });
});

/*用于帧数条横向滚动*/
const inner = document.querySelector('.frameChart-back');

inner.addEventListener('wheel', event => {
  const { scrollLeft, scrollWidth, clientWidth } = inner;
  const { deltaY } = event;
  const maxScrollLeft = scrollWidth - clientWidth;
  const left = inner.scrollLeft + event.deltaY;
  if ((deltaY < 0 && left >= 0) || (deltaY > 0 && left <= maxScrollLeft)) {
    event.preventDefault();
  }
  // event.preventDefault();
  inner.scrollLeft = left;
});