Upd. Minesweeper, Agg. Nonogram

This commit is contained in:
2023-03-22 23:47:51 +01:00
parent fc12cb2c21
commit 8fe2e1589c
5 changed files with 102 additions and 21 deletions

View File

@ -69,22 +69,53 @@
</div>
<staticoso:DynamicPart:*/Foot>
<script>
// Issue on Firefox 69: Getting background CSS property doesn't work, maybe background: url('') is invalid?
// Issue on Firefox 69 / Chromium: Getting background CSS property doesn't work, maybe background: url('') is invalid for <meta>? Maybe use content: ''?
var RawDataCss = JSON.parse(window.getComputedStyle(document.getElementById('RawDataCssInject')).background.split('url("')[1].split('")').slice(0, -1).join('")').replaceAll('\\\"', '\"'));
var SectionMenu = document.querySelector('#RightBoxContainer > Details');
var NormalOpen = SectionMenu.open;
var MediaQuery = window.matchMedia(`(min-width: ${RawDataCss.DeskModeMinWid})`);
var SectionMenu = document.querySelector('#RightBoxContainer > Details');
var SectionButton = SectionMenu.querySelector('Summary');
function MediaQueryCheck(Query) {
if (Query.matches) NormalOpen = SectionMenu.open; // Go in desktop mode
else SectionMenu.open = NormalOpen; // Going in normal mode
SectionMenu.querySelector('> Summary').hidden = Query.matches;
var NormalOpen = SectionMenu.open;
SectionButton.onclick = function() {
if (!MediaQuery.matches) {
// For some reason without the ! it sets the opposite of what's really happening???
// Maybe the onclick event fires before the details element is actually opened by the click?
NormalOpen = !SectionMenu.open;
};
};
function MediaQueryCheck(Query) {
if (MediaQuery.matches) SectionMenu.open = true; // Go in desktop mode
else SectionMenu.open = NormalOpen; // Going in normal mode
// we must when handle user manually disable desktop mode if we want hide the button
//SectionButton.style.display = {true: "none", false: ""}[Query.matches];
};
MediaQuery.addListener(MediaQueryCheck);
MediaQueryCheck(MediaQuery);
// Note: onclick doesn't work and doesn't show any error, wtf? But calling ShowHidePageBg manually works
/*
function ShowHidePageBg() {
var Style = Body.style;
if (Style.visibility || Style.overflow || Body.onclick) {
Style.visibility = '';
Style.overflow = '';
Body.onclick = null;
} else {
Style.visibility = 'hidden';
Style.overflow = 'hidden';
Body.onclick = ShowHidePageBg;
};
};
var PageBgEl = document.getElementById('fn:PageBg');
if (PageBgEl) {
var PageBgPar = PageBgEl.querySelector('p');
var PageBgTokens = PageBgPar.innerHTML.split('</a>');
PageBgPar.innerHTML = PageBgTokens[0] + '</a>&nbsp;<button onclick="ShowHidePageBg()">Guarda</button>' + PageBgTokens.slice(1, -1);
};
*/
</script>
<link rel="stylesheet" href="[staticoso:CustomPath:Assets]/Fonts/SpaceMono/Style.css"/>
</body>