【发布时间】:2019-02-11 14:27:56
【问题描述】:
当我将以下 javascript 代码粘贴到 Chrome 检查控制台时,它可以工作;但我无法成功地将其用作书签。有人知道为什么吗?
我要做的是设置 css 样式 white-space: pre-wrap 以便正确查看预先格式化的表格。
javascript: void(! function(t, i) {
try {
if (!t || !i) return;
! function(e, t) {
if ("string" == typeof e && 0 < e.length && null === i.getElementById(t)) {
var n = i.createElement("style");
n.setAttribute("type", "text/css"), "string" == typeof t && 0 < t.length && n.setAttribute("id", t);
var r = i.createTextNode(e);
n.appendChild(r);
var o = i.getElementsByTagName("head");
0 < o.length && o[0].appendChild(n);
}
}("pre, code, kbd, samp {white-space: pre !important;}", "orospu-jupyter");
} catch (e) {
t && t.console && "function" == typeof t.console.error && t.console.error(e);
}
}(window, window.document));
【问题讨论】:
-
当您单击该书签时,您是否在控制台中看到任何错误/警告?
-
当前,当我点击书签时,控制台中没有任何反应
-
澄清:我意识到预格式化的文本在 iframe 内
标签: javascript css jupyter-notebook