From 1a5905d9fdcc01aaf94d13bba3e4e833f61e9bb3 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 23 Jun 2016 12:07:51 +0200 Subject: [PATCH] more work on highlighting modes in codemirror * style the select menu * add more modes * preset language selection to 'javascript' * don't prompt the user with a silly hash when changing their name --- www/code/main.js | 8 +-- www/code/modes.js | 122 ++++++++++++++++++++++++++++++++++++++++-- www/common/toolbar.js | 7 +++ 3 files changed, 130 insertions(+), 7 deletions(-) diff --git a/www/code/main.js b/www/code/main.js index b84417b4b..29901e11a 100644 --- a/www/code/main.js +++ b/www/code/main.js @@ -30,8 +30,7 @@ define([ var andThen = function (CMeditor) { var CodeMirror = module.CodeMirror = CMeditor; - CodeMirror.modeURL = "/code/codemirror-5.13.2/mode/%N/%N.js"; - + CodeMirror.modeURL = "/code/CodeMirror-5.16.0/mode/%N/%N.js"; var $pad = $('#pad-iframe'); var $textarea = $pad.contents().find('#editor1'); @@ -126,7 +125,7 @@ define([ var createChangeName = function(id, $container) { var buttonElmt = $container.find('#'+id)[0]; buttonElmt.addEventListener("click", function() { - var newName = window.prompt("Change your name :", myUserName); + var newName = window.prompt("Change your name :"); if (newName && newName.trim()) { var myUserNameTemp = newName.trim(); if(newName.trim().length > 32) { @@ -163,7 +162,8 @@ define([ var dropdown = ''; diff --git a/www/code/modes.js b/www/code/modes.js index 5154c3331..7c6176bc0 100644 --- a/www/code/modes.js +++ b/www/code/modes.js @@ -1,8 +1,124 @@ define(function () { return [ - "Javascript javascript", - "Python python", - "Mixed_HTML htmlmixed", + "apl apl", + "asciiarmor asciiarmor", + "asn.1 asn.1", + "asterisk asterisk", + "brainfuck brainfuck", + "clike clike", + "clojure clojure", + "cmake cmake", + "cobol cobol", + "coffeescript coffeescript", + "commonlisp commonlisp", + "crystal crystal", + "css css", + "cypher cypher", + "d d", + "dart dart", + "diff diff", + "django django", + "dockerfile dockerfile", + "dtd dtd", + "dylan dylan", + "ebnf ebnf", + "ecl ecl", + "eiffel eiffel", + "elm elm", + "erlang erlang", + "factor factor", + "fcl fcl", + "forth forth", + "fortran fortran", + "gas gas", + "gfm gfm", + "gherkin gherkin", + "go go", + "groovy groovy", + "haml haml", + "handlebars handlebars", + "haskell haskell", + "haskell-literate haskell-literate", + "haxe haxe", + "htmlembedded htmlembedded", + "htmlmixed htmlmixed", + "http http", + "idl idl", + "index.html index.html", + "jade jade", + "javascript javascript", + "jinja2 jinja2", + "jsx jsx", + "julia julia", + "livescript livescript", + "loadmode.js loadmode.js", + "lua lua", + "markdown markdown", + "mathematica mathematica", + "meta.js meta.js", + "mirc mirc", + "mllike mllike", + "modelica modelica", + "mscgen mscgen", + "mumps mumps", + "nginx nginx", + "nsis nsis", + "ntriples ntriples", + "octave octave", + "oz oz", + "pascal pascal", + "pegjs pegjs", + "perl perl", + "php php", + "pig pig", + "properties properties", + "protobuf protobuf", + "puppet puppet", + "python python", + "q q", + "r r", + "rpm rpm", + "rst rst", + "ruby ruby", + "rust rust", + "sass sass", + "scheme scheme", + "shell shell", + "sieve sieve", + "slim slim", + "smalltalk smalltalk", + "smarty smarty", + "solr solr", + "soy soy", + "sparql sparql", + "spreadsheet spreadsheet", + "sql sql", + "stex stex", + "stylus stylus", + "swift swift", + "tcl tcl", + "textile textile", + "tiddlywiki tiddlywiki", + "tiki tiki", + "toml toml", + "tornado tornado", + "troff troff", + "ttcn ttcn", + "ttcn-cfg ttcn-cfg", + "turtle turtle", + "twig twig", + "vb vb", + "vbscript vbscript", + "velocity velocity", + "verilog verilog", + "vhdl vhdl", + "vue vue", + "xml xml", + //"xwiki xwiki21", + "xquery xquery", + "yaml yaml", + "yaml-frontmatter yaml-frontmatter", + "z80 z80" ].map(function (line) { var kv = line.split(/\s/); return { diff --git a/www/common/toolbar.js b/www/common/toolbar.js index e24bec338..158c7ef29 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -129,6 +129,13 @@ define([ .{{TOOLBAR_CLS}} .{{LOAD_ELEMENT_CLS}}:after { content: 'IMPORT'; } + +.{{TOOLBAR_CLS}} select { + border: 0px; + margin-left: 5px; + margin-right: 5px; + padding-left: 5px; +} */}.toString().slice(14,-3), { TOOLBAR_CLS: TOOLBAR_CLS,