Created
March 13, 2015 22:21
-
-
Save flying-sheep/0cf393e9d88eb4351aec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Reddit stylesheet editor | |
// @namespace flying-sheep | |
// @description CodeMirror-based stylesheet editor for reddit mods | |
// @include http://www.reddit.com/r/*/about/stylesheet/ | |
// @version 1 | |
// @require https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/addon/hint/show-hint.min.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/mode/css/css.min.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/addon/hint/css-hint.js | |
// @resource mainCSS https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/codemirror.min.js | |
// @resource themCSS https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/theme/ambiance.min.css | |
// @resource hintCSS https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.0.0/addon/hint/show-hint.min.css | |
// @grant GM_addStyle | |
// @grant GM_getResourceText | |
// ==/UserScript== | |
// more stuff: https://cdnjs.com/libraries/codemirror | |
// docs: http://codemirror.net/doc/manual.html | |
try { | |
GM_addStyle(GM_getResourceText('mainCSS')) | |
GM_addStyle(GM_getResourceText('themCSS')) | |
GM_addStyle(GM_getResourceText('hintCSS')) | |
var textAreaID = 'stylesheet_contents' | |
var textArea = document.getElementById(textAreaID) | |
var myCodeMirror = CodeMirror.fromTextArea(textArea, { | |
lineNumbers: true, | |
gutter: true, | |
mode: 'css', | |
theme: 'ambiance', | |
indentWithTabs: true, | |
}) | |
} catch (e) { | |
console.error(e) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment