Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/**
* This script imports the platform.js script from Google, which enables the use of YouTube subscribe buttons.
* To embed a subscribe button, use the following HTML:
* <div class="g-ytsubscribe" data-channel="ChannelName" data-layout="default" data-count="default"></div>
* See https://developers.google.com/youtube/youtube_subscribe_button for more information.
**/
(function () {
var state = 0;
mw.hook('wikipage.content').add(function ($content) {
if ($content.find('.g-ytsubscribe').length > 0) {
if (state === 0) {
state = 1;
$.getScript('https://apis.google.com/js/platform.js', function () {
state = 2;
});
} else if (state === 2) {
$content.each(function (i, elem) {
gapi.ytsubscribe.go(elem);
});
}
}
});
}());