zvodd
4/27/2015 - 7:19 AM

Ugly Userscript(tested in chrome TamperMonkey) to add syntax highlighter and code copy to all code samples on MSDN. Uses highlighjs to auto-

Ugly Userscript(tested in chrome TamperMonkey) to add syntax highlighter and code copy to all code samples on MSDN. Uses highlighjs to auto-magicly detect and highlight code blocks.

// ==UserScript==
// @name         MSDN Syntax Highlighter
// @namespace    http://example.com
// @version      0.1
// @description  Uses highlightjs to highlight code examples on MSDN
// @author       Zv_oDD
// @match        https://msdn.microsoft.com/en-us/library/*
// @include      http://msdn.microsoft.com/en-us/library/*
// @grant        GM_setClipboard
// ==/UserScript==

function default_codes_css(){
/*HERE
.hljs {
  display: block;
  overflow-x: auto;
  padding: 0.5em;
  background: #f0f0f0;
  -webkit-text-size-adjust: none;
}

.hljs,
.hljs-subst,
.hljs-tag .hljs-title,
.nginx .hljs-title {
  color: black;
}

.hljs-string,
.hljs-title,
.hljs-constant,
.hljs-parent,
.hljs-tag .hljs-value,
.hljs-rule .hljs-value,
.hljs-preprocessor,
.hljs-pragma,
.hljs-name,
.haml .hljs-symbol,
.ruby .hljs-symbol,
.ruby .hljs-symbol .hljs-string,
.hljs-template_tag,
.django .hljs-variable,
.smalltalk .hljs-class,
.hljs-addition,
.hljs-flow,
.hljs-stream,
.bash .hljs-variable,
.pf .hljs-variable,
.apache .hljs-tag,
.apache .hljs-cbracket,
.tex .hljs-command,
.tex .hljs-special,
.erlang_repl .hljs-function_or_atom,
.asciidoc .hljs-header,
.markdown .hljs-header,
.coffeescript .hljs-attribute {
  color: #800;
}

.smartquote,
.hljs-comment,
.hljs-annotation,
.diff .hljs-header,
.hljs-chunk,
.asciidoc .hljs-blockquote,
.markdown .hljs-blockquote {
  color: #888;
}

.hljs-number,
.hljs-date,
.hljs-regexp,
.hljs-literal,
.hljs-hexcolor,
.smalltalk .hljs-symbol,
.smalltalk .hljs-char,
.go .hljs-constant,
.hljs-change,
.lasso .hljs-variable,
.makefile .hljs-variable,
.asciidoc .hljs-bullet,
.markdown .hljs-bullet,
.asciidoc .hljs-link_url,
.markdown .hljs-link_url {
  color: #080;
}

.hljs-label,
.hljs-javadoc,
.ruby .hljs-string,
.hljs-decorator,
.hljs-filter .hljs-argument,
.hljs-localvars,
.hljs-array,
.hljs-attr_selector,
.hljs-important,
.hljs-pseudo,
.hljs-pi,
.haml .hljs-bullet,
.hljs-doctype,
.hljs-deletion,
.hljs-envvar,
.hljs-shebang,
.apache .hljs-sqbracket,
.nginx .hljs-built_in,
.tex .hljs-formula,
.erlang_repl .hljs-reserved,
.hljs-prompt,
.asciidoc .hljs-link_label,
.markdown .hljs-link_label,
.vhdl .hljs-attribute,
.clojure .hljs-attribute,
.asciidoc .hljs-attribute,
.lasso .hljs-attribute,
.coffeescript .hljs-property,
.hljs-phony {
  color: #88f;
}

.hljs-keyword,
.hljs-id,
.hljs-title,
.hljs-built_in,
.css .hljs-tag,
.hljs-javadoctag,
.hljs-phpdoc,
.hljs-dartdoc,
.hljs-yardoctag,
.smalltalk .hljs-class,
.hljs-winutils,
.bash .hljs-variable,
.pf .hljs-variable,
.apache .hljs-tag,
.hljs-type,
.hljs-typename,
.tex .hljs-command,
.asciidoc .hljs-strong,
.markdown .hljs-strong,
.hljs-request,
.hljs-status {
  font-weight: bold;
}

.asciidoc .hljs-emphasis,
.markdown .hljs-emphasis {
  font-style: italic;
}

.nginx .hljs-built_in {
  font-weight: normal;
}

.coffeescript .javascript,
.javascript .xml,
.lasso .markup,
.tex .hljs-formula,
.xml .javascript,
.xml .vbscript,
.xml .css,
.xml .hljs-cdata {
  opacity: 0.5;
}
HERE*/
    var here = "HERE";
    var reobj = new RegExp("/\\*"+here+"\\n[\\s\\S]*?\\n"+here+"\\*/", "m");
    str = reobj.exec(default_codes_css).toString();
    str = str.replace(new RegExp("/\\*"+here+"\\n",'m'),'').toString();
    return str.replace(new RegExp("\\n"+here+"\\*/",'m'),'').toString();
}

