打开/关闭搜索
搜索
打开/关闭菜单
1.2万
1.8万
94
8万
导航
首页
最近更改
特殊页面
上传文件
随机页面
随机页面
随机歌曲
随机P主
编辑相关
帮助
讨论版
公共沙盒
待修改页面
批量上传文件
友情链接
VCPedia
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
登录后可编辑和发表评论。
user-interface-preferences
个人工具
创建账号
登录
欢迎加入
本站官方QQ群
!
查看“︁Widget:AppleMusic”︁的源代码
来自Vocawiki
更多语言
查看
阅读
查看源代码
查看历史
associated-pages
Widget
讨论
更多操作
←
Widget:AppleMusic
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您没有权限编辑
Widget
命名空间内的页面。
您可以查看和复制此页面的源代码。
<noinclude>Only for {{tl|AppleMusic}}</noinclude><includeonly><!--{if !isset($wgAppleMusic) || !$wgAppleMusic}--><!--{assign var="wgAppleMusic" value=true scope="global"}--><script> "use strict"; window.RLQ = window.RLQ || []; window.RLQ.push([["mediawiki.base", "jquery", "ext.gadget.libOOUIDialog", "mediawiki.Uri"], () => { try { const placeholderToggle = (iframe) => { if (iframe.data("displayFlag")) { iframe.data("displayFlag", false); iframe.data("placeholder").fadeOut(370); } }; let lazyLoadObserver; if ("IntersectionObserver" in window && "IntersectionObserverEntry" in window && "intersectionRatio" in window.IntersectionObserverEntry.prototype && "isIntersecting" in window.IntersectionObserverEntry.prototype) { lazyLoadObserver = new IntersectionObserver((entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { entry.target.src = entry.target.dataset.src; setTimeout(() => { placeholderToggle($(entry.target)); }, 13070); lazyLoadObserver.unobserve(entry.target); } }); }); } else { lazyLoadObserver = { observe: (target) => { target.src = target.dataset.src; setTimeout(() => { placeholderToggle($(target)); }, 13070); }, }; } const run = () => { $(".appleMusic:not(.exec)").each((_, that) => { const self = $(that); self.addClass("exec"); const id = that.dataset.id; const area = that.dataset.area; const song = that.dataset.song; const title = that.dataset.title; let float = that.dataset.float; const width = 660; const height = /^\d+$/.test(song) ? 150 : 450; if (!/^\d+$/.test(id)) { return self.css("color", "red").text("Error in widget:AppleMusic: Invalid id."); } if (!["left", "right"].includes(float)) { float = "none"; } if (float !== "none") { self.addClass(`float-${float}`); } self.empty().attr("title", `${title || that.title || `id ${id}${/^\d+$/.test(id) ? ` song ${song}` : ""}`} - Apple Music`).append(`<${"div"} class="subinfo"><${"a"} rel="nofollow noreferrer noopener" class="external text" href="https://music.apple.com/${area}/album/${id}${/^\d+$/.test(song) ? `?i=${song}` : ""}" target="_blank"><${"img"} src="https://music.apple.com/assets/favicon/favicon-32.png"></${"a"}><${"br"}>[<${"a"} href="javascript:void(0);" class="appleMusicCopyrightNotice">会员提示</${"a"}>]</${"div"}>`); const iframe = $("<iframe/>"); iframe.attr({ allow: "encrypted-media; clipboard-write", "data-src": `https://embed.music.apple.com/${area}/album/${id}${/^\d+$/.test(song) ? `?i=${song}` : ""}`, }); iframe.width(width).height(height); const div = $("<div/>"); div.width(width).height(height).css({ position: "absolute", top: "0", left: "0", "z-index": "99", display: "flex", "align-items": "center", background: "rgba(255, 255, 255, .37)", }); const text = $("<div/>"); text.css({ "text-align": "center", width: "100%", }).text("正在加载中,若长时间空白则说明是网络问题……"); div.append(text).appendTo(self); iframe.data({ placeholder: div, displayFlag: true, }); self.prepend(iframe); iframe[0].addEventListener("load", () => { placeholderToggle(iframe); }); self.find(".appleMusicCopyrightNotice").on("click", () => { oouiDialog.alert("Apple Music 限制了未订阅 Apple Music 用户的站外音乐播放功能,如果您未在 Apple Music 网站登录订阅了 Apple Music 的账户,则只能播放随机30秒片段。<br>此时我们建议点击播放器右侧 Apple Music 图标,跳转到歌曲页面欣赏。"); }); lazyLoadObserver.observe(iframe[0]); }); }; $(run); mw.hook("wikipage.content").add(run); $(window).on("load", run); } catch (e) { // eslint-disable-next-line prefer-template oouiDialog.alert($("<di" + "v>").text("AppleMusic模板执行出现问题,请复制以下内容并在提问求助区处粘贴寻求帮助:").append($("<pr" + "e>").text("wgPageName: " + mw.config.get("wgPageName") + "\n" + "wgArticleId: " + mw.config.get("wgArticleId") + "\n" + "wgRevisionId: " + mw.config.get("wgRevisionId") + "\n----\nUser Agent: " + navigator.userAgent + "\n----\n" + e + "\n" + e.stack.split("\n")[1].trim())), { size: "medium", }); } }]); </script><style> .appleMusic { position: relative; display: flex; flex-wrap:wrap; justify-content: flex-start; align-items: flex-start; align-content: flex-start; max-width: 100%; } .appleMusic iframe { border: none; margin: 0; max-width: 100%; } body .appleMusic .subinfo img { height: 1rem!important; margin-left: .25rem; max-width: none!important; } .appleMusic .subinfo { margin: 0 10px; } .appleMusic.float-left { float: left; padding-right: 33px; } .appleMusic.float-right { float: right; padding-right: 33px; } </style><!--{/if}--></includeonly>
该页面嵌入的页面:
Template:Tl
(
查看源代码
)
返回
Widget:AppleMusic
。
查看“︁Widget:AppleMusic”︁的源代码
来自Vocawiki