code
stringlengths
1
2.08M
language
stringclasses
1 value
/* * Class: fileUploader * Use: Upload multiple files using jquery * Author: Matt Brailsford * Version: 1.0 */ (function ($, window, document, undefined) { $.event.props.push('dataTransfer'); var defaultOptions = { autoUpload: false, limit: false, allowedExtension: 'jpg|...
JavaScript
/// <reference path="/umbraco_client/Application/NamespaceManager.js" /> /// <reference path="UmbracoUtils.js" /> /// <reference path="/umbraco_client/modal/modal.js" /> /// <reference path="language.aspx" /> /// <reference name="MicrosoftAjax.js"/> Umbraco.Sys.registerNamespace("Umbraco.Application"); Umbra...
JavaScript
/// <reference path="/umbraco_client/Application/NamespaceManager.js" /> Umbraco.Sys.registerNamespace("Umbraco.Utils"); Umbraco.Utils.generateRandom = function() { /// <summary>Returns a random integer for use with URLs</summary> day = new Date() z = day.getTime() y = (z - (parseInt(z / 1000...
JavaScript
/// <reference path="/umbraco_client/Application/NamespaceManager.js" /> /// <reference path="/umbraco_client/Application/HistoryManager.js" /> /// <reference path="/umbraco_client/ui/jquery.js" /> /// <reference path="/umbraco_client/Tree/UmbracoTree.js" /> /// <reference name="MicrosoftAjax.js"/> Umbraco.Sys....
JavaScript
(function($) { $.fn.VerticalAlign = function(opts) { return this.each(function() { var top = (($(this).parent().height() - $(this).height()) / 2); $(this).css('margin-top', top); }); }; })(jQuery);
JavaScript
/* * jQuery Autocomplete plugin 1.1 * * Copyright (c) 2009 Jörn Zaefferer * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $ */ ; (functio...
JavaScript
//used for live editing to invoke no conflict after jquery has loaded with lazy loading //alert("jquery.noConflict: " + jQuery.noConflict); jQuery.noConflict();
JavaScript
/*! * jQuery idleTimer plugin * version 0.9.100511 * by Paul Irish. * http://github.com/paulirish/yui-misc/tree/ * MIT license * adapted from YUI idle timer by nzakas: * http://github.com/nzakas/yui-misc/ */ /* * Copyright (c) 2009 Nicholas C. Zakas * * Permission is hereby granted, free of charge...
JavaScript
/** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /** * Create a cookie with the given name and value and other optional parameters. ...
JavaScript
/* * jQuery Hotkeys Plugin * Copyright 2010, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * * Based upon the plugin by Tzury Bar Yochay: * http://github.com/tzuryby/hotkeys * * Original idea by: * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ */ (function(jQuery){ ...
JavaScript
Umbraco.Sys.registerNamespace("Umbraco.Utils"); Umbraco.Utils.UrlEncoder = { // public method for url encoding encode: function(string) { return escape(this._utf8_encode(string)); }, // public method for url decoding decode: function(string) { return this._utf8_decode(...
JavaScript
if (typeof Umbraco == 'undefined') var Umbraco = {}; if (!Umbraco.Sys) Umbraco.Sys = {}; Umbraco.Sys.registerNamespace = function(namespace) { /// <summary> /// Used to easily register namespaces for classes without doing the syntax listed on line 1/2 for each class. /// Pretty much the same as ASP....
JavaScript
/// <reference path="/umbraco_client/Application/NamespaceManager.js" /> /// <reference name="MicrosoftAjax.js"/> /// <reference path="/umbraco_client/Application/JQuery/jquery.ba-bbq.min.js" /> Umbraco.Sys.registerNamespace("Umbraco.Controls"); (function($) { Umbraco.Controls.HistoryManager = function(...
JavaScript
// // password_strength_plugin.js // Copyright (c) 2009 myPocket technologies (www.mypocket-technologies.com) // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the ...
JavaScript
/* * Jeditable - jQuery in place edit plugin * * Copyright (c) 2006-2009 Mika Tuupola, Dylan Verheul * * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php * * Project home: * http://www.appelsiini.net/projects/jeditable * * Based on editable by Dylan Verheul <dylan_at_...
JavaScript
/** * * Color picker * Author: Stefan Petre www.eyecon.ro * * Dual licensed under the MIT and GPL licenses * */ (function ($) { var ColorPicker = function () { var ids = {}, inAction, charMin = 65, visible, tpl = '<div class="colorpicker"><div class="colorpicker_color"><div><di...
JavaScript
/* jQuery Tags Input Plugin 1.3.3 Copyright (c) 2011 XOXCO, Inc Documentation for this plugin lives here: http://xoxco.com/clickable/jquery-tags-input Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php ben@xoxco.com */ (function($) { var delimiter = new Array(); var t...
JavaScript
(function($) { $.extend({ tablesorter: new function() { var parsers = [], widgets = []; this.defaults = { cssHeader: "header", cssAsc: "headerSortUp", cssDesc: "headerSortDown", sortInitialOrder: "asc", sortMultiSortKey: "shiftKey", sortForce: null, sortAppend: null, textExtract...
JavaScript
// // @author daemach // daemach = function() { this.name = "Daemach's Toolbox"; this.version = "2.0"; this.debug = false; // load extensions this.cw = new colorWeasel(this); this.cm = new cssMonkey(this); }; jQuery.extend(daemach, { prototype: { log: function() {...
JavaScript
// // TableDnD plug-in for JQuery, allows you to drag and drop table rows // You can set up various options to control how the system will work // Copyright (c) Denis Howlett <denish@isocra.com> // Licensed like jQuery, see http://docs.jquery.com/License. // // Configuration options: // // onDragStyle // ...
JavaScript
/// <reference path="../Application/NamespaceManager.js" /> Umbraco.Sys.registerNamespace('Umbraco.Controls'); Umbraco.Controls.TabView = (function () { var onChangeEvents = []; var obj = { setActiveTab: function (tabviewid, tabid, tabs) { for (var i = 0; i < tabs.length; i++) { ...
JavaScript
// CodeMirror version 2.34 // All functions that need access to the editor's state live inside // the CodeMirror function. Below that, at the bottom of the file, // some utilities are defined. // CodeMirror is the only global var we claim window.CodeMirror = (function() { "use strict"; // This is the function tha...
JavaScript
(function () { CodeMirror.simpleHint = function (editor, getHints) { // We want a single cursor position. if (editor.somethingSelected()) return; //don't show completion if the token is empty var tempToken = editor.getTokenAt(editor.getCursor()); if (!(/[\S]/gi.test(tem...
JavaScript
(function(){ function SearchCursor(cm, query, pos, caseFold) { this.atOccurrence = false; this.cm = cm; if (caseFold == null && typeof query == "string") caseFold = false; pos = pos ? cm.clipPos(pos) : {line: 0, ch: 0}; this.pos = {from: pos, to: pos}; // The matches method is filled in based on...
JavaScript
// Utility function that allows modes to be combined. The mode given // as the base argument takes care of most of the normal mode // functionality, but a second (typically simple) mode is used, which // can override the style of text. Both modes get to parse all of the // text, but when both assign a non-null style to...
JavaScript
CodeMirror.multiplexingMode = function(outer /*, others */) { // Others should be {open, close, mode [, delimStyle]} objects var others = Array.prototype.slice.call(arguments, 1); var n_others = others.length; function indexOf(string, pattern, from) { if (typeof pattern == "string") return string.indexOf(p...
JavaScript
(function() { CodeMirror.simpleHint = function(editor, getHints, givenOptions) { // Determine effective options based on given values and defaults. var options = {}, defaults = CodeMirror.simpleHint.defaults; for (var opt in defaults) if (defaults.hasOwnProperty(opt)) options[opt] = (givenOp...
JavaScript
// Define search commands. Depends on dialog.js or another // implementation of the openDialog method. // Replace works a little oddly -- it will do the replace on the next // Ctrl-G (or whatever is bound to findNext) press. You prevent a // replace by making sure the match is no longer selected when hitting // Ctrl-G...
JavaScript
// Open simple dialogs on top of an editor. Relies on dialog.css. (function() { function dialogDiv(cm, template) { var wrap = cm.getWrapperElement(); var dialog = wrap.insertBefore(document.createElement("div"), wrap.firstChild); dialog.className = "CodeMirror-dialog"; dialog.innerHTML = '<div>' + te...
JavaScript
(function () { function forEach(arr, f) { for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); } function arrayContains(arr, item) { if (!Array.prototype.indexOf) { var i = arr.length; while (i--) { if (arr[i] === item) { return true; } } return false...
JavaScript
// ============== Formatting extensions ============================ (function() { // Define extensions for a few modes CodeMirror.extendMode("css", { commentStart: "/*", commentEnd: "*/", wordWrapChars: [";", "\\{", "\\}"], autoFormatLineBreaks: function (text) { return text.replace(new RegEx...
JavaScript
(function () { function forEach(arr, f) { for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); } function arrayContains(arr, item) { if (!Array.prototype.indexOf) { var i = arr.length; while (i--) { if (arr[i] === item) { return true; } } return false...
JavaScript
(function() { CodeMirror.xmlHints = []; CodeMirror.xmlHint = function(cm, simbol) { if(simbol.length > 0) { var cursor = cm.getCursor(); cm.replaceSelection(simbol); cursor = {line: cursor.line, ch: cursor.ch + 1}; cm.setCursor(cursor); } ...
JavaScript
(function() { CodeMirror.razorHints['@'] = [ 'inherits', 'Library', 'Model', 'Parameter', 'using', 'Dictionary', ['if/else', 'if(SomeCondition){\n\n}else{\n\n}\n'], ['if', 'if(SomeCondition){\...
JavaScript
// the tagRangeFinder function is // Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org> // released under the MIT license (../../LICENSE) like the rest of CodeMirror CodeMirror.tagRangeFinder = function(cm, line, hideEnd) { var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u0...
JavaScript
// Define match-highlighter commands. Depends on searchcursor.js // Use by attaching the following function call to the onCursorActivity event: //myCodeMirror.matchHighlight(minChars); // And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see dem...
JavaScript
/* Just enough of CodeMirror to run runMode under node.js */ function splitLines(string){ return string.split(/\r?\n|\r/); }; function StringStream(string) { this.pos = this.start = 0; this.string = string; } StringStream.prototype = { eol: function() {return this.pos >= this.string.length;}, sol: function() ...
JavaScript
/** * Tag-closer extension for CodeMirror. * * This extension adds a "closeTag" utility function that can be used with key bindings to * insert a matching end tag after the ">" character of a start tag has been typed. It can * also complete "</" if a matching start tag is found. It will correctly ignore si...
JavaScript
(function () { CodeMirror.razorHints = []; function arrayContains(arr, item) { if (!Array.prototype.indexOf) { var i = arr.length; while (i--) { if (arr[i] === item) { return true; } } re...
JavaScript
CodeMirror.runMode = function(string, modespec, callback, options) { function esc(str) { return str.replace(/[<&]/, function(ch) { return ch == "<" ? "&lt;" : "&amp;"; }); } var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); var isNode = callback.nodeType == 1; var tabSize = (options && option...
JavaScript
(function() { if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; var loading = {}; function splitCallback(cont, n) { var countDown = n; return function() { if (--countDown == 0) cont(); }; } function ensureDeps(mode, cont) { var deps = CodeMirror.modes[mode].dependencies; if (!...
JavaScript
(function() { function keywords(str) { var obj = {}, words = str.split(" "); for (var i = 0; i < words.length; ++i) obj[words[i]] = true; return obj; } function heredoc(delim) { return function(stream, state) { if (stream.match(delim)) state.tokenize = null; else stream.skipToEnd(); ...
JavaScript
CodeMirror.defineMode("verilog", function(config, parserConfig) { var indentUnit = config.indentUnit, keywords = parserConfig.keywords || {}, blockKeywords = parserConfig.blockKeywords || {}, atoms = parserConfig.atoms || {}, hooks = parserConfig.hooks || {}, multiLineStrings = par...
JavaScript
CodeMirror.defineMode("razor", function(config, parserConfig) { var indentUnit = config.indentUnit, keywords = words("abstract as base break case catch checked class const continue" + " default delegate do else enum event explicit extern finally fixed for" + " foreach g...
JavaScript
CodeMirror.defineMode('ocaml', function(config) { var words = { 'true': 'atom', 'false': 'atom', 'let': 'keyword', 'rec': 'keyword', 'in': 'keyword', 'of': 'keyword', 'and': 'keyword', 'succ': 'keyword', 'if': 'keyword', 'then': 'keyword', 'else': 'keyword', 'for': 'ke...
JavaScript
CodeMirror.defineMode('tiki', function(config, parserConfig) { function inBlock(style, terminator, returnTokenizer) { return function(stream, state) { while (!stream.eol()) { if (stream.match(terminator)) { state.tokenize = inText; break; } stream.next(); } if (returnTokenizer) sta...
JavaScript
CodeMirror.defineMode("plsql", function(config, parserConfig) { var indentUnit = config.indentUnit, keywords = parserConfig.keywords, functions = parserConfig.functions, types = parserConfig.types, sqlplus = parserConfig.sqlplus, multiLineStrings ...
JavaScript
/* * See LICENSE in this directory for the license under which this code * is released. */ CodeMirror.defineMode("sieve", function(config) { function words(str) { var obj = {}, words = str.split(" "); for (var i = 0; i < words.length; ++i) obj[words[i]] = true; return obj; } var keywords = words(...
JavaScript
/********************************************************** * This script provides syntax highlighting support for * the Ntriples format. * Ntriples format specification: * http://www.w3.org/TR/rdf-testcases/#ntriples ***********************************************************/ /* The following expression d...
JavaScript
/** * Author: Hans Engel * Branched from CodeMirror's Scheme mode (by Koh Zi Han, based on implementation by Koh Zi Chun) */ CodeMirror.defineMode("clojure", function (config, mode) { var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", TAG = "tag", ATOM = "atom", NUMBER = "number", BRACKET =...
JavaScript
/* * Pig Latin Mode for CodeMirror 2 * @author Prasanth Jayachandran * @link https://github.com/prasanthj/pig-codemirror-2 * This implementation is adapted from PL/SQL mode in CodeMirror 2. */ CodeMirror.defineMode("pig", function(config, parserConfig) { var indentUnit = config.indentUnit, keywords = parserCo...
JavaScript
CodeMirror.defineMode("smarty", function(config, parserConfig) { var keyFuncs = ["debug", "extends", "function", "include", "literal"]; var last; var regs = { operatorChars: /[+\-*&%=<>!?]/, validIdentifier: /[a-zA-Z0-9\_]/, stringChar: /[\'\"]/ }; var leftDelim = (typeof config.mode.leftDelimiter...
JavaScript
// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08) // This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com) CodeMirror.defineMode("perl",function(config,parserConfig){ // http://perldoc.perl.org var PERL={ // null - magic touch // 1 - ...
JavaScript
/** * Link to the project's GitHub page: * https://github.com/pickhardt/coffeescript-codemirror-mode */ CodeMirror.defineMode('coffeescript', function(conf) { var ERRORCLASS = 'error'; function wordRegexp(words) { return new RegExp("^((" + words.join(")|(") + "))\\b"); } var singleOperators...
JavaScript
/* LESS mode - http://www.lesscss.org/ Ported to CodeMirror by Peter Kroon <plakroon@gmail.com> Report bugs/issues here: https://github.com/marijnh/CodeMirror/issues GitHub: @peterkroon */ CodeMirror.defineMode("less", function(config) { var indentUnit = config.indentUnit, type; function ret(style, tp) {typ...
JavaScript
CodeMirror.defineMode("vbscript", function() { var regexVBScriptKeyword = /^(?:Call|Case|CDate|Clear|CInt|CLng|Const|CStr|Description|Dim|Do|Each|Else|ElseIf|End|Err|Error|Exit|False|For|Function|If|LCase|Loop|LTrim|Next|Nothing|Now|Number|On|Preserve|Quit|ReDim|Resume|RTrim|Select|Set|Sub|Then|To|Trim|True|UBound|UC...
JavaScript
// Initiate ModeTest and set defaults var MT = ModeTest; MT.modeName = 'css'; MT.modeOptions = {}; // Requires at least one media query MT.testMode( 'atMediaEmpty', '@media { }', [ 'def', '@media', null, ' ', 'error', '{', null, ' }' ] ); MT.testMode( 'atMediaMultiple', '@media not screen ...
JavaScript
CodeMirror.defineMode("css", function(config) { var indentUnit = config.indentUnit, type; var atMediaTypes = keySet([ "all", "aural", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "embossed" ]); var atMediaFeatures = keySet([ "width", "min-width", "max-width", "height", ...
JavaScript
CodeMirror.defineMode('rst', function(config, options) { function setState(state, fn, ctx) { state.fn = fn; setCtx(state, ctx); } function setCtx(state, ctx) { state.ctx = ctx || {}; } function setNormal(state, ch) { if (ch && (typeof ch !== 'string')) { ...
JavaScript
CodeMirror.defineMode("velocity", function(config) { function parseWords(str) { var obj = {}, words = str.split(" "); for (var i = 0; i < words.length; ++i) obj[words[i]] = true; return obj; } var indentUnit = config.indentUnit; var keywords = parseWords("#end #else #break #stop...
JavaScript
CodeMirror.defineMode("python", function(conf, parserConf) { var ERRORCLASS = 'error'; function wordRegexp(words) { return new RegExp("^((" + words.join(")|(") + "))\\b"); } var singleOperators = new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"); var singleDelimiters = new RegExp('^[\\(\\)\\[\...
JavaScript
// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's // CodeMirror 1 mode. // highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting CodeMirror.defineMode("lua", function(config, parserConfig) { var indentUnit = config.indentUnit; function prefixRE(words) { ...
JavaScript
CodeMirror.defineMode("rust", function() { var indentUnit = 4, altIndentUnit = 2; var valKeywords = { "if": "if-style", "while": "if-style", "else": "else-style", "do": "else-style", "ret": "else-style", "fail": "else-style", "break": "atom", "cont": "atom", "const": "let", "resource": "fn", "let": ...
JavaScript
CodeMirror.defineMode("ecl", function(config) { function words(str) { var obj = {}, words = str.split(" "); for (var i = 0; i < words.length; ++i) obj[words[i]] = true; return obj; } function metaHook(stream, state) { if (!state.startOfLine) return false; stream.skipToEnd(); r...
JavaScript
CodeMirror.defineMode("diff", function() { var TOKEN_NAMES = { '+': 'tag', '-': 'string', '@': 'meta' }; return { token: function(stream) { var tw_pos = stream.string.search(/[\t ]+?$/); if (!stream.sol() || tw_pos === 0) { stream.skipToEnd(); return ("error " + ( ...
JavaScript
CodeMirror.defineMode("changes", function(config, modeConfig) { var headerSeperator = /^-+$/; var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; var simpleEmail = /^[\w+.-]+@[\w.-]+/; return { token: functi...
JavaScript
// Quick and dirty spec file highlighting CodeMirror.defineMode("spec", function(config, modeConfig) { var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/; var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildReq...
JavaScript
CodeMirror.defineMode('shell', function(config) { var words = {}; function define(style, string) { var split = string.split(' '); for(var i = 0; i < split.length; i++) { words[split[i]] = style; } }; // Atoms define('atom', 'true false'); // Keywords define('keyword', 'if then do else...
JavaScript
CodeMirror.defineMode("commonlisp", function (config) { var assumeBody = /^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/; var numLiteral = /^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/; var symbol = /[^\s'`,@()\[\]";]/; var type;...
JavaScript
CodeMirror.defineMode("go", function(config, parserConfig) { var indentUnit = config.indentUnit; var keywords = { "break":true, "case":true, "chan":true, "const":true, "continue":true, "default":true, "defer":true, "else":true, "fallthrough":true, "for":true, "func":true, "go":true, "goto":true, "if":t...
JavaScript
CodeMirror.defineMode("r", function(config) { function wordObj(str) { var words = str.split(" "), res = {}; for (var i = 0; i < words.length; ++i) res[words[i]] = true; return res; } var atoms = wordObj("NULL NA Inf NaN NA_integer_ NA_real_ NA_complex_ NA_character_"); var builtins = wordObj("list q...
JavaScript
CodeMirror.defineMode("groovy", function(config, parserConfig) { function words(str) { var obj = {}, words = str.split(" "); for (var i = 0; i < words.length; ++i) obj[words[i]] = true; return obj; } var keywords = words( "abstract as assert boolean break byte case catch char class const continue ...
JavaScript
CodeMirror.defineMode("jinja2", function(config, parserConf) { var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false", "loop", "none", "self", "super", "if", "as", "not", "and", "else", "import", "with", "without", "context"]; keywords = new RegExp("...
JavaScript
CodeMirror.defineMode("yaml", function() { var cons = ['true', 'false', 'on', 'off', 'yes', 'no']; var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i'); return { token: function(stream, state) { var ch = stream.peek(); var esc = state.escaped; state.escaped = false; /* comments */ ...
JavaScript
CodeMirror.defineMode('smalltalk', function(config, modeConfig) { var specialChars = /[+\-/\\*~<>=@%|&?!.:;^]/; var keywords = /true|false|nil|self|super|thisContext/; var Context = function(tokenizer, parent) { this.next = tokenizer; this.parent = parent; }; var Token = function(name, context, eos) { thi...
JavaScript
// Initiate ModeTest and set defaults var MT = ModeTest; MT.modeName = 'markdown'; MT.modeOptions = {}; MT.testMode( 'plainText', 'foo', [ null, 'foo' ] ); // Code blocks using 4 spaces (regardless of CodeMirror.tabSize value) MT.testMode( 'codeBlocksUsing4Spaces', ' foo', [ null, ' ', ...
JavaScript
CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { var htmlFound = CodeMirror.mimeModes.hasOwnProperty("text/html"); var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? "text/html" : "text/plain"); var codeDepth = 0; var prevLineHasContent = false , thisLineHasContent = false; var header ...
JavaScript
CodeMirror.defineMode("gfm", function(config, parserConfig) { var mdMode = CodeMirror.getMode(config, "markdown"); var aliases = { html: "htmlmixed", js: "javascript", json: "application/json", c: "text/x-csrc", "c++": "text/x-c++src", java: "text/x-java", csharp: "text/x-csharp", "c...
JavaScript
// block; "begin", "case", "fun", "if", "receive", "try": closed by "end" // block internal; "after", "catch", "of" // guard; "when", closed by "->" // "->" opens a clause, closed by ";" or "." // "<<" opens a binary, closed by ">>" // "," appears in arglists, lists, tuples and terminates lines of code // "." resets in...
JavaScript
var MT = ModeTest; MT.modeName = 'stex'; MT.modeOptions = {}; MT.testMode( 'word', 'foo', [ null, 'foo' ] ); MT.testMode( 'twoWords', 'foo bar', [ null, 'foo bar' ] ); MT.testMode( 'beginEndDocument', '\\begin{document}\n\\end{document}', [ 'tag', '\\begin', 'bracket', '{', ...
JavaScript
/* * Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de) * Licence: MIT */ CodeMirror.defineMode("stex", function(cmCfg, modeCfg) { function pushCommand(state, command) { state.cmdState.push(command); } function peekCommand(state) { if (state.cmdState.length>0) return state.cmd...
JavaScript
CodeMirror.defineMode("properties", function() { return { token: function(stream, state) { var sol = stream.sol() || state.afterSection; var eol = stream.eol(); state.afterSection = false; if (sol) { if (state.nextMultiline) { state.inMultiline = true; state.n...
JavaScript
CodeMirror.defineMode("sparql", function(config) { var indentUnit = config.indentUnit; var curPunc; function wordRegexp(words) { return new RegExp("^(?:" + words.join("|") + ")$", "i"); } var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri", ...
JavaScript
CodeMirror.defineMode("haxe", function(config, parserConfig) { var indentUnit = config.indentUnit; // Tokenizer var keywords = function(){ function kw(type) {return {type: type, style: "keyword"};} var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); var operator = kw("operator"), at...
JavaScript
CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { //config settings var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i, scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i; //inner modes var scriptingMode, htmlMixedMode; //tokenizer when in html mode functi...
JavaScript
/*** |''Name''|tiddlywiki.js| |''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror| |''Author''|PMario| |''Version''|0.1.7| |''Status''|''stable''| |''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]| |''Documentation''|http://codemirror.tiddlyspace.com/| |''...
JavaScript
CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) { function switchState(source, setState, f) { setState(f); return f(source, setState); } // These should all be Unicode extended, as per the Haskell 2010 report var smallRE = /[a-z_]/; var largeRE = /[A-Z]/; var digitRE = /[0-9]/; var h...
JavaScript
CodeMirror.defineMode("javascript", function(config, parserConfig) { var indentUnit = config.indentUnit; var jsonMode = parserConfig.json; // Tokenizer var keywords = function(){ function kw(type) {return {type: type, style: "keyword"};} var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"...
JavaScript
CodeMirror.defineMode("htmlmixed", function(config) { var htmlMode = CodeMirror.getMode(config, {name: "xml", htmlMode: true}); var jsMode = CodeMirror.getMode(config, "javascript"); var cssMode = CodeMirror.getMode(config, "css"); function html(stream, state) { var style = htmlMode.token(stream, state.htm...
JavaScript
/* Copyright (C) 2011 by MarkLogic Corporation Author: Mike Brevoort <mike@brevoort.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the right...
JavaScript
$(document).ready(function(){ module("testProcessingInstructions"); test("testProcessingInstructions", function() { expect(1); var input = 'data(<?target content?>) instance of xs:string'; var expected = '<span class="cm-variable cm-def">data</span>(<span class="cm-comment cm-meta">&lt;?target content?...
JavaScript
$(document).ready(function(){ module("testQuoteEscape"); test("testQuoteEscapeDouble", function() { expect(1); var input = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"\ let $keysfolder := concat($rootfolder, "keys\\")\ return\ $keysfolder'; var expected = '<span class="cm-ke...
JavaScript
$(document).ready(function(){ module("test namespaces"); // -------------------------------------------------------------------------------- // this test is based on this: //http://mbrevoort.github.com/CodeMirror2/#!exprSeqTypes/PrologExpr/VariableProlog/ExternalVariablesWith/K2-ExternalVariablesWith-10.xq // ------...
JavaScript
$(document).ready(function(){ module("testMultiAttr"); test("test1", function() { expect(1); var expected = '<span class="cm-tag">&lt;p </span><span class="cm-attribute">a1</span>=<span class="cm-string">"foo"</span> <span class="cm-attribute">a2</span>=<span class="cm-string">"bar"</span><span c...
JavaScript
$(document).ready(function(){ module("testEmptySequenceKeyword"); test("testEmptySequenceKeyword", function() { expect(1); var input = '"foo" instance of empty-sequence()'; var expected = '<span class="cm-string">"foo"</span> <span class="cm-keyword">instance</span> <span class="cm-keyword">of</span> <...
JavaScript
CodeMirror.defineMode("ruby", function(config, parserConfig) { function wordObj(words) { var o = {}; for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true; return o; } var keywords = wordObj([ "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else", ...
JavaScript
CodeMirror.defineMode("clike", function(config, parserConfig) { var indentUnit = config.indentUnit, keywords = parserConfig.keywords || {}, builtin = parserConfig.builtin || {}, blockKeywords = parserConfig.blockKeywords || {}, atoms = parserConfig.atoms || {}, hooks = parserConfig.hooks...
JavaScript
CodeMirror.defineMode("pascal", function(config) { function words(str) { var obj = {}, words = str.split(" "); for (var i = 0; i < words.length; ++i) obj[words[i]] = true; return obj; } var keywords = words("and array begin case const div do downto else end file for forward integer " + ...
JavaScript
/** * Author: Koh Zi Han, based on implementation by Koh Zi Chun */ CodeMirror.defineMode("scheme", function (config, mode) { var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD="keyword"; var INDENT_WORD_SKIP = 2, KEYWORDS_SK...
JavaScript
/* * MySQL Mode for CodeMirror 2 by MySQL-Tools * @author James Thorne (partydroid) * @link http://github.com/partydroid/MySQL-Tools * @link http://mysqltools.org * @version 02/Jan/2012 */ CodeMirror.defineMode("mysql", function(config) { var indentUnit = config.indentUnit; var curPunc; function wordRege...
JavaScript