Giter Site home page Giter Site logo

Comments (8)

Nriver avatar Nriver commented on June 17, 2024

这个是根据浏览器的User Agent来判断是桌面还是手机,然后写入cookie。
只要cookie里面 trilium-device=mobile 就是移动版界面, trilium-device=desktop就是桌面版界面。

from trilium-translation.

Nriver avatar Nriver commented on June 17, 2024

写了一个简单的js, 移动端打开页面时设置cookie, 这样一直都是桌面版界面

always desktop mode.zip

from trilium-translation.

X-Bruce-Y avatar X-Bruce-Y commented on June 17, 2024

大佬666。
我试了一下,手机端登录之后似乎需要刷新一次这个脚本才会生效(已设置#run=mobileStartup,用的edge浏览器已清除旧cookie),这个是浏览器或者我的server的问题吗?
还有一个小白问题,就是我希望能够在手机端登录、用你的脚本自动切换到桌面端后,自动Toggle Mobile View,从而节省一次点击也少占一个launcher,但是这个脚本SetHTMLMetaSetNoteView我设置了#run=mobileStartup后好像也没有生效(刷新网页后没有生效),是我哪里弄错了吗?

from trilium-translation.

Nriver avatar Nriver commented on June 17, 2024

把那些js代码复制到我那个js下面试试

from trilium-translation.

X-Bruce-Y avatar X-Bruce-Y commented on June 17, 2024

我把来自Toggle Mobile Vew的相关代码复制到了你的always desktop mod下方:

var viewport = document.createElement('meta');
viewport.name = 'viewport';
viewport.content = 'width=device-width, initial-scale=1.0'
document.head.appendChild(viewport);

$('body').toggleClass("mobile-view");
$('body').attr("current-view", "sidebar");

并且把相关原js笔记都设置为了#disabled:run,但好像没有效果。还有需要刷新才能进入桌面版的问题,要是没有直接的解决方案就先搁置算了,以后我慢慢钻研

from trilium-translation.

X-Bruce-Y avatar X-Bruce-Y commented on June 17, 2024

Mobile View问题解决了!原来是应该用#run=frontendStartup而非mobileStartup,因为你的操作生效之后实际上就是桌面版了。然后我在想不管出于什么原因导致我需要刷新一次你的脚本才能生效,有没有api可以直接实现reloadFrontendApp的好加在你的代码最后,相当于直接自动刷新一次?

from trilium-translation.

Nriver avatar Nriver commented on June 17, 2024

直接刷新整个页面?

location.reload();

from trilium-translation.

X-Bruce-Y avatar X-Bruce-Y commented on June 17, 2024

直接刷新整个页面?

location.reload();

有效!谢谢佬

from trilium-translation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.