Skip to content

Instantly share code, notes, and snippets.

@yuyangchee98
Created March 4, 2024 13:27
Show Gist options
  • Save yuyangchee98/1dc49651895b9d4086c8e5622b56911b to your computer and use it in GitHub Desktop.
Save yuyangchee98/1dc49651895b9d4086c8e5622b56911b to your computer and use it in GitHub Desktop.
Read only logseq
// ==UserScript==
// @name Logseq view only
// @namespace http://tampermonkey.net/
// @version 2024-03-02
// @description view only mode by disabling keyboard and mouse, set as chrome new tab page to always view your logseq journal
// @author You
// @match https://demo.logseq.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
(function() {
'use strict';
document.addEventListener("keydown", handler, true);
function handler(e) {
e.stopPropagation();
e.preventDefault();
}
setTimeout(function() { document.getElementsByClassName('ui__button inline-flex items-center justify-center whitespace-nowrap text-sm gap-1 font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 select-none bg-primary/90 hover:bg-primary/100 active:opacity-90 text-primary-foreground hover:text-primary-foreground as-classic h-7 rounded px-3 py-1 ui__modal-enter')[0].click(); }, 500);
setTimeout(function() { document.getElementsByClassName('item group flex items-center p-2 text-sm font-medium rounded-md')[0].click(); }, 700);
setTimeout(function() { document.querySelector('[title="Import changes from local files"]').click(); }, 1000);
setTimeout(function() { document.getElementsByClassName('ui__button inline-flex items-center justify-center whitespace-nowrap text-sm gap-1 font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 select-none bg-primary/90 hover:bg-primary/100 active:opacity-90 text-primary-foreground hover:text-primary-foreground as-classic h-7 rounded px-3 py-1 ui__modal-enter')[0].click(); }, 1200);
setTimeout(function() { document.addEventListener("click", handler, true);}, 1500);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment