mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
"switch to desktop version" button
This commit is contained in:
parent
78d9fac1e6
commit
f6db9a50ab
@ -9,6 +9,7 @@ import server from "./server.js";
|
||||
import promptDialog from "../dialogs/prompt.js";
|
||||
import ContextMenuItemsContainer from "./context_menu_items_container.js";
|
||||
import treeChangesService from "./branches.js";
|
||||
import utils from "./utils.js";
|
||||
|
||||
const $leftPane = $("#left-pane");
|
||||
const $tree = $("#tree");
|
||||
@ -111,7 +112,9 @@ $("#global-actions-button").click(async e => {
|
||||
|
||||
contextMenuWidget.initContextMenu(e, itemsContainer, (event, cmd) => {
|
||||
if (cmd === "switch-to-desktop") {
|
||||
alert("switch to desktop");
|
||||
utils.setCookie('trilium-device', 'desktop');
|
||||
|
||||
utils.reloadApp();
|
||||
}
|
||||
else if (cmd === 'log-out') {
|
||||
$("#logout-form").submit();
|
||||
|
@ -153,6 +153,13 @@ function isDesktop() {
|
||||
return window.device === "desktop";
|
||||
}
|
||||
|
||||
function setCookie(name, value) {
|
||||
const date = new Date(Date.now() + 10 * 365 * 24 * 60 * 60 * 1000);
|
||||
const expires = "; expires=" + date.toUTCString();
|
||||
|
||||
document.cookie = name + "=" + (value || "") + expires + "; path=/";
|
||||
}
|
||||
|
||||
export default {
|
||||
reloadApp,
|
||||
parseDate,
|
||||
@ -178,5 +185,6 @@ export default {
|
||||
randomString,
|
||||
bindShortcut,
|
||||
isMobile,
|
||||
isDesktop
|
||||
isDesktop,
|
||||
setCookie
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user