油猴脚本
以下是最简易的一个脚本,在<head>
当中插入script。
javascript
// ==UserScript== // @name Notion Custom Script // @namespace none // @version 0.1 // @description Inject custom script into Notion pages // @match https://notion.so/* // @match https://www.notion.so/* // @grant none // ==/UserScript== (function() { 'use strict'; // Your custom script here var customScript = document.createElement('script'); customScript.textContent = ` // Your custom JavaScript code here console.log('油猴脚本 => Notion 笔记'); `; document.head.appendChild(customScript); })();
易学排盘
通过油猴脚本实现在Notion笔记中,显示易学卦。
// ==UserScript== // @name Notion Custom Script // @namespace none // @version 0.1 // @description Inject custom script into Notion pages // @match https://notion.so/* // @match https://www.notion.so/* // @grant none // ==/UserScript== (function() { 'use strict'; // Create a <script> element for KaTeX var katexScript = document.createElement('script'); katexScript.type = 'text/javascript'; katexScript.src = 'http://mysite.com/katex.min.js'; katexScript.charset = 'utf-8'; katexScript.defer = true; // Append the <script> element to the <head> var head = document.getElementsByTagName('head')[0]; head.appendChild(katexScript); })();