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

MediaWiki:Common.js:修订间差异

MediaWiki界面页面
Yexiaoyu留言 | 贡献
无编辑摘要
Yexiaoyu留言 | 贡献
无编辑摘要
 
(未显示同一用户的44个中间版本)
第1行: 第1行:
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
if (mw.config.get('wgPageName') === '首页') {
if (mw.config.get('wgPageName') === '首页') {
var event = new KeyboardEvent('keydown', {
    var event = new KeyboardEvent('keydown', {
key: '/',
        key: '/',
keyCode: 65,
        keyCode: 65,
which: 65,
        which: 65,
ctrlKey: false,
        ctrlKey: false,
altKey: false,
        altKey: false,
shiftKey: false,
        shiftKey: false,
metaKey: false
        metaKey: false
});
    });


var skin_search = document.getElementById('skin-citizen-search-trigger');
    var skin_search = document.getElementById('skin-citizen-search-trigger');
// 添加点击事件监听器
    // 添加点击事件监听器
skin_search.addEventListener('click', function() {
    skin_search.addEventListener('click', function () {
document.dispatchEvent(event); //执行
        document.dispatchEvent(event); //执行
});
    });


$(function() {
    $(function () {
/* 头图 */
        /* 头图 */
var mwBody = document.getElementById('content');
        var mwBody = document.getElementById('content');
var newDiv = document.createElement('div');
        var newDiv = document.createElement('div');
newDiv.setAttribute('class', 'header-image');
        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>';
        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);
        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() {
$('.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%',
      height: '360',
        height: '360',
      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);
  });
});


$(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 kp_img = $(this).data('id');
var img_array = [];
var kp_img = kp_img.split(";");
$(".jskp_js").on("click", function () {
var dataNameValue = $(this).data('name');
    var kp_img = $(this).data('id');//用这个传递图片的
var dataYmValue = $(this).data('ym');
    var kp_img = kp_img.split(";");//处理;的分隔
var jsDiv = $(this).find('#div1').html();
    img_array = kp_img;
var jsDiv2 = $(this).find('#js2').html();
    var cv_name = $(this).data('cv');
var jsDiv3 = $(this).find('#js3').html();
    var dataNameValue = $(this).data('name');
var boxHeight = $(window).height() * 0.7;
    var dataYmValue = $(this).data('ym');
     $.alert({
    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:'角色详情',
         title: '<div style="margin: 5px;"><h4 style="margin: 0;"><span>'+dataNameValue+'</span></h4><div style="font-size: 1rem;font-style: italic;">'+dataYmValue +'</div><div>',
         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 style="padding: 5px;width: 30%;overflow: hidden;">' +
            '<div class="kp_mini_lihui2">' +
        '<img src="'+ kp_img[0] +'" style="width: 100%;height: auto;aspect-ratio: 9 / 16;object-fit: cover;object-position: top;box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;border-radius: 20px;">' +
            '<img id="lihui" src="' + kp_img[0] + '">' +
        '</div>' +
            '</div>' +
        '<div style="margin: 10px;width: calc(66% - 20px);">' +
            '<div class="kp_mini_right">' +
        '<div style="margin-top: -10px;">'+jsDiv+'</div>'+
            '<div style="margin: 5px;">' + jsDiv +
        '</div>' +
            '</div>' +
         '<!--div style="max-height: 300px;margin: 10px;width:100%">' +
            '</div>',
        '<div style="margin-top: 10px;">'+jsDiv+jsDiv2+'</div>'+
    });
        '</div>' +
    confirmDialog.onOpen();
         '</div--></div>',
    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];
}