MediaWiki:Common.js
From KAYŌ 💖 DAY
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)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ $(function () { // 导航加随机背景图 var pipingUrl if ($('.image').length > 0) { var selectedImage = $('.image')[Math.ceil(Math.random() * $('.image').length) - 1].href $.get(selectedImage, function (data) { pipingUrl = $(data).find('.fullImageLink a').attr('href') // if ($('.piping').length === 0) { // $('#page-content').before('<div class="piping"></div>') // $('footer').after('<div class="piping"></div>') // } $('.top-bar').css({ // 'height': $('.top-bar').height(), 'background': 'linear-gradient(to right, #000 20%, transparent 50%), url(' + pipingUrl + ') 100% center / 80% auto no-repeat', }) }) }; // 厂牌如果为空,删除十字架符号 $('.record-label').each(function () { if ($(this).text() === '†') { $(this).remove() } }); // 清除“监视本页”选中状态 if (window.location.href.indexOf('edit') !== -1) { $('#wpWatchthis').attr('checked', false) }; // 播放器 $('body').append('<div id="player"><p class="track-title"> </p></div>'); // 播放器 $('body').append('<div id="player"><p class="track-title"> </p></div>'); if ($.fn.mediaelementplayer) { $('video, audio').mediaelementplayer({ // Do not forget to put a final slash pluginPath: 'https://cdnjs.com/libraries/mediaelement/', // this will allow the CDN to use Flash without restrictions // (by default, this is set as 'sameDomain') shimScriptAccess: 'always' // more configuration }) }; $('.btn-play-audio').on('click', function () { let url = 'http://showapops.com/audio/' + $(this).attr('data-file') + '.mp3' }); }())