Difference between revisions of "MediaWiki:Mpfunctions.js"
Jump to navigation
Jump to search
m |
m |
||
Line 17: | Line 17: | ||
} | } | ||
}); | }); | ||
var styles = ` | |||
.SB-keybind-key:hover { | |||
filter:brightness(1.5); | |||
} | |||
.SB-keybind-active { | |||
z-index: 2; | |||
border-color: #ffffff40; | |||
filter: brightness(1.5); | |||
} | |||
` | |||
var styleSheet = document.createElement("style") | |||
styleSheet.type = "text/css" | |||
styleSheet.innerText = styles | |||
document.head.appendChild(styleSheet) | |||
} | } | ||
Revision as of 13:45, 19 July 2021
function MPSSC() {
let li = document.querySelectorAll('.MPSSC-list-header')
for (var i=0;i<li.length;i++) {
li[i].addEventListener('click', function(){this.classList.toggle('active')}, false)
}
}
function keybindsPage() {
document.addEventListener('click',function(e){
var a = document.querySelector('.SB-keybind-active')
if (a) {
a.classList.remove('SB-keybind-active')
}
if(e.target && e.target.classList.contains('SB-keybind-key') && e.target != a){
e.target.classList.toggle('SB-keybind-active')
}
});
var styles = `
.SB-keybind-key:hover {
filter:brightness(1.5);
}
.SB-keybind-active {
z-index: 2;
border-color: #ffffff40;
filter: brightness(1.5);
}
`
var styleSheet = document.createElement("style")
styleSheet.type = "text/css"
styleSheet.innerText = styles
document.head.appendChild(styleSheet)
}
switch(mw.config.get('wgPageName')) {
case 'Keybinds':
keybindsPage();
break;
case 'User:DustyFB/Sandbox/Main_Page':
MPSSC();
break;
}