added a setting to control the width of the content

This commit is contained in:
Jack 2020-10-06 17:28:03 +01:00
parent 9da38ba19a
commit 1682b2d71d
4 changed files with 79 additions and 2 deletions

View file

@ -807,6 +807,18 @@ a:hover {
align-items: center;
z-index: 999;
grid-template-rows: auto 1fr auto;
&.wide125{
max-width: 1250px;
}
&.wide150{
max-width: 1500px;
}
&.wide200{
max-width: 2000px;
}
&.widemax{
max-width: unset;
}
}
#caret {

View file

@ -2266,6 +2266,52 @@
<!-- <div class="text">Change the font family for the site</div> -->
<div class="buttons"></div>
</div>
<div class="section pageWidth">
<h1>page width</h1>
<div class="text">Control the width of the content.</div>
<div class="buttons">
<div
class="button"
pageWidth="100"
tabindex="0"
onclick="this.blur();"
>
100%
</div>
<div
class="button"
pageWidth="125"
tabindex="0"
onclick="this.blur();"
>
125%
</div>
<div
class="button"
pageWidth="150"
tabindex="0"
onclick="this.blur();"
>
150%
</div>
<div
class="button"
pageWidth="200"
tabindex="0"
onclick="this.blur();"
>
200%
</div>
<div
class="button"
pageWidth="max"
tabindex="0"
onclick="this.blur();"
>
Max
</div>
</div>
</div>
<div class="sectionSpacer"></div>
</div>

View file

@ -214,6 +214,7 @@ settingsGroups.capsLockBackspace = new SettingsGroup(
settingsGroups.layout = new SettingsGroup("layout", changeLayout);
settingsGroups.language = new SettingsGroup("language", changeLanguage);
settingsGroups.fontSize = new SettingsGroup("fontSize", changeFontSize);
settingsGroups.pageWidth = new SettingsGroup("pageWidth", setPageWidth);
settingsGroups.caretStyle = new SettingsGroup("caretStyle", setCaretStyle);
settingsGroups.paceCaretStyle = new SettingsGroup("paceCaretStyle", setPaceCaretStyle);
settingsGroups.timerStyle = new SettingsGroup("timerStyle", setTimerStyle);

View file

@ -59,7 +59,8 @@ let defaultConfig = {
swapEscAndTab: false,
showOutOfFocusWarning: true,
paceCaret: "off",
paceCaretCustomSpeed: 100
paceCaretCustomSpeed: 100,
pageWidth: "100"
};
let cookieConfig = null;
@ -199,7 +200,7 @@ function applyConfig(configObj) {
setShowOutOfFocusWarning(configObj.showOutOfFocusWarning, true);
setPaceCaret(configObj.paceCaret, true);
setPaceCaretCustomSpeed(configObj.paceCaretCustomSpeed, true);
setPageWidth(configObj.pageWidth, true);
config.startGraphsAtZero = configObj.startGraphsAtZero;
// if (
@ -500,6 +501,23 @@ function toggleColorfulMode() {
saveConfigToCookie();
}
function setPageWidth(val, nosave) {
if (val == null || val == undefined) {
val = "100";
}
config.pageWidth = val;
$("#centerContent").removeClass("wide125");
$("#centerContent").removeClass("wide150");
$("#centerContent").removeClass("wide200");
$("#centerContent").removeClass("widemax");
if (val !== "100") {
$("#centerContent").addClass('wide' + val);
}
if (!nosave) saveConfigToCookie();
}
function setCaretStyle(caretStyle, nosave) {
if (caretStyle == null || caretStyle == undefined) {
caretStyle = "default";