mirror of
https://github.com/janishutz/MusicPlayerV2.git
synced 2025-11-25 21:14:22 +00:00
start adding showcase screen
This commit is contained in:
@@ -29,13 +29,15 @@
|
||||
<div class="slider-wrapper" v-if="isShowingFullScreenPlayer">
|
||||
<div class="slider-pb-pos">
|
||||
<p class="playback-pos">{{ nicePlaybackPos }}</p>
|
||||
<p class="playback-duration" @click="toggleRemaining()">{{ niceDuration }}</p>
|
||||
<p class="playback-duration" @click="toggleRemaining()" title="Toggle between remaining time and song duration">{{ niceDuration }}</p>
|
||||
</div>
|
||||
<sliderView :position="pos" :active="true" :duration="duration" name="main" @pos="( pos ) => player.goToPos( pos )"></sliderView>
|
||||
</div>
|
||||
|
||||
<div class="shuffle-repeat" v-if="isShowingFullScreenPlayer">
|
||||
<span class="material-symbols-outlined controls" @click="control( 'repeat' )" style="margin-right: auto;">repeat{{ repeatMode }}</span>
|
||||
<span class="material-symbols-outlined controls" @click="control( 'start-share' )" style="margin-right: auto;" title="Share your playlist on a public playlist page (opens a configuration window)" v-if="!isConnectedToNotifier">share</span>
|
||||
<span class="material-symbols-outlined controls" @click="control( 'stop-share' )" style="margin-right: auto;" title="Stop sharing your playlist on a public playlist page" v-else>close</span>
|
||||
<span class="material-symbols-outlined controls" @click="control( 'shuffle' )">shuffle{{ shuffleMode }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -82,11 +84,13 @@
|
||||
const nicePlaybackPos = ref( '00:00' );
|
||||
const niceDuration = ref( '00:00' );
|
||||
const isShowingRemainingTime = ref( false );
|
||||
let isShowingRemainingTimeBackend = false;
|
||||
const currentlyPlayingSongArtist = ref( '' );
|
||||
const pos = ref( 0 );
|
||||
const duration = ref( 0 );
|
||||
const notifications = ref( notificationsModule );
|
||||
const notificationHandler = new NotificationHandler();
|
||||
const isConnectedToNotifier = ref( false );
|
||||
|
||||
const emits = defineEmits( [ 'playerStateChange' ] );
|
||||
|
||||
@@ -163,6 +167,9 @@
|
||||
getDetails();
|
||||
startProgressTracker();
|
||||
}, 2000 );
|
||||
} else if ( action === 'start-share' ) {
|
||||
// TODO: Open popup, then send data with popup returns
|
||||
notificationHandler.connect( 'test' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,9 +177,15 @@
|
||||
const controlUI = ( action: string ) => {
|
||||
if ( action === 'show' ) {
|
||||
isShowingFullScreenPlayer.value = true;
|
||||
isShowingRemainingTime.value = isShowingRemainingTimeBackend;
|
||||
emits( 'playerStateChange', 'show' );
|
||||
} else if ( action === 'hide' ) {
|
||||
isShowingFullScreenPlayer.value = false;
|
||||
isShowingRemainingTimeBackend = isShowingRemainingTime.value;
|
||||
isShowingRemainingTime.value = false;
|
||||
try {
|
||||
prepNiceDurationTime( player.getPlayingSong() );
|
||||
} catch ( err ) { /* empty */ }
|
||||
emits( 'playerStateChange', 'hide' );
|
||||
}
|
||||
}
|
||||
@@ -300,18 +313,7 @@
|
||||
hasReachedEnd = false;
|
||||
isPlaying.value = true;
|
||||
const playingSong = player.getPlayingSong();
|
||||
duration.value = playingSong.duration;
|
||||
const minuteCounts = Math.floor( ( playingSong.duration ) / 60 );
|
||||
niceDuration.value = String( minuteCounts ) + ':';
|
||||
if ( ( '' + minuteCounts ).length === 1 ) {
|
||||
niceDuration.value = '0' + minuteCounts + ':';
|
||||
}
|
||||
const secondCounts = Math.floor( ( playingSong.duration ) - minuteCounts * 60 );
|
||||
if ( ( '' + secondCounts ).length === 1 ) {
|
||||
niceDuration.value += '0' + secondCounts;
|
||||
} else {
|
||||
niceDuration.value += secondCounts;
|
||||
}
|
||||
prepNiceDurationTime( playingSong );
|
||||
progressTracker = setInterval( () => {
|
||||
pos.value = player.getPlaybackPos();
|
||||
if ( pos.value > playingSong.duration - 1 && !hasReachedEnd ) {
|
||||
@@ -319,6 +321,9 @@
|
||||
hasReachedEnd = true;
|
||||
if ( repeatMode.value === '_one_on' ) {
|
||||
player.goToPos( 0 );
|
||||
setTimeout( () => {
|
||||
control( 'play' );
|
||||
}, 500 );
|
||||
} else {
|
||||
control( 'next' );
|
||||
}
|
||||
@@ -356,6 +361,21 @@
|
||||
}, 50 );
|
||||
}
|
||||
|
||||
const prepNiceDurationTime = ( playingSong: Song ) => {
|
||||
duration.value = playingSong.duration;
|
||||
const minuteCounts = Math.floor( ( playingSong.duration ) / 60 );
|
||||
niceDuration.value = String( minuteCounts ) + ':';
|
||||
if ( ( '' + minuteCounts ).length === 1 ) {
|
||||
niceDuration.value = '0' + minuteCounts + ':';
|
||||
}
|
||||
const secondCounts = Math.floor( ( playingSong.duration ) - minuteCounts * 60 );
|
||||
if ( ( '' + secondCounts ).length === 1 ) {
|
||||
niceDuration.value += '0' + secondCounts;
|
||||
} else {
|
||||
niceDuration.value += secondCounts;
|
||||
}
|
||||
}
|
||||
|
||||
const stopProgressTracker = () => {
|
||||
try {
|
||||
clearInterval( progressTracker );
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
Loading...
|
||||
<!-- TODO: Make prettier -->
|
||||
</div>
|
||||
<div v-else-if="!$props.isLoggedIn">
|
||||
<p>You are not logged into Apple Music.</p>
|
||||
<div v-else-if="!$props.isLoggedIn" class="not-logged-in">
|
||||
<p>You are not logged into Apple Music. We therefore can't show you your playlists. <a href="" title="Refreshes the page, allowing you to log in">Change that</a></p>
|
||||
<p>Use the below button to load songs from your local disk</p>
|
||||
<input class="pl-loader-button" type="file" multiple="true" accept="audio/*" id="pl-loader"><br>
|
||||
<button @click="loadPlaylistFromDisk()" class="pl-loader-button">Load custom playlist from disk</button>
|
||||
<button @click="loadPlaylistFromDisk()" class="pl-loader-button" id="load-button">Load</button>
|
||||
<p v-if="!hasSelectedSongs">Please select at least one song to proceed!</p>
|
||||
</div>
|
||||
<div class="playlist-wrapper">
|
||||
@@ -87,5 +88,19 @@
|
||||
|
||||
.pl-loader-button {
|
||||
background-color: white;
|
||||
border: none;
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
margin: 5px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#load-button {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.not-logged-in {
|
||||
width: 80%;
|
||||
}
|
||||
</style>
|
||||
@@ -1,481 +1,298 @@
|
||||
<!-- eslint-disable no-undef -->
|
||||
<template>
|
||||
<div id="popup-backdrop">
|
||||
<div class="popup-container">
|
||||
<div class="popup" :class="size">
|
||||
<div class="close-wrapper"><span class="material-symbols-outlined close-button" @click="closePopup( 'cancel' );" title="Close this popup">close</span></div>
|
||||
<div class="message-container">
|
||||
<div v-if="contentType === 'string'" class="options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<div class="button-wrapper">
|
||||
<button @click="closePopup( 'ok' )" title="Close popup" class="buttons fancy-button">Ok</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'html'" v-html="data.message" class="options"></div>
|
||||
<div v-else-if="contentType === 'code'" class="options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<button @click="copy()" id="code-copy" class="buttons fancy-button">Copy</button>
|
||||
<pre>
|
||||
<code>
|
||||
{{ data.options.code }}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'long-text'" class="options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<p>{{ data.options.note }}</p>
|
||||
<textarea cols="80" rows="10" v-model="data.selected" id="text-input"></textarea>
|
||||
<div class="button-wrapper">
|
||||
<button @click="closePopup( 'ok' )" title="Save changes" class="buttons fancy-button">{{ data.options.display.save ?? 'Save' }}</button>
|
||||
<button @click="closePopup( 'cancel' )" title="Cancel changes" class="buttons fancy-button">{{ data.options.display.cancel ?? 'Cancel' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'text'" class="options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<input type="text" v-model="data.selected">
|
||||
<p>{{ info }}</p>
|
||||
<div class="button-wrapper">
|
||||
<button @click="closePopup( 'ok' )" title="Save changes" class="buttons fancy-button">{{ data.options.display.save ?? 'Save' }}</button>
|
||||
<button @click="closePopup( 'cancel' )" title="Cancel changes" class="buttons fancy-button">{{ data.options.display.cancel ?? 'Cancel' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'number'" class="options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<input type="number" v-model="data.selected">
|
||||
<div class="button-wrapper">
|
||||
<button @click="closePopup( 'ok' )" title="Save changes" class="buttons fancy-button">{{ data.options.display.save ?? 'Save' }}</button>
|
||||
<button @click="closePopup( 'cancel' )" title="Cancel changes" class="buttons fancy-button">{{ data.options.display.cancel ?? 'Cancel' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'settings'" class="options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<settings v-model:settings="data.options"></settings>
|
||||
<div class="button-wrapper">
|
||||
<button @click="submitSettings( 'ok' )" title="Save changes" class="buttons fancy-button">Save</button>
|
||||
<button @click="closePopup( 'cancel' )" title="Cancel changes" class="buttons fancy-button">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'confirm'" class="confirm options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<div class="button-wrapper">
|
||||
<button @click="closePopup( 'ok' )" title="Save changes" class="buttons fancy-button">{{ data.options.ok ?? 'Ok' }}</button>
|
||||
<button @click="closePopup( 'cancel' )" title="Cancel changes" class="buttons fancy-button">{{ data.options.display.cancel ?? 'Cancel' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'dropdown'" class="options">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<select id="select" v-model="data.selected">
|
||||
<option v-for="selectOption in data.options" :key="selectOption.value" :value="selectOption.value">{{ selectOption.displayName }}</option>
|
||||
</select>
|
||||
<div class="button-wrapper">
|
||||
<button @click="closePopup( 'ok' )" title="Save changes" class="buttons fancy-button">{{ data.options.display.save ?? 'Save' }}</button>
|
||||
<button @click="closePopup( 'cancel' )" title="Cancel changes" class="buttons fancy-button">{{ data.options.display.cancel ?? 'Cancel' }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'selection'" class="options selection">
|
||||
<h3>{{ data.message }}</h3>
|
||||
<div v-for="selectOption in data.options.selections" :key="selectOption.value" class="select-button-wrapper">
|
||||
<button class="select-button" @click="closePopupAdvanced( 'ok', selectOption.value )">{{ selectOption.displayName }}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'iframe'" class="options iframe-wrapper">
|
||||
<iframe :src="data.options.link" frameborder="0" class="popup-iframe"></iframe>
|
||||
</div>
|
||||
<div v-else-if="contentType === 'editor'" class="options">
|
||||
<!-- Create the toolbar container -->
|
||||
<h3>{{ data.message }}</h3>
|
||||
<p v-if="data.options.note" v-html="data.options.note"></p>
|
||||
<!-- Optional toggles (added via options object) -->
|
||||
<table class="editor-options">
|
||||
<tr v-for="element in data.options.settings" :key="element.id">
|
||||
<td>
|
||||
{{ element.displayName }}
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" v-if="element.type === 'text'" v-model="data.selected[ element.id ]">
|
||||
<input type="number" v-else-if="element.type === 'number'" v-model="data.selected[ element.id ]">
|
||||
<input type="email" v-else-if="element.type === 'email'" v-model="data.selected[ element.id ]">
|
||||
<select v-else-if="element.type === 'dropdown'" v-model="data.selected[ element.id ]">
|
||||
<option v-for="el in element.options" :key="el.value" :value="el.value">{{ el.displayName }}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="quill-toolbar">
|
||||
<span class="ql-formats">
|
||||
<select class="ql-font" title="Fonts">
|
||||
<option selected="" title="Default"></option>
|
||||
<option value="serif" title="Serif"></option>
|
||||
<option value="monospace" title="Monospace"></option>
|
||||
</select>
|
||||
<select class="ql-size" title="Font size">
|
||||
<option value="small" title="Small"></option>
|
||||
<option selected="" title="Default"></option>
|
||||
<option value="large" title="Large"></option>
|
||||
<option value="huge" title="Huge"></option>
|
||||
</select>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-bold" title="Bold"></button>
|
||||
<button class="ql-italic" title="Italic"></button>
|
||||
<button class="ql-underline" title="Underlined"></button>
|
||||
<button class="ql-strike" title="Strikethrough"></button>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<select class="ql-color" title="Text colour"></select>
|
||||
<select class="ql-background" title="Background colour"></select>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-list" value="ordered" title="Ordered list"></button>
|
||||
<button class="ql-list" value="bullet" title="Bullet points"></button>
|
||||
<select class="ql-align" title="Alignment">
|
||||
<option selected="" title="left"></option>
|
||||
<option value="center" title="center"></option>
|
||||
<option value="right" title="right"></option>
|
||||
<option value="justify" title="block"></option>
|
||||
</select>
|
||||
</span>
|
||||
<span class="ql-formats">
|
||||
<button class="ql-link" title="Insert link"></button>
|
||||
<button class="ql-image" title="Insert image"></button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Create the editor container -->
|
||||
<div id="quill-editor">
|
||||
</div>
|
||||
|
||||
<div class="message-iframe" v-if="data.selected.oldMsg" style="height: 60vh;">
|
||||
<p>Attached message: </p>
|
||||
<iframe :srcdoc="data.selected.oldMsg" frameborder="0" class="message-iframe"></iframe>
|
||||
</div>
|
||||
|
||||
<div class="button-wrapper">
|
||||
<button @click="closePopupEditor()" :title="data.options.saveButtonHint" class="buttons fancy-button">{{ data.options.saveButtonDisplay }}</button>
|
||||
<button @click="closePopup( 'cancel' )" title="Cancel changes" class="buttons fancy-button">Cancel</button>
|
||||
<div>
|
||||
<div :class="'popup-backdrop' + ( isShowingPopup ? '' : ' hidden' )" :style="'transform-origin: ' + transformOriginVertical + ';'">
|
||||
<div class="popup-main">
|
||||
<span class="material-symbols-outlined close-icon" @click="closePopup()">close</span>
|
||||
<h2>{{ popupContent.title }}</h2>
|
||||
<div v-if="popupContent.popupType === 'information' || popupContent.popupType === 'confirmation'" class="popup-content">
|
||||
<p v-html="popupContent.subtitle"></p>
|
||||
</div>
|
||||
<div v-else class="popup-content">
|
||||
<p v-if="isShowingIncomplete" class="incomplete-message">{{ popupContent.incompleteMessage ? popupContent.incompleteMessage : 'Some entries are not filled out. Please fill them out to proceed.' }}</p>
|
||||
<p v-html="popupContent.subtitle"></p>
|
||||
<div v-for="content in popupContent.data" v-bind:key="content.id" class="popup-content-wrapper">
|
||||
<div v-if="content.dataType === 'text'">
|
||||
<label :for="'text-' + content.id">{{ content.name }}</label><br>
|
||||
<input type="text" :id="'text-' + content.id" v-model="data[ content.id ]" class="input">
|
||||
</div>
|
||||
<div v-else-if="content.dataType === 'number'">
|
||||
<label :for="'number-' + content.id">{{ content.name }}</label><br>
|
||||
<input type="number" :id="'number-' + content.id" v-model="data[ content.id ]" class="input">
|
||||
</div>
|
||||
<div v-else-if="content.dataType === 'checkbox'">
|
||||
<label :for="'checkbox-' + content.id">{{ content.name }}</label><br>
|
||||
<label class="switch">
|
||||
<input type="checkbox" v-model="data[ content.id ]">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div v-else-if="content.dataType === 'textbox'">
|
||||
<label :for="'textarea-' + content.id">{{ content.name }}</label><br>
|
||||
<textarea :id="'textarea-' + content.id" v-model="data[ content.id ]" class="textarea"></textarea>
|
||||
</div>
|
||||
<div v-else-if="content.dataType === 'colour'">
|
||||
<label :for="'colour-' + content.id">{{ content.name }}</label><br>
|
||||
<input type="text" :id="'colour-' + content.id" v-model="data[ content.id ]" class="input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 20px;">
|
||||
<button @click="closePopup()" style="margin-right: 10px;" class="fancy-button" v-if="popupContent.popupType === 'confirmation'">Cancel</button>
|
||||
<button @click="closePopupReturn()" class="fancy-button">Ok</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Options to be passed in: html, settings (for settings component), strings, confirm, dropdowns, selection -->
|
||||
|
||||
<script setup lang="ts">
|
||||
type PopupType = 'confirmation' | 'information' | 'input';
|
||||
|
||||
<script>
|
||||
import settings from '@/components/settingsOptions.vue';
|
||||
import hljs from 'highlight.js';
|
||||
import beautify from 'json-beautify';
|
||||
import Quill from 'quill';
|
||||
import( 'quill/dist/quill.snow.css' );
|
||||
interface PopupData {
|
||||
/**
|
||||
* What to display to the user in front of the input field
|
||||
*/
|
||||
name: string;
|
||||
|
||||
export default {
|
||||
name: 'popupsHandler',
|
||||
components: {
|
||||
settings,
|
||||
},
|
||||
props: {
|
||||
size: {
|
||||
type: String,
|
||||
'default': 'normal',
|
||||
},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
contentType: 'dropdown',
|
||||
data: {
|
||||
options: {
|
||||
display: '',
|
||||
},
|
||||
},
|
||||
info: '',
|
||||
editor: null,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
closePopup( message ) {
|
||||
if ( this.data.options.disallowedCharacters ) {
|
||||
for ( let letter in this.data.selected ) {
|
||||
if ( this.data.options.disallowedCharacters.includes( this.data.selected[ letter ] ) ) {
|
||||
this.info = `Illegal character "${ this.data.selected[ letter ] }"`;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line no-undef
|
||||
$( '#popup-backdrop' ).fadeOut( 300 );
|
||||
if ( message ) {
|
||||
this.$emit( 'data', { 'data': this.data.selected, 'status': message } );
|
||||
}
|
||||
},
|
||||
closePopupEditor () {
|
||||
this.data.selected;
|
||||
this.data.selected.mail = document.getElementsByClassName( 'ql-editor' )[ 0 ].innerHTML + ( this.data.selected.oldMsg ?? '' );
|
||||
this.closePopup( 'editor' );
|
||||
},
|
||||
selectTicket ( option ) {
|
||||
let total = 0;
|
||||
for ( let i in this.data.options.count ) {
|
||||
total += this.data.options.count[ i ];
|
||||
}
|
||||
/**
|
||||
* The type of data to display
|
||||
*/
|
||||
dataType: 'text' | 'number' | 'checkbox' | 'textbox' | 'colour';
|
||||
|
||||
if ( total < this.data.options.max ) {
|
||||
this.data.options.count[ option ] += 1;
|
||||
/**
|
||||
* ID that is used for internal usage only. May only contain alphanumerical characters, as well as dashes and underscores
|
||||
*/
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface PopupContent {
|
||||
/**
|
||||
* The title shown in big letters at the top of the popup
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* (OPTIONAL) The subtitle shown to the user in normal sized letters below title
|
||||
*/
|
||||
subtitle?: string;
|
||||
|
||||
/**
|
||||
* (OPTIONAL) The message to show, if the user has not filled out all fields
|
||||
*/
|
||||
incompleteMessage?: string;
|
||||
|
||||
/**
|
||||
* The type of popup (i.e. what it is for)
|
||||
*/
|
||||
popupType: PopupType;
|
||||
|
||||
/**
|
||||
* (REQUIRED ONLY when popupType === 'input') The input fields to show
|
||||
*/
|
||||
data?: PopupData[];
|
||||
}
|
||||
|
||||
interface Data {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
import "@melloware/coloris/dist/coloris.css";
|
||||
import { ref, type Ref } from 'vue';
|
||||
import Coloris from '@melloware/coloris';
|
||||
|
||||
Coloris.init();
|
||||
|
||||
const isShowingPopup = ref( false );
|
||||
const transformOriginVertical = ref( '50% 50%' );
|
||||
const data: Ref<Data> = ref( {} );
|
||||
const isShowingIncomplete = ref( false );
|
||||
|
||||
const popupContent: Ref<PopupContent> = ref( {
|
||||
title: 'Undefined popup title',
|
||||
popupType: 'information',
|
||||
subtitle: 'This popup was not configured correctly during development. Please send a bug-report at <a href="https://support.janishutz.com/index.php?a=add&category=7" target="_blank">support.janishutz.com</a> and inform us about where exactly you encountered this popup! We are sorry for the inconvenience'
|
||||
} );
|
||||
|
||||
const closePopup = () => {
|
||||
isShowingPopup.value = false;
|
||||
Coloris.close();
|
||||
}
|
||||
|
||||
const closePopupReturn = () => {
|
||||
for ( let el in popupContent.value.data ) {
|
||||
if ( !data.value[ popupContent.value.data[ parseInt( el ) ].id ] ) {
|
||||
isShowingIncomplete.value = true;
|
||||
return;
|
||||
}
|
||||
},
|
||||
deselectTicket ( option ) {
|
||||
if ( this.data.options.count[ option ] > 0 ) {
|
||||
this.data.options.count[ option ] -= 1;
|
||||
}
|
||||
},
|
||||
submitTicket () {
|
||||
// eslint-disable-next-line no-undef
|
||||
$( '#popup-backdrop' ).fadeOut( 300 );
|
||||
this.$emit( 'ticket', { 'data': this.data.options.count, 'component': this.data.options.id } );
|
||||
},
|
||||
closePopupAdvanced ( message, data ) {
|
||||
this.data[ 'selected' ] = data;
|
||||
this.closePopup( message );
|
||||
},
|
||||
submitSettings () {
|
||||
// eslint-disable-next-line no-undef
|
||||
$( '#popup-backdrop' ).fadeOut( 300 );
|
||||
const dat = this.data.options;
|
||||
let ret = {};
|
||||
for ( let setting in dat ) {
|
||||
if ( dat[ setting ][ 'type' ] !== 'link' ) {
|
||||
ret[ setting ] = dat[ setting ][ 'value' ];
|
||||
}
|
||||
}
|
||||
this.$emit( 'data', { 'data': ret, 'status': 'settings' } );
|
||||
},
|
||||
openPopup ( message, options, dataType, selected ) {
|
||||
this.data = {
|
||||
'message': message ?? 'No message defined on method call!!',
|
||||
'options': options ?? { '1': { 'value': 'undefined', 'displayName': 'No options specified in call' } },
|
||||
'selected': selected ?? ''
|
||||
};
|
||||
this.contentType = dataType ?? 'string';
|
||||
// eslint-disable-next-line no-undef
|
||||
$( '#popup-backdrop' ).fadeIn( 300 );
|
||||
if ( dataType === 'code' ) {
|
||||
if ( options.lang === 'json' ) {
|
||||
this.data.options.code = beautify( options.code, null, 2, 50 );
|
||||
}
|
||||
setTimeout( () => {
|
||||
hljs.highlightAll();
|
||||
}, 200 );
|
||||
} else if ( dataType === 'editor' ) {
|
||||
setTimeout( () => {
|
||||
if ( !document.getElementById( 'quill-editor' ).classList.contains( 'ql-container' ) ) {
|
||||
this.editor = new Quill( '#quill-editor', {
|
||||
modules: { toolbar: '#quill-toolbar' },
|
||||
theme: 'snow',
|
||||
} );
|
||||
if ( this.data.selected === '' ) {
|
||||
this.data.selected = {};
|
||||
}
|
||||
setTimeout( () => {
|
||||
if ( selected.message ) {
|
||||
console.log( selected.message );
|
||||
document.getElementsByClassName( 'ql-editor' )[ 0 ].innerHTML = selected.message;
|
||||
}
|
||||
}, 500 );
|
||||
}
|
||||
}, 200 );
|
||||
}
|
||||
},
|
||||
copy() {
|
||||
const codeCopy = document.getElementById( 'code-copy' )
|
||||
codeCopy.innerHTML = 'Copied!';
|
||||
navigator.clipboard.writeText( this.data.options.code );
|
||||
setTimeout( () => {
|
||||
codeCopy.innerHTML = 'Copy';
|
||||
}, 2000 );
|
||||
}
|
||||
},
|
||||
};
|
||||
closePopup();
|
||||
if ( popupContent.value.popupType === 'confirmation' ) {
|
||||
emit( 'update', true );
|
||||
} else {
|
||||
emit( 'update', data.value );
|
||||
}
|
||||
}
|
||||
|
||||
const openPopup = ( popupConfig: PopupContent, transformOrigin?: string ) => {
|
||||
if ( transformOrigin ) {
|
||||
transformOriginVertical.value = transformOrigin;
|
||||
} else {
|
||||
transformOriginVertical.value = '50% 50%';
|
||||
}
|
||||
data.value = {};
|
||||
for ( let el in popupConfig.data ) {
|
||||
if ( !popupConfig.data[ parseInt( el ) ].id ) {
|
||||
console.warn( '[ popup ] Missing ID for input with name "' + popupConfig.data[ parseInt( el ) ].name + '"!' );
|
||||
} else if ( popupConfig.data[ parseInt( el ) ].dataType === 'colour' ) {
|
||||
Coloris( { el: '#colour-' + popupConfig.data[ parseInt( el ) ].id } );
|
||||
}
|
||||
}
|
||||
isShowingPopup.value = true;
|
||||
popupContent.value = popupConfig;
|
||||
}
|
||||
|
||||
defineExpose( {
|
||||
openPopup,
|
||||
} );
|
||||
|
||||
const emit = defineEmits( [ 'update' ] );
|
||||
</script>
|
||||
|
||||
|
||||
<style scoped>
|
||||
.message-iframe {
|
||||
width: 100%;
|
||||
height: 50vh;
|
||||
margin-top: 1%;
|
||||
}
|
||||
|
||||
pre {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
code {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#popup-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
.popup-backdrop {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: rgba( 0, 0, 0, 0.6 );
|
||||
display: none;
|
||||
}
|
||||
|
||||
.popup-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
background-color: var( --overlay-color );
|
||||
top: 0;
|
||||
left: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
transition: all 0.5s;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
#text-input {
|
||||
width: 90%;
|
||||
resize: vertical;
|
||||
.incomplete-message {
|
||||
color: red;
|
||||
font-weight: 300;
|
||||
font-style: italic;
|
||||
margin-top: 0;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.button-wrapper {
|
||||
width: 100%;
|
||||
margin-top: 3%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: row;
|
||||
.hidden {
|
||||
transform: scale(0);
|
||||
}
|
||||
|
||||
.close-wrapper {
|
||||
width: 100%;
|
||||
height: 5%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
margin-right: 1vw;
|
||||
margin-top: 2vw;
|
||||
font-size: 200%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.popup {
|
||||
border: none;
|
||||
.popup-main {
|
||||
width: 40%;
|
||||
height: 50%;
|
||||
background-color: var( --secondary-color );
|
||||
padding: 2.5%;
|
||||
border-radius: 20px;
|
||||
background-color: white;
|
||||
width: 90vw;
|
||||
height: 80vh;
|
||||
position: relative;
|
||||
overflow: scroll;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.popup-iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.close-icon {
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
font-size: 2rem;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.iframe-wrapper {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.message-container {
|
||||
height: 90%;
|
||||
width: 90%;
|
||||
margin-left: 5%;
|
||||
.popup-content {
|
||||
position: unset;
|
||||
height: 60%;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
.options {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
overflow: visible;
|
||||
min-height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.options .buttons {
|
||||
padding: 1% 2%;
|
||||
margin: 5px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.options .buttons:hover {
|
||||
background-color: darkgreen;
|
||||
}
|
||||
|
||||
.select-button-wrapper {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.select-button {
|
||||
background-color: rgba( 0, 0, 0, 0 ) !important;
|
||||
color: black !important;
|
||||
padding: 3vh 2vw !important;
|
||||
border: solid black 1px;
|
||||
border-radius: 5px;
|
||||
transition: all 0.5s ease-in-out;
|
||||
margin-bottom: 1vh;
|
||||
width: 90%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select-button:hover {
|
||||
background-color: gray !important;
|
||||
}
|
||||
|
||||
.controls {
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
border: solid var( --primary-color ) 1px;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 999px) {
|
||||
.small {
|
||||
width: 40%;
|
||||
height: 40%;
|
||||
}
|
||||
|
||||
.normal {
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
.big {
|
||||
width: 60%;
|
||||
height: 60%;
|
||||
}
|
||||
|
||||
.bigger {
|
||||
width: 70%;
|
||||
height: 70%;
|
||||
}
|
||||
|
||||
.huge {
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
}
|
||||
}
|
||||
|
||||
#quill-editor, #quill-toolbar {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
#quill-editor {
|
||||
min-height: 20vh;
|
||||
}
|
||||
|
||||
.editor-options {
|
||||
.textarea {
|
||||
width: 80%;
|
||||
resize: vertical;
|
||||
min-height: 30px;
|
||||
border-radius: 10px;
|
||||
border: solid var( --primary-color ) 1px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.input {
|
||||
padding: 5px;
|
||||
border-radius: 10px;
|
||||
border: solid var( --primary-color ) 1px;
|
||||
}
|
||||
|
||||
.popup-content-wrapper {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
/* https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_switch */
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 60px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 26px;
|
||||
width: 26px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 1px #2196F3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(26px);
|
||||
-ms-transform: translateX(26px);
|
||||
transform: translateX(26px);
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
@@ -136,7 +136,7 @@
|
||||
width: 100vw;
|
||||
left: 0;
|
||||
transition: all 1s;
|
||||
z-index: 2;
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
#search-bar.search-shown {
|
||||
|
||||
Reference in New Issue
Block a user