2019-12-20 05:50:50 +00:00
|
|
|
<style scoped>
|
|
|
|
.slotholder {
|
|
|
|
height: 100vh;
|
2022-02-25 02:33:49 +00:00
|
|
|
width: 180px;
|
2019-12-20 05:50:50 +00:00
|
|
|
display: block;
|
|
|
|
float: left;
|
2022-09-25 17:17:41 +00:00
|
|
|
overflow: hidden;
|
2019-12-20 05:50:50 +00:00
|
|
|
}
|
|
|
|
.global-menu {
|
2022-02-25 02:33:49 +00:00
|
|
|
width: 180px;
|
2021-12-18 22:18:22 +00:00
|
|
|
/* background: #221f2b; */
|
2019-12-20 05:50:50 +00:00
|
|
|
background: #221f2b;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
box-sizing: border-box;
|
|
|
|
display: block;
|
|
|
|
position: fixed;
|
|
|
|
z-index: 111;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
bottom: 0;
|
|
|
|
}
|
2020-03-26 04:45:23 +00:00
|
|
|
.menu-logo-display {
|
2020-07-07 04:04:55 +00:00
|
|
|
width: 27px;
|
2022-02-25 02:33:49 +00:00
|
|
|
margin: 5px 0 0 55px;
|
2020-03-26 04:45:23 +00:00
|
|
|
display: inline-block;
|
2020-07-07 04:04:55 +00:00
|
|
|
height: auto;
|
2020-03-26 04:45:23 +00:00
|
|
|
}
|
2019-12-20 05:50:50 +00:00
|
|
|
|
|
|
|
.menu-item {
|
|
|
|
color: #fff;
|
2020-06-07 20:57:35 +00:00
|
|
|
padding: 9px 10px;
|
2019-12-20 05:50:50 +00:00
|
|
|
display: inline-block;
|
|
|
|
width: 100%;
|
2020-06-07 20:57:35 +00:00
|
|
|
font-size: 1.1em;
|
2019-12-20 05:50:50 +00:00
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
2020-02-01 22:21:22 +00:00
|
|
|
.menu-item i.icon {
|
|
|
|
margin-right: 10px;
|
|
|
|
}
|
2019-12-20 05:50:50 +00:00
|
|
|
.sub {
|
|
|
|
padding-left: 20px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.menu-section {}
|
|
|
|
.menu-section + .menu-section {
|
2021-12-18 22:18:22 +00:00
|
|
|
/* border-top: 1px solid #534c68; */
|
|
|
|
border-top: 1px solid #534c68e3;
|
2019-12-20 05:50:50 +00:00
|
|
|
}
|
|
|
|
.menu-button {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.menu-button:hover {
|
|
|
|
background-color: #534c68;
|
2020-02-01 22:21:22 +00:00
|
|
|
text-decoration: none;
|
2019-12-20 05:50:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.router-link-active {
|
|
|
|
background-color: #534c68;
|
|
|
|
}
|
|
|
|
|
|
|
|
.shade {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
background-color: rgba(0,0,0,0.7);
|
|
|
|
z-index: 100;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.top-menu-bar {
|
2020-01-03 01:26:55 +00:00
|
|
|
/*color: var(--text_color);*/
|
|
|
|
/*width: 100%;*/
|
|
|
|
position: fixed;
|
2021-12-18 22:18:22 +00:00
|
|
|
bottom: 0;
|
2020-01-03 01:26:55 +00:00
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
z-index: 999;
|
2020-06-07 20:57:35 +00:00
|
|
|
background-color: var(--small_element_bg_color);
|
2020-07-07 04:04:55 +00:00
|
|
|
/*padding: 5px 1rem 5px;*/
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-around;
|
2020-08-03 02:40:27 +00:00
|
|
|
width: 100vw;
|
2021-12-18 22:18:22 +00:00
|
|
|
border-top: 1px solid var(--dark_border_color);
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
2020-01-03 01:26:55 +00:00
|
|
|
}
|
|
|
|
.place-holder {
|
|
|
|
width: 100%;
|
2021-12-18 22:18:22 +00:00
|
|
|
/*height: 40px;*/
|
|
|
|
height: 0;
|
2019-12-20 05:50:50 +00:00
|
|
|
}
|
2020-07-07 04:04:55 +00:00
|
|
|
.logo-display {
|
|
|
|
width: 27px;
|
|
|
|
height: auto;
|
2019-12-20 05:50:50 +00:00
|
|
|
}
|
2020-04-10 03:47:15 +00:00
|
|
|
.version-display {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: -20px;
|
|
|
|
right: 0;
|
|
|
|
height: 30px;
|
|
|
|
padding: 5px 0;
|
|
|
|
text-align: center;
|
|
|
|
color: #8c80ae;
|
|
|
|
cursor: pointer;
|
2022-09-25 17:17:41 +00:00
|
|
|
background-color: var(--menu-background);
|
2020-04-10 03:47:15 +00:00
|
|
|
}
|
2019-12-20 05:50:50 +00:00
|
|
|
|
2020-07-07 04:04:55 +00:00
|
|
|
.mobile-button {
|
2021-12-18 22:18:22 +00:00
|
|
|
padding: 5px 0 0;
|
|
|
|
margin: 0;
|
2020-07-07 04:04:55 +00:00
|
|
|
cursor: pointer;
|
2021-12-18 22:18:22 +00:00
|
|
|
font-size: 0.6em;
|
|
|
|
color: var(--menu-text);
|
|
|
|
text-align: center;
|
|
|
|
flex-basis: 100%;
|
|
|
|
line-height: 1.8em;
|
2020-07-07 04:04:55 +00:00
|
|
|
}
|
2021-12-18 22:18:22 +00:00
|
|
|
.mobile-button + .mobile-button {
|
|
|
|
border-left: 1px solid var(--dark_border_color);
|
2020-07-07 04:04:55 +00:00
|
|
|
}
|
|
|
|
.mobile-button i {
|
2021-12-18 22:18:22 +00:00
|
|
|
font-size: 2em;
|
|
|
|
margin: 0 auto;
|
|
|
|
padding: 0;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
.mobile-button svg {
|
|
|
|
margin: 0 46% 0;
|
|
|
|
display: inline-block;
|
|
|
|
width: 15px;
|
|
|
|
}
|
|
|
|
.mobile-button:active, .mobile-button:focus, .mobile-button:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
.mobile-button.active {
|
|
|
|
background-color: transparent;
|
2020-07-07 04:04:55 +00:00
|
|
|
}
|
2022-02-25 02:33:49 +00:00
|
|
|
.single-line-text {
|
|
|
|
width: calc(100%);
|
|
|
|
/*margin: 5px 10px;*/
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
.faded {
|
|
|
|
color: var(--dark_border_color);
|
|
|
|
}
|
2020-07-07 04:04:55 +00:00
|
|
|
|
2019-12-20 05:50:50 +00:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
2020-01-03 01:26:55 +00:00
|
|
|
|
|
|
|
<div class="place-holder" v-if="collapsed && !menuOpen"></div>
|
|
|
|
|
2019-12-20 05:50:50 +00:00
|
|
|
<!-- collapsed menu, appears as a bar -->
|
2020-01-03 01:26:55 +00:00
|
|
|
<div class="top-menu-bar" v-if="(collapsed || mobile) && !menuOpen">
|
|
|
|
|
2021-12-18 22:18:22 +00:00
|
|
|
<!-- logo -->
|
|
|
|
<router-link v-if="loggedIn" class="mobile-button" exact-active-class="active" to="/notes" v-on:click.native="emitReloadEvent()">
|
|
|
|
<logo class="logo-display" color="var(--main-accent)" />
|
|
|
|
Notes
|
|
|
|
</router-link>
|
|
|
|
|
|
|
|
<!-- new note -->
|
|
|
|
<div v-if="loggedIn" class="mobile-button">
|
|
|
|
<span v-if="!disableNewNote" @click="createNote">
|
|
|
|
<i class="green plus icon"></i>
|
|
|
|
New Note
|
|
|
|
</span>
|
|
|
|
<span v-if="disableNewNote">
|
|
|
|
<i class="grey plus icon"></i>
|
|
|
|
Working
|
|
|
|
</span>
|
2020-07-07 04:04:55 +00:00
|
|
|
</div>
|
2020-02-01 22:21:22 +00:00
|
|
|
|
2020-07-14 05:31:02 +00:00
|
|
|
<!-- open straight to note -->
|
|
|
|
<router-link
|
|
|
|
v-if="loggedIn && $store.getters.totals && $store.getters.totals['quickNote']"
|
|
|
|
exact-active-class="active"
|
|
|
|
class="mobile-button"
|
|
|
|
:to="`/notes/open/${$store.getters.totals['quickNote']}`">
|
2020-07-07 04:04:55 +00:00
|
|
|
<i class="green sticky note outline icon"></i>
|
2021-12-18 22:18:22 +00:00
|
|
|
Scratch Pad
|
2020-07-07 04:04:55 +00:00
|
|
|
</router-link>
|
2020-07-14 05:31:02 +00:00
|
|
|
|
|
|
|
<!-- create new and redirect to new note id -->
|
|
|
|
<a
|
|
|
|
v-if="loggedIn && $store.getters.totals && !$store.getters.totals['quickNote']"
|
|
|
|
v-on:click="newQuickNote()"
|
|
|
|
exact-active-class="active"
|
|
|
|
class="mobile-button">
|
|
|
|
<i class="green sticky note outline icon"></i>
|
2021-12-18 22:18:22 +00:00
|
|
|
Scratch Pad
|
2020-07-14 05:31:02 +00:00
|
|
|
</a>
|
2020-03-26 04:45:23 +00:00
|
|
|
|
|
|
|
|
2020-07-07 04:04:55 +00:00
|
|
|
<router-link v-if="loggedIn" class="mobile-button" exact-active-class="active" to="/attachments">
|
|
|
|
<i class="green open folder outline icon"></i>
|
2021-12-18 22:18:22 +00:00
|
|
|
Files
|
2020-07-07 04:04:55 +00:00
|
|
|
</router-link>
|
2020-03-26 04:45:23 +00:00
|
|
|
|
2021-12-18 22:18:22 +00:00
|
|
|
<!-- menu -->
|
2022-02-25 02:33:49 +00:00
|
|
|
<div class="mobile-button" v-on:click="collapseMenu">
|
|
|
|
<i class="green link bars icon" ></i>
|
2021-12-18 22:18:22 +00:00
|
|
|
Menu
|
|
|
|
</div>
|
2020-01-03 01:26:55 +00:00
|
|
|
|
2020-03-26 04:45:23 +00:00
|
|
|
|
2019-12-20 05:50:50 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="shade" v-if="mobile && !collapsed" v-on:click="collapseMenu"></div>
|
|
|
|
|
|
|
|
<div class="slotholder" v-if="!collapsed && !mobile">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="global-menu" v-if="!collapsed" v-on:click="menuClicked">
|
|
|
|
|
2020-03-26 04:45:23 +00:00
|
|
|
<div class="menu-section" v-on:click="collapseMenu">
|
2020-07-14 05:31:02 +00:00
|
|
|
<i class="white angle left icon"></i>
|
|
|
|
<logo class="menu-logo-display" color="var(--main-accent)" />
|
2019-12-20 05:50:50 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="menu-section" v-if="loggedIn">
|
|
|
|
<div v-if="!disableNewNote" @click="createNote" class="menu-item menu-item menu-button">
|
2022-02-25 02:33:49 +00:00
|
|
|
<div class="ui green fluid compact button">
|
2020-04-10 03:47:15 +00:00
|
|
|
<i class="plus icon"></i>New Note
|
|
|
|
</div>
|
2019-12-20 05:50:50 +00:00
|
|
|
</div>
|
|
|
|
<div v-if="disableNewNote" class="menu-item menu-item menu-button">
|
2022-02-25 02:33:49 +00:00
|
|
|
<div class="ui basic fluid compact button">
|
2020-04-10 03:47:15 +00:00
|
|
|
<i class="plus loading icon"></i>New Note
|
|
|
|
</div>
|
2019-12-20 05:50:50 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-05-20 07:57:15 +00:00
|
|
|
<div class="menu-section" v-if="loggedIn">
|
2020-01-03 01:26:55 +00:00
|
|
|
<router-link exact-active-class="active" class="menu-item menu-button" to="/notes" v-on:click.native="emitReloadEvent()">
|
2020-02-11 06:05:28 +00:00
|
|
|
<i class="file outline icon"></i>Notes
|
2020-05-20 07:57:15 +00:00
|
|
|
<counter v-if="$store.getters.totals && $store.getters.totals['totalNotes']" class="float-right" number-id="totalNotes" />
|
2019-12-20 05:50:50 +00:00
|
|
|
</router-link>
|
|
|
|
<div>
|
2020-06-07 20:57:35 +00:00
|
|
|
<div class="menu-item menu-button sub" v-on:click="updateFastFilters(3)" v-if="$store.getters.totals && ($store.getters.totals['sharedToNotes'] > 0 || $store.getters.totals['sharedFromNotes'] > 0)">
|
2022-02-25 02:33:49 +00:00
|
|
|
<i class="grey paper plane outline icon"></i>Shared
|
|
|
|
|
|
|
|
<counter v-if="$store.getters.totals && $store.getters.totals['sharedToNotes']" class="float-right" number-id="sharedToNotes" />
|
2020-06-07 20:57:35 +00:00
|
|
|
</div>
|
|
|
|
<div class="menu-item menu-button sub" v-on:click="updateFastFilters(2)" v-if="$store.getters.totals && $store.getters.totals['archivedNotes'] > 0">
|
|
|
|
<i class="grey archive icon"></i>Archived
|
2022-02-25 02:33:49 +00:00
|
|
|
|
|
|
|
<counter v-if="$store.getters.totals && $store.getters.totals['archivedNotes']" class="float-right" number-id="archivedNotes" />
|
2020-06-07 20:57:35 +00:00
|
|
|
</div>
|
|
|
|
<div class="menu-item menu-button sub" v-on:click="updateFastFilters(4)" v-if="$store.getters.totals && $store.getters.totals['trashedNotes'] > 0">
|
|
|
|
<i class="grey trash alternate outline icon"></i>Trashed
|
2022-02-25 02:33:49 +00:00
|
|
|
|
|
|
|
<counter v-if="$store.getters.totals && $store.getters.totals['trashedNotes']" class="float-right" number-id="trashedNotes" />
|
2020-06-07 20:57:35 +00:00
|
|
|
</div>
|
2020-02-01 22:21:22 +00:00
|
|
|
<!-- <div class="menu-item sub">Show Only <i class="caret down icon"></i></div> -->
|
|
|
|
<!-- <div v-on:click="updateFastFilters(0)" class="menu-item menu-button sub"><i class="grey linkify icon"></i>Links</div> -->
|
|
|
|
<!-- <div v-on:click="updateFastFilters(1)" class="menu-item menu-button sub"><i class="grey tags icon"></i>Tags</div> -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-02-11 21:11:14 +00:00
|
|
|
<div class="menu-section" v-if="loggedIn && $store.getters.totals && $store.getters.totals['totalFiles']">
|
2019-12-20 05:50:50 +00:00
|
|
|
<router-link class="menu-item menu-button" exact-active-class="active" to="/attachments">
|
2020-02-23 06:27:49 +00:00
|
|
|
<i class="open folder outline icon"></i>Files
|
2020-02-14 01:08:46 +00:00
|
|
|
<counter class="float-right" number-id="totalFiles" />
|
2019-12-20 05:50:50 +00:00
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
|
2020-05-15 23:12:09 +00:00
|
|
|
<div class="menu-section" v-if="loggedIn">
|
2020-07-14 05:31:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
<!-- open straight to note -->
|
|
|
|
<router-link
|
|
|
|
v-if="loggedIn && $store.getters.totals && $store.getters.totals['quickNote']"
|
|
|
|
exact-active-class="active"
|
|
|
|
class="menu-item menu-button"
|
|
|
|
:to="`/notes/open/${$store.getters.totals['quickNote']}`">
|
2020-05-15 23:12:09 +00:00
|
|
|
<i class="sticky note outline icon"></i>Scratch Pad
|
2019-12-20 05:50:50 +00:00
|
|
|
</router-link>
|
2020-07-14 05:31:02 +00:00
|
|
|
|
|
|
|
<!-- create new and redirect to new note id -->
|
|
|
|
<a
|
|
|
|
v-if="loggedIn && $store.getters.totals && !$store.getters.totals['quickNote']"
|
|
|
|
v-on:click="newQuickNote()"
|
|
|
|
exact-active-class="active"
|
|
|
|
class="menu-item menu-button">
|
|
|
|
<i class="sticky note outline icon"></i>Scratch Pad
|
|
|
|
</a>
|
|
|
|
|
2020-05-15 23:12:09 +00:00
|
|
|
</div>
|
2019-12-20 05:50:50 +00:00
|
|
|
|
|
|
|
<div class="menu-section" v-if="!loggedIn">
|
|
|
|
<router-link v-if="!loggedIn" class="menu-item menu-button" exact-active-class="active" to="/">
|
|
|
|
<i class="home icon"></i>Welcome
|
|
|
|
</router-link>
|
|
|
|
|
|
|
|
<router-link exact-active-class="active" class="menu-item menu-button" to="/login">
|
|
|
|
<i class="plug icon"></i>Login
|
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="menu-section">
|
|
|
|
<div v-on:click="toggleNightMode" class="menu-item menu-button">
|
2020-05-15 23:12:09 +00:00
|
|
|
<span v-if="$store.getters.getIsNightMode == 0">
|
|
|
|
<i class="moon outline icon"></i>Black Theme</span>
|
|
|
|
<span v-if="$store.getters.getIsNightMode == 1">
|
2020-02-01 22:21:22 +00:00
|
|
|
<i class="moon outline icon"></i>Light Theme</span>
|
2019-12-20 05:50:50 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-04-10 03:47:15 +00:00
|
|
|
<div class="menu-section">
|
|
|
|
<router-link class="menu-item menu-button" exact-active-class="active" to="/help">
|
2020-07-23 05:00:20 +00:00
|
|
|
<i class="question circle outline icon"></i>Help
|
2020-04-10 03:47:15 +00:00
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
|
2020-07-23 05:00:20 +00:00
|
|
|
<div class="menu-section" v-if="loggedIn">
|
2020-07-07 04:04:55 +00:00
|
|
|
<router-link class="menu-item menu-button" exact-active-class="active" to="/settings">
|
2020-08-03 02:40:27 +00:00
|
|
|
<i class="cog icon"></i>Settings
|
2020-07-07 04:04:55 +00:00
|
|
|
</router-link>
|
2020-04-10 03:47:15 +00:00
|
|
|
</div>
|
|
|
|
|
2020-08-03 02:40:27 +00:00
|
|
|
<div class="menu-section" v-if="loggedIn">
|
|
|
|
<div class="menu-item menu-button" v-on:click="logout()">
|
|
|
|
<i class="log out icon"></i>Log Out
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-10 03:47:15 +00:00
|
|
|
|
2022-02-25 02:33:49 +00:00
|
|
|
<!-- Tags -->
|
|
|
|
<div class="menu-section" v-if="gotTags()">
|
|
|
|
<div class="menu-item">
|
|
|
|
<i class="green tags icon"></i>
|
|
|
|
Tags
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div v-if="gotTags()">
|
|
|
|
<div class="menu-section"
|
|
|
|
v-for="(data, tag) in $store.getters.totals['tags']">
|
|
|
|
<router-link class="menu-item menu-button" :to="`/search/tags/${tag}`">
|
|
|
|
<span class="single-line-text">
|
|
|
|
<!-- <i class="small grey tag icon"></i> -->
|
|
|
|
<span class="float-right">{{ data.uses }}</span>
|
|
|
|
<span class="faded"> #</span> {{ tag }}</span>
|
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-06-15 09:02:20 +00:00
|
|
|
<div v-on:click="reloadPage" class="version-display" v-if="version != 0" >
|
2020-04-10 03:47:15 +00:00
|
|
|
<i :class="`${getVersionIcon()} icon`"></i> {{ version }}
|
|
|
|
</div>
|
2019-12-20 05:50:50 +00:00
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import axios from 'axios'
|
|
|
|
|
|
|
|
export default {
|
2020-01-03 01:26:55 +00:00
|
|
|
components: {
|
|
|
|
'search-input': require('@/components/SearchInput.vue').default,
|
2020-02-14 01:08:46 +00:00
|
|
|
'counter':require('@/components/AnimatedCounterComponent.vue').default,
|
2020-07-07 04:04:55 +00:00
|
|
|
'logo':require('@/components/LogoComponent.vue').default,
|
2020-01-03 01:26:55 +00:00
|
|
|
},
|
2019-12-20 05:50:50 +00:00
|
|
|
data: function(){
|
|
|
|
return {
|
2020-06-15 09:02:20 +00:00
|
|
|
version: '0',
|
2019-12-20 05:50:50 +00:00
|
|
|
username: '',
|
|
|
|
collapsed: false,
|
|
|
|
mobile: false,
|
2020-01-03 01:26:55 +00:00
|
|
|
disableNewNote: false,
|
|
|
|
menuOpen: true,
|
2020-03-02 05:33:49 +00:00
|
|
|
userIcon: true,
|
2020-07-07 04:04:55 +00:00
|
|
|
resizeDebounce: null,
|
2019-12-20 05:50:50 +00:00
|
|
|
}
|
|
|
|
},
|
2020-07-07 04:04:55 +00:00
|
|
|
beforeMount(){
|
|
|
|
window.addEventListener('resize', this.resizeEventHandler)
|
|
|
|
},
|
|
|
|
beforeDestroy(){
|
|
|
|
window.removeEventListener('resize', this.resizeEventHandler)
|
2019-12-20 05:50:50 +00:00
|
|
|
},
|
|
|
|
mounted: function(){
|
|
|
|
this.mobile = this.$store.getters.getIsUserOnMobile
|
|
|
|
this.collapsed = this.$store.getters.getIsUserOnMobile
|
2020-01-03 01:26:55 +00:00
|
|
|
|
|
|
|
if(this.mobile){
|
|
|
|
this.menuOpen = false
|
|
|
|
}
|
2020-02-23 06:27:49 +00:00
|
|
|
|
|
|
|
if(this.loggedIn){
|
|
|
|
this.$store.dispatch('fetchAndUpdateUserTotals')
|
2020-06-15 09:02:20 +00:00
|
|
|
this.version = localStorage.getItem('currentVersion')
|
2020-02-23 06:27:49 +00:00
|
|
|
}
|
2020-07-14 05:31:02 +00:00
|
|
|
|
|
|
|
this.resizeEventHandler() //Trigger resize event
|
2020-02-10 17:44:43 +00:00
|
|
|
|
2019-12-20 05:50:50 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
loggedIn () {
|
|
|
|
//Map logged in from state
|
|
|
|
return this.$store.getters.getLoggedIn
|
2020-03-02 05:33:49 +00:00
|
|
|
},
|
2019-12-20 05:50:50 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2022-02-25 02:33:49 +00:00
|
|
|
gotTags(){
|
|
|
|
|
|
|
|
if(this.loggedIn && this.$store.getters.totals && this.$store.getters.totals.tags
|
|
|
|
&& Object.keys(this.$store.getters.totals.tags).length
|
|
|
|
){
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
},
|
2020-08-03 02:40:27 +00:00
|
|
|
logout() {
|
|
|
|
|
|
|
|
this.$router.push('/')
|
|
|
|
axios.post('/api/user/logout')
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
this.$store.commit('destroyLoginToken')
|
|
|
|
this.$bus.$emit('notification', 'Logged Out')
|
|
|
|
}, 200)
|
|
|
|
},
|
2020-07-14 05:31:02 +00:00
|
|
|
newQuickNote(){
|
|
|
|
|
|
|
|
axios.post('/api/quick-note/get')
|
|
|
|
.then( ({data}) => {
|
|
|
|
|
|
|
|
this.$router.push({'path':'/notes/open/'+data.noteId})
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
2020-07-07 04:04:55 +00:00
|
|
|
resizeEventHandler(e) {
|
|
|
|
clearTimeout(this.resizeDebounce)
|
|
|
|
this.resizeDebounce = setTimeout(() => {
|
|
|
|
|
2020-07-14 05:31:02 +00:00
|
|
|
this.mobile = false
|
2020-07-07 04:04:55 +00:00
|
|
|
this.menuOpen = false
|
|
|
|
this.collapsed = false
|
|
|
|
|
|
|
|
if(window.innerWidth < 700){
|
|
|
|
|
|
|
|
this.collapsed = true
|
2020-07-14 05:31:02 +00:00
|
|
|
this.mobile = true
|
|
|
|
|
2020-07-07 04:04:55 +00:00
|
|
|
}
|
|
|
|
}, 100)
|
|
|
|
},
|
2019-12-20 05:50:50 +00:00
|
|
|
menuClicked(){
|
|
|
|
//Collapse menu when item is clicked in mobile
|
|
|
|
if(this.mobile && !this.collapsed){
|
|
|
|
this.collapsed = true
|
2020-01-03 01:26:55 +00:00
|
|
|
this.menuOpen = false
|
2019-12-20 05:50:50 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
collapseMenu(){
|
|
|
|
this.collapsed = !this.collapsed
|
2020-01-03 01:26:55 +00:00
|
|
|
|
|
|
|
if(!this.collapsed){
|
|
|
|
this.menuOpen = true
|
|
|
|
} else {
|
|
|
|
this.menuOpen = false
|
|
|
|
}
|
|
|
|
|
2019-12-20 05:50:50 +00:00
|
|
|
},
|
|
|
|
createNote(event){
|
2020-07-07 04:04:55 +00:00
|
|
|
|
2019-12-20 05:50:50 +00:00
|
|
|
this.disableNewNote = true
|
|
|
|
|
2020-07-07 04:04:55 +00:00
|
|
|
axios.post('/api/note/create', {title:''})
|
2019-12-20 05:50:50 +00:00
|
|
|
.then(response => {
|
|
|
|
|
|
|
|
if(response.data && response.data.id){
|
2020-07-07 04:04:55 +00:00
|
|
|
|
|
|
|
//Push new note to url and it will open
|
|
|
|
this.$router.push('/notes/open/'+response.data.id)
|
|
|
|
|
2019-12-20 05:50:50 +00:00
|
|
|
this.disableNewNote = false
|
|
|
|
}
|
|
|
|
})
|
2020-04-14 05:09:19 +00:00
|
|
|
.catch(error => { this.$bus.$emit('notification', 'Failed to create note') })
|
2019-12-20 05:50:50 +00:00
|
|
|
},
|
|
|
|
toggleNightMode(){
|
|
|
|
this.$store.commit('toggleNightMode')
|
|
|
|
},
|
|
|
|
ucWords(str){
|
|
|
|
return (str + '')
|
|
|
|
.replace(/^(.)|\s+(.)/g, function ($1) {
|
|
|
|
return $1.toUpperCase()
|
|
|
|
})
|
|
|
|
},
|
2020-01-03 01:26:55 +00:00
|
|
|
emitReloadEvent(){
|
|
|
|
//Reloads note page to initial state
|
|
|
|
this.$bus.$emit('note_reload')
|
|
|
|
},
|
2020-06-07 20:57:35 +00:00
|
|
|
updateFastFilters(filterIndex){
|
2019-12-20 05:50:50 +00:00
|
|
|
|
|
|
|
//A little hacky, brings user to notes page then filters on click
|
2020-06-07 20:57:35 +00:00
|
|
|
if(this.$route.name != 'Note Page'){
|
2019-12-20 05:50:50 +00:00
|
|
|
this.$router.push('/notes')
|
|
|
|
setTimeout( () => {
|
2020-06-07 20:57:35 +00:00
|
|
|
this.$bus.$emit('update_fast_filters', filterIndex)
|
2019-12-20 05:50:50 +00:00
|
|
|
}, 500 )
|
2020-06-07 20:57:35 +00:00
|
|
|
} else {
|
|
|
|
this.$bus.$emit('update_fast_filters', filterIndex)
|
2019-12-20 05:50:50 +00:00
|
|
|
}
|
2020-04-10 03:47:15 +00:00
|
|
|
},
|
|
|
|
reloadPage(){
|
|
|
|
location.reload(true)
|
|
|
|
},
|
|
|
|
getVersionIcon(){
|
2020-07-03 03:25:38 +00:00
|
|
|
const icons = ['cat','crow','dog','dove','dragon','fish','frog','hippo','horse','kiwi bird','otter','spider', 'smile', 'robot', 'hat wizard', 'microchip', 'atom', 'grin tongue squint', 'radiation', 'ghost', 'dna', 'burn', 'brain', 'moon', 'torii gate']
|
2020-04-10 03:47:15 +00:00
|
|
|
const index = ( parseInt(this.version.replace(/\./g,'')) % (icons.length))
|
|
|
|
return icons[index]
|
|
|
|
|
2019-12-20 05:50:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|