MediaWiki:Common.js:修订间差异
MediaWiki界面页面
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第46行: | 第46行: | ||
}); | }); | ||
$(document).ready(function(){ | |||
$(".jskpjs").click(function(){ | |||
$(this).find("#ws").querySelector('.jskp-card').classList.toggle('jskp-flipped'); | |||
}); | |||
}); | |||
2023年12月15日 (五) 21:30的版本
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
if (mw.config.get('wgPageName') === '首页') {
var event = new KeyboardEvent('keydown', {
key: '/',
keyCode: 65,
which: 65,
ctrlKey: false,
altKey: false,
shiftKey: false,
metaKey: false
});
var skin_search = document.getElementById('skin-citizen-search-trigger');
// 添加点击事件监听器
skin_search.addEventListener('click', function() {
document.dispatchEvent(event); //执行
});
$(function() {
/* 头图 */
var mwBody = document.getElementById('content');
var newDiv = document.createElement('div');
newDiv.setAttribute('class', 'header-image');
newDiv.innerHTML = '<div class="header-image" style="background-image: linear-gradient(to top, var(--color-surface-0), transparent 50%), url(https://galbaike.com/images/2/26/%E9%A6%96%E9%A1%B5%E5%A4%B4%E5%9B%BE3.png);background-size: cover;background-position: top;height: 36vh;margin-bottom: -37vh;"></div>';
mwBody.parentNode.insertBefore(newDiv, mwBody);
}())
}
if ($('.bvideo').length > 0) {
var dataIdValue = $('.bvideo').data('id');
console.log('目标<div>存在,可以执行相关操作'+dataIdValue );
}
$('.bvideo').each(function() {
var dataIdValue = $(this).data('id');
var iframeElement = $('<iframe>', {
src: 'https://player.bilibili.com/player.html?bvid='+dataIdValue ,
width: '100%',
height: '360',
frameborder: '0',
allowfullscreen: 'allowfullscreen'
});
$(this).append(iframeElement);
console.log('目标<div>存在,可以执行相关操作'+dataIdValue );
});
$(document).ready(function(){
$(".jskpjs").click(function(){
$(this).find("#ws").querySelector('.jskp-card').classList.toggle('jskp-flipped');
});
});