MediaWiki:Common.js:修订间差异
MediaWiki界面页面
更多操作
无编辑摘要 |
无编辑摘要 |
||
| (未显示同一用户的23个中间版本) | |||
| 第35行: | 第35行: | ||
$('.bvideo').each(function () { | $('.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, | src: 'https://player.bilibili.com/player.html?bvid=' + dataIdValue, | ||
width: '100%', | width: '100%', | ||
| 第41行: | 第41行: | ||
frameborder: '0', | frameborder: '0', | ||
allowfullscreen: 'allowfullscreen' | 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); | ||
| 第58行: | 第59行: | ||
var kp_img = kp_img.split(";");//处理;的分隔 | var kp_img = kp_img.split(";");//处理;的分隔 | ||
img_array = kp_img; | img_array = kp_img; | ||
var cv_name = $(this).data('cv'); | |||
var dataNameValue = $(this).data('name'); | var dataNameValue = $(this).data('name'); | ||
var dataYmValue = $(this).data('ym'); | var dataYmValue = $(this).data('ym'); | ||
| 第66行: | 第68行: | ||
var confirmDialog = $.alert({ | var confirmDialog = $.alert({ | ||
//title:'角色详情', | //title:'角色详情', | ||
title: '<div style="margin: 5px;"><h4 style="margin: 0;"><span>' + dataNameValue + '</span></h4><div style="font-size: 1rem;font-style: italic;">' + | 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 style="display: flex;flex-wrap:wrap;">' + | ||
'<div | '<div class="kp_mini_lihui2">' + | ||
'<img id="lihui" src="' + kp_img[0] + ' | '<img id="lihui" src="' + kp_img[0] + '">' + | ||
'</div>' + | '</div>' + | ||
'<div | '<div class="kp_mini_right">' + | ||
'<div style="margin | '<div style="margin: 5px;">' + jsDiv + | ||
'</div>' + | '</div>' + | ||
'</div>', | |||
}); | }); | ||
confirmDialog.onOpen(); | |||
if (kp_img[1] === undefined || kp_img[1] === null) { | if (kp_img[1] === undefined || kp_img[1] === null) { | ||
console.log(kp_img); | console.log(kp_img); | ||
console.log('只有一个立绘!'); | console.log('只有一个立绘!'); | ||
} else { | } else { | ||
setTimeout(function () { | |||
console.log(kp_img); | console.log(kp_img); | ||
$(".jconfirm-content .xxcss:first").append('<a onclick="kp2_img(event)">切换立绘</a></div>'); | |||
img_index = 0; | img_index = 0; | ||
}, | }, 100); | ||
} | } | ||
}); | }); | ||
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];
}