Skip to content

Commit

Permalink
fix: html indentation incompatible with licensesnip
Browse files Browse the repository at this point in the history
Signed-off-by: giac-mysten <[email protected]>
  • Loading branch information
giac-mysten committed Aug 21, 2024
1 parent 1286565 commit c4c13d8
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 111 deletions.
9 changes: 7 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ max_line_length = 150
indent_size = 2
max_line_length = 150

[{*.html,*.tsx,*.jsx,*.js,*.ts}]
[{*.html,*.css}]
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

[{*.tsx,*.jsx,*.js,*.ts}]
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
Expand All @@ -30,7 +35,7 @@ insert_final_newline = true
indent_size = unset

# Ignore paths
[{.git/**/*,**/*.lock,**/Move.toml,LICENSE,**/*.html,**/*.css,**/*.json,**/pnpm-lock.yaml}]
[{.git/**/*,**/*.lock,**/Move.toml,LICENSE,**/*.json,**/pnpm-lock.yaml}]
charset = unset
end_of_line = unset
indent_size = unset
Expand Down
31 changes: 15 additions & 16 deletions capacity/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
SPDX-License-Identifier: Apache-2.0
-->

<!--
Copyright (c) Mysten Labs, Inc.
SPDX-License-Identifier: Apache-2.0
-->

<!doctype html>
<html lang="en">
<head>
Expand Down Expand Up @@ -63,10 +68,8 @@ <h2>Last Events</h2>
</table>

<script>
const WALRUS_SYSTEM =
"0x6c957cf363ec968582f24e3e1a638c968cec1fa228999c560ec7925994906315";
const WALRUS_PACKAGE =
"0x7e12d67a52106ddd5f26c6ff4fe740ba5dea7cfc138d5b1d33863ba9098aa6fe";
const WALRUS_SYSTEM = "0x6c957cf363ec968582f24e3e1a638c968cec1fa228999c560ec7925994906315";
const WALRUS_PACKAGE = "0x7e12d67a52106ddd5f26c6ff4fe740ba5dea7cfc138d5b1d33863ba9098aa6fe";
const DIGEST_LEN = 32;
const BLOB_ID_LEN = 32;

Expand Down Expand Up @@ -264,8 +267,7 @@ <h2>Last Events</h2>

const color = availableTb > 1 ? "green" : "red";

document.getElementById("capacity").innerText =
`Walrus used capacity: ${usedGb} GB`;
document.getElementById("capacity").innerText = `Walrus used capacity: ${usedGb} GB`;
document.getElementById("available-capacity").innerText =
`Approximately ${availableTb} TB are available out of ${totalTb} TB.`;
document.getElementById("available-capacity").style.color = color;
Expand All @@ -284,8 +286,7 @@ <h2>Last Events</h2>
document.getElementById("spinner").style.display = "none";
const used = system.result.data.content.fields.used_capacity_size;
const nShards =
system.result.data.content.fields.current_committee.fields.bls_committee
.fields.n_shards;
system.result.data.content.fields.current_committee.fields.bls_committee.fields.n_shards;
plotEvents(events, used, nShards);
document.getElementById("plotHeading").innerText =
`Storage plot for the last ${events.length} events`;
Expand All @@ -308,14 +309,12 @@ <h2>Last Events</h2>
}
}

document
.getElementById("numEvents")
.addEventListener("keypress", function (event) {
if (event.key === "Enter") {
event.preventDefault();
document.getElementById("plotButton").click();
}
});
document.getElementById("numEvents").addEventListener("keypress", function (event) {
if (event.key === "Enter") {
event.preventDefault();
document.getElementById("plotButton").click();
}
});
main();
</script>
<body></body>
Expand Down
11 changes: 8 additions & 3 deletions flatland/mint-site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
SPDX-License-Identifier: Apache-2.0
-->

<!--
Copyright (c) Mysten Labs, Inc.
SPDX-License-Identifier: Apache-2.0
-->

<!doctype html>
<html lang="en" class="dark-theme" style="color-scheme: dark">
<head>
Expand All @@ -13,9 +18,9 @@

<style>
/*
* Josh's Custom CSS Reset
* https://www.joshwcomeau.com/css/custom-css-reset/
*/
Josh's Custom CSS Reset
https://www.joshwcomeau.com/css/custom-css-reset/
*/
*,
*::before,
*::after {
Expand Down
2 changes: 1 addition & 1 deletion flatland/mint-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@
"typescript": "^5.3.3",
"vite": "^4.4.4"
}
}
}
5 changes: 5 additions & 0 deletions flatland/nft-viz/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
SPDX-License-Identifier: Apache-2.0
-->

<!--
Copyright (c) Mysten Labs, Inc.
SPDX-License-Identifier: Apache-2.0
-->

<!doctype html>
<html lang="en">
<head>
Expand Down
87 changes: 22 additions & 65 deletions publish/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@
function storeBlob() {
const inputFile = document.getElementById("file-input").files[0];
const numEpochs = document.getElementById("epochs-input").value;
const basePublisherUrl = document.getElementById(
"publisher-url-input",
).value;
const basePublisherUrl = document.getElementById("publisher-url-input").value;

// Submit a PUT request with the file's content as the body to the /v1/store endpoint.
return fetch(`${basePublisherUrl}/v1/store?epochs=${numEpochs}`, {
Expand Down Expand Up @@ -124,9 +122,7 @@
}

// The URL used to download and view the blob.
const baseAggregatorUrl = document.getElementById(
"aggregator-url-input",
).value;
const baseAggregatorUrl = document.getElementById("aggregator-url-input").value;
const blobUrl = `${baseAggregatorUrl}/v1/${info.blobId}`;

// The URL for viewing the event or object on chain
Expand All @@ -141,23 +137,17 @@
document.getElementById("uploaded-blobs").insertAdjacentHTML(
"afterBegin",
`<article class="row border rounded-2 shadow-sm mb-3">
<object type="${isImage ? media_type : ""}" data="${
isImage ? blobUrl : ""
}"
<object type="${isImage ? media_type : ""}" data="${isImage ? blobUrl : ""}"
class="col-4 ps-0"></object>
<dl class="blob-info col-8 my-2">
<dt>Status</dt><dd>${info.status}</dd>
<dt>Blob ID</dt>
<dd class="text-truncate"><a href="${blobUrl}">${
info.blobId
}</a></dd>
<dd class="text-truncate"><a href="${blobUrl}">${info.blobId}</a></dd>
<dt>${info.suiRefType}</dt>
<dd class="text-truncate">
<a href="${suiUrl}" target="_blank">${
info.suiRef
}</a>
<a href="${suiUrl}" target="_blank">${info.suiRef}</a>
</dd>
<dt>Stored until epoch</dt><dd>${info.endEpoch}</dd>
</dl>
Expand All @@ -171,31 +161,21 @@
function enableForm(isEnabled) {
if (isEnabled) {
// Copy the urls, so that they are not reset.
const publisherUrl = document.getElementById(
"publisher-url-input",
).value;
const aggregatorUrl = document.getElementById(
"aggregator-url-input",
).value;
const publisherUrl = document.getElementById("publisher-url-input").value;
const aggregatorUrl = document.getElementById("aggregator-url-input").value;
// Reset the form
document.getElementById("upload-form").reset();
// Revert the URLs to their previous values
document.getElementById("publisher-url-input").value = publisherUrl;
document.getElementById("aggregator-url-input").value = aggregatorUrl;
// Disable the progress indication
document.getElementById("submit-spinner").style.visibility =
"collapse";
document.getElementById("submit-spinner").style.visibility = "collapse";
document.getElementById("submit-text").textContent = "Upload";
// Re-enable the form
document
.querySelector("#upload-form fieldset")
.removeAttribute("disabled");
document.querySelector("#upload-form fieldset").removeAttribute("disabled");
} else {
document
.querySelector("#upload-form fieldset")
.setAttribute("disabled", "");
document.getElementById("submit-spinner").style.visibility =
"visible";
document.querySelector("#upload-form fieldset").setAttribute("disabled", "");
document.getElementById("submit-spinner").style.visibility = "visible";
document.getElementById("submit-text").textContent = "Uploading ...";
}
}
Expand All @@ -215,9 +195,7 @@
<header class="container my-3">
<hgroup>
<h1>Walrus Blob Upload</h1>
<p class="lead">
An example uploading and displaying files with Walrus.
</p>
<p class="lead">An example uploading and displaying files with Walrus.</p>
</hgroup>
</header>
<main class="container">
Expand All @@ -227,29 +205,20 @@ <h1>Walrus Blob Upload</h1>
<h2>Blob Upload</h2>
<p>
Upload blobs to Walrus, and display them on this page. See the
<a
href="https://mystenlabs.github.io/walrus-docs"
target="_blank"
>
<a href="https://mystenlabs.github.io/walrus-docs" target="_blank">
Walrus documentation</a
>
for more information. The file size is limited to 10 MiB on the
default publisher. Use the
<a
href="https://docs.walrus.site/usage/client-cli.html"
target="_blank"
>CLI tool</a
>
for more information. The file size is limited to 10 MiB on the default publisher. Use
the
<a href="https://docs.walrus.site/usage/client-cli.html" target="_blank">CLI tool</a>
to store bigger files.
</p>
</hgroup>

<form id="upload-form" onsubmit="return onSubmit(event)" class="mb-3">
<fieldset class="row g-3">
<div class="col-lg-6">
<label for="publisher-url-input" class="form-label">
Walrus publisher URL
</label>
<label for="publisher-url-input" class="form-label"> Walrus publisher URL </label>
<input
id="publisher-url-input"
type="url"
Expand All @@ -261,9 +230,7 @@ <h2>Blob Upload</h2>
</div>

<div class="col-lg-6">
<label for="aggregator-url-input" class="form-label">
Walrus aggregator URL
</label>
<label for="aggregator-url-input" class="form-label"> Walrus aggregator URL </label>
<input
id="aggregator-url-input"
type="url"
Expand All @@ -276,15 +243,10 @@ <h2>Blob Upload</h2>

<div class="col-12">
<label for="file-input" class="form-label"
>Blob to upload (<strong>Max 10 MiB size</strong> on the
default publisher!)</label
>Blob to upload (<strong>Max 10 MiB size</strong> on the default
publisher!)</label
>
<input
id="file-input"
type="file"
class="form-control"
required
/>
<input id="file-input" type="file" class="form-control" required />
</div>

<div class="col-12">
Expand Down Expand Up @@ -315,12 +277,7 @@ <h2>Blob Upload</h2>
</fieldset>
</form>

<div
id="alert"
class="alert alert-danger"
role="alert"
style="visibility: hidden"
></div>
<div id="alert" class="alert alert-danger" role="alert" style="visibility: hidden"></div>
</section>

<section class="col-lg-7">
Expand Down
10 changes: 6 additions & 4 deletions redirect-blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
SPDX-License-Identifier: Apache-2.0
-->

<!--
Copyright (c) Mysten Labs, Inc.
SPDX-License-Identifier: Apache-2.0
-->

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Redirect to Walrus Docs</title>
<meta
http-equiv="refresh"
content="0; URL=https://docs.walrus.site/blog/00_intro.html"
/>
<meta http-equiv="refresh" content="0; URL=https://docs.walrus.site/blog/00_intro.html" />
</head>
<body>
Redirecting...
Expand Down
26 changes: 6 additions & 20 deletions walrus-snake/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ <h1>the Walrus Game</h1>
let canvas = document.getElementById("game");
let context = canvas.getContext("2d");

// the canvas width & height, snake x & y, and the apple x & y, all need to be a multiples of the grid size in order for collision detection to work
// the canvas width & height, snake x & y, and the apple x & y, all need to be a
// multiples of the grid size in order for collision detection to work
// (e.g. 16 * 25 = 400)
let grid = 16;
let count = 0;
Expand Down Expand Up @@ -143,13 +144,7 @@ <h1>the Walrus Game</h1>
}

// draw apple
context.drawImage(
appleImage,
apple.x - grid,
apple.y - grid,
3 * grid,
3 * grid,
);
context.drawImage(appleImage, apple.x - grid, apple.y - grid, 3 * grid, 3 * grid);
// context.fillStyle = 'red';
// context.fillRect(apple.x, apple.y, grid - 1, grid - 1);

Expand All @@ -162,9 +157,6 @@ <h1>the Walrus Game</h1>
context.fillRect(cell.x, cell.y, grid - 1, grid - 1);
}

// drawing 1 px smaller than the grid creates a grid effect in the snake body so you can see how long it is
// context.fillRect(cell.x, cell.y, grid - 1, grid - 1);

// snake ate apple
if (cell.x === apple.x && cell.y === apple.y) {
snake.maxCells++;
Expand All @@ -177,10 +169,7 @@ <h1>the Walrus Game</h1>
// check collision with all cells after this one (modified bubble sort)
for (let i = index + 1; i < snake.cells.length; i++) {
// snake occupies same space as a body part. reset game
if (
cell.x === snake.cells[i].x &&
cell.y === snake.cells[i].y
) {
if (cell.x === snake.cells[i].x && cell.y === snake.cells[i].y) {
snake.x = 160;
snake.y = 160;
snake.cells = [];
Expand Down Expand Up @@ -235,12 +224,9 @@ <h1>the Walrus Game</h1>
</script>

<p>
Click the game area to start playing, and use the arrow keys to move
around.<br />
Click the game area to start playing, and use the arrow keys to move around.<br />
The game has been adapted from
<a
href="https://gist.github.com/straker/ff00b4b49669ad3dec890306d348adc4"
>this Gist</a
<a href="https://gist.github.com/straker/ff00b4b49669ad3dec890306d348adc4">this Gist</a
>.
</p>
</div>
Expand Down

0 comments on commit c4c13d8

Please sign in to comment.