2020-12-27 02:42:26 +00:00
|
|
|
<template>
|
|
|
|
<div id="app">
|
2021-11-27 00:25:56 +00:00
|
|
|
<div><vue-file-toolbar-menu :content="myMenu" /></div>
|
2021-11-20 01:10:15 +00:00
|
|
|
|
2021-04-24 00:42:33 +00:00
|
|
|
<NewAscii />
|
2021-10-16 05:16:21 +00:00
|
|
|
<Options v-if="asciibirdMeta.length" />
|
2021-08-17 00:24:41 +00:00
|
|
|
<EditAscii v-if="asciibirdMeta.length" />
|
2021-07-10 01:41:17 +00:00
|
|
|
<PasteAscii />
|
2021-10-16 05:16:21 +00:00
|
|
|
<ImageOverlay v-if="asciibirdMeta.length" />
|
2021-04-17 01:58:45 +00:00
|
|
|
|
2021-08-16 06:14:49 +00:00
|
|
|
<KeyboardShortcuts
|
|
|
|
:selected-blocks="selectedBlocks"
|
2021-08-17 00:24:41 +00:00
|
|
|
:selecting="selecting"
|
2021-09-04 01:13:28 +00:00
|
|
|
:is-showing-dialog="isShowingDialog"
|
2021-08-16 06:14:49 +00:00
|
|
|
@updatecanvas="updatecanvas"
|
2021-08-19 01:42:33 +00:00
|
|
|
:is-inputting-brush-size="this.isInputtingBrushSize"
|
2021-11-06 00:59:17 +00:00
|
|
|
:canvas-x="canvasX"
|
|
|
|
:canvas-y="canvasY"
|
|
|
|
@triggerbrush="triggerbrush"
|
2021-08-16 06:14:49 +00:00
|
|
|
/>
|
2021-08-16 04:10:06 +00:00
|
|
|
|
2021-09-04 01:13:28 +00:00
|
|
|
<t-dialog
|
|
|
|
name="dialog-posthttp"
|
|
|
|
title="Enter URL"
|
|
|
|
text="Enter URL for POST command"
|
|
|
|
icon="question"
|
2021-11-27 00:25:56 +00:00
|
|
|
:clickToClose="false"
|
|
|
|
:showCloseButton="true"
|
|
|
|
:disableBodyScroll="true"
|
2021-09-04 01:13:28 +00:00
|
|
|
@closed="postHttp()"
|
|
|
|
>
|
|
|
|
<t-input v-model="lastPostURL" />
|
|
|
|
</t-dialog>
|
|
|
|
|
2021-12-21 09:03:40 +00:00
|
|
|
<context-menu ref="menu" class="z-50">
|
2021-04-17 01:36:44 +00:00
|
|
|
<ul>
|
2021-04-24 00:20:11 +00:00
|
|
|
<li
|
2021-04-24 00:42:33 +00:00
|
|
|
@click="$store.commit('openModal', 'new-ascii')"
|
2021-12-21 11:25:18 +00:00
|
|
|
class="ab-context-menu-item"
|
2021-04-24 00:20:11 +00:00
|
|
|
@contextmenu.prevent
|
|
|
|
>
|
|
|
|
New ASCII
|
|
|
|
</li>
|
2021-08-15 01:20:58 +00:00
|
|
|
<li
|
2021-08-17 00:24:41 +00:00
|
|
|
@click="$store.commit('openModal', 'edit-ascii')"
|
2021-12-21 11:25:18 +00:00
|
|
|
class="ab-context-menu-item"
|
2021-08-17 00:24:41 +00:00
|
|
|
v-if="asciibirdMeta.length"
|
2021-08-15 01:20:58 +00:00
|
|
|
>
|
2021-08-17 00:24:41 +00:00
|
|
|
Edit Ascii
|
2021-08-15 01:20:58 +00:00
|
|
|
</li>
|
2021-08-17 00:24:41 +00:00
|
|
|
<li
|
|
|
|
@click="closeTab(currentTab)"
|
2021-12-21 11:25:18 +00:00
|
|
|
class="ab-context-menu-item border-b"
|
2021-08-17 00:24:41 +00:00
|
|
|
v-if="asciibirdMeta.length"
|
|
|
|
>
|
|
|
|
Close Ascii
|
2021-08-15 01:20:58 +00:00
|
|
|
</li>
|
2021-10-02 00:55:39 +00:00
|
|
|
<li
|
|
|
|
@click="$store.commit('openModal', 'options')"
|
2021-12-21 11:25:18 +00:00
|
|
|
class="ab-context-menu-item border-b"
|
2021-11-06 01:19:15 +00:00
|
|
|
v-if="asciibirdMeta.length"
|
2021-10-02 00:55:39 +00:00
|
|
|
>
|
|
|
|
Options
|
|
|
|
</li>
|
|
|
|
|
2021-12-22 10:36:41 +00:00
|
|
|
<li @click="startImport('mirc')" class="ab-context-menu-item">
|
|
|
|
Import mIRC from File
|
|
|
|
</li>
|
2021-08-04 03:21:06 +00:00
|
|
|
<li
|
2021-08-05 05:30:53 +00:00
|
|
|
@click="startExport('file')"
|
2021-12-21 11:25:18 +00:00
|
|
|
class="ab-context-menu-item border-b"
|
2021-08-03 03:00:32 +00:00
|
|
|
v-if="asciibirdMeta.length"
|
2021-04-24 00:20:11 +00:00
|
|
|
>
|
|
|
|
Export mIRC to File
|
|
|
|
</li>
|
2021-12-22 10:36:41 +00:00
|
|
|
<li
|
|
|
|
class="ab-context-menu-item"
|
|
|
|
@click="$store.commit('openModal', 'paste-ascii')"
|
|
|
|
>
|
2021-07-10 01:41:17 +00:00
|
|
|
Import mIRC from Clipboard
|
|
|
|
</li>
|
2021-04-24 00:20:11 +00:00
|
|
|
<li
|
2021-12-21 11:25:18 +00:00
|
|
|
class="ab-context-menu-item"
|
2021-08-05 05:30:53 +00:00
|
|
|
@click="startExport('clipboard')"
|
2021-08-03 03:00:32 +00:00
|
|
|
v-if="asciibirdMeta.length"
|
2021-04-17 01:36:44 +00:00
|
|
|
>
|
2021-04-24 00:20:11 +00:00
|
|
|
Export mIRC to Clipboard
|
2021-04-17 01:36:44 +00:00
|
|
|
</li>
|
2021-08-20 23:53:07 +00:00
|
|
|
<li
|
2021-12-21 11:25:18 +00:00
|
|
|
class="ab-context-menu-item border-b"
|
2021-08-20 23:53:07 +00:00
|
|
|
@click="startExport('post')"
|
|
|
|
v-if="asciibirdMeta.length"
|
|
|
|
>
|
2021-08-21 00:13:56 +00:00
|
|
|
Export mIRC to HTTP POST
|
2021-08-20 23:53:07 +00:00
|
|
|
</li>
|
2021-04-17 01:36:44 +00:00
|
|
|
<li
|
|
|
|
@click="exportAsciibirdState()"
|
2021-12-21 11:25:18 +00:00
|
|
|
class="ab-context-menu-item"
|
2021-08-03 03:00:32 +00:00
|
|
|
v-if="asciibirdMeta.length"
|
2021-04-17 01:36:44 +00:00
|
|
|
>
|
|
|
|
Save Asciibird State
|
|
|
|
</li>
|
2021-12-22 10:36:41 +00:00
|
|
|
<li @click="startImport('asb')" class="ab-context-menu-item">
|
|
|
|
Load Asciibird State
|
|
|
|
</li>
|
2021-04-17 01:36:44 +00:00
|
|
|
</ul>
|
|
|
|
</context-menu>
|
|
|
|
|
|
|
|
<span
|
|
|
|
@mouseup.right="openContextMenu"
|
|
|
|
@contextmenu.prevent
|
|
|
|
style="width: 100%; height: 100%; position: absolute; z-index: -1"
|
2021-08-04 03:21:06 +00:00
|
|
|
/>
|
2021-04-17 01:36:44 +00:00
|
|
|
|
|
|
|
<input
|
|
|
|
type="file"
|
|
|
|
style="display: none"
|
|
|
|
ref="asciiInput"
|
|
|
|
@change="onImport()"
|
2021-08-19 07:17:46 +00:00
|
|
|
/>
|
2021-04-17 01:36:44 +00:00
|
|
|
|
2021-08-03 03:00:32 +00:00
|
|
|
<template v-if="asciibirdMeta.length">
|
2021-09-04 01:13:28 +00:00
|
|
|
<div
|
2021-11-20 01:10:15 +00:00
|
|
|
class="bg-gray-500 relative z-auto"
|
2021-09-04 01:13:28 +00:00
|
|
|
ref="tabbar"
|
|
|
|
:style="toolbarString"
|
|
|
|
>
|
2021-08-17 00:24:41 +00:00
|
|
|
<span
|
|
|
|
v-for="(value, key) in asciibirdMeta"
|
|
|
|
:key="key"
|
2021-09-04 05:16:27 +00:00
|
|
|
class="mr-2 z-40"
|
2021-08-15 01:20:58 +00:00
|
|
|
>
|
2021-08-12 02:22:29 +00:00
|
|
|
<t-button
|
2021-09-04 05:16:27 +00:00
|
|
|
class="p-1 z-40"
|
2021-08-17 00:24:41 +00:00
|
|
|
:class="buttonStyle(key)"
|
|
|
|
@click="changeTab(key, value)"
|
2021-08-12 02:22:29 +00:00
|
|
|
>
|
2021-12-21 10:15:42 +00:00
|
|
|
<span>
|
|
|
|
<span class="material-icons relative">insert_drive_file</span>
|
|
|
|
<span class="bottom-1 relative pl-1 pr-1">{{ value.title }}</span>
|
2021-12-22 10:36:41 +00:00
|
|
|
<t-button
|
|
|
|
class="relative bottom-1 z-40 rounded-3xl h-5"
|
|
|
|
@click="closeTab(key)"
|
|
|
|
><span class="material-icons" style="font-size: 16px"
|
|
|
|
>close</span
|
|
|
|
></t-button
|
|
|
|
>
|
2021-12-21 10:15:42 +00:00
|
|
|
</span>
|
2021-08-08 01:55:59 +00:00
|
|
|
</t-button>
|
2021-08-17 00:24:41 +00:00
|
|
|
</span>
|
2021-08-16 07:03:53 +00:00
|
|
|
</div>
|
2021-01-09 01:57:48 +00:00
|
|
|
|
2021-08-16 06:14:49 +00:00
|
|
|
<Editor
|
|
|
|
@coordsupdate="updateCoords"
|
|
|
|
@selectedblocks="selectedblocks"
|
|
|
|
@textediting="textediting"
|
|
|
|
:update-canvas="updateCanvas"
|
2021-08-17 00:24:41 +00:00
|
|
|
@selecting="updateSelecting"
|
2021-08-21 01:28:06 +00:00
|
|
|
:y-offset="scrollOffset"
|
2021-11-06 00:59:17 +00:00
|
|
|
:brush="drawBrush"
|
2021-08-16 06:14:49 +00:00
|
|
|
/>
|
2021-03-29 08:44:42 +00:00
|
|
|
|
2021-09-04 05:16:27 +00:00
|
|
|
<Toolbar :y-offset="scrollOffset" />
|
2021-12-21 09:03:40 +00:00
|
|
|
|
2021-09-04 05:16:27 +00:00
|
|
|
<DebugPanel
|
|
|
|
:canvas-x="canvasX"
|
|
|
|
:canvas-y="canvasY"
|
|
|
|
v-if="debugPanelState.visible"
|
2021-08-21 01:28:06 +00:00
|
|
|
:y-offset="scrollOffset"
|
2021-03-30 08:36:53 +00:00
|
|
|
/>
|
2021-08-06 04:00:21 +00:00
|
|
|
|
2021-12-22 10:36:41 +00:00
|
|
|
<BrushLibrary
|
|
|
|
v-show="brushLibraryState.visible"
|
|
|
|
:y-offset="scrollOffset"
|
|
|
|
/>
|
2021-09-04 05:16:27 +00:00
|
|
|
|
2021-11-27 00:25:56 +00:00
|
|
|
<BrushPreview @inputtingbrush="inputtingbrush" :y-offset="scrollOffset" />
|
2021-09-04 05:16:27 +00:00
|
|
|
|
|
|
|
<LayersLibrary :y-offset="scrollOffset" />
|
|
|
|
|
|
|
|
<CharPicker
|
|
|
|
v-if="toolbarState.isChoosingChar"
|
|
|
|
class="z-50"
|
|
|
|
:y-offset="scrollOffset"
|
|
|
|
/>
|
|
|
|
<ColourPicker
|
|
|
|
v-if="toolbarState.isChoosingFg || toolbarState.isChoosingBg"
|
|
|
|
class="z-50"
|
|
|
|
:y-offset="scrollOffset"
|
|
|
|
/>
|
2021-04-17 01:36:44 +00:00
|
|
|
</template>
|
|
|
|
<template v-else>
|
2021-08-08 01:55:59 +00:00
|
|
|
<div
|
|
|
|
class="
|
|
|
|
absolute
|
|
|
|
top-1/2
|
|
|
|
left-1/2
|
|
|
|
transform
|
|
|
|
-translate-x-1/2 -translate-y-1/2
|
|
|
|
text-center
|
|
|
|
"
|
|
|
|
@mouseup.right="openContextMenu"
|
|
|
|
@contextmenu.prevent
|
|
|
|
>
|
|
|
|
<BrushCanvas :blocks="splashAscii" />
|
2021-04-17 01:36:44 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
2020-12-27 02:42:26 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-08-05 05:30:53 +00:00
|
|
|
import LZString from "lz-string";
|
|
|
|
import Toolbar from "./components/Toolbar.vue";
|
|
|
|
import DebugPanel from "./components/DebugPanel.vue";
|
2021-08-06 04:00:21 +00:00
|
|
|
import BrushLibrary from "./components/BrushLibrary.vue";
|
2021-08-16 06:14:49 +00:00
|
|
|
import LayersLibrary from "./components/LayersLibrary.vue";
|
2021-08-05 05:30:53 +00:00
|
|
|
import Editor from "./views/Editor.vue";
|
|
|
|
|
|
|
|
import CharPicker from "./components/parts/CharPicker.vue";
|
|
|
|
import ColourPicker from "./components/parts/ColourPicker.vue";
|
|
|
|
import ContextMenu from "./components/parts/ContextMenu.vue";
|
|
|
|
|
|
|
|
import NewAscii from "./components/modals/NewAscii.vue";
|
2021-10-02 00:55:39 +00:00
|
|
|
import Options from "./components/modals/Options.vue";
|
2021-10-16 05:16:21 +00:00
|
|
|
import ImageOverlay from "./components/modals/ImageOverlay.vue";
|
2021-08-05 05:30:53 +00:00
|
|
|
import EditAscii from "./components/modals/EditAscii.vue";
|
|
|
|
import PasteAscii from "./components/modals/PasteAscii.vue";
|
|
|
|
|
2021-08-08 01:55:59 +00:00
|
|
|
import BrushCanvas from "./components/parts/BrushCanvas.vue";
|
2021-08-14 06:41:42 +00:00
|
|
|
import BrushPreview from "./components/parts/BrushPreview.vue";
|
2021-08-16 04:10:06 +00:00
|
|
|
import KeyboardShortcuts from "./components/parts/KeyboardShortcuts.vue";
|
2021-08-08 01:55:59 +00:00
|
|
|
|
2021-08-05 05:30:53 +00:00
|
|
|
import {
|
|
|
|
parseMircAscii,
|
|
|
|
toolbarIcons,
|
|
|
|
exportMirc,
|
|
|
|
downloadFile,
|
|
|
|
checkForGetRequest,
|
2021-08-08 01:55:59 +00:00
|
|
|
splashAscii,
|
2021-08-05 05:30:53 +00:00
|
|
|
} from "./ascii";
|
2021-07-17 01:44:27 +00:00
|
|
|
|
2021-11-27 00:25:56 +00:00
|
|
|
import VueFileToolbarMenu from "vue-file-toolbar-menu";
|
2021-11-20 01:10:15 +00:00
|
|
|
|
2020-12-27 02:42:26 +00:00
|
|
|
export default {
|
2021-03-14 07:36:14 +00:00
|
|
|
async created() {
|
2021-03-31 23:29:55 +00:00
|
|
|
// Load from irc watch if present in the URL bar
|
2021-08-05 05:30:53 +00:00
|
|
|
checkForGetRequest();
|
2021-08-21 01:28:06 +00:00
|
|
|
var isThis = this;
|
|
|
|
window.addEventListener("scroll", function (event) {
|
|
|
|
isThis.scrollOffset = this.scrollY;
|
|
|
|
});
|
2021-12-24 04:06:55 +00:00
|
|
|
this.mirror.x = this.toolbarState.mirrorX;
|
|
|
|
this.mirror.y = this.toolbarState.mirrorY;
|
2021-08-21 01:28:06 +00:00
|
|
|
},
|
|
|
|
destroyed() {
|
|
|
|
window.removeEventListener("scroll", function (event) {
|
|
|
|
isThis.scrollOffset = this.scrollY;
|
|
|
|
});
|
2020-12-27 02:42:26 +00:00
|
|
|
},
|
2021-03-31 23:29:55 +00:00
|
|
|
components: {
|
2021-04-17 01:36:44 +00:00
|
|
|
Toolbar,
|
|
|
|
DebugPanel,
|
|
|
|
Editor,
|
|
|
|
CharPicker,
|
|
|
|
ColourPicker,
|
2021-04-24 00:20:11 +00:00
|
|
|
ContextMenu,
|
|
|
|
NewAscii,
|
2021-07-10 01:41:17 +00:00
|
|
|
EditAscii,
|
2021-08-03 07:33:25 +00:00
|
|
|
PasteAscii,
|
2021-08-07 05:36:32 +00:00
|
|
|
BrushLibrary,
|
2021-08-08 01:55:59 +00:00
|
|
|
BrushCanvas,
|
2021-08-14 06:41:42 +00:00
|
|
|
BrushPreview,
|
2021-08-16 06:14:49 +00:00
|
|
|
KeyboardShortcuts,
|
2021-08-19 07:17:46 +00:00
|
|
|
LayersLibrary,
|
2021-10-16 05:16:21 +00:00
|
|
|
Options,
|
2021-11-20 01:10:15 +00:00
|
|
|
ImageOverlay,
|
2021-11-27 00:25:56 +00:00
|
|
|
VueFileToolbarMenu,
|
2021-03-31 23:29:55 +00:00
|
|
|
},
|
2021-08-05 05:30:53 +00:00
|
|
|
name: "Dashboard",
|
2020-12-27 02:42:26 +00:00
|
|
|
data: () => ({
|
2021-03-29 05:10:31 +00:00
|
|
|
canvasX: null,
|
|
|
|
canvasY: null,
|
2021-04-02 02:07:49 +00:00
|
|
|
dashboardX: 0,
|
|
|
|
dashboardY: 0,
|
2021-04-01 01:10:52 +00:00
|
|
|
importType: null,
|
2021-04-17 01:36:44 +00:00
|
|
|
showContextMenu: false,
|
2021-08-16 04:10:06 +00:00
|
|
|
selectedBlocks: null,
|
|
|
|
textEditing: null,
|
|
|
|
updateCanvas: false,
|
2021-08-17 00:24:41 +00:00
|
|
|
selecting: null,
|
2021-08-19 01:42:33 +00:00
|
|
|
isInputtingBrushSize: false,
|
2021-08-21 01:28:06 +00:00
|
|
|
scrollOffset: 0,
|
2021-09-04 01:13:28 +00:00
|
|
|
toolbarString: "top: 0px;",
|
|
|
|
lastPostURL: "",
|
|
|
|
isShowingDialog: false,
|
2021-11-06 00:59:17 +00:00
|
|
|
drawBrush: false,
|
2021-11-27 00:25:56 +00:00
|
|
|
happy: false,
|
2021-12-24 04:06:55 +00:00
|
|
|
mirror: {
|
|
|
|
x: false,
|
|
|
|
y: false,
|
|
|
|
}
|
2020-12-27 02:42:26 +00:00
|
|
|
}),
|
2021-04-02 03:36:00 +00:00
|
|
|
computed: {
|
2021-12-22 10:36:41 +00:00
|
|
|
isDefault() {
|
|
|
|
return this.currentTool.name === "default";
|
|
|
|
},
|
2021-08-08 01:55:59 +00:00
|
|
|
splashAscii() {
|
|
|
|
return splashAscii;
|
|
|
|
},
|
2021-04-03 03:13:03 +00:00
|
|
|
currentTool() {
|
2021-08-03 07:33:25 +00:00
|
|
|
return toolbarIcons[this.$store.getters.currentTool] ?? null;
|
2021-04-03 03:13:03 +00:00
|
|
|
},
|
|
|
|
icon() {
|
2021-04-17 01:36:44 +00:00
|
|
|
return [
|
2021-08-05 05:30:53 +00:00
|
|
|
this.currentTool.fa ?? "fas",
|
|
|
|
this.currentTool.icon ?? "mouse-pointer",
|
2021-04-17 01:36:44 +00:00
|
|
|
];
|
2021-04-03 03:13:03 +00:00
|
|
|
},
|
2021-10-02 00:55:39 +00:00
|
|
|
// options() {
|
|
|
|
// return this.$store.getters.options;
|
|
|
|
// },
|
2021-12-24 04:06:55 +00:00
|
|
|
|
2021-08-03 03:00:32 +00:00
|
|
|
asciibirdMeta() {
|
|
|
|
return this.$store.getters.asciibirdMeta;
|
|
|
|
},
|
|
|
|
debugPanelState() {
|
2021-08-03 07:33:25 +00:00
|
|
|
return this.$store.getters.debugPanel;
|
2021-08-03 03:00:32 +00:00
|
|
|
},
|
2021-08-07 02:41:47 +00:00
|
|
|
brushLibraryState() {
|
|
|
|
return this.$store.getters.brushLibraryState;
|
|
|
|
},
|
2021-08-08 01:55:59 +00:00
|
|
|
currentAscii() {
|
|
|
|
return this.$store.getters.currentAscii;
|
|
|
|
},
|
2021-08-16 07:03:53 +00:00
|
|
|
currentTab() {
|
|
|
|
return this.$store.getters.currentTab;
|
2021-08-12 02:22:29 +00:00
|
|
|
},
|
2021-12-04 03:47:31 +00:00
|
|
|
imageOverlay() {
|
|
|
|
return this.$store.getters.imageOverlay || false;
|
|
|
|
},
|
|
|
|
imageOverlayUrl() {
|
|
|
|
return this.imageOverlay.url
|
|
|
|
? this.imageOverlay.url.split("/").pop()
|
|
|
|
: "";
|
|
|
|
},
|
2021-12-24 04:06:55 +00:00
|
|
|
|
|
|
|
// Layers
|
2021-12-04 03:47:31 +00:00
|
|
|
asciiLayersMenu() {
|
|
|
|
let menu = [];
|
2021-11-20 01:10:15 +00:00
|
|
|
|
2021-12-22 10:36:41 +00:00
|
|
|
for (let i in [...this.currentAsciiLayers]) {
|
2021-12-04 03:47:31 +00:00
|
|
|
menu.push({
|
|
|
|
text: this.currentAsciiLayers[i].label,
|
2021-12-22 10:36:41 +00:00
|
|
|
click: () =>
|
|
|
|
this.$store.commit(
|
|
|
|
"changeLayer",
|
|
|
|
this.currentAsciiLayers.length - i
|
|
|
|
),
|
2021-12-04 03:47:31 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return menu.reverse();
|
|
|
|
},
|
2021-12-24 04:06:55 +00:00
|
|
|
currentAsciiLayers() {
|
|
|
|
return this.$store.getters.currentAsciiLayers;
|
|
|
|
},
|
|
|
|
selectedLayer() {
|
|
|
|
return this.$store.getters.selectedLayer;
|
|
|
|
},
|
|
|
|
canToggleLayer() {
|
|
|
|
return this.currentAsciiLayers.length > 1;
|
|
|
|
// We want to avoid hiding all the layers, so if there's only one
|
|
|
|
// visible left, we have to disable the buttons
|
|
|
|
},
|
|
|
|
|
|
|
|
// Toolbar related
|
|
|
|
gridView() {
|
|
|
|
return this.toolbarState.gridView;
|
|
|
|
},
|
|
|
|
canFg() {
|
|
|
|
return this.$store.getters.isTargettingFg;
|
|
|
|
},
|
|
|
|
canBg() {
|
|
|
|
return this.$store.getters.isTargettingBg;
|
|
|
|
},
|
|
|
|
canText() {
|
|
|
|
return this.$store.getters.isTargettingChar;
|
|
|
|
},
|
|
|
|
currentFg() {
|
|
|
|
return this.$store.getters.currentFg;
|
|
|
|
},
|
|
|
|
currentBg() {
|
|
|
|
return this.$store.getters.currentBg;
|
|
|
|
},
|
|
|
|
currentChar() {
|
|
|
|
return this.$store.getters.currentChar;
|
|
|
|
},
|
|
|
|
toolbarState() {
|
|
|
|
return this.$store.getters.toolbarState;
|
|
|
|
},
|
|
|
|
|
|
|
|
// Toolbar menu
|
2021-11-27 00:25:56 +00:00
|
|
|
myMenu() {
|
|
|
|
let menu = [];
|
2021-11-20 01:10:15 +00:00
|
|
|
|
2021-11-27 00:25:56 +00:00
|
|
|
menu.push({
|
|
|
|
text: "File",
|
2021-12-22 10:36:41 +00:00
|
|
|
hotkey: "0",
|
2021-12-21 11:25:18 +00:00
|
|
|
icon: "insert_drive_file",
|
2021-11-27 00:25:56 +00:00
|
|
|
menu: [
|
|
|
|
{
|
|
|
|
text: "New ASCII",
|
|
|
|
click: () => this.$store.commit("openModal", "new-ascii"),
|
2021-12-22 10:36:41 +00:00
|
|
|
icon: "fiber_new",
|
|
|
|
disabled: !this.isDefault,
|
|
|
|
hotkey: "n",
|
2021-11-27 00:25:56 +00:00
|
|
|
},
|
2021-11-20 01:10:15 +00:00
|
|
|
],
|
2021-11-27 00:25:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
if (this.asciibirdMeta.length) {
|
|
|
|
menu[0].menu.push(
|
|
|
|
{
|
|
|
|
text: "Edit ASCII",
|
|
|
|
click: () => this.$store.commit("openModal", "edit-ascii"),
|
2021-12-22 10:36:41 +00:00
|
|
|
icon: "edit",
|
|
|
|
disabled: !this.isDefault,
|
|
|
|
hotkey: "ctrl+e",
|
2021-11-27 00:25:56 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Close ASCII",
|
|
|
|
click: () => this.closeTab(this.currentTab),
|
2021-12-22 10:36:41 +00:00
|
|
|
icon: "close",
|
|
|
|
disabled: !this.isDefault,
|
|
|
|
hotkey: "ctrl+c",
|
2021-11-27 00:25:56 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
menu.push({
|
2021-12-22 10:36:41 +00:00
|
|
|
text: "View",
|
|
|
|
icon: "preview",
|
2021-11-27 00:25:56 +00:00
|
|
|
menu: [
|
|
|
|
{
|
2021-12-22 10:36:41 +00:00
|
|
|
text: "Windows",
|
|
|
|
icon: "desktop",
|
|
|
|
disabled: !this.isDefault,
|
|
|
|
menu: [
|
|
|
|
{
|
|
|
|
text: "Show Menu Bar",
|
|
|
|
icon: this.check2 ? "check_box" : "check_box_outline_blank",
|
|
|
|
click: (e) => {
|
|
|
|
e.stopPropagation(); // prevent menu close when clicking
|
|
|
|
this.check2 = !this.check2;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Show Tabs",
|
|
|
|
icon: "tab",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Toggle Grid",
|
2021-12-24 04:06:55 +00:00
|
|
|
icon: this.gridView ? "check_box" : "check_box_outline_blank",
|
|
|
|
hotkey: "alt+g",
|
|
|
|
click: (e) => {this.$store.commit("toggleGridView", !this.gridView)},
|
2021-12-22 10:36:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Mirror X",
|
2021-12-24 04:06:55 +00:00
|
|
|
hotkey: "alt+x",
|
|
|
|
icon: this.toolbarState.mirrorX ? "check_box" : "check_box_outline_blank",
|
|
|
|
click: (e) => {
|
|
|
|
this.mirror.x = !this.toolbarState.mirrorX;
|
|
|
|
this.$store.commit("updateMirror", this.mirror);
|
|
|
|
this.$toasted.show(`Mirror Y ${this.mirror.y ? 'enabled' : 'disabled'}`);
|
|
|
|
},
|
2021-12-22 10:36:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Mirror Y",
|
2021-12-24 04:06:55 +00:00
|
|
|
icon: this.toolbarState.mirrorY ? "check_box" : "check_box_outline_blank",
|
|
|
|
hotkey: "alt+y",
|
|
|
|
click: (e) => {
|
|
|
|
this.mirror.y = !this.toolbarState.mirrorY;
|
|
|
|
this.$store.commit("updateMirror", this.mirror);
|
|
|
|
this.$toasted.show(`Mirror Y ${this.mirror.y ? 'enabled' : 'disabled'}`);
|
|
|
|
},
|
2021-12-22 10:36:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Update Brush",
|
2021-12-24 04:06:55 +00:00
|
|
|
hotkey: "alt+u",
|
|
|
|
icon: this.toolbarState.updateBrush ? "check_box" : "check_box_outline_blank",
|
|
|
|
click: (e) => {
|
|
|
|
this.$store.commit('toggleUpdateBrush', !this.toolbarState.updateBrush);
|
|
|
|
this.$toasted.show(`Update Brush when colours or char changes ${this.toolbarState.updateBrush ? 'enabled' : 'disabled'}`);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
is: "separator",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Swap FG and BG",
|
|
|
|
hotkey: "alt+r",
|
|
|
|
icon: "swap_horiz",
|
|
|
|
click: (e) => {
|
|
|
|
let bg = this.currentBg;
|
|
|
|
let fg = this.currentFg;
|
|
|
|
|
|
|
|
this.$store.commit("changeColourFg", bg);
|
|
|
|
this.$store.commit("changeColourBg", fg);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Change FG",
|
|
|
|
hotkey: "alt+f",
|
|
|
|
icon: "flip_to_front",
|
|
|
|
click: (e) => {
|
|
|
|
this.$store.commit(
|
|
|
|
"changeIsUpdatingFg",
|
|
|
|
!this.toolbarState.isChoosingFg
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Change BG",
|
|
|
|
hotkey: "alt+b",
|
|
|
|
icon: "flip_to_back",
|
|
|
|
click: (e) => {
|
|
|
|
this.$store.commit(
|
|
|
|
"changeIsUpdatingBg",
|
|
|
|
!this.toolbarState.isChoosingBg
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Change Char",
|
|
|
|
hotkey: "alt+c",
|
|
|
|
icon: "atm",
|
|
|
|
click: (e) => {
|
|
|
|
this.$store.commit(
|
|
|
|
"changeIsUpdatingChar",
|
|
|
|
!this.toolbarState.isChoosingChar
|
|
|
|
);
|
|
|
|
},
|
2021-12-22 10:36:41 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
is: "separator",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Options",
|
2021-12-11 01:28:44 +00:00
|
|
|
icon: "settings",
|
2021-12-22 10:36:41 +00:00
|
|
|
click: () => this.$store.commit("openModal", "options"),
|
|
|
|
disabled: !this.isDefault,
|
|
|
|
hotkey: "ctrl+o",
|
|
|
|
// menu: [
|
|
|
|
// {
|
|
|
|
// text: "Show Options",
|
|
|
|
// click: () => this.$store.commit("openModal", "options"),
|
|
|
|
// icon: "settings",
|
|
|
|
// },
|
|
|
|
// ],
|
2021-11-27 00:25:56 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
2021-12-22 10:36:41 +00:00
|
|
|
|
2021-11-27 00:25:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
menu.push({
|
|
|
|
text: "Import",
|
2021-12-21 11:25:18 +00:00
|
|
|
icon: "upload_file",
|
2021-11-27 00:25:56 +00:00
|
|
|
menu: [
|
2021-12-22 10:36:41 +00:00
|
|
|
{
|
|
|
|
text: "mIRC File",
|
|
|
|
click: () => this.startImport("mirc"),
|
|
|
|
icon: "upload_file",
|
|
|
|
hotkey: "ctrl+shift+o",
|
|
|
|
},
|
2021-11-27 00:25:56 +00:00
|
|
|
{
|
|
|
|
text: "mIRC Clipboard",
|
|
|
|
click: () => this.$store.commit("openModal", "paste-ascii"),
|
2021-12-22 10:36:41 +00:00
|
|
|
hotkey: "ctrl+shift+v",
|
|
|
|
icon: "copy_all",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "ASCIIBIRD State",
|
|
|
|
click: () => this.startImport("asb"),
|
|
|
|
icon: "save_alt",
|
2021-11-27 00:25:56 +00:00
|
|
|
},
|
2021-11-20 01:10:15 +00:00
|
|
|
],
|
2021-11-27 00:25:56 +00:00
|
|
|
});
|
2021-11-20 01:10:15 +00:00
|
|
|
|
2021-11-27 00:25:56 +00:00
|
|
|
if (this.asciibirdMeta.length) {
|
2021-12-04 03:47:31 +00:00
|
|
|
menu.push(
|
|
|
|
{
|
|
|
|
text: "Export",
|
2021-12-21 11:25:18 +00:00
|
|
|
icon: "save_alt",
|
2021-12-04 03:47:31 +00:00
|
|
|
menu: [
|
2021-12-22 10:36:41 +00:00
|
|
|
{
|
|
|
|
text: "mIRC File",
|
|
|
|
click: () => this.startExport("file"),
|
|
|
|
icon: "download_file",
|
|
|
|
hotkey: "ctrl+shift+f",
|
|
|
|
},
|
2021-12-04 03:47:31 +00:00
|
|
|
{
|
|
|
|
text: "mIRC Clipboard",
|
2021-12-22 10:36:41 +00:00
|
|
|
hotkey: "ctrl+shift+c",
|
2021-12-04 03:47:31 +00:00
|
|
|
click: () => this.startExport("clipboard"),
|
2021-12-22 10:36:41 +00:00
|
|
|
icon: "copy_all",
|
|
|
|
},
|
|
|
|
{ text: "PNG Image", click: () => true, icon: "image" },
|
|
|
|
{
|
|
|
|
text: "HTTP POST",
|
|
|
|
click: () => this.startExport("post"),
|
2021-12-24 04:06:55 +00:00
|
|
|
hotkey: "ctrl+shift+h",
|
2021-12-22 10:36:41 +00:00
|
|
|
icon: "post_add",
|
2021-12-04 03:47:31 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "ASCIIBIRD State",
|
|
|
|
click: () => this.exportAsciibirdState(),
|
2021-12-22 10:36:41 +00:00
|
|
|
icon: "save_alt",
|
2021-12-04 03:47:31 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Layers",
|
2021-12-21 11:25:18 +00:00
|
|
|
icon: "layers",
|
2021-12-04 03:47:31 +00:00
|
|
|
menu: [
|
|
|
|
// {
|
|
|
|
// text: "Change Layers",
|
|
|
|
// menu: this.asciiLayersMenu,
|
|
|
|
// },
|
|
|
|
{
|
|
|
|
text: "Show/Hide Layer",
|
2021-12-22 10:36:41 +00:00
|
|
|
click: () =>
|
|
|
|
this.$store.commit("toggleLayer", this.selectedLayer),
|
|
|
|
icon: "panorama_fish_eye",
|
2021-12-24 04:06:55 +00:00
|
|
|
hotkey: "ctrl+shift+t",
|
2021-12-22 10:36:41 +00:00
|
|
|
disabled: !this.canToggleLayer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Rename Layer",
|
|
|
|
hotkey: "ctrl+shift+r",
|
|
|
|
click: () =>
|
|
|
|
this.showLayerRename(
|
|
|
|
this.selectedLayer,
|
|
|
|
this.currentAsciiLayers[this.selectedLayer].label
|
|
|
|
),
|
|
|
|
icon: "text_rotation_none",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Add Layer",
|
|
|
|
hotkey: "ctrl+shift+a",
|
|
|
|
click: () => this.$store.commit("addLayer"),
|
|
|
|
icon: "playlist_add",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Delete Layer",
|
|
|
|
hotkey: "ctrl+shift+d",
|
|
|
|
click: () =>
|
|
|
|
this.$store.commit("removeLayer", this.selectedLayer),
|
|
|
|
icon: "delete_sweep",
|
|
|
|
disabled: !this.canToggleLayer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Move Layer Down",
|
|
|
|
hotkey: "ctrl+shift+s",
|
|
|
|
click: () => this.$store.commit("upLayer", this.selectedLayer),
|
|
|
|
icon: "arrow_downward",
|
|
|
|
disabled: !this.canToggleLayer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Move Layer Up",
|
|
|
|
hotkey: "ctrl+shift+w",
|
|
|
|
click: () =>
|
|
|
|
this.$store.commit("downLayer", this.selectedLayer),
|
|
|
|
icon: "arrow_upward",
|
|
|
|
disabled: !this.canToggleLayer,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: "Merge All Layers",
|
|
|
|
hotkey: "ctrl+shift+m",
|
|
|
|
click: () => this.$store.commit("mergeAllLayers"),
|
|
|
|
icon: "playlist_play",
|
|
|
|
disabled: !this.canToggleLayer,
|
2021-12-04 03:47:31 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|
|
|
|
);
|
2021-11-27 00:25:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
},
|
2021-04-02 03:36:00 +00:00
|
|
|
},
|
2021-08-21 01:28:06 +00:00
|
|
|
watch: {
|
2021-09-04 05:16:27 +00:00
|
|
|
// scrollOffset(val) {
|
|
|
|
// this.$refs.tabbar.style.top = val;
|
|
|
|
// this.toolbarString = `top: ${val}px`;
|
|
|
|
// },
|
2021-08-21 01:28:06 +00:00
|
|
|
},
|
2020-12-27 02:42:26 +00:00
|
|
|
methods: {
|
2021-12-04 03:47:31 +00:00
|
|
|
showLayerRename(key, label) {
|
|
|
|
this.$store.commit("toggleDisableKeyboard", true);
|
|
|
|
this.$dialog
|
|
|
|
.prompt({
|
|
|
|
title: "Rename Layer",
|
|
|
|
text: "Please input your new layer name",
|
|
|
|
icon: "question",
|
|
|
|
inputValue: label,
|
|
|
|
clickToClose: false,
|
|
|
|
})
|
|
|
|
.then((result) => {
|
|
|
|
if (!result.input.length) {
|
|
|
|
this.$toasted.show("You must enter a layer name!", {
|
|
|
|
type: "error",
|
|
|
|
});
|
|
|
|
this.$store.commit("toggleDisableKeyboard", false);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result.isOk) {
|
|
|
|
this.updateLayerName(key, result.input);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$store.commit("toggleDisableKeyboard", false);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
updateLayerName(key, label) {
|
|
|
|
this.$store.commit("updateLayerName", {
|
|
|
|
key: key,
|
|
|
|
label: label,
|
|
|
|
});
|
|
|
|
},
|
2021-11-06 00:59:17 +00:00
|
|
|
triggerbrush() {
|
2021-11-27 00:25:56 +00:00
|
|
|
this.drawBrush = !this.drawBrush;
|
2021-11-06 00:59:17 +00:00
|
|
|
},
|
2021-08-19 01:42:33 +00:00
|
|
|
inputtingbrush(val) {
|
2021-08-21 00:13:56 +00:00
|
|
|
this.isInputtingBrushSize = val;
|
2021-08-19 01:42:33 +00:00
|
|
|
},
|
2021-08-16 07:03:53 +00:00
|
|
|
buttonStyle(key) {
|
2021-08-19 07:17:46 +00:00
|
|
|
return this.currentTab === key
|
2021-08-16 07:03:53 +00:00
|
|
|
? `text-sm pl-1 p-1 h-10 text-white border border-transparent shadow-sm hover:bg-blue-500 bg-gray-900`
|
|
|
|
: `text-sm pl-1 p-1 h-10 text-white border border-transparent shadow-sm hover:bg-blue-500 bg-gray-400`;
|
2021-08-19 07:17:46 +00:00
|
|
|
},
|
2021-04-17 01:36:44 +00:00
|
|
|
openContextMenu(e) {
|
2021-06-19 01:34:31 +00:00
|
|
|
e.preventDefault();
|
2021-04-17 01:36:44 +00:00
|
|
|
this.$refs.menu.open(e);
|
|
|
|
},
|
2021-03-29 05:10:31 +00:00
|
|
|
updateCoords(value) {
|
2021-03-30 08:36:53 +00:00
|
|
|
this.canvasX = value.x;
|
|
|
|
this.canvasY = value.y;
|
2021-03-29 05:10:31 +00:00
|
|
|
},
|
2021-08-16 04:10:06 +00:00
|
|
|
selectedblocks(value) {
|
2021-08-19 07:17:46 +00:00
|
|
|
this.selectedBlocks = value;
|
2021-08-16 04:10:06 +00:00
|
|
|
},
|
2021-08-17 00:24:41 +00:00
|
|
|
updateSelecting(value) {
|
2021-08-19 07:17:46 +00:00
|
|
|
this.selecting = value;
|
2021-08-17 00:24:41 +00:00
|
|
|
},
|
2021-08-16 04:10:06 +00:00
|
|
|
textediting(value) {
|
2021-08-19 07:17:46 +00:00
|
|
|
this.textEditing = value;
|
2021-08-16 04:10:06 +00:00
|
|
|
},
|
|
|
|
updatecanvas() {
|
2021-08-19 07:17:46 +00:00
|
|
|
this.updateCanvas = !this.updateCanvas;
|
2021-08-16 04:10:06 +00:00
|
|
|
},
|
2021-05-16 00:30:18 +00:00
|
|
|
async onImport() {
|
2021-01-23 02:50:32 +00:00
|
|
|
const { files } = this.$refs.asciiInput;
|
|
|
|
const filename = files[0].name;
|
2021-01-16 03:03:14 +00:00
|
|
|
const fileReader = new FileReader();
|
|
|
|
|
2021-08-04 03:21:06 +00:00
|
|
|
const fileType = this.importType;
|
2021-08-05 05:30:53 +00:00
|
|
|
fileReader.addEventListener("load", () => {
|
2021-08-04 03:21:06 +00:00
|
|
|
switch (fileType) {
|
2021-08-05 05:30:53 +00:00
|
|
|
case "asb":
|
2021-04-03 03:13:03 +00:00
|
|
|
this.importAsciibirdState(fileReader.result, filename);
|
2021-04-01 01:10:52 +00:00
|
|
|
break;
|
|
|
|
|
2021-08-04 03:21:06 +00:00
|
|
|
default:
|
2021-08-05 05:30:53 +00:00
|
|
|
case "mirc":
|
|
|
|
parseMircAscii(fileReader.result, filename);
|
2021-04-01 01:10:52 +00:00
|
|
|
break;
|
|
|
|
}
|
2021-03-14 07:36:14 +00:00
|
|
|
});
|
2021-04-01 01:10:52 +00:00
|
|
|
|
|
|
|
// This will fire the file reader 'load' event
|
2021-08-04 03:21:06 +00:00
|
|
|
fileReader.readAsText(files[0]);
|
2021-03-14 07:36:14 +00:00
|
|
|
},
|
2021-04-01 01:10:52 +00:00
|
|
|
startImport(type) {
|
2021-03-31 23:29:55 +00:00
|
|
|
// For ANSI we'll need to add back in the
|
|
|
|
// type cariable here
|
2021-04-03 03:13:03 +00:00
|
|
|
this.importType = type;
|
2021-07-10 01:41:17 +00:00
|
|
|
// console.log(this.importType);
|
2021-03-14 07:36:14 +00:00
|
|
|
this.$refs.asciiInput.click();
|
|
|
|
},
|
2021-05-15 03:54:30 +00:00
|
|
|
importAsciibirdState(fileContents) {
|
2021-08-04 03:21:06 +00:00
|
|
|
const contents = JSON.parse(
|
2021-08-05 05:30:53 +00:00
|
|
|
LZString.decompressFromEncodedURIComponent(fileContents)
|
2021-06-19 00:26:23 +00:00
|
|
|
);
|
2021-08-05 05:30:53 +00:00
|
|
|
this.$store.commit("changeState", { ...contents });
|
2021-04-01 01:10:52 +00:00
|
|
|
},
|
|
|
|
exportAsciibirdState() {
|
|
|
|
let output;
|
|
|
|
|
|
|
|
try {
|
2021-06-19 00:26:23 +00:00
|
|
|
output = LZString.compressToEncodedURIComponent(
|
2021-08-05 05:30:53 +00:00
|
|
|
JSON.stringify(this.$store.getters.state)
|
2021-06-19 00:26:23 +00:00
|
|
|
);
|
2021-04-01 23:01:36 +00:00
|
|
|
|
|
|
|
// Default timestamp for filename
|
2021-04-03 03:13:03 +00:00
|
|
|
const today = new Date();
|
|
|
|
const y = today.getFullYear();
|
|
|
|
const m = today.getMonth() + 1; // JavaScript months are 0-based.
|
|
|
|
const d = today.getDate();
|
|
|
|
const h = today.getHours();
|
|
|
|
const mi = today.getMinutes();
|
|
|
|
const s = today.getSeconds();
|
2021-04-01 23:01:36 +00:00
|
|
|
|
2021-08-05 05:30:53 +00:00
|
|
|
downloadFile(
|
2021-04-17 01:36:44 +00:00
|
|
|
output,
|
|
|
|
`asciibird-${y}-${m}-${d}-${h}-${mi}-${s}.asb`,
|
2021-08-05 05:30:53 +00:00
|
|
|
"application/gzip"
|
2021-04-17 01:36:44 +00:00
|
|
|
);
|
2021-04-01 01:10:52 +00:00
|
|
|
} catch (err) {
|
2021-08-12 02:22:29 +00:00
|
|
|
this.$toasted.show(err, {
|
|
|
|
type: "error",
|
|
|
|
});
|
2021-04-01 01:10:52 +00:00
|
|
|
}
|
|
|
|
},
|
2021-08-05 05:30:53 +00:00
|
|
|
startExport(type) {
|
|
|
|
let ascii = exportMirc();
|
2021-04-24 00:20:11 +00:00
|
|
|
|
|
|
|
switch (type) {
|
2021-08-05 05:30:53 +00:00
|
|
|
case "clipboard":
|
|
|
|
this.$copyText(ascii.output.join("")).then(
|
2021-08-04 03:21:06 +00:00
|
|
|
(e) => {
|
2021-08-12 02:22:29 +00:00
|
|
|
this.$toasted.show("Copied mIRC to clipboard!", {
|
|
|
|
type: "success",
|
|
|
|
});
|
2021-06-19 00:26:23 +00:00
|
|
|
},
|
2021-08-04 03:21:06 +00:00
|
|
|
(e) => {
|
2021-08-12 02:22:29 +00:00
|
|
|
this.$toasted.show("Error when copying mIRC to clipboard!", {
|
|
|
|
type: "error",
|
|
|
|
});
|
2021-08-05 05:30:53 +00:00
|
|
|
}
|
2021-06-19 00:26:23 +00:00
|
|
|
);
|
2021-04-24 00:20:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2021-08-05 05:30:53 +00:00
|
|
|
case "file":
|
|
|
|
downloadFile(ascii.output.join(""), ascii.filename, "text/plain");
|
2021-04-24 00:20:11 +00:00
|
|
|
break;
|
2021-08-20 23:53:07 +00:00
|
|
|
case "post":
|
2021-09-04 01:13:28 +00:00
|
|
|
this.$store.commit("toggleDisableKeyboard", true);
|
2021-11-27 00:25:56 +00:00
|
|
|
this.$dialog.show("dialog-posthttp");
|
2021-09-04 01:13:28 +00:00
|
|
|
this.isShowingDialog = true;
|
2021-08-20 23:53:07 +00:00
|
|
|
break;
|
2021-04-24 00:20:11 +00:00
|
|
|
}
|
2021-04-01 01:10:52 +00:00
|
|
|
},
|
2021-09-04 01:13:28 +00:00
|
|
|
postHttp() {
|
|
|
|
let ascii = exportMirc();
|
|
|
|
|
|
|
|
// this.lastPostURL = result.input;
|
|
|
|
const requestOptions = {
|
|
|
|
method: "POST",
|
|
|
|
headers: { "Content-Type": "application/octet-stream" },
|
|
|
|
body: ascii.output.join(""),
|
|
|
|
};
|
|
|
|
fetch(this.lastPostURL, requestOptions)
|
|
|
|
.then((response) => {
|
|
|
|
this.$toasted.show("POSTed ascii!");
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
this.$toasted.show("Error POSTing");
|
|
|
|
});
|
|
|
|
|
|
|
|
this.$store.commit("toggleDisableKeyboard", false);
|
|
|
|
this.isShowingDialog = false;
|
|
|
|
},
|
2021-08-04 03:21:06 +00:00
|
|
|
changeTab(key) {
|
2020-12-27 02:42:26 +00:00
|
|
|
// Update the tab index in vuex store
|
2021-08-05 05:30:53 +00:00
|
|
|
this.$store.commit("changeTab", key);
|
2020-12-27 02:42:26 +00:00
|
|
|
},
|
2021-08-08 01:55:59 +00:00
|
|
|
closeTab(key) {
|
|
|
|
this.$dialog
|
|
|
|
.confirm({
|
2021-08-12 02:22:29 +00:00
|
|
|
title: `Close ${this.asciibirdMeta[key].title}?`,
|
2021-08-08 01:55:59 +00:00
|
|
|
text: "This action cannot be undone and the ASCII will be gone.",
|
|
|
|
icon: "info",
|
|
|
|
})
|
|
|
|
.then((result) => {
|
|
|
|
if (result.isOk) {
|
|
|
|
this.$store.commit("closeTab", key);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
2021-04-02 02:07:49 +00:00
|
|
|
captureMouse(event) {
|
2021-04-03 03:13:03 +00:00
|
|
|
this.dashboardX = event.pageX;
|
|
|
|
this.dashboardY = event.pageY;
|
|
|
|
},
|
2020-12-27 02:42:26 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|