MediaWiki:Common.js:修订间差异
MediaWiki界面页面
更多操作
无编辑摘要 |
无编辑摘要 |
||
| (未显示同一用户的46个中间版本) | |||
| 第1行: | 第1行: | ||
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */ | /* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */ | ||
if (mw.config.get('wgPageName') === '首页') { | 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); | |||
}()) | |||
} | } | ||
| 第31行: | 第31行: | ||
if ($('.bvideo').length > 0) { | if ($('.bvideo').length > 0) { | ||
var dataIdValue = $('.bvideo').data('id'); | var dataIdValue = $('.bvideo').data('id'); | ||
console.log('目标<div>存在,可以执行相关操作'+dataIdValue ); | console.log('目标<div>存在,可以执行相关操作' + dataIdValue); | ||
} | } | ||
$('.bvideo').each(function () { | |||
var dataIdValue = $(this).data('id'); | var dataIdValue = $(this).data('id'); | ||
var iframeElement = $('<iframe>', { | /**var iframeElement = $('<iframe>', { | ||
src: 'https://player.bilibili.com/player.html?bvid=' + dataIdValue, | |||
width: '100%', | |||
height: '360', | |||
frameborder: '0', | |||
allowfullscreen: 'allowfullscreen' | |||
}); | });**/ | ||
var iframeElement = '<iframe src="https://player.bilibili.com/player.html?bvid='+ dataIdValue + '" frameborder="0" allowfullscreen="allowfullscreen" style="width: 100%;aspect-ratio:16 / 9;"></iframe>'; | |||
$(this).append(iframeElement); | $(this).append(iframeElement); | ||
console.log('目标<div>存在,可以执行相关操作'+dataIdValue ); | console.log('目标<div>存在,可以执行相关操作' + dataIdValue); | ||
}); | |||
$(document).ready(function(){ | $(document).ready(function () { | ||
$(".jskpjs").click(function(){ | $(".jskpjs").click(function () { | ||
$(this).find('.jskp-card').toggleClass('jskp-flipped'); | $(this).find('.jskp-card').toggleClass('jskp-flipped'); | ||
}); | }); | ||
}); | }); | ||
mw.loader.load('https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-confirm/3.3.4/jquery-confirm.min.js'); | mw.loader.load('https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-confirm/3.3.4/jquery-confirm.min.js'); | ||
$(".jskp_js").on("click", function(){ | var img_index = 0; | ||
var | var img_array = []; | ||
var dataNameValue = $(this).data('name'); | $(".jskp_js").on("click", function () { | ||
var dataYmValue = $(this).data('ym'); | var kp_img = $(this).data('id');//用这个传递图片的 | ||
var jsDiv = $(this).find('#div1').html(); | var kp_img = kp_img.split(";");//处理;的分隔 | ||
var jsDiv2 = $(this).find('#js2').html(); | img_array = kp_img; | ||
var jsDiv3 = $(this).find('#js3').html(); | var cv_name = $(this).data('cv'); | ||
var boxHeight = $(window).height() * 0.7; | var dataNameValue = $(this).data('name'); | ||
$.alert({ | var dataYmValue = $(this).data('ym'); | ||
title:'角色详情', | var jsDiv = $(this).find('#div1').html(); | ||
var jsDiv2 = $(this).find('#js2').html(); | |||
var jsDiv3 = $(this).find('#js3').html(); | |||
var boxHeight = $(window).height() * 0.7; | |||
var confirmDialog = $.alert({ | |||
//title:'角色详情', | |||
title: '<div style="margin: 5px;"><h4 style="margin: 0;"><span>' + dataNameValue + '('+dataYmValue+')</span></h4><div style="font-size: 1rem;font-style: italic;">配音CV:' + cv_name + '</div><div>', | |||
closeIcon: true, | closeIcon: true, | ||
content: '<div style="max-height:'+boxHeight+'px;">'+ | content: '<div style="max-height:' + boxHeight + 'px;" >' + | ||
'<div style="display: flex;flex-wrap:wrap;">' + | |||
'<div class="kp_mini_lihui2">' + | |||
'<img id="lihui" src="' + kp_img[0] + '">' + | |||
'</div>' + | |||
'<div class="kp_mini_right">' + | |||
'<div style="margin: 5px;">' + jsDiv + | |||
'</div>' + | |||
' | '</div>', | ||
}); | |||
confirmDialog.onOpen(); | |||
if (kp_img[1] === undefined || kp_img[1] === null) { | |||
} | console.log(kp_img); | ||
console.log('只有一个立绘!'); | |||
} else { | |||
setTimeout(function () { | |||
console.log(kp_img); | |||
$(".jconfirm-content .xxcss:first").append('<a onclick="kp2_img(event)">切换立绘</a></div>'); | |||
img_index = 0; | |||
}, 100); | |||
} | |||
}); | }); | ||
function kp2_img(event) { | |||
img_index = (img_index + 1) % img_array.length; | |||
var parentElement = event.target.parentNode.parentNode.parentNode.parentNode; | |||
var imageElement = parentElement.querySelector("#lihui"); | |||
imageElement.src = img_array[img_index]; | |||
} | |||
2024年4月20日 (六) 07:19的最新版本
/* 这里的任何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'
});**/
var iframeElement = '<iframe src="https://player.bilibili.com/player.html?bvid='+ dataIdValue + '" frameborder="0" allowfullscreen="allowfullscreen" style="width: 100%;aspect-ratio:16 / 9;"></iframe>';
$(this).append(iframeElement);
console.log('目标<div>存在,可以执行相关操作' + dataIdValue);
});
$(document).ready(function () {
$(".jskpjs").click(function () {
$(this).find('.jskp-card').toggleClass('jskp-flipped');
});
});
mw.loader.load('https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-confirm/3.3.4/jquery-confirm.min.js');
var img_index = 0;
var img_array = [];
$(".jskp_js").on("click", function () {
var kp_img = $(this).data('id');//用这个传递图片的
var kp_img = kp_img.split(";");//处理;的分隔
img_array = kp_img;
var cv_name = $(this).data('cv');
var dataNameValue = $(this).data('name');
var dataYmValue = $(this).data('ym');
var jsDiv = $(this).find('#div1').html();
var jsDiv2 = $(this).find('#js2').html();
var jsDiv3 = $(this).find('#js3').html();
var boxHeight = $(window).height() * 0.7;
var confirmDialog = $.alert({
//title:'角色详情',
title: '<div style="margin: 5px;"><h4 style="margin: 0;"><span>' + dataNameValue + '('+dataYmValue+')</span></h4><div style="font-size: 1rem;font-style: italic;">配音CV:' + cv_name + '</div><div>',
closeIcon: true,
content: '<div style="max-height:' + boxHeight + 'px;" >' +
'<div style="display: flex;flex-wrap:wrap;">' +
'<div class="kp_mini_lihui2">' +
'<img id="lihui" src="' + kp_img[0] + '">' +
'</div>' +
'<div class="kp_mini_right">' +
'<div style="margin: 5px;">' + jsDiv +
'</div>' +
'</div>',
});
confirmDialog.onOpen();
if (kp_img[1] === undefined || kp_img[1] === null) {
console.log(kp_img);
console.log('只有一个立绘!');
} else {
setTimeout(function () {
console.log(kp_img);
$(".jconfirm-content .xxcss:first").append('<a onclick="kp2_img(event)">切换立绘</a></div>');
img_index = 0;
}, 100);
}
});
function kp2_img(event) {
img_index = (img_index + 1) % img_array.length;
var parentElement = event.target.parentNode.parentNode.parentNode.parentNode;
var imageElement = parentElement.querySelector("#lihui");
imageElement.src = img_array[img_index];
}