(() => { return (_, resources) => { class ImageViewer { constructor(url) { this.url = url; if ($(".image-viewer").length === 0) { this.createDom(); } this.viewer = $(".image-viewer-container"); this.downloadImage(); } createDom() { $("body").append(resources.data.imageViewerDom.text); resources.applyStyle("imageViewerStyle"); $(".image-viewer-container .close").on("click", () => this.hide()); } downloadImage() { const xhr = new XMLHttpRequest(); xhr.open("GET", this.url.replace("http:", "https:"), true); xhr.responseType = "blob"; xhr.onload = () => { const title = document.title.replace("_哔哩哔哩 (゜-゜)つロ 干杯~-bilibili", ""); const data = URL.createObjectURL(xhr.response); this.imageData = data; this.viewer.find(".download") .attr("href", data) .attr("download", title); this.viewer.find(".image") .prop("src", data); }; xhr.send(); } show() { this.viewer.addClass("opened"); // $("html,body").addClass("image-viewer-opened"); } hide() { this.viewer.removeClass("opened"); // $("html,body").removeClass("image-viewer-opened"); } } if ($("meta[itemprop='image'],meta[property='og:image']").length > 0) { return { settingsWidget: { category: "视频与直播", content: `