// ==UserScript== // @name 知乎公式复制LaTeX // @namespace https://jasongzy.com // @version 0.2 // @description 在知乎中直接复制公式即可得到对应的LaTeX代码 // @author jasongzy // @match https://www.zhihu.com/question/* // @match https://zhuanlan.zhihu.com/p/* // @icon https://www.google.com/s2/favicons?domain=zhihu.com // @grant none // @downloadURL none // ==/UserScript== (window.onload = function() { 'use strict'; let eqs = document.querySelectorAll("img[alt]"); for (let i = 0; i < eqs.length; i++) { let latex = '$' + eqs[i].getAttribute("data-formula") + '$'; eqs[i].setAttribute("alt", latex); } })