全站通知:

BOSS

阅读

    

2025-12-12更新

    

最新编辑:梁兮兮L

阅读:

  

更新日期:2025-12-12

  

最新编辑:梁兮兮L

来自元素地牢WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索
页面贡献者 :
梁兮兮L

如果是第一次来,按"Ctrl+D"可以收藏随时查看更新~觉得WIKI好玩的话,请推荐给朋友哦~(◕ω<)☆
按右上角“WIKI功能→编辑”即可修改页面内容。

<script src="https://wiki.biligame.com/skins/common/tools/dynamic-query.js"></script>

       <button onclick="queryVideo('all')" style="margin-right:8px; border:none; padding:4px 12px; border-radius:4px; background:#f0f0f0; cursor:pointer;">全部</button>
       <button onclick="queryVideo('攻略')" style="margin-right:8px; border:none; padding:4px 12px; border-radius:4px; background:#f0f0f0; cursor:pointer;">攻略</button>
       <button onclick="queryVideo('实况')" style="margin-right:8px; border:none; padding:4px 12px; border-radius:4px; background:#f0f0f0; cursor:pointer;">实况</button>
       <button onclick="queryVideo('官方')" style="margin-right:8px; border:none; padding:4px 12px; border-radius:4px; background:#f0f0f0; cursor:pointer;">官方</button>

加载中...

<script> // 分类样式配置:与你的视频分类一一对应 var videoConfig = {

   "攻略": {
       tagStyle: "background:#28a745; color:white; padding:2px 6px; border-radius:2px; font-size:12px;"
   },
   "实况": {
       tagStyle: "background:#17a2b8; color:white; padding:2px 6px; border-radius:2px; font-size:12px;"
   },
   "官方": {
       tagStyle: "background:#dc3545; color:white; padding:2px 6px; border-radius:2px; font-size:12px;"
   },
   "默认": {
       tagStyle: "background:#6c757d; color:white; padding:2px 6px; border-radius:2px; font-size:12px;"
   }

};

// 总分类名称:所有视频必须归属的分类 var MAIN_CATEGORY = "魔法工艺视频";

// 核心查询函数 function queryVideo(targetCat) {

   var container = document.getElementById("videoContainer");

container.innerHTML = "

加载中...

";

   // 构建查询条件
   var queryStr = "";
   if (targetCat !== "all") {
       queryStr += "";
   }
   // 配置查询参数:指定要获取的属性
   var queryParams = {
       prop: "标题|链接|UP主",  // 必须与视频页面的属性名一致
       format: "json"
   };
   // 调用官方动态查询API
   dynamicQuery(queryStr, queryParams, function(data) {
       if (!data || data.length === 0) {

container.innerHTML = "

暂无该分类下的视频

";

           return;
       }
       // 渲染视频列表

var html = "

    "; data.forEach(function(item) { // 匹配视频子分类 var videoCat = targetCat === "all"  ? item.categories.find(c => c !== MAIN_CATEGORY) || "默认"  : targetCat; var style = videoConfig[videoCat] ? videoConfig[videoCat].tagStyle : videoConfig["默认"].tagStyle; // 拼接单条视频HTML html += "
  • "; html += "" + videoCat + ""; html += "" + (item.标题 || "未知标题") + ""; html += "(UP主:" + (item.UP主 || "未知") + ")"; html += "
  • "; }); html += "

";

       container.innerHTML = html;
   });

}

// 页面加载完成后,默认显示全部视频 window.onload = function() {

   queryVideo("all");

}; </script>