Skip to content

Instantly share code, notes, and snippets.

@imyelo
Last active June 7, 2024 11:36
Show Gist options
  • Save imyelo/7a560234ed1227028053ebe18342ac62 to your computer and use it in GitHub Desktop.
Save imyelo/7a560234ed1227028053ebe18342ac62 to your computer and use it in GitHub Desktop.
UserScript - LogSeq Print Mode
// ==UserScript==
// @name LogSeq Print Mode
// @description Logseq 打印模式
// @version 0.2
// @author yelo <zhihuzeye@gmail.com>
// @match https://**/**
// @grant GM_registerMenuCommand
// @run-at document-start
// @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js
// ==/UserScript==
/* global $ */
(function() {
'use strict';
const clean = () => {
$("html").css("overflow", "auto");
$("#head").remove();
$("#left-sidebar").remove();
$("#main-content").removeClass("is-left-sidebar-open");
$("#left-container").css("height", "auto");
$('.block-content img').css('max-width', 400);
};
GM_registerMenuCommand(
"进入打印模式",
async () => {
clean();
},
{
accessKey: "p",
autoClose: true,
}
);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment