Skip to content

Commit b64b73c

Browse files
committed
toggle switch css and improve logging
1 parent 2cd93ab commit b64b73c

5 files changed

Lines changed: 42 additions & 7 deletions

File tree

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</div>
6363
<div class="simple-widget">
6464
<label>Export modified files only (developer)</label>
65-
<input type="checkbox" id="setting-export-modified-only"/>
65+
<input type="checkbox" id="setting-export-modified-only" class="switch"/>
6666
</div>
6767
</div>
6868
</div>
@@ -121,7 +121,7 @@ <h3 class="widget-text">A heading widget...</h3>
121121
<template id="switch-widget-template">
122122
<div class="widget switch-widget widget-with-input">
123123
<label class="widget-text">A switch</label>
124-
<input type="checkbox" class="widget-input widget-switch-input" id="widget-input-x" />
124+
<input type="checkbox" class="widget-input widget-switch-input switch" id="widget-input-x" />
125125
</div>
126126
</template>
127127

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export class ConfigClass {
235235
});
236236

237237
if (input_value === null) {
238-
console.log(`Input value is null, so not applying method ${this.datapack_id}:${method_name}`);
238+
console.log(`[DPConfig] Input value is null, so not applying method ${this.datapack_id}:${method_name}`);
239239
}
240240
else {
241241
applyMethodAsChangeToPack(

src/datapack_changes.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ export class DatapackModifier {
5858
application_method: method
5959
};
6060
this.changeQueue.push(change);
61-
console.log(`Queued change: \nDatapack: ${change.datapack.id}\nFiles: ${change.file_path}\nValue: ${change.value_path}\nValue: ${change.value}\nMethod: ${change.application_method}`);
61+
console.log(`[DatapackModifier] Queued change: \nDatapack: ${change.datapack.id}\nFiles: ${change.file_path}\nValue: ${change.value_path}\nValue: ${change.value}\nMethod: ${change.application_method}`);
6262
}
6363
else {
64-
console.warn(`Datapack change wasn't queued - value ${value} (type <${typeof value}>) doesn't match application method "${method}!"`);
64+
console.warn(`[DatapackModifier] Datapack change wasn't queued - value ${value} (type <${typeof value}>) doesn't match application method "${method}!"`);
6565
}
6666
}
6767

6868
public async applyChanges(datapacks: ReadonlyArray<Datapack>, export_settings: ExportSettings) {
69-
console.time("Applying changes to packs...");
69+
console.time("[DatapackModifier] Applying changes to packs");
7070

7171
// Apply changes to files
7272
for (const change of this.changeQueue) {
@@ -94,7 +94,7 @@ export class DatapackModifier {
9494
} else throw new Error("what");
9595
}
9696

97-
console.timeEnd("Applying changes to packs...");
97+
console.timeEnd("[DatapackModifier] Applying changes to packs");
9898
for (const pack in packs) {
9999
if (Object.prototype.hasOwnProperty.call(packs, pack)) {
100100
const zip = packs[pack];
@@ -104,6 +104,7 @@ export class DatapackModifier {
104104
}
105105

106106
public async saveFile(zip: JSZip, export_settings: ExportSettings) {
107+
console.log(`[DatapackModifier] Saving file... [${zip.name}]`);
107108
await zip.generateAsync({
108109
type: "blob",
109110
compression: export_settings.compressionLevel == 0 ? "STORE" : "DEFLATE",

src/page_interactions/settings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export function getExportSettings(): ExportSettings {
88
element = document.getElementById("setting-export-modified-only") as HTMLInputElement;
99
const export_modified_only: boolean = element.checked;
1010

11+
console.info(`Getting export settings...\n\tCompression level: ${archive_compression_level}\n\tExport modified only: ${export_modified_only}`);
12+
1113
return {
1214
compressionLevel: archive_compression_level as CompressionLevel,
1315
modifiedOnly: export_modified_only

style.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,4 +372,36 @@ svg.icon {
372372
svg.icon {
373373
height: 1em;
374374
}
375+
}
376+
377+
.switch {
378+
appearance: none;
379+
position: relative;
380+
display: inline-block;
381+
box-sizing: content-box;
382+
width: 4em;
383+
height: 1.5em;
384+
padding: 2px;
385+
border: none;
386+
cursor: pointer;
387+
overflow: hidden;
388+
background-color: var(--background);
389+
transition: background ease 0.3s;
390+
border: var(--border-width) solid var(--background-below);
391+
}
392+
.switch:before {
393+
content: "";
394+
display: block;
395+
position: absolute;
396+
width: 1.5em;
397+
height: 1.5em;
398+
background: var(--background-above-above);
399+
transition: transform linear 0.05s;
400+
}
401+
.switch:checked {
402+
background-color: var(--accent-color);
403+
}
404+
.switch:checked:before {
405+
transform: translateX(2.5em);
406+
background: var(--background-above);
375407
}

0 commit comments

Comments
 (0)