Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manifest.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"lang": "en-US",
"dir": "ltr",
"display": "standalone",
"orientation": "landscape",
"orientation": "portrait",
"id": "/",
"start_url": "/",
"categories": [
Expand Down
10 changes: 9 additions & 1 deletion src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Timer } from "./timer";
import { Counter } from "./counter";
import { Config, Mode, BOARD_CONFIG, MODE_NAME } from "./config";
import { State } from "./state";
import { UrlTool } from "./urlTool";
import { UrlTool } from "./util/urlUtil";
import {
EVENT_CELL_REVEALED,
EVENT_CELL_FLAGGED,
Expand All @@ -15,6 +15,7 @@ import {
} from "./util/pub-sub";
import { Session } from "./util/session";
import { Settings } from "./settings";
import { MobileUtil } from "./util/mobileUtil";

export class Game {

Expand Down Expand Up @@ -155,6 +156,13 @@ export class Game {
Session.set("applyFirstClickRule", true);
}

if (MobileUtil.isMobile()) {
// Overwrite mode
mode = { rows: 12, cols: 8, mines: 15 };
console.debug(window.screen.availWidth);
console.debug(window.screen.availHeight);
}

this.logDebugMessage(mode);

this.board = new Board(mode, state, this.boardEl);
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const config: Config = {
encoder: BinaryToBase64UrlEncoderV2.prototype,
modePairer: CantorPairer.prototype,
firstClick: FIRST_CLICK.GuaranteedCascade,
debug: false,
debug: true,
darkModeOn: true,
github: {
owner: "rdlf0",
Expand Down
7 changes: 7 additions & 0 deletions src/util/mobileUtil.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export class MobileUtil {

public static isMobile(): boolean {
return /iPhone|Android/i.test(navigator.userAgent);
}

}
8 changes: 4 additions & 4 deletions src/urlTool.ts → src/util/urlUtil.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Encoder } from "./encoder/encoder";
import { Pairer, Tuple } from "./pairer/pairer";
import { Mode } from "./config";
import { State } from "./state";
import { Encoder } from "../encoder/encoder";
import { Pairer, Tuple } from "../pairer/pairer";
import { Mode } from "../config";
import { State } from "../state";

const MODE_SIZE = 24;
const MIN_ROWS = 5;
Expand Down
8 changes: 7 additions & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ main {
}


@media all and (display-mode: standalone) {
@media all and (display-mode: standalone), (max-width: 30rem) {
html {
height: 100%;
}
Expand All @@ -354,3 +354,9 @@ main {
margin: auto;
}
}

@media (max-width: 30rem) {
main {
--cell-side: 45rem;
}
}