Widget:BilibiliVideo:修订间差异

删除1,909字节 、​ 2020年5月27日 (星期三)
无编辑摘要
imported>=海豚=
无编辑摘要
imported>=海豚=
无编辑摘要
第16行: 第16行:
}
}
.bilibili-video-container,
.bilibili-video-container,
.bilibili-video-container div,
.bilibili-video-container .bilibili-widescreen,
.bilibili-video-container .bilibili-widescreen,
.bilibili-video-container iframe {
.bilibili-video-container iframe {
第76行: 第77行:
    border: 0 solid rgba(170,170,170,0.37);
    border: 0 solid rgba(170,170,170,0.37);
    border-top-width: 1px;
    border-top-width: 1px;
}
.bilibili-video-container:not([data-max-width]) .bilibili-iframe-container {
    max-width: calc(100% - 12px)!important;
    max-width: calc(100% - 12px)!important;
}
}
.bilibili-video-container:not([data-max-width]).onshow .bilibili-iframe-container {
.onshow .bilibili-iframe-container {
    max-height: calc(100% - 27px)!important;
    max-height: calc(100% - 27px)!important;
}
}
第110行: 第109行:
}
}
</style><script>
</style><script>
/* eslint-disable no-loop-func */
window.RLQ.push(function() {
/* eslint-disable no-constant-condition */
    $(function() {
/* eslint-disable no-magic-numbers */
     'use strict';
/* global mw */
"use strict";
window.RLQ.push(function () {
    $(function () {
      if (mw.config.get("AnnTools-BilibiliVideo-running", false)) {
      if (mw.config.get("AnnTools-BilibiliVideo-running", false)) {
        return;
        return;
      }
      }
      mw.config.set("AnnTools-BilibiliVideo-running", true);
      mw.config.set("AnnTools-BilibiliVideo-running", true);
      const isNaN = Number.isNaN || window.isNaN;
      var isNaN = Number.isNaN || window.isNaN;
      const temp = new Set();
      const temp = new Set();
     const cssLengthUnitValidator = (length, defaultValue, callback) => {
       if (typeof length !== "string" || length.length === 0) {
         callback(false);
         return defaultValue;
       }
       const parsedNumber = parseFloat(length.replace(/[a-z]+/i, ""));
       if (isNaN(parsedNumber) || parsedNumber <= 0) {
         callback(false);
         return defaultValue;
       }
       if (/^(?:\d+|\d*\.\d+)(?:em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|Q|in|pc|pt|px|%)$/.test(length)) {
         callback(true);
         return length;
       }
       if (/^(?:\d+|\d*\.\d+)$/.test(length)) {
         callback(true);
         return `${length}px`;
       }
       callback(false);
       return defaultValue;
     };
      class Converter {
      class Converter {
        constructor() {
        constructor() {
第161行: 第135行:
          } else if (bv.length === 9) {
          } else if (bv.length === 9) {
            return `BV1${bv}`;
            return `BV1${bv}`;
         } else {
           throw new Error("BV's length must be 9, 10 or 12");
          }
          }
         throw new Error("BV's length must be 9, 10 or 12");
        }
        }
        _bvidToAid(bvid) {
        _bvidToAid(bvid) {
          let r = 0;
          let r = 0;
          for (let i = 0; i < 6; i++) {
          for (let i = 0; i < 6; i++) {
            r += this._base58Table.indexOf(bvid[this._digitMap[i]]) * 58 ** i;
            r += this._base58Table.indexOf(bvid[this._digitMap[i]]) * (58 ** i);
          }
          }
          return "av" + (r - this._add ^ this._xor);
          return 'av' + ((r - this._add) ^ this._xor);
        }
        }
        bvidToAid(str) {
        bvidToAid(str) {
第180行: 第154行:
          if (/^av/i.test(av)) {
          if (/^av/i.test(av)) {
            return av;
            return av;
         } else {
           return `av${av}`;
          }
          }
         return `av${av}`;
        }
        }
        _aidToBvid(aid) {
        _aidToBvid(aid) {
第199行: 第173行:
      }
      }
      const converter = new Converter();
      const converter = new Converter();
      if (mw.config.get("skin") === "minerva") {
      if (mw.config.get('skin') === 'minerva') $('.bilibili-video-container:not(.bilibili-video-initialized)').each(function() {
       $(".bilibili-video-container:not(.bilibili-video-initialized)").each(function () {
       var element = $(this),
         const element = $(this),
         dataset = this.dataset;
           dataset = this.dataset;
       element.addClass("bilibili-video-initialized");
         element.addClass("bilibili-video-initialized");
       var _id = dataset.id,
         const _id = dataset.id,
         id = _id.replace(/^[ab]v/i, ''),
           id = _id.replace(/^[ab]v/i, ""),
         title = dataset.title,
           title = dataset.title,
         pagename = dataset.pagename,
           pagename = dataset.pagename,
         page = parseInt(dataset.page),
           page = parseInt(dataset.page),
         t = parseInt(dataset.t),
           t = parseInt(dataset.t),
         tIsInvalid = isNaN(t) || t <= 0,
           tIsInvalid = isNaN(t) || t <= 0,
         subtitle = dataset.subtitle === 'true' ? true : false;
           subtitle = dataset.subtitle === "true" ? true : false;
       var prefix;
         let prefix;
       var decode = null;
         let decode = null;
       if (/^(?:av)?\d{1,9}$/i.test(_id)) {
         if (/^(?:av)?\d{1,9}$/i.test(_id)) {
         prefix = {
           prefix = {
           href: "av",
             href: "av",
           iframe: "aid"
             iframe: "aid",
         };
           };
       } else if (/^(?:bv)?[\da-z]{10}$/i.test(_id)) {
         } else if (/^(?:bv)?[\da-z]{10}$/i.test(_id)) {
         prefix = {
           prefix = {
           href: "BV",
             href: "BV",
           iframe: "bvid"
             iframe: "bvid",
         };
           };
         if (!/[bB][vV][fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF]{10}/.test(_id)) {
           if (!converter._bvidRegExp.test(_id)) {
           temp.add(_id);
             temp.add(_id);
           } else {
             decode = converter.bvidToAid(_id);
           }
          } else {
          } else {
            if (/^(?:av)?\d{10,}$/i.test(_id)) {
            decode = converter.bvidToAid(_id);
             temp.add(_id);
         }
           }
       } else {
           return this.outerHTML = "<i>id错误</i>";
         if (/^(?:av)?\d{10,}$/i.test(_id)) {
           temp.add(_id);
          }
          }
          $.ajax({
          return this.outerHTML = "<i>id错误</i>";
           url: "https://mgwbcprd.azureedge.net/BilibiliMeta/Index/" + encodeURIComponent(typeof decode === "string" ? decode : prefix.href + id),
       }
           type: "GET",
       $.ajax({
           timeout: 10000,
         url: 'https://mgwbcprd.azureedge.net/BilibiliMeta/Index/' + encodeURIComponent(typeof decode === "string" ? decode : prefix.href + id),
           success: function (data) {
         type: 'GET',
             const list = data.VideoEntities
         success: function(data) {
               .map(function (e, i) {
           var list = data.VideoEntities
                 e.page = i + 1;
             .map(function(e, i) {
                 e.title = e.Title.replace(/^\d+、/, "");
               e.page = i + 1;
                 return e;
               e.title = e.Title.replace(/^\d+、/, '');
               });
               return e;
              let _page = 1;
             }),
              const name = title || (data.Title ? data.Title : prefix.href + id);
              _page = 1,
              let index;
              name = title || (data.Title ? data.Title : prefix.href + id),
              let length;
              index,
             if (pagename) {
              length;
               for (index = 0, length = list.length; index < length; index++) {
           if (pagename) {
                 if (list[index].Title !== pagename && list[index].title !== pagename) { continue; }
             for (index = 0, length = list.length; index < length; index++) {
                 _page = list[index].page;
               if (list[index].Title !== pagename && list[index].title !== pagename) continue;
                 break;
               _page = list[index].page;
               }
               break;
             } else { _page = page; }
             index = _page - 1;
             let sec = t % 60 + "";
             if (sec.length === 1) { sec = "0" + sec; }
             const time = Math.floor(t / 60) + ":" + sec;
             const button = $("<a/>").addClass("bilibili-video-button").attr("rel", "nofollow noreferrer noopener").attr("href", "https://www.bilibili.com/video/" + prefix.href + id + "?p=" + _page + (tIsInvalid ? "" : "&t=" + t)).text(name + " [" + _page + "/" + list.length + "]" + (tIsInvalid ? "" : "[跳转至" + time + "]"));
             if (list[index] !== undefined && list[index].VideoCid !== undefined && subtitle) {
               button.append("<br>(" + _page + "、" + list[index].Title + ")");
              }
              }
              element.before(button).remove();
           } else _page = page;
           },
           index = _page - 1;
           error: function () {
           var sec = t % 60 + '';
             element.before($("<a/>").addClass("bilibili-video-button").attr("rel", "nofollow noreferrer noopener").attr("href", "https://www.bilibili.com/video/" + prefix.href + id + "?p=" + page + (tIsInvalid ? "" : "&t=" + t)).text((title || prefix.href + id) + ([0, 1].indexOf(page) !== -1 && !isNaN(page) ? " (P" + page + ")" : ""))).remove();
           if (sec.length === 1) sec = '0' + sec;
           },
           var time = Math.floor(t / 60) + ':' + sec;
         });
           var button = $('<a/>').addClass('bilibili-video-button').attr("rel", "nofollow noreferrer noopener").attr('href', "https://www.bilibili.com/video/" + prefix.href + id + "?p=" + _page + (tIsInvalid ? '' : '&t=' + t)).text(name + ' [' + _page + '/' + list.length + ']' + (tIsInvalid ? '' : '[跳转至' + time + ']'));
           if (list[index] !== undefined && list[index].VideoCid !== undefined && subtitle) {
              button.append('<br>(' + _page + '、' + list[index].Title + ')');
           }
           element.before(button).remove();
         },
         error: function(e) {
           element.before($('<a/>').addClass('bilibili-video-button').attr("rel", "nofollow noreferrer noopener").attr('href', "https://www.bilibili.com/video/" + prefix.href + id + "?p=" + page + (tIsInvalid ? '' : '&t=' + t)).text((title || prefix.href + id) + ([0, 1].indexOf(page) !== -1 && !isNaN(page) ? ' (P' + page + ')' : ''))).remove();
         },
        });
        });
      }
      });
      else {
      else {
        const global_element = $("#mw-content-text");
        var global_element = $('#mw-content-text');
        window.widget = window.widget || {};
        window.widget = window.widget || {};
        window.widget.bilibili = {
        window.widget.bilibili = {
第285行: 第256行:
          }
          }
          running = true;
          running = true;
          while (true) {
          let target = widget.bilibili.iframes.shift();
           const target = window.widget.bilibili.iframes.shift();
         while (target) {
           if (target) {
           await new Promise((res) => {
             await new Promise((res) => {
             target.addEventListener("load", () => {
               target.addEventListener("load", () => {
                running = false;
                 res();
                target = widget.bilibili.iframes.shift();
                });
               res();
                target.src = target.dataset.src;
              });
              });
           } else {
              target.src = target.dataset.src;
              running = false;
            });
             return;
            }
          }
          }
        };
        };
第305行: 第273行:
          "intersectionRatio" in window.IntersectionObserverEntry.prototype &&
          "intersectionRatio" in window.IntersectionObserverEntry.prototype &&
          "isIntersecting" in window.IntersectionObserverEntry.prototype) {
          "isIntersecting" in window.IntersectionObserverEntry.prototype) {
          lazyLoadObserver = new IntersectionObserver(function (entries) {
          lazyLoadObserver = new IntersectionObserver(function(entries) {
            entries.forEach(function (entry) {
            entries.forEach(function(entry) {
              if (entry.isIntersecting) {
              if (entry.isIntersecting) {
                const lazyTarget = entry.target;
                const lazyTarget = entry.target;
                window.widget.bilibili.iframes.push(lazyTarget);
                widget.bilibili.iframes.push(lazyTarget);
                loop();
                loop();
                lazyLoadObserver.unobserve(lazyTarget);
                lazyLoadObserver.unobserve(lazyTarget);
第318行: 第286行:
          lazyLoadObserver = {
          lazyLoadObserver = {
            observe: (ele) => {
            observe: (ele) => {
              window.widget.bilibili.iframes.push(ele);
              widget.bilibili.iframes.push(ele);
              loop();
              loop();
            },
            }
          };
          }
        }
        }
        const iframe_href_base = "https://www.bilibili.com/blackboard/newplayer.html?playlist=true&playlist_order=sequential&musth5=1&noEndPanel=1&crossDomain=1&autoplay=0&";
        var iframe_href_base = 'https://www.bilibili.com/blackboard/newplayer.html?playlist=true&playlist_order=sequential&musth5=1&noEndPanel=1&crossDomain=1&autoplay=0&';
        const EPSILON = 2.220446049250313e-16,
        var EPSILON = 2.220446049250313e-16,
          rememberWH = function rememberWH(ele) {
          rememberWH = function rememberWH(ele) {
            ele.data({ width: ele.width(), height: ele.height() });
            ele.data({ width: ele.width(), height: ele.height() });
          },
          },
          setTureHeight = function setTureHeight(ele) {
          setTureHeight = function setTureHeight(ele) {
            const barHeight = ele.data("height") - ele.data("width") * 9 / 16; //计算标题和播放器控制栏高度
            var barHeight = ele.data('height') - ele.data('width') * 9 / 16; //计算标题和播放器控制栏高度
            ele.height(ele.width() * 9 / 16 + barHeight);
            ele.height(ele.width() * 9 / 16 + barHeight);
          },
          },
          setWH = function setWH(ele) {
          setWH = function setWH(ele) {
            ele.css({ width: "100%", height: "100%" });
            ele.css({ width: '100%', height: '100%' });
          },
          },
          recallWH = function recallWH(ele) {
          recallWH = function recallWH(ele) {
            ele.width(ele.data("width")).height(ele.data("height"));
            ele.width(ele.data('width')).height(ele.data('height'));
          },
          },
          setMaxHeight = function setMaxHeight(container, target) {
          setMaxHeight = function setMaxHeight(container, target) {
            const h = container.outerHeight(true);
            var h = container.outerHeight(true);
            let t = 0;
            var t = 0;
            container.children().each(function () {
            container.children().each(function() {
              t += $(this).outerHeight(true);
              t += $(this).outerHeight(true);
            });
            });
            target.css("max-height", "calc(100% - " + parseInt(t - h + 2 - (Number.EPSILON || EPSILON)) + "px)");
            target.css('max-height', 'calc(100% - ' + parseInt(t - h + 2 - (Number.EPSILON || EPSILON)) + 'px)');
          };
          };
        $(".bilibili-video-container").addClass("exec").each(function () {
        $('.bilibili-video-container').addClass('exec').each(function() {
          const dataset = this.dataset,
          var dataset = this.dataset,
            _id = dataset.id,
            _id = dataset.id,
            id = _id.replace(/^[ab]v/i, ""),
            id = _id.replace(/^[ab]v/i, ''),
            selfbox = $(this);
            selfbox = $(this);
          let prefix;
          var prefix;
          let decode = null;
          var decode = null;
          if (/^(?:av)?\d{1,9}$/i.test(_id)) {
          if (/^(?:av)?\d{1,9}$/i.test(_id)) {
            prefix = {
            prefix = {
              href: "av",
              href: "av",
              iframe: "aid",
              iframe: "aid"
            };
            };
          } else if (/^(?:bv)?[\da-z]{10}$/i.test(_id)) {
          } else if (/^(?:bv)?[\da-z]{10}$/i.test(_id)) {
            prefix = {
            prefix = {
              href: "BV",
              href: "BV",
              iframe: "bvid",
              iframe: "bvid"
            };
            };
            if (!converter._bvidRegExp.test(_id)) {
            if (!/[bB][vV][fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF]{10}/.test(_id)) {
              temp.add(_id);
              temp.add(_id);
            } else {
            } else {
第374行: 第342行:
            return this.outerHTML = "<i>id错误</i>";
            return this.outerHTML = "<i>id错误</i>";
          }
          }
          let page = parseInt(+(dataset.page || 1));
          var page = parseInt(+(dataset.page || 1)),
         const pagename = dataset.pagename;
           pagename = dataset.pagename,
         const title = dataset.title;
           title = dataset.title,
         const height = cssLengthUnitValidator(dataset.height, "441px", (isValidated) => isValidated || $(this).removeAttr("data-height"));
           height = +dataset.height || 441,
         const width = cssLengthUnitValidator(dataset.width, "665px", (isValidated) => isValidated || $(this).removeAttr("data-width"));
           width = +dataset.width || 665,
         const maxHeight = cssLengthUnitValidator(dataset.maxHeight, undefined, (isValidated) => isValidated || $(this).removeAttr("data-max-height"));
           subtitle = dataset.subtitle === 'true' ? true : false,
         const maxWidth = cssLengthUnitValidator(dataset.maxWidth, undefined, (isValidated) => isValidated || $(this).removeAttr("data-max-width"));
           t = parseInt(dataset.t),
         const subtitle = dataset.subtitle === "true" ? true : false;
           tIsInvalid = isNaN(t) || t <= 0,
         const t = parseInt(dataset.t);
           iframeContainer = $(this).find('.bilibili-iframe-container'),
         const tIsInvalid = isNaN(t) || t <= 0;
           title_text = $('<a/>').attr("rel", "nofollow noreferrer noopener").addClass('external text').attr({
         const iframeContainer = $(this).find(".bilibili-iframe-container");
             href: "https://www.bilibili.com/video/" + prefix.href + id + "?p=" + page + (tIsInvalid ? '' : '&t=' + t),
         const title_text = $("<a/>").attr("rel", "nofollow noreferrer noopener").addClass("external text").attr({
             target: '_blank',
           href: "https://www.bilibili.com/video/" + prefix.href + id + "?p=" + page + (tIsInvalid ? "" : "&t=" + t),
           }).prependTo($(this).find('.bilibili-title')),
           target: "_blank",
           iframe = $('<iframe/>').attr({
         }).prependTo($(this).find(".bilibili-title"));
             frameborder: 0,
         const iframe = $("<iframe/>").attr({
             scrolling: 'no',
           frameborder: 0,
             src: '',
           scrolling: "no",
             allowfullscreen: true,
           src: "",
             class: "bilibili-iframe",
           allowfullscreen: true,
           }).css({
           "class": "bilibili-iframe",
             width: width,
          }).css({
             height: height,
           });
         if (!tIsInvalid) selfbox.removeAttr("data-auto-expand");
         if (isNaN(page) || page < 1) page = 1;
          if (isNaN(width)) width = 665;
         if (isNaN(height)) height = 441;
         var sec = t % 60 + '';
         if (sec.length === 1) sec = '0' + sec;
         var time = Math.floor(t / 60) + ':' + sec;
         title_text.text((title || prefix.href + id) + ([0, 1].indexOf(page) === -1 ? ' (' + page + ')' : '') + (tIsInvalid ? '' : '[视频从' + time + '开始播放]'));
         iframeContainer.css({
            width: width,
            width: width,
            height: height,
            height: height,
           "max-width": maxWidth,
          }).find(".bilibili-iframe-overlay").css({
           "max-height": maxHeight,
          });
         if (!tIsInvalid) { selfbox.removeAttr("data-auto-expand"); }
         if (isNaN(page) || page < 1) { page = 1; }
         let sec = t % 60 + "";
         if (sec.length === 1) { sec = "0" + sec; }
         const time = Math.floor(t / 60) + ":" + sec;
         title_text.text((title || prefix.href + id) + ([0, 1].indexOf(page) === -1 ? " (" + page + ")" : "") + (tIsInvalid ? "" : "[视频从" + time + "开始播放]") + "【视频信息加载中……】");
         iframeContainer.css({
            width: width,
            width: width,
            height: height,
            height: height,
           "max-width": maxWidth,
          }).text('正在加载,请稍候……');
           "max-height": maxHeight,
          iframe.appendTo(iframeContainer.empty());
          });
          window.setTimeout(function() { //异步出去不要卡主线程
          iframe.appendTo(iframeContainer);
          window.setTimeout(function () { //异步出去不要卡主线程
            $.ajax({
            $.ajax({
              url: "https://mgwbcprd.azureedge.net/BilibiliMeta/Index/" + encodeURIComponent(typeof decode === "string" ? decode : prefix.href + id),
              url: 'https://mgwbcprd.azureedge.net/BilibiliMeta/Index/' + encodeURIComponent(typeof decode === "string" ? decode : prefix.href + id),
              type: "GET",
              type: 'GET',
             timeout: 10000,
              success: function(data) {
              success: function (data) {
                var list = data.VideoEntities
                const list = data.VideoEntities
                  .map(function(e, i) {
                  .map(function (e, i) {
                    e.page = i + 1;
                    e.page = i + 1;
                    e.title = e.Title.replace(/^\d+、/, "");
                    e.title = e.Title.replace(/^\d+、/, '');
                    return e;
                    return e;
                  });
                  }),
               let _page = 1;
                 _page = 1,
               const name = title || (data.Title ? data.Title : prefix.href + id);
                 name = title || (data.Title ? data.Title : prefix.href + id),
               let index;
                 index,
               let length;
                 length;
                if (pagename) {
                if (pagename) {
                  for (index = 0, length = list.length; index < length; index++) {
                  for (index = 0, length = list.length; index < length; index++) {
                    if (list[index].Title !== pagename && list[index].title !== pagename) { continue; }
                    if (list[index].Title !== pagename && list[index].title !== pagename) continue;
                    _page = list[index].page;
                    _page = list[index].page;
                    break;
                    break;
                  }
                  }
                } else { _page = page; }
                } else _page = page;
                index = _page - 1;
                index = _page - 1;
                const href = title_text.attr("href");
                var href = title_text.attr('href');
                if (list[index] !== undefined && list[index].VideoCid !== undefined) {
                if (list[index] !== undefined && list[index].VideoCid !== undefined) {
                  iframe.attr("data-src", iframe_href_base + prefix.iframe + "=" + id + "&page=" + _page + (tIsInvalid ? "" : "&t=" + t));
                  iframe.attr('data-src', iframe_href_base + prefix.iframe + '=' + id + '&page=' + _page + (tIsInvalid ? '' : '&t=' + t));
                  title_text.attr("href", href.replace(new RegExp("\\?p=" + page, "g"), "?p=" + _page));
                  title_text.attr('href', href.replace(new RegExp("\\?p=" + page, 'g'), "?p=" + _page));
                  title_text.text(name + " [" + _page + "/" + list.length + "]" + (tIsInvalid ? "" : "[视频从" + time + " 开始播放]"));
                  title_text.text(name + ' [' + _page + '/' + list.length + ']' + (tIsInvalid ? '' : '[视频从' + time + ' 开始播放]'));
                  if (subtitle) { title_text.append("<br>(" + _page + " " + list[index].Title + " "); }
                  if (subtitle) title_text.append('<br>(' + _page + ' ' + list[index].Title + ' ');
                } else {
                } else {
                  title_text.text(name + (tIsInvalid ? "" : "[视频从" + time + " 开始播放]"));
                  title_text.text(name + (tIsInvalid ? '' : '[视频从' + time + ' 开始播放]'));
                  iframe.attr("data-src", iframe_href_base + prefix.iframe + "=" + id + "&page=" + _page + (tIsInvalid ? "" : "&t=" + t));
                  iframe.attr('data-src', iframe_href_base + prefix.iframe + '=' + id + '&page=' + _page + (tIsInvalid ? '' : '&t=' + t));
                }
                }
                lazyLoadObserver.observe(iframe[0]);
                lazyLoadObserver.observe(iframe[0]);
              },
              },
              error: function (e) {
              error: function(e) {
                title_text.text((title || prefix.href + id) + ([0, 1].indexOf(page) === -1 ? " (" + page + ")" : "") + (tIsInvalid ? "" : "[视频从" + time + " 开始播放]"));
                title_text.text((title || prefix.href + id) + ([0, 1].indexOf(page) === -1 ? ' (' + page + ')' : '') + (tIsInvalid ? '' : '[视频从' + time + ' 开始播放]'));
                if (e && e.responseJSON && e.responseJSON.message && e.responseJSON.message === "Authentication is required for accessing this video.") { title_text.parent().append('<sup title="“Bilibili采用会员制,大部分投稿视频会员与游客都可以观看,\n  但部分视频在UP主设定下只有会员才可以观看(这些视频常被称为‘只有会员才知道的世界’)。”\n  - Bilibili#用户制度 @ ZhMoegirl\n在这种情况下我们无法为您解析视频及其分P标题、分P数量等。">(只有会员才知道的世界)</sup>'); }
                if (e && e.responseJSON && e.responseJSON.message && e.responseJSON.message === "Authentication is required for accessing this video.") title_text.parent().append('<sup title="“Bilibili采用会员制,大部分投稿视频会员与游客都可以观看,\n  但部分视频在UP主设定下只有会员才可以观看(这些视频常被称为‘只有会员才知道的世界’)。”\n  - Bilibili#用户制度 @ ZhMoegirl\n在这种情况下我们无法为您解析视频及其分P标题、分P数量等。">(只有会员才知道的世界)</sup>');
                iframe.attr("data-src", iframe_href_base + prefix.iframe + "=" + id + "&page=" + page + (tIsInvalid ? "" : "&t=" + t));
                iframe.attr('data-src', iframe_href_base + prefix.iframe + '=' + id + '&page=' + page + (tIsInvalid ? '' : '&t=' + t));
                lazyLoadObserver.observe(iframe[0]);
                lazyLoadObserver.observe(iframe[0]);
              },
              },
第459行: 第425行:
          }, 137);
          }, 137);
          //toggle
          //toggle
          selfbox.find(".bilibili-toggle").on("click", function () {
          selfbox.find('.bilibili-toggle').on('click', function() {
            selfbox.width(iframeContainer.outerWidth(true));
            selfbox.width(iframeContainer.outerWidth(true));
            selfbox.toggleClass("onshow");
            selfbox.toggleClass('onshow');
            iframeContainer.toggle();
            iframeContainer.toggle();
            if ($(this).text() === " 显示视频") {
            if ($(this).text() === ' 显示视频') {
              $(this).text(" 隐藏视频");
              $(this).text(' 隐藏视频');
              $(window).resize();
              $(window).resize();
            } else {
            } else {
              $(this).text(" 显示视频");
              $(this).text(' 显示视频');
              selfbox.removeAttr("style");
              selfbox.removeAttr('style');
            }
            }
          });
          });
          selfbox.find(".bilibili-widescreen").on("click", function () {
          selfbox.find('.bilibili-widescreen').on('click', function() {
            if (selfbox.is(":not(.onshow)")) { return; }
            if (selfbox.is(':not(.onshow)')) return;
            if (selfbox.is(".widescreen")) {
            if (selfbox.is('.widescreen')) {
              selfbox.removeClass("widescreen");
              selfbox.removeClass('widescreen');
              $(this).text(" 显示宽屏");
              $(this).text(' 显示宽屏');
              recallWH(iframeContainer);
              recallWH(iframeContainer);
              recallWH(iframe);
              recallWH(iframe);
              recallWH(selfbox);
              recallWH(selfbox);
            } else {
            } else {
              selfbox.addClass("widescreen");
              selfbox.addClass('widescreen');
              $(this).text(" 退出宽屏");
              $(this).text(' 退出宽屏');
              rememberWH(selfbox);
              rememberWH(selfbox);
              selfbox.css("width", selfbox.parent().width() > Math.min(911, global_element.width()) ? "73%" : "100%"); //可以看见按钮的最小宽度 665 的 1/0.73 倍
              selfbox.css('width', selfbox.parent().width() > Math.min(911, global_element.width()) ? '73%' : '100%'); //可以看见按钮的最小宽度 665 的 1/0.73 倍
              setTureHeight(selfbox);
              setTureHeight(selfbox);
              rememberWH(iframe);
              rememberWH(iframe);
第494行: 第460行:
          });
          });
        });
        });
        $(window).on("resize", function () {
        $(window).on('resize', function() {
          $(".bilibili-video-container.onshow.widescreen").each(function () {
          $('.bilibili-video-container.onshow.widescreen').each(function() {
            const selfbox = $(this);
            var selfbox = $(this);
            selfbox.css("width", selfbox.parent().width() > Math.min(911, global_element.width()) ? "73%" : "100%");
            selfbox.css('width', selfbox.parent().width() > Math.min(911, global_element.width()) ? '73%' : '100%');
            setTureHeight(selfbox);
            setTureHeight(selfbox);
            setMaxHeight(selfbox, selfbox.find(".bilibili-iframe-container"));
            setMaxHeight(selfbox, selfbox.find('.bilibili-iframe-container'));
          });
          });
        });
        });
        setTimeout(function () {
        setTimeout(function() {
          $('.bilibili-video-container.exec[data-auto-expand="true"]').find(".bilibili-toggle").click();
          $('.bilibili-video-container.exec[data-auto-expand="true"]').find('.bilibili-toggle').click();
        }, 100);
        }, 100);
      }
      }
第510行: 第476行:
          const raw = await $.get("https://zh.moegirl.org/User:AnnAngela/SandBox/bvid?action=raw&ctype=application/json&_=" + Math.random());
          const raw = await $.get("https://zh.moegirl.org/User:AnnAngela/SandBox/bvid?action=raw&ctype=application/json&_=" + Math.random());
          let flags = false;
          let flags = false;
          for (const i of temp) {
          for (let i of temp) {
            if (!(i in raw)) {
            if (!(i in raw)) {
              flags = true;
              flags = true;
第521行: 第487行:
              title: "User:AnnAngela/SandBox/bvid",
              title: "User:AnnAngela/SandBox/bvid",
              text: JSON.stringify(raw),
              text: JSON.stringify(raw),
              summary: "[[Widget:BilibiliVideo|BilibiliVideo]]:bvid不符合格式 - " + Array.from(temp.values()).filter(bvid => !raw.includes(bvid)).join(", "),
              summary: "[[Widget:BilibiliVideo|BilibiliVideo]]:bvid不符合格式 - " + submit.filter(bvid => !raw.includes(bvid)).join(", "),
              tags: "Automation tool",
              tags: "Automation tool",
              minor: true,
              minor: true,
第528行: 第494行:
              watchlist: "nochange",
              watchlist: "nochange",
              contentformat: "application/json",
              contentformat: "application/json",
              contentmodel: "json",
              contentmodel: "json"
            });
            });
          }
          }
匿名用户