「Widget:BilibiliVideo」の版間の差分
135行目: | 135行目: | ||
}); | }); | ||
else { | else { | ||
− | var global_autoplay = false; | + | var global_autoplay = false, |
+ | global_element = $('#mw-content-text'); | ||
window.widget = window.widget || {}; | window.widget = window.widget || {}; | ||
window.widget.bilibili = { | window.widget.bilibili = { | ||
161行目: | 162行目: | ||
pagename = this.dataset.pagename, | pagename = this.dataset.pagename, | ||
title = this.dataset.title, | title = this.dataset.title, | ||
− | height = +this.dataset.height || | + | height = +this.dataset.height || 441, |
− | width = +this.dataset.width || | + | width = +this.dataset.width || 665, |
subtitle = this.dataset.subtitle === 'true' ? true : false, | subtitle = this.dataset.subtitle === 'true' ? true : false, | ||
autoplay = this.dataset.autoplay === 'true' ? true : false, | autoplay = this.dataset.autoplay === 'true' ? true : false, | ||
181行目: | 182行目: | ||
}); | }); | ||
if (isNaN(page) || page < 1) page = 1; | if (isNaN(page) || page < 1) page = 1; | ||
− | if (isNaN(width)) width = | + | if (isNaN(width)) width = 665; |
− | if (isNaN(height)) height = | + | if (isNaN(height)) height = 441; |
title_text.text((title || 'av' + id) + ([0, 1].indexOf(page) === -1 ? ' (' + page + ')' : '')); | title_text.text((title || 'av' + id) + ([0, 1].indexOf(page) === -1 ? ' (' + page + ')' : '')); | ||
iframeContainer.css({ | iframeContainer.css({ | ||
267行目: | 268行目: | ||
selfbox.width(iframeContainer.outerWidth(true)); | selfbox.width(iframeContainer.outerWidth(true)); | ||
selfbox.toggleClass('onshow'); | selfbox.toggleClass('onshow'); | ||
− | + | iframeContainer.toggle(); | |
if ($(this).text() === '動画表示') { | if ($(this).text() === '動画表示') { | ||
$(this).text('動画隠す'); | $(this).text('動画隠す'); | ||
274行目: | 275行目: | ||
} else { | } else { | ||
$(this).text('動画表示'); | $(this).text('動画表示'); | ||
− | selfbox.removeAttr('style'); | + | selfbox.add(iframeContainer).removeAttr('style'); |
} | } | ||
}); | }); | ||
289行目: | 290行目: | ||
$(this).text('デフォルト表示'); | $(this).text('デフォルト表示'); | ||
rememberWH(selfbox); | rememberWH(selfbox); | ||
− | selfbox.css('width', '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); | ||
311行目: | 312行目: | ||
$('.bilibili-video-container.onshow.widescreen').each(function() { | $('.bilibili-video-container.onshow.widescreen').each(function() { | ||
var selfbox = $(this); | var selfbox = $(this); | ||
− | selfbox.css('width', '73%'); | + | selfbox.css('width', selfbox.parent().width > Math.min(911, global_element.width()) ? '73%' : '100%'); |
setTureHeight(selfbox); | setTureHeight(selfbox); | ||
}); | }); |
2017年12月30日 (土) 20:06時点における版
Name: Bilibili Video Plugin
Author: 加大号的猫
Revised: Boxsnake
Re-revised: AnnAngela
Re-re-revised for HTML5: AnnAngela
Copyright agreement: MIT
Mobile support: XYZ指示物
Release date: 1st version on 2012/06/29, 2nd versionon on 2015/02/06, major update on 2016/11/29, HTML5 version on 2017/04/10
Release at: zh.moegirl.org/Widget:BilibiliVideo && zh.moegirl.org/Template:BilibiliVideo
Note: If there are any questions, please contact the author.
THIS WIDGET CAN NOT BE USED ALONE, PLEASE USE {{BilibiliVideo}}!