LLWiki正在建设中,欢迎加入我们!
“Widget:游戏主界面”的版本间差异
跳转到导航
跳转到搜索
小 |
小 |
||
第3行: | 第3行: | ||
window.addEventListener('load', function () { |
window.addEventListener('load', function () { |
||
var ele = document.querySelector('.start-screen'), |
var ele = document.querySelector('.start-screen'), |
||
parent = document.querySelector('#mw-content-text |
parent = document.querySelector('#mw-content-text .mw-parser-output'); |
||
ele.querySelectorAll('a[href]').forEach(function(e) { |
ele.querySelectorAll('a[href]').forEach(function(e) { |
||
var href = decodeURIComponent(e.href), |
var href = decodeURIComponent(e.href), |
||
section = /#/.test(href), |
section = /#/.test(href), |
||
pagename = section ? href.match('^(?:https:)?(?:\/\/llwiki\.org)?/zh/(.*)#')[1] : href.match('^(?:https:)?(?:\/\/llwiki\.org)?/zh/(.*)$')[1]; |
pagename = section ? href.match('^(?:https:)?(?:\/\/llwiki\.org)?/zh/(.*)#')[1] : href.match('^(?:https:)?(?:\/\/llwiki\.org)?/zh/(.*)$')[1]; |
||
if(pagename == mw.config.get('wgPageName')) { |
if (pagename == mw.config.get('wgPageName')) { |
||
e.href = section ? href.match(/#.*$/)[0] : 'javascript:void(0)'; |
e.href = section ? href.match(/#.*$/)[0] : 'javascript:void(0)'; |
||
} |
} |
||
}); |
}); |
||
if(mw.config.get('skin') == 'minerva') { |
if (mw.config.get('skin') == 'minerva') { |
||
ele.querySelectorAll( '.lazy-image-placeholder' ).forEach(function(e) { |
ele.querySelectorAll( '.lazy-image-placeholder' ).forEach(function(e) { |
||
let img = document.createElement('img'); |
let img = document.createElement('img'); |
2020年11月16日 (一) 03:09的版本
JavaScript脚本:
window.addEventListener('load', function () {
var ele = document.querySelector('.start-screen'),
parent = document.querySelector('#mw-content-text .mw-parser-output');
ele.querySelectorAll('a[href]').forEach(function(e) {
var href = decodeURIComponent(e.href),
section = /#/.test(href),
pagename = section ? href.match('^(?:https:)?(?:\/\/llwiki\.org)?/zh/(.*)#')[1] : href.match('^(?:https:)?(?:\/\/llwiki\.org)?/zh/(.*)$')[1];
if (pagename == mw.config.get('wgPageName')) {
e.href = section ? href.match(/#.*$/)[0] : 'javascript:void(0)';
}
});
if (mw.config.get('skin') == 'minerva') {
ele.querySelectorAll( '.lazy-image-placeholder' ).forEach(function(e) {
let img = document.createElement('img');
img.src = e.dataset.src;
e.replaceWith(img);
});
parent.appendChild(ele);
ele.scrollLeft = (ele.scrollWidth - ele.clientWidth) / 2;
}
});
//
CSS样式表:
*/
.start-screen {
text-align: center;
position: sticky;
bottom: 3px;
white-space: nowrap;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
scroll-snap-type: x mandatory;
}
.start-screen a {
scroll-snap-align: start;
}
.start-screen table {
display: inline-table;
margin: 0;
width: auto !important;
}
/*