User:Canadabonk/common.js: Difference between revisions
Content deleted Content added
Canadabonk (talk | contribs) No edit summary |
Canadabonk (talk | contribs) No edit summary |
||
Line 1:
importScript('User:Canadabonk/sandbox.js');
/*
canada's cosmostweaks
last updated: 22 june 2024
refer to [[CosmosTweaks]] on dev.miraheze.org
*/
// sidetools
Line 14 ⟶ 22:
enableBannerNav = true;
enableBackToTop = true;
enableHideRail = true;
//-------------------------------------------------
Line 27 ⟶ 36:
document.documentElement.classList.add('fullwide');
}
if (localStorage.ctRailHidden == 'true') {
$('.cosmos-articleContainer').toggleClass('ct-railhidden');
if (!enableFullwide) {▼
localStorage.removeItem('ctDarkMode');▼
}
if (!enableDarkMode) {
▲ localStorage.removeItem('ctDarkMode');
}
▲if (!enableFullwide) {
localStorage.removeItem('ctFullwide');
}
Line 146 ⟶ 157:
fullwideButton.click(function(){
$html.addClass('fullwide-animate').toggleClass('fullwide');
if ($html.is('.fullwide')) {
localStorage.ctFullwide = true;
Line 202 ⟶ 213:
});
} // end back to top------------------------------------------------------------------------------------------------------
if (enableHideRail) {
const railToggle = $('.ct-railtoggle');
railToggle.click(function(){
$('.cosmos-articleContainer').toggleClass('ct-railhidden');
if ($('.cosmos-articleContainer').is('.ct-railhidden')) {
localStorage.railHidden = true;
} else {
localStorage.removeKey('railHidden');
$('#CosmosRail').fadeIn(1000);
}
} // end hide rail ------------------------------------------------------------------------------------------------------
} //end desktop ------------------------------------------------------------------------------------------------------
Line 210 ⟶ 238:
sunIcon = '<svg fill="white" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"> <path d="M8 11a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm0 1a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"></path> </svg>';
drkmodebtn = document.createElement('a');
drkmodebtn.id = 'ct-darkmode';
const dropdown = document.getElementById('p-more');
const buttonGroup = document.getElementsByClassName('cosmos-header__wiki-buttons')[0];
buttonGroup.insertBefore(drkmodebtn, dropdown);
$('#cosmos-notifsButton-icon').append('<li><a id="ct-darkmode" class="ct-darkmode"></a></li>');
const darkModeButton = $('.ct-darkmode');
if (defaultDarkMode && localStorage.ctDarkMode == null) {
Line 238 ⟶ 274:
}
}// end dark mode ------------------------------------------------------------------------------------------------------
▲ $(this).wrap('<div class="table-scroll"></div>');
▲ }
▲ });
function hideOnClickOutside(container, hiddenitem) {
|