0

The following javascript code works when i paste it into Chrome inspect console; but i could not succeed to make it work as a bookmark. Anybody has an idea why?

What i am trying to do is to set css style white-space: pre-wrap in order to see pre formatted tables properly.

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));
BlackNetworkBit
  • 768
  • 11
  • 21
Mari
  • 165
  • 1
  • 3
  • 8

1 Answers1

-1

Because bookmarking is only for webpages. Can't use it for scripting bookmarking. Sorry.

Maybe this could be useful function as google chrome bookmark

  • perhaps i wasn't as clear. I am working on jupyter notebooks where a spark dataframe content appears with css style: pre, code, kbd, samp {white-space: pre-wrap;} i would like to have a bookmark button in chrome which can change this to: pre, code, kbd, samp {white-space: pre;} or better yet disable it. I do know that you can do this by adding a javascript code as bookmark. Because i am a lazy for 2 extraclicks (open inspect, find and disable pre-wrap) :) – Mari Sep 06 '18 at 11:09