function highlightjs(){
    var txt64 = 'IWZ1bmN0aW9uKGUpeyJ1bmRlZmluZWQiIT10e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VudGlsIHVzaW5nIHdoZW4gd2hlcmUgd2hpbGUgd2lkZW5pbmcgd2l0aCB3aXRoZXZlbnRzIHdyaXRlb25seSB4b3IiLGJ1aWx0X2luOiJib29sZWFuIGJ5dGUgY2Jvb2wgY2J5dGUgY2NoYXIgY2RhdGUgY2RlYyBjZGJsIGNoYXIgY2ludCBjbG5n'
+'IGNvYmogY3NieXRlIGNzaG9ydCBjc25nIGNzdHIgY3R5cGUgZGF0ZSBkZWNpbWFsIGRpcmVjdGNhc3QgZG91YmxlIGdldHR5cGUgZ2V0eG1sbmFtZXNwYWNlIGlpZiBpbnRlZ2VyIGxvbmcgb2JqZWN0IHNieXRlIHNob3J0IHNpbmdsZSBzdHJpbmcgdHJ5Y2FzdCB0eXBlb2YgdWludGVnZXIgdWxvbmcgdXNob3J0IixsaXRlcmFsOiJ0cnVlIGZhbHNlIG5vdGhpbmcifSxpOiIvL3x7fH18ZW5kaWZ8'
+'Z29zdWJ8dmFyaWFudHx3ZW5kIixjOltlLmluaGVyaXQoZS5RU00se2M6W3tiOiciIid9XX0pLGUuQygiJyIsIiQiLHtyQjohMCxjOlt7Y046InhtbERvY1RhZyIsYjoiJycnfDwhLS18LS0+IixjOltlLlBXTV19LHtjTjoieG1sRG9jVGFnIixiOiI8Lz8iLGU6Ij4iLGM6W2UuUFdNXX1dfSksZS5DTk0se2NOOiJwcmVwcm9jZXNzb3IiLGI6IiMiLGU6IiQiLGs6ImlmIGVsc2UgZWxzZWlmIGVuZCBy'
+'ZWdpb24gZXh0ZXJuYWxzb3VyY2UifV19fSk7'
    return  decodeURIComponent(escape(window.atob(txt64)));
}

function getPathTo(element) {
    if (element.id!=='')
        return 'id("'+element.id+'")';
    if (element===document.body)
        return element.tagName;

    var ix= 0;
    var siblings= element.parentNode.childNodes;
    for (var i= 0; i<siblings.length; i++) {
        var sibling= siblings[i];
        if (sibling===element)
            return getPathTo(element.parentNode)+'/'+element.tagName+'['+(ix+1)+']';
        if (sibling.nodeType===1 && sibling.tagName===element.tagName)
            ix++;
    }
}

var style = document.createElement('style'),
    code = document.createElement('script');
style.innerHTML = default_codes_css();
code.innerHTML = highlightjs();

document.body.appendChild(style);
document.body.appendChild(code);
var pre_els  = document.body.getElementsByTagName('pre');
for ( var i = 0 ; i < pre_els.length; i++){
    (function (el) {
        var b_copy = document.createElement('button'),
            b_highlight = document.createElement('button'),
            toolbar = el.parentElement.parentElement.parentElement.getElementsByClassName('codeSnippetToolBar')[0],
            pretag = el,
            codetext = el.innerText;
        b_copy.innerHTML= 'Copy Code';
        b_copy.onclick= function() {
            GM_setClipboard(codetext, {type: 'text', mimetype: 'text/plain'})
        };
        b_highlight.innerHTML = "Highlight";
        b_highlight.onclick = function(){
            hljs.highlightBlock(el);
        }
        toolbar.appendChild(b_copy);
        toolbar.appendChild(b_highlight);
        //console.log(el);
    }(pre_els[i]));
}