View | Details | Raw Unified | Return to bug 21582
Collapse All | Expand All

(-)a/admin/preferences.pl (-1 / +3 lines)
Lines 61-67 sub _get_chunk { Link Here
61
61
62
    my $name = $options{'pref'};
62
    my $name = $options{'pref'};
63
    my $chunk = { name => $name, value => $value, type => $options{'type'} || 'input', class => $options{'class'} };
63
    my $chunk = { name => $name, value => $value, type => $options{'type'} || 'input', class => $options{'class'} };
64
64
    if( $options{'syntax'} ){
65
        $chunk->{'syntax'} = $options{'syntax'};
66
    }
65
    if ( $options{'class'} && $options{'class'} eq 'password' ) {
67
    if ( $options{'class'} && $options{'class'} eq 'password' ) {
66
        $chunk->{'input_type'} = 'password';
68
        $chunk->{'input_type'} = 'password';
67
    } elsif ( $options{'class'} && $options{'class'} eq 'date' ) {
69
    } elsif ( $options{'class'} && $options{'class'} eq 'date' ) {
(-)a/koha-tmpl/intranet-tmpl/lib/codemirror/css.js (+833 lines)
Line 0 Link Here
1
/* CodeMirror version: 5.40.2 */
2
// CodeMirror, copyright (c) by Marijn Haverbeke and others
3
// Distributed under an MIT license: https://codemirror.net/LICENSE
4
5
(function(mod) {
6
  if (typeof exports == "object" && typeof module == "object") // CommonJS
7
    mod(require("../../lib/codemirror"));
8
  else if (typeof define == "function" && define.amd) // AMD
9
    define(["../../lib/codemirror"], mod);
10
  else // Plain browser env
11
    mod(CodeMirror);
12
})(function(CodeMirror) {
13
"use strict";
14
15
CodeMirror.defineMode("css", function(config, parserConfig) {
16
  var inline = parserConfig.inline
17
  if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
18
19
  var indentUnit = config.indentUnit,
20
      tokenHooks = parserConfig.tokenHooks,
21
      documentTypes = parserConfig.documentTypes || {},
22
      mediaTypes = parserConfig.mediaTypes || {},
23
      mediaFeatures = parserConfig.mediaFeatures || {},
24
      mediaValueKeywords = parserConfig.mediaValueKeywords || {},
25
      propertyKeywords = parserConfig.propertyKeywords || {},
26
      nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
27
      fontProperties = parserConfig.fontProperties || {},
28
      counterDescriptors = parserConfig.counterDescriptors || {},
29
      colorKeywords = parserConfig.colorKeywords || {},
30
      valueKeywords = parserConfig.valueKeywords || {},
31
      allowNested = parserConfig.allowNested,
32
      lineComment = parserConfig.lineComment,
33
      supportsAtComponent = parserConfig.supportsAtComponent === true;
34
35
  var type, override;
36
  function ret(style, tp) { type = tp; return style; }
37
38
  // Tokenizers
39
40
  function tokenBase(stream, state) {
41
    var ch = stream.next();
42
    if (tokenHooks[ch]) {
43
      var result = tokenHooks[ch](stream, state);
44
      if (result !== false) return result;
45
    }
46
    if (ch == "@") {
47
      stream.eatWhile(/[\w\\\-]/);
48
      return ret("def", stream.current());
49
    } else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) {
50
      return ret(null, "compare");
51
    } else if (ch == "\"" || ch == "'") {
52
      state.tokenize = tokenString(ch);
53
      return state.tokenize(stream, state);
54
    } else if (ch == "#") {
55
      stream.eatWhile(/[\w\\\-]/);
56
      return ret("atom", "hash");
57
    } else if (ch == "!") {
58
      stream.match(/^\s*\w*/);
59
      return ret("keyword", "important");
60
    } else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
61
      stream.eatWhile(/[\w.%]/);
62
      return ret("number", "unit");
63
    } else if (ch === "-") {
64
      if (/[\d.]/.test(stream.peek())) {
65
        stream.eatWhile(/[\w.%]/);
66
        return ret("number", "unit");
67
      } else if (stream.match(/^-[\w\\\-]+/)) {
68
        stream.eatWhile(/[\w\\\-]/);
69
        if (stream.match(/^\s*:/, false))
70
          return ret("variable-2", "variable-definition");
71
        return ret("variable-2", "variable");
72
      } else if (stream.match(/^\w+-/)) {
73
        return ret("meta", "meta");
74
      }
75
    } else if (/[,+>*\/]/.test(ch)) {
76
      return ret(null, "select-op");
77
    } else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
78
      return ret("qualifier", "qualifier");
79
    } else if (/[:;{}\[\]\(\)]/.test(ch)) {
80
      return ret(null, ch);
81
    } else if (((ch == "u" || ch == "U") && stream.match(/rl(-prefix)?\(/i)) ||
82
               ((ch == "d" || ch == "D") && stream.match("omain(", true, true)) ||
83
               ((ch == "r" || ch == "R") && stream.match("egexp(", true, true))) {
84
      stream.backUp(1);
85
      state.tokenize = tokenParenthesized;
86
      return ret("property", "word");
87
    } else if (/[\w\\\-]/.test(ch)) {
88
      stream.eatWhile(/[\w\\\-]/);
89
      return ret("property", "word");
90
    } else {
91
      return ret(null, null);
92
    }
93
  }
94
95
  function tokenString(quote) {
96
    return function(stream, state) {
97
      var escaped = false, ch;
98
      while ((ch = stream.next()) != null) {
99
        if (ch == quote && !escaped) {
100
          if (quote == ")") stream.backUp(1);
101
          break;
102
        }
103
        escaped = !escaped && ch == "\\";
104
      }
105
      if (ch == quote || !escaped && quote != ")") state.tokenize = null;
106
      return ret("string", "string");
107
    };
108
  }
109
110
  function tokenParenthesized(stream, state) {
111
    stream.next(); // Must be '('
112
    if (!stream.match(/\s*[\"\')]/, false))
113
      state.tokenize = tokenString(")");
114
    else
115
      state.tokenize = null;
116
    return ret(null, "(");
117
  }
118
119
  // Context management
120
121
  function Context(type, indent, prev) {
122
    this.type = type;
123
    this.indent = indent;
124
    this.prev = prev;
125
  }
126
127
  function pushContext(state, stream, type, indent) {
128
    state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context);
129
    return type;
130
  }
131
132
  function popContext(state) {
133
    if (state.context.prev)
134
      state.context = state.context.prev;
135
    return state.context.type;
136
  }
137
138
  function pass(type, stream, state) {
139
    return states[state.context.type](type, stream, state);
140
  }
141
  function popAndPass(type, stream, state, n) {
142
    for (var i = n || 1; i > 0; i--)
143
      state.context = state.context.prev;
144
    return pass(type, stream, state);
145
  }
146
147
  // Parser
148
149
  function wordAsValue(stream) {
150
    var word = stream.current().toLowerCase();
151
    if (valueKeywords.hasOwnProperty(word))
152
      override = "atom";
153
    else if (colorKeywords.hasOwnProperty(word))
154
      override = "keyword";
155
    else
156
      override = "variable";
157
  }
158
159
  var states = {};
160
161
  states.top = function(type, stream, state) {
162
    if (type == "{") {
163
      return pushContext(state, stream, "block");
164
    } else if (type == "}" && state.context.prev) {
165
      return popContext(state);
166
    } else if (supportsAtComponent && /@component/i.test(type)) {
167
      return pushContext(state, stream, "atComponentBlock");
168
    } else if (/^@(-moz-)?document$/i.test(type)) {
169
      return pushContext(state, stream, "documentTypes");
170
    } else if (/^@(media|supports|(-moz-)?document|import)$/i.test(type)) {
171
      return pushContext(state, stream, "atBlock");
172
    } else if (/^@(font-face|counter-style)/i.test(type)) {
173
      state.stateArg = type;
174
      return "restricted_atBlock_before";
175
    } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(type)) {
176
      return "keyframes";
177
    } else if (type && type.charAt(0) == "@") {
178
      return pushContext(state, stream, "at");
179
    } else if (type == "hash") {
180
      override = "builtin";
181
    } else if (type == "word") {
182
      override = "tag";
183
    } else if (type == "variable-definition") {
184
      return "maybeprop";
185
    } else if (type == "interpolation") {
186
      return pushContext(state, stream, "interpolation");
187
    } else if (type == ":") {
188
      return "pseudo";
189
    } else if (allowNested && type == "(") {
190
      return pushContext(state, stream, "parens");
191
    }
192
    return state.context.type;
193
  };
194
195
  states.block = function(type, stream, state) {
196
    if (type == "word") {
197
      var word = stream.current().toLowerCase();
198
      if (propertyKeywords.hasOwnProperty(word)) {
199
        override = "property";
200
        return "maybeprop";
201
      } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
202
        override = "string-2";
203
        return "maybeprop";
204
      } else if (allowNested) {
205
        override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
206
        return "block";
207
      } else {
208
        override += " error";
209
        return "maybeprop";
210
      }
211
    } else if (type == "meta") {
212
      return "block";
213
    } else if (!allowNested && (type == "hash" || type == "qualifier")) {
214
      override = "error";
215
      return "block";
216
    } else {
217
      return states.top(type, stream, state);
218
    }
219
  };
220
221
  states.maybeprop = function(type, stream, state) {
222
    if (type == ":") return pushContext(state, stream, "prop");
223
    return pass(type, stream, state);
224
  };
225
226
  states.prop = function(type, stream, state) {
227
    if (type == ";") return popContext(state);
228
    if (type == "{" && allowNested) return pushContext(state, stream, "propBlock");
229
    if (type == "}" || type == "{") return popAndPass(type, stream, state);
230
    if (type == "(") return pushContext(state, stream, "parens");
231
232
    if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {
233
      override += " error";
234
    } else if (type == "word") {
235
      wordAsValue(stream);
236
    } else if (type == "interpolation") {
237
      return pushContext(state, stream, "interpolation");
238
    }
239
    return "prop";
240
  };
241
242
  states.propBlock = function(type, _stream, state) {
243
    if (type == "}") return popContext(state);
244
    if (type == "word") { override = "property"; return "maybeprop"; }
245
    return state.context.type;
246
  };
247
248
  states.parens = function(type, stream, state) {
249
    if (type == "{" || type == "}") return popAndPass(type, stream, state);
250
    if (type == ")") return popContext(state);
251
    if (type == "(") return pushContext(state, stream, "parens");
252
    if (type == "interpolation") return pushContext(state, stream, "interpolation");
253
    if (type == "word") wordAsValue(stream);
254
    return "parens";
255
  };
256
257
  states.pseudo = function(type, stream, state) {
258
    if (type == "meta") return "pseudo";
259
260
    if (type == "word") {
261
      override = "variable-3";
262
      return state.context.type;
263
    }
264
    return pass(type, stream, state);
265
  };
266
267
  states.documentTypes = function(type, stream, state) {
268
    if (type == "word" && documentTypes.hasOwnProperty(stream.current())) {
269
      override = "tag";
270
      return state.context.type;
271
    } else {
272
      return states.atBlock(type, stream, state);
273
    }
274
  };
275
276
  states.atBlock = function(type, stream, state) {
277
    if (type == "(") return pushContext(state, stream, "atBlock_parens");
278
    if (type == "}" || type == ";") return popAndPass(type, stream, state);
279
    if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
280
281
    if (type == "interpolation") return pushContext(state, stream, "interpolation");
282
283
    if (type == "word") {
284
      var word = stream.current().toLowerCase();
285
      if (word == "only" || word == "not" || word == "and" || word == "or")
286
        override = "keyword";
287
      else if (mediaTypes.hasOwnProperty(word))
288
        override = "attribute";
289
      else if (mediaFeatures.hasOwnProperty(word))
290
        override = "property";
291
      else if (mediaValueKeywords.hasOwnProperty(word))
292
        override = "keyword";
293
      else if (propertyKeywords.hasOwnProperty(word))
294
        override = "property";
295
      else if (nonStandardPropertyKeywords.hasOwnProperty(word))
296
        override = "string-2";
297
      else if (valueKeywords.hasOwnProperty(word))
298
        override = "atom";
299
      else if (colorKeywords.hasOwnProperty(word))
300
        override = "keyword";
301
      else
302
        override = "error";
303
    }
304
    return state.context.type;
305
  };
306
307
  states.atComponentBlock = function(type, stream, state) {
308
    if (type == "}")
309
      return popAndPass(type, stream, state);
310
    if (type == "{")
311
      return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top", false);
312
    if (type == "word")
313
      override = "error";
314
    return state.context.type;
315
  };
316
317
  states.atBlock_parens = function(type, stream, state) {
318
    if (type == ")") return popContext(state);
319
    if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
320
    return states.atBlock(type, stream, state);
321
  };
322
323
  states.restricted_atBlock_before = function(type, stream, state) {
324
    if (type == "{")
325
      return pushContext(state, stream, "restricted_atBlock");
326
    if (type == "word" && state.stateArg == "@counter-style") {
327
      override = "variable";
328
      return "restricted_atBlock_before";
329
    }
330
    return pass(type, stream, state);
331
  };
332
333
  states.restricted_atBlock = function(type, stream, state) {
334
    if (type == "}") {
335
      state.stateArg = null;
336
      return popContext(state);
337
    }
338
    if (type == "word") {
339
      if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||
340
          (state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))
341
        override = "error";
342
      else
343
        override = "property";
344
      return "maybeprop";
345
    }
346
    return "restricted_atBlock";
347
  };
348
349
  states.keyframes = function(type, stream, state) {
350
    if (type == "word") { override = "variable"; return "keyframes"; }
351
    if (type == "{") return pushContext(state, stream, "top");
352
    return pass(type, stream, state);
353
  };
354
355
  states.at = function(type, stream, state) {
356
    if (type == ";") return popContext(state);
357
    if (type == "{" || type == "}") return popAndPass(type, stream, state);
358
    if (type == "word") override = "tag";
359
    else if (type == "hash") override = "builtin";
360
    return "at";
361
  };
362
363
  states.interpolation = function(type, stream, state) {
364
    if (type == "}") return popContext(state);
365
    if (type == "{" || type == ";") return popAndPass(type, stream, state);
366
    if (type == "word") override = "variable";
367
    else if (type != "variable" && type != "(" && type != ")") override = "error";
368
    return "interpolation";
369
  };
370
371
  return {
372
    startState: function(base) {
373
      return {tokenize: null,
374
              state: inline ? "block" : "top",
375
              stateArg: null,
376
              context: new Context(inline ? "block" : "top", base || 0, null)};
377
    },
378
379
    token: function(stream, state) {
380
      if (!state.tokenize && stream.eatSpace()) return null;
381
      var style = (state.tokenize || tokenBase)(stream, state);
382
      if (style && typeof style == "object") {
383
        type = style[1];
384
        style = style[0];
385
      }
386
      override = style;
387
      if (type != "comment")
388
        state.state = states[state.state](type, stream, state);
389
      return override;
390
    },
391
392
    indent: function(state, textAfter) {
393
      var cx = state.context, ch = textAfter && textAfter.charAt(0);
394
      var indent = cx.indent;
395
      if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
396
      if (cx.prev) {
397
        if (ch == "}" && (cx.type == "block" || cx.type == "top" ||
398
                          cx.type == "interpolation" || cx.type == "restricted_atBlock")) {
399
          // Resume indentation from parent context.
400
          cx = cx.prev;
401
          indent = cx.indent;
402
        } else if (ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
403
            ch == "{" && (cx.type == "at" || cx.type == "atBlock")) {
404
          // Dedent relative to current context.
405
          indent = Math.max(0, cx.indent - indentUnit);
406
        }
407
      }
408
      return indent;
409
    },
410
411
    electricChars: "}",
412
    blockCommentStart: "/*",
413
    blockCommentEnd: "*/",
414
    blockCommentContinue: " * ",
415
    lineComment: lineComment,
416
    fold: "brace"
417
  };
418
});
419
420
  function keySet(array) {
421
    var keys = {};
422
    for (var i = 0; i < array.length; ++i) {
423
      keys[array[i].toLowerCase()] = true;
424
    }
425
    return keys;
426
  }
427
428
  var documentTypes_ = [
429
    "domain", "regexp", "url", "url-prefix"
430
  ], documentTypes = keySet(documentTypes_);
431
432
  var mediaTypes_ = [
433
    "all", "aural", "braille", "handheld", "print", "projection", "screen",
434
    "tty", "tv", "embossed"
435
  ], mediaTypes = keySet(mediaTypes_);
436
437
  var mediaFeatures_ = [
438
    "width", "min-width", "max-width", "height", "min-height", "max-height",
439
    "device-width", "min-device-width", "max-device-width", "device-height",
440
    "min-device-height", "max-device-height", "aspect-ratio",
441
    "min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
442
    "min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
443
    "max-color", "color-index", "min-color-index", "max-color-index",
444
    "monochrome", "min-monochrome", "max-monochrome", "resolution",
445
    "min-resolution", "max-resolution", "scan", "grid", "orientation",
446
    "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
447
    "pointer", "any-pointer", "hover", "any-hover"
448
  ], mediaFeatures = keySet(mediaFeatures_);
449
450
  var mediaValueKeywords_ = [
451
    "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
452
    "interlace", "progressive"
453
  ], mediaValueKeywords = keySet(mediaValueKeywords_);
454
455
  var propertyKeywords_ = [
456
    "align-content", "align-items", "align-self", "alignment-adjust",
457
    "alignment-baseline", "anchor-point", "animation", "animation-delay",
458
    "animation-direction", "animation-duration", "animation-fill-mode",
459
    "animation-iteration-count", "animation-name", "animation-play-state",
460
    "animation-timing-function", "appearance", "azimuth", "backface-visibility",
461
    "background", "background-attachment", "background-blend-mode", "background-clip",
462
    "background-color", "background-image", "background-origin", "background-position",
463
    "background-repeat", "background-size", "baseline-shift", "binding",
464
    "bleed", "bookmark-label", "bookmark-level", "bookmark-state",
465
    "bookmark-target", "border", "border-bottom", "border-bottom-color",
466
    "border-bottom-left-radius", "border-bottom-right-radius",
467
    "border-bottom-style", "border-bottom-width", "border-collapse",
468
    "border-color", "border-image", "border-image-outset",
469
    "border-image-repeat", "border-image-slice", "border-image-source",
470
    "border-image-width", "border-left", "border-left-color",
471
    "border-left-style", "border-left-width", "border-radius", "border-right",
472
    "border-right-color", "border-right-style", "border-right-width",
473
    "border-spacing", "border-style", "border-top", "border-top-color",
474
    "border-top-left-radius", "border-top-right-radius", "border-top-style",
475
    "border-top-width", "border-width", "bottom", "box-decoration-break",
476
    "box-shadow", "box-sizing", "break-after", "break-before", "break-inside",
477
    "caption-side", "caret-color", "clear", "clip", "color", "color-profile", "column-count",
478
    "column-fill", "column-gap", "column-rule", "column-rule-color",
479
    "column-rule-style", "column-rule-width", "column-span", "column-width",
480
    "columns", "content", "counter-increment", "counter-reset", "crop", "cue",
481
    "cue-after", "cue-before", "cursor", "direction", "display",
482
    "dominant-baseline", "drop-initial-after-adjust",
483
    "drop-initial-after-align", "drop-initial-before-adjust",
484
    "drop-initial-before-align", "drop-initial-size", "drop-initial-value",
485
    "elevation", "empty-cells", "fit", "fit-position", "flex", "flex-basis",
486
    "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap",
487
    "float", "float-offset", "flow-from", "flow-into", "font", "font-feature-settings",
488
    "font-family", "font-kerning", "font-language-override", "font-size", "font-size-adjust",
489
    "font-stretch", "font-style", "font-synthesis", "font-variant",
490
    "font-variant-alternates", "font-variant-caps", "font-variant-east-asian",
491
    "font-variant-ligatures", "font-variant-numeric", "font-variant-position",
492
    "font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow",
493
    "grid-auto-rows", "grid-column", "grid-column-end", "grid-column-gap",
494
    "grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-gap",
495
    "grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns",
496
    "grid-template-rows", "hanging-punctuation", "height", "hyphens",
497
    "icon", "image-orientation", "image-rendering", "image-resolution",
498
    "inline-box-align", "justify-content", "justify-items", "justify-self", "left", "letter-spacing",
499
    "line-break", "line-height", "line-stacking", "line-stacking-ruby",
500
    "line-stacking-shift", "line-stacking-strategy", "list-style",
501
    "list-style-image", "list-style-position", "list-style-type", "margin",
502
    "margin-bottom", "margin-left", "margin-right", "margin-top",
503
    "marks", "marquee-direction", "marquee-loop",
504
    "marquee-play-count", "marquee-speed", "marquee-style", "max-height",
505
    "max-width", "min-height", "min-width", "move-to", "nav-down", "nav-index",
506
    "nav-left", "nav-right", "nav-up", "object-fit", "object-position",
507
    "opacity", "order", "orphans", "outline",
508
    "outline-color", "outline-offset", "outline-style", "outline-width",
509
    "overflow", "overflow-style", "overflow-wrap", "overflow-x", "overflow-y",
510
    "padding", "padding-bottom", "padding-left", "padding-right", "padding-top",
511
    "page", "page-break-after", "page-break-before", "page-break-inside",
512
    "page-policy", "pause", "pause-after", "pause-before", "perspective",
513
    "perspective-origin", "pitch", "pitch-range", "place-content", "place-items", "place-self", "play-during", "position",
514
    "presentation-level", "punctuation-trim", "quotes", "region-break-after",
515
    "region-break-before", "region-break-inside", "region-fragment",
516
    "rendering-intent", "resize", "rest", "rest-after", "rest-before", "richness",
517
    "right", "rotation", "rotation-point", "ruby-align", "ruby-overhang",
518
    "ruby-position", "ruby-span", "shape-image-threshold", "shape-inside", "shape-margin",
519
    "shape-outside", "size", "speak", "speak-as", "speak-header",
520
    "speak-numeral", "speak-punctuation", "speech-rate", "stress", "string-set",
521
    "tab-size", "table-layout", "target", "target-name", "target-new",
522
    "target-position", "text-align", "text-align-last", "text-decoration",
523
    "text-decoration-color", "text-decoration-line", "text-decoration-skip",
524
    "text-decoration-style", "text-emphasis", "text-emphasis-color",
525
    "text-emphasis-position", "text-emphasis-style", "text-height",
526
    "text-indent", "text-justify", "text-outline", "text-overflow", "text-shadow",
527
    "text-size-adjust", "text-space-collapse", "text-transform", "text-underline-position",
528
    "text-wrap", "top", "transform", "transform-origin", "transform-style",
529
    "transition", "transition-delay", "transition-duration",
530
    "transition-property", "transition-timing-function", "unicode-bidi",
531
    "user-select", "vertical-align", "visibility", "voice-balance", "voice-duration",
532
    "voice-family", "voice-pitch", "voice-range", "voice-rate", "voice-stress",
533
    "voice-volume", "volume", "white-space", "widows", "width", "will-change", "word-break",
534
    "word-spacing", "word-wrap", "z-index",
535
    // SVG-specific
536
    "clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
537
    "flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
538
    "color-interpolation", "color-interpolation-filters",
539
    "color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
540
    "marker", "marker-end", "marker-mid", "marker-start", "shape-rendering", "stroke",
541
    "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
542
    "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
543
    "baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
544
    "glyph-orientation-vertical", "text-anchor", "writing-mode"
545
  ], propertyKeywords = keySet(propertyKeywords_);
546
547
  var nonStandardPropertyKeywords_ = [
548
    "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
549
    "scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
550
    "scrollbar-3d-light-color", "scrollbar-track-color", "shape-inside",
551
    "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
552
    "searchfield-results-decoration", "zoom"
553
  ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
554
555
  var fontProperties_ = [
556
    "font-family", "src", "unicode-range", "font-variant", "font-feature-settings",
557
    "font-stretch", "font-weight", "font-style"
558
  ], fontProperties = keySet(fontProperties_);
559
560
  var counterDescriptors_ = [
561
    "additive-symbols", "fallback", "negative", "pad", "prefix", "range",
562
    "speak-as", "suffix", "symbols", "system"
563
  ], counterDescriptors = keySet(counterDescriptors_);
564
565
  var colorKeywords_ = [
566
    "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
567
    "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
568
    "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
569
    "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
570
    "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen",
571
    "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
572
    "darkslateblue", "darkslategray", "darkturquoise", "darkviolet",
573
    "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick",
574
    "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
575
    "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
576
    "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
577
    "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
578
    "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink",
579
    "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray",
580
    "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
581
    "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
582
    "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
583
    "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
584
    "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
585
    "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
586
    "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
587
    "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown",
588
    "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
589
    "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan",
590
    "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
591
    "whitesmoke", "yellow", "yellowgreen"
592
  ], colorKeywords = keySet(colorKeywords_);
593
594
  var valueKeywords_ = [
595
    "above", "absolute", "activeborder", "additive", "activecaption", "afar",
596
    "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
597
    "always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
598
    "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page",
599
    "avoid-region", "background", "backwards", "baseline", "below", "bidi-override", "binary",
600
    "bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box",
601
    "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel",
602
    "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
603
    "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
604
    "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
605
    "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
606
    "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
607
    "compact", "condensed", "contain", "content", "contents",
608
    "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
609
    "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
610
    "decimal-leading-zero", "default", "default-button", "dense", "destination-atop",
611
    "destination-in", "destination-out", "destination-over", "devanagari", "difference",
612
    "disc", "discard", "disclosure-closed", "disclosure-open", "document",
613
    "dot-dash", "dot-dot-dash",
614
    "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
615
    "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
616
    "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
617
    "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
618
    "ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
619
    "ethiopic-halehame-gez", "ethiopic-halehame-om-et",
620
    "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
621
    "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
622
    "ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed",
623
    "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
624
    "forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove",
625
    "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
626
    "help", "hidden", "hide", "higher", "highlight", "highlighttext",
627
    "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore",
628
    "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
629
    "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
630
    "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert",
631
    "italic", "japanese-formal", "japanese-informal", "justify", "kannada",
632
    "katakana", "katakana-iroha", "keep-all", "khmer",
633
    "korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
634
    "landscape", "lao", "large", "larger", "left", "level", "lighter", "lighten",
635
    "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
636
    "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
637
    "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
638
    "lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "match", "matrix", "matrix3d",
639
    "media-controls-background", "media-current-time-display",
640
    "media-fullscreen-button", "media-mute-button", "media-play-button",
641
    "media-return-to-realtime-button", "media-rewind-button",
642
    "media-seek-back-button", "media-seek-forward-button", "media-slider",
643
    "media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
644
    "media-volume-slider-container", "media-volume-sliderthumb", "medium",
645
    "menu", "menulist", "menulist-button", "menulist-text",
646
    "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
647
    "mix", "mongolian", "monospace", "move", "multiple", "multiply", "myanmar", "n-resize",
648
    "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
649
    "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
650
    "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote",
651
    "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
652
    "outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
653
    "painted", "page", "paused", "persian", "perspective", "plus-darker", "plus-lighter",
654
    "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
655
    "progress", "push-button", "radial-gradient", "radio", "read-only",
656
    "read-write", "read-write-plaintext-only", "rectangle", "region",
657
    "relative", "repeat", "repeating-linear-gradient",
658
    "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse",
659
    "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
660
    "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
661
    "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",
662
    "scroll", "scrollbar", "scroll-position", "se-resize", "searchfield",
663
    "searchfield-cancel-button", "searchfield-decoration",
664
    "searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end",
665
    "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama",
666
    "simp-chinese-formal", "simp-chinese-informal", "single",
667
    "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
668
    "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
669
    "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali",
670
    "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square",
671
    "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub",
672
    "subpixel-antialiased", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table",
673
    "table-caption", "table-cell", "table-column", "table-column-group",
674
    "table-footer-group", "table-header-group", "table-row", "table-row-group",
675
    "tamil",
676
    "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
677
    "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
678
    "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
679
    "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
680
    "trad-chinese-formal", "trad-chinese-informal", "transform",
681
    "translate", "translate3d", "translateX", "translateY", "translateZ",
682
    "transparent", "ultra-condensed", "ultra-expanded", "underline", "unset", "up",
683
    "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
684
    "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
685
    "var", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted",
686
    "visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
687
    "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
688
    "xx-large", "xx-small"
689
  ], valueKeywords = keySet(valueKeywords_);
690
691
  var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)
692
    .concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)
693
    .concat(valueKeywords_);
694
  CodeMirror.registerHelper("hintWords", "css", allWords);
695
696
  function tokenCComment(stream, state) {
697
    var maybeEnd = false, ch;
698
    while ((ch = stream.next()) != null) {
699
      if (maybeEnd && ch == "/") {
700
        state.tokenize = null;
701
        break;
702
      }
703
      maybeEnd = (ch == "*");
704
    }
705
    return ["comment", "comment"];
706
  }
707
708
  CodeMirror.defineMIME("text/css", {
709
    documentTypes: documentTypes,
710
    mediaTypes: mediaTypes,
711
    mediaFeatures: mediaFeatures,
712
    mediaValueKeywords: mediaValueKeywords,
713
    propertyKeywords: propertyKeywords,
714
    nonStandardPropertyKeywords: nonStandardPropertyKeywords,
715
    fontProperties: fontProperties,
716
    counterDescriptors: counterDescriptors,
717
    colorKeywords: colorKeywords,
718
    valueKeywords: valueKeywords,
719
    tokenHooks: {
720
      "/": function(stream, state) {
721
        if (!stream.eat("*")) return false;
722
        state.tokenize = tokenCComment;
723
        return tokenCComment(stream, state);
724
      }
725
    },
726
    name: "css"
727
  });
728
729
  CodeMirror.defineMIME("text/x-scss", {
730
    mediaTypes: mediaTypes,
731
    mediaFeatures: mediaFeatures,
732
    mediaValueKeywords: mediaValueKeywords,
733
    propertyKeywords: propertyKeywords,
734
    nonStandardPropertyKeywords: nonStandardPropertyKeywords,
735
    colorKeywords: colorKeywords,
736
    valueKeywords: valueKeywords,
737
    fontProperties: fontProperties,
738
    allowNested: true,
739
    lineComment: "//",
740
    tokenHooks: {
741
      "/": function(stream, state) {
742
        if (stream.eat("/")) {
743
          stream.skipToEnd();
744
          return ["comment", "comment"];
745
        } else if (stream.eat("*")) {
746
          state.tokenize = tokenCComment;
747
          return tokenCComment(stream, state);
748
        } else {
749
          return ["operator", "operator"];
750
        }
751
      },
752
      ":": function(stream) {
753
        if (stream.match(/\s*\{/, false))
754
          return [null, null]
755
        return false;
756
      },
757
      "$": function(stream) {
758
        stream.match(/^[\w-]+/);
759
        if (stream.match(/^\s*:/, false))
760
          return ["variable-2", "variable-definition"];
761
        return ["variable-2", "variable"];
762
      },
763
      "#": function(stream) {
764
        if (!stream.eat("{")) return false;
765
        return [null, "interpolation"];
766
      }
767
    },
768
    name: "css",
769
    helperType: "scss"
770
  });
771
772
  CodeMirror.defineMIME("text/x-less", {
773
    mediaTypes: mediaTypes,
774
    mediaFeatures: mediaFeatures,
775
    mediaValueKeywords: mediaValueKeywords,
776
    propertyKeywords: propertyKeywords,
777
    nonStandardPropertyKeywords: nonStandardPropertyKeywords,
778
    colorKeywords: colorKeywords,
779
    valueKeywords: valueKeywords,
780
    fontProperties: fontProperties,
781
    allowNested: true,
782
    lineComment: "//",
783
    tokenHooks: {
784
      "/": function(stream, state) {
785
        if (stream.eat("/")) {
786
          stream.skipToEnd();
787
          return ["comment", "comment"];
788
        } else if (stream.eat("*")) {
789
          state.tokenize = tokenCComment;
790
          return tokenCComment(stream, state);
791
        } else {
792
          return ["operator", "operator"];
793
        }
794
      },
795
      "@": function(stream) {
796
        if (stream.eat("{")) return [null, "interpolation"];
797
        if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i, false)) return false;
798
        stream.eatWhile(/[\w\\\-]/);
799
        if (stream.match(/^\s*:/, false))
800
          return ["variable-2", "variable-definition"];
801
        return ["variable-2", "variable"];
802
      },
803
      "&": function() {
804
        return ["atom", "atom"];
805
      }
806
    },
807
    name: "css",
808
    helperType: "less"
809
  });
810
811
  CodeMirror.defineMIME("text/x-gss", {
812
    documentTypes: documentTypes,
813
    mediaTypes: mediaTypes,
814
    mediaFeatures: mediaFeatures,
815
    propertyKeywords: propertyKeywords,
816
    nonStandardPropertyKeywords: nonStandardPropertyKeywords,
817
    fontProperties: fontProperties,
818
    counterDescriptors: counterDescriptors,
819
    colorKeywords: colorKeywords,
820
    valueKeywords: valueKeywords,
821
    supportsAtComponent: true,
822
    tokenHooks: {
823
      "/": function(stream, state) {
824
        if (!stream.eat("*")) return false;
825
        state.tokenize = tokenCComment;
826
        return tokenCComment(stream, state);
827
      }
828
    },
829
    name: "css",
830
    helperType: "gss"
831
  });
832
833
});
(-)a/koha-tmpl/intranet-tmpl/lib/codemirror/css.min.js (+1 lines)
Line 0 Link Here
1
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(T){"use strict";function e(e){for(var t={},r=0;r<e.length;++r)t[e[r].toLowerCase()]=!0;return t}T.defineMode("css",function(e,t){var r=t.inline;t.propertyKeywords||(t=T.resolveMode("text/css"));var o,i,a=e.indentUnit,n=t.tokenHooks,l=t.documentTypes||{},s=t.mediaTypes||{},c=t.mediaFeatures||{},d=t.mediaValueKeywords||{},p=t.propertyKeywords||{},u=t.nonStandardPropertyKeywords||{},m=t.fontProperties||{},h=t.counterDescriptors||{},g=t.colorKeywords||{},b=t.valueKeywords||{},f=t.allowNested,y=t.lineComment,w=!0===t.supportsAtComponent;function k(e,t){return o=t,e}function v(i){return function(e,t){for(var r,o=!1;null!=(r=e.next());){if(r==i&&!o){")"==i&&e.backUp(1);break}o=!o&&"\\"==r}return(r==i||!o&&")"!=i)&&(t.tokenize=null),k("string","string")}}function x(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=v(")"),k(null,"(")}function z(e,t,r){this.type=e,this.indent=t,this.prev=r}function j(e,t,r,o){return e.context=new z(r,t.indentation()+(!1===o?0:a),e.context),r}function q(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function P(e,t,r){return B[r.context.type](e,t,r)}function K(e,t,r,o){for(var i=o||1;0<i;i--)r.context=r.context.prev;return P(e,t,r)}function C(e){var t=e.current().toLowerCase();i=b.hasOwnProperty(t)?"atom":g.hasOwnProperty(t)?"keyword":"variable"}var B={top:function(e,t,r){if("{"==e)return j(r,t,"block");if("}"==e&&r.context.prev)return q(r);if(w&&/@component/i.test(e))return j(r,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return j(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return j(r,t,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return j(r,t,"at");if("hash"==e)i="builtin";else if("word"==e)i="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return j(r,t,"interpolation");if(":"==e)return"pseudo";if(f&&"("==e)return j(r,t,"parens")}return r.context.type},block:function(e,t,r){if("word"!=e)return"meta"==e?"block":f||"hash"!=e&&"qualifier"!=e?B.top(e,t,r):(i="error","block");var o=t.current().toLowerCase();return p.hasOwnProperty(o)?(i="property","maybeprop"):u.hasOwnProperty(o)?(i="string-2","maybeprop"):f?(i=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(i+=" error","maybeprop")},maybeprop:function(e,t,r){return":"==e?j(r,t,"prop"):P(e,t,r)},prop:function(e,t,r){if(";"==e)return q(r);if("{"==e&&f)return j(r,t,"propBlock");if("}"==e||"{"==e)return K(e,t,r);if("("==e)return j(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)C(t);else if("interpolation"==e)return j(r,t,"interpolation")}else i+=" error";return"prop"},propBlock:function(e,t,r){return"}"==e?q(r):"word"==e?(i="property","maybeprop"):r.context.type},parens:function(e,t,r){return"{"==e||"}"==e?K(e,t,r):")"==e?q(r):"("==e?j(r,t,"parens"):"interpolation"==e?j(r,t,"interpolation"):("word"==e&&C(t),"parens")},pseudo:function(e,t,r){return"meta"==e?"pseudo":"word"==e?(i="variable-3",r.context.type):P(e,t,r)},documentTypes:function(e,t,r){return"word"==e&&l.hasOwnProperty(t.current())?(i="tag",r.context.type):B.atBlock(e,t,r)},atBlock:function(e,t,r){if("("==e)return j(r,t,"atBlock_parens");if("}"==e||";"==e)return K(e,t,r);if("{"==e)return q(r)&&j(r,t,f?"block":"top");if("interpolation"==e)return j(r,t,"interpolation");if("word"==e){var o=t.current().toLowerCase();i="only"==o||"not"==o||"and"==o||"or"==o?"keyword":s.hasOwnProperty(o)?"attribute":c.hasOwnProperty(o)?"property":d.hasOwnProperty(o)?"keyword":p.hasOwnProperty(o)?"property":u.hasOwnProperty(o)?"string-2":b.hasOwnProperty(o)?"atom":g.hasOwnProperty(o)?"keyword":"error"}return r.context.type},atComponentBlock:function(e,t,r){return"}"==e?K(e,t,r):"{"==e?q(r)&&j(r,t,f?"block":"top",!1):("word"==e&&(i="error"),r.context.type)},atBlock_parens:function(e,t,r){return")"==e?q(r):"{"==e||"}"==e?K(e,t,r,2):B.atBlock(e,t,r)},restricted_atBlock_before:function(e,t,r){return"{"==e?j(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(i="variable","restricted_atBlock_before"):P(e,t,r)},restricted_atBlock:function(e,t,r){return"}"==e?(r.stateArg=null,q(r)):"word"==e?(i="@font-face"==r.stateArg&&!m.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!h.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},keyframes:function(e,t,r){return"word"==e?(i="variable","keyframes"):"{"==e?j(r,t,"top"):P(e,t,r)},at:function(e,t,r){return";"==e?q(r):"{"==e||"}"==e?K(e,t,r):("word"==e?i="tag":"hash"==e&&(i="builtin"),"at")},interpolation:function(e,t,r){return"}"==e?q(r):"{"==e||";"==e?K(e,t,r):("word"==e?i="variable":"variable"!=e&&"("!=e&&")"!=e&&(i="error"),"interpolation")}};return{startState:function(e){return{tokenize:null,state:r?"block":"top",stateArg:null,context:new z(r?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||function(e,t){var r=e.next();if(n[r]){var o=n[r](e,t);if(!1!==o)return o}return"@"==r?(e.eatWhile(/[\w\\\-]/),k("def",e.current())):"="==r||("~"==r||"|"==r)&&e.eat("=")?k(null,"compare"):'"'==r||"'"==r?(t.tokenize=v(r),t.tokenize(e,t)):"#"==r?(e.eatWhile(/[\w\\\-]/),k("atom","hash")):"!"==r?(e.match(/^\s*\w*/),k("keyword","important")):/\d/.test(r)||"."==r&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),k("number","unit")):"-"!==r?/[,+>*\/]/.test(r)?k(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?k("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?k(null,r):("u"==r||"U"==r)&&e.match(/rl(-prefix)?\(/i)||("d"==r||"D"==r)&&e.match("omain(",!0,!0)||("r"==r||"R"==r)&&e.match("egexp(",!0,!0)?(e.backUp(1),t.tokenize=x,k("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),k("property","word")):k(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),k("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?k("variable-2","variable-definition"):k("variable-2","variable")):e.match(/^\w+-/)?k("meta","meta"):void 0})(e,t);return r&&"object"==typeof r&&(o=r[1],r=r[0]),i=r,"comment"!=o&&(t.state=B[t.state](o,e,t)),i},indent:function(e,t){var r=e.context,o=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=o&&")"!=o||(r=r.prev),r.prev&&("}"!=o||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type?(")"!=o||"parens"!=r.type&&"atBlock_parens"!=r.type)&&("{"!=o||"at"!=r.type&&"atBlock"!=r.type)||(i=Math.max(0,r.indent-a)):i=(r=r.prev).indent),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:y,fold:"brace"}});var t=["domain","regexp","url","url-prefix"],r=e(t),o=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],i=e(o),a=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],n=e(a),l=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],s=e(l),c=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-gap","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-gap","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","justify-items","justify-self","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","place-content","place-items","place-self","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","user-select","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],d=e(c),p=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],u=e(p),m=e(["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]),h=e(["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"]),g=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],b=e(g),f=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","grid","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","opacity","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unset","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],y=e(f),w=t.concat(o).concat(a).concat(l).concat(c).concat(p).concat(g).concat(f);function k(e,t){for(var r,o=!1;null!=(r=e.next());){if(o&&"/"==r){t.tokenize=null;break}o="*"==r}return["comment","comment"]}T.registerHelper("hintWords","css",w),T.defineMIME("text/css",{documentTypes:r,mediaTypes:i,mediaFeatures:n,mediaValueKeywords:s,propertyKeywords:d,nonStandardPropertyKeywords:u,fontProperties:m,counterDescriptors:h,colorKeywords:b,valueKeywords:y,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=k)(e,t)}},name:"css"}),T.defineMIME("text/x-scss",{mediaTypes:i,mediaFeatures:n,mediaValueKeywords:s,propertyKeywords:d,nonStandardPropertyKeywords:u,colorKeywords:b,valueKeywords:y,fontProperties:m,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=k)(e,t):["operator","operator"]},":":function(e){return!!e.match(/\s*\{/,!1)&&[null,null]},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return!!e.eat("{")&&[null,"interpolation"]}},name:"css",helperType:"scss"}),T.defineMIME("text/x-less",{mediaTypes:i,mediaFeatures:n,mediaValueKeywords:s,propertyKeywords:d,nonStandardPropertyKeywords:u,colorKeywords:b,valueKeywords:y,fontProperties:m,allowNested:!0,lineComment:"//",tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=k)(e,t):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:!e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i,!1)&&(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),T.defineMIME("text/x-gss",{documentTypes:r,mediaTypes:i,mediaFeatures:n,propertyKeywords:d,nonStandardPropertyKeywords:u,fontProperties:m,counterDescriptors:h,colorKeywords:b,valueKeywords:y,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return!!e.eat("*")&&(t.tokenize=k)(e,t)}},name:"css",helperType:"gss"})});
(-)a/koha-tmpl/intranet-tmpl/lib/codemirror/javascript.js (+900 lines)
Line 0 Link Here
1
/* CodeMirror version: 5.40.2 */
2
// CodeMirror, copyright (c) by Marijn Haverbeke and others
3
// Distributed under an MIT license: https://codemirror.net/LICENSE
4
5
(function(mod) {
6
  if (typeof exports == "object" && typeof module == "object") // CommonJS
7
    mod(require("../../lib/codemirror"));
8
  else if (typeof define == "function" && define.amd) // AMD
9
    define(["../../lib/codemirror"], mod);
10
  else // Plain browser env
11
    mod(CodeMirror);
12
})(function(CodeMirror) {
13
"use strict";
14
15
CodeMirror.defineMode("javascript", function(config, parserConfig) {
16
  var indentUnit = config.indentUnit;
17
  var statementIndent = parserConfig.statementIndent;
18
  var jsonldMode = parserConfig.jsonld;
19
  var jsonMode = parserConfig.json || jsonldMode;
20
  var isTS = parserConfig.typescript;
21
  var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
22
23
  // Tokenizer
24
25
  var keywords = function(){
26
    function kw(type) {return {type: type, style: "keyword"};}
27
    var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"), D = kw("keyword d");
28
    var operator = kw("operator"), atom = {type: "atom", style: "atom"};
29
30
    return {
31
      "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
32
      "return": D, "break": D, "continue": D, "new": kw("new"), "delete": C, "void": C, "throw": C,
33
      "debugger": kw("debugger"), "var": kw("var"), "const": kw("var"), "let": kw("var"),
34
      "function": kw("function"), "catch": kw("catch"),
35
      "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
36
      "in": operator, "typeof": operator, "instanceof": operator,
37
      "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
38
      "this": kw("this"), "class": kw("class"), "super": kw("atom"),
39
      "yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
40
      "await": C
41
    };
42
  }();
43
44
  var isOperatorChar = /[+\-*&%=<>!?|~^@]/;
45
  var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
46
47
  function readRegexp(stream) {
48
    var escaped = false, next, inSet = false;
49
    while ((next = stream.next()) != null) {
50
      if (!escaped) {
51
        if (next == "/" && !inSet) return;
52
        if (next == "[") inSet = true;
53
        else if (inSet && next == "]") inSet = false;
54
      }
55
      escaped = !escaped && next == "\\";
56
    }
57
  }
58
59
  // Used as scratch variables to communicate multiple values without
60
  // consing up tons of objects.
61
  var type, content;
62
  function ret(tp, style, cont) {
63
    type = tp; content = cont;
64
    return style;
65
  }
66
  function tokenBase(stream, state) {
67
    var ch = stream.next();
68
    if (ch == '"' || ch == "'") {
69
      state.tokenize = tokenString(ch);
70
      return state.tokenize(stream, state);
71
    } else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
72
      return ret("number", "number");
73
    } else if (ch == "." && stream.match("..")) {
74
      return ret("spread", "meta");
75
    } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
76
      return ret(ch);
77
    } else if (ch == "=" && stream.eat(">")) {
78
      return ret("=>", "operator");
79
    } else if (ch == "0" && stream.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i)) {
80
      return ret("number", "number");
81
    } else if (/\d/.test(ch)) {
82
      stream.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/);
83
      return ret("number", "number");
84
    } else if (ch == "/") {
85
      if (stream.eat("*")) {
86
        state.tokenize = tokenComment;
87
        return tokenComment(stream, state);
88
      } else if (stream.eat("/")) {
89
        stream.skipToEnd();
90
        return ret("comment", "comment");
91
      } else if (expressionAllowed(stream, state, 1)) {
92
        readRegexp(stream);
93
        stream.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/);
94
        return ret("regexp", "string-2");
95
      } else {
96
        stream.eat("=");
97
        return ret("operator", "operator", stream.current());
98
      }
99
    } else if (ch == "`") {
100
      state.tokenize = tokenQuasi;
101
      return tokenQuasi(stream, state);
102
    } else if (ch == "#") {
103
      stream.skipToEnd();
104
      return ret("error", "error");
105
    } else if (isOperatorChar.test(ch)) {
106
      if (ch != ">" || !state.lexical || state.lexical.type != ">") {
107
        if (stream.eat("=")) {
108
          if (ch == "!" || ch == "=") stream.eat("=")
109
        } else if (/[<>*+\-]/.test(ch)) {
110
          stream.eat(ch)
111
          if (ch == ">") stream.eat(ch)
112
        }
113
      }
114
      return ret("operator", "operator", stream.current());
115
    } else if (wordRE.test(ch)) {
116
      stream.eatWhile(wordRE);
117
      var word = stream.current()
118
      if (state.lastType != ".") {
119
        if (keywords.propertyIsEnumerable(word)) {
120
          var kw = keywords[word]
121
          return ret(kw.type, kw.style, word)
122
        }
123
        if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false))
124
          return ret("async", "keyword", word)
125
      }
126
      return ret("variable", "variable", word)
127
    }
128
  }
129
130
  function tokenString(quote) {
131
    return function(stream, state) {
132
      var escaped = false, next;
133
      if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
134
        state.tokenize = tokenBase;
135
        return ret("jsonld-keyword", "meta");
136
      }
137
      while ((next = stream.next()) != null) {
138
        if (next == quote && !escaped) break;
139
        escaped = !escaped && next == "\\";
140
      }
141
      if (!escaped) state.tokenize = tokenBase;
142
      return ret("string", "string");
143
    };
144
  }
145
146
  function tokenComment(stream, state) {
147
    var maybeEnd = false, ch;
148
    while (ch = stream.next()) {
149
      if (ch == "/" && maybeEnd) {
150
        state.tokenize = tokenBase;
151
        break;
152
      }
153
      maybeEnd = (ch == "*");
154
    }
155
    return ret("comment", "comment");
156
  }
157
158
  function tokenQuasi(stream, state) {
159
    var escaped = false, next;
160
    while ((next = stream.next()) != null) {
161
      if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
162
        state.tokenize = tokenBase;
163
        break;
164
      }
165
      escaped = !escaped && next == "\\";
166
    }
167
    return ret("quasi", "string-2", stream.current());
168
  }
169
170
  var brackets = "([{}])";
171
  // This is a crude lookahead trick to try and notice that we're
172
  // parsing the argument patterns for a fat-arrow function before we
173
  // actually hit the arrow token. It only works if the arrow is on
174
  // the same line as the arguments and there's no strange noise
175
  // (comments) in between. Fallback is to only notice when we hit the
176
  // arrow, and not declare the arguments as locals for the arrow
177
  // body.
178
  function findFatArrow(stream, state) {
179
    if (state.fatArrowAt) state.fatArrowAt = null;
180
    var arrow = stream.string.indexOf("=>", stream.start);
181
    if (arrow < 0) return;
182
183
    if (isTS) { // Try to skip TypeScript return type declarations after the arguments
184
      var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow))
185
      if (m) arrow = m.index
186
    }
187
188
    var depth = 0, sawSomething = false;
189
    for (var pos = arrow - 1; pos >= 0; --pos) {
190
      var ch = stream.string.charAt(pos);
191
      var bracket = brackets.indexOf(ch);
192
      if (bracket >= 0 && bracket < 3) {
193
        if (!depth) { ++pos; break; }
194
        if (--depth == 0) { if (ch == "(") sawSomething = true; break; }
195
      } else if (bracket >= 3 && bracket < 6) {
196
        ++depth;
197
      } else if (wordRE.test(ch)) {
198
        sawSomething = true;
199
      } else if (/["'\/]/.test(ch)) {
200
        return;
201
      } else if (sawSomething && !depth) {
202
        ++pos;
203
        break;
204
      }
205
    }
206
    if (sawSomething && !depth) state.fatArrowAt = pos;
207
  }
208
209
  // Parser
210
211
  var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
212
213
  function JSLexical(indented, column, type, align, prev, info) {
214
    this.indented = indented;
215
    this.column = column;
216
    this.type = type;
217
    this.prev = prev;
218
    this.info = info;
219
    if (align != null) this.align = align;
220
  }
221
222
  function inScope(state, varname) {
223
    for (var v = state.localVars; v; v = v.next)
224
      if (v.name == varname) return true;
225
    for (var cx = state.context; cx; cx = cx.prev) {
226
      for (var v = cx.vars; v; v = v.next)
227
        if (v.name == varname) return true;
228
    }
229
  }
230
231
  function parseJS(state, style, type, content, stream) {
232
    var cc = state.cc;
233
    // Communicate our context to the combinators.
234
    // (Less wasteful than consing up a hundred closures on every call.)
235
    cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
236
237
    if (!state.lexical.hasOwnProperty("align"))
238
      state.lexical.align = true;
239
240
    while(true) {
241
      var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
242
      if (combinator(type, content)) {
243
        while(cc.length && cc[cc.length - 1].lex)
244
          cc.pop()();
245
        if (cx.marked) return cx.marked;
246
        if (type == "variable" && inScope(state, content)) return "variable-2";
247
        return style;
248
      }
249
    }
250
  }
251
252
  // Combinator utils
253
254
  var cx = {state: null, column: null, marked: null, cc: null};
255
  function pass() {
256
    for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
257
  }
258
  function cont() {
259
    pass.apply(null, arguments);
260
    return true;
261
  }
262
  function inList(name, list) {
263
    for (var v = list; v; v = v.next) if (v.name == name) return true
264
    return false;
265
  }
266
  function register(varname) {
267
    var state = cx.state;
268
    cx.marked = "def";
269
    if (state.context) {
270
      if (state.lexical.info == "var" && state.context && state.context.block) {
271
        // FIXME function decls are also not block scoped
272
        var newContext = registerVarScoped(varname, state.context)
273
        if (newContext != null) {
274
          state.context = newContext
275
          return
276
        }
277
      } else if (!inList(varname, state.localVars)) {
278
        state.localVars = new Var(varname, state.localVars)
279
        return
280
      }
281
    }
282
    // Fall through means this is global
283
    if (parserConfig.globalVars && !inList(varname, state.globalVars))
284
      state.globalVars = new Var(varname, state.globalVars)
285
  }
286
  function registerVarScoped(varname, context) {
287
    if (!context) {
288
      return null
289
    } else if (context.block) {
290
      var inner = registerVarScoped(varname, context.prev)
291
      if (!inner) return null
292
      if (inner == context.prev) return context
293
      return new Context(inner, context.vars, true)
294
    } else if (inList(varname, context.vars)) {
295
      return context
296
    } else {
297
      return new Context(context.prev, new Var(varname, context.vars), false)
298
    }
299
  }
300
301
  function isModifier(name) {
302
    return name == "public" || name == "private" || name == "protected" || name == "abstract" || name == "readonly"
303
  }
304
305
  // Combinators
306
307
  function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block }
308
  function Var(name, next) { this.name = name; this.next = next }
309
310
  var defaultVars = new Var("this", new Var("arguments", null))
311
  function pushcontext() {
312
    cx.state.context = new Context(cx.state.context, cx.state.localVars, false)
313
    cx.state.localVars = defaultVars
314
  }
315
  function pushblockcontext() {
316
    cx.state.context = new Context(cx.state.context, cx.state.localVars, true)
317
    cx.state.localVars = null
318
  }
319
  function popcontext() {
320
    cx.state.localVars = cx.state.context.vars
321
    cx.state.context = cx.state.context.prev
322
  }
323
  popcontext.lex = true
324
  function pushlex(type, info) {
325
    var result = function() {
326
      var state = cx.state, indent = state.indented;
327
      if (state.lexical.type == "stat") indent = state.lexical.indented;
328
      else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
329
        indent = outer.indented;
330
      state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
331
    };
332
    result.lex = true;
333
    return result;
334
  }
335
  function poplex() {
336
    var state = cx.state;
337
    if (state.lexical.prev) {
338
      if (state.lexical.type == ")")
339
        state.indented = state.lexical.indented;
340
      state.lexical = state.lexical.prev;
341
    }
342
  }
343
  poplex.lex = true;
344
345
  function expect(wanted) {
346
    function exp(type) {
347
      if (type == wanted) return cont();
348
      else if (wanted == ";" || type == "}" || type == ")" || type == "]") return pass();
349
      else return cont(exp);
350
    };
351
    return exp;
352
  }
353
354
  function statement(type, value) {
355
    if (type == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex);
356
    if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
357
    if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
358
    if (type == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex);
359
    if (type == "debugger") return cont(expect(";"));
360
    if (type == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext);
361
    if (type == ";") return cont();
362
    if (type == "if") {
363
      if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
364
        cx.state.cc.pop()();
365
      return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
366
    }
367
    if (type == "function") return cont(functiondef);
368
    if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
369
    if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), className, poplex); }
370
    if (type == "variable") {
371
      if (isTS && value == "declare") {
372
        cx.marked = "keyword"
373
        return cont(statement)
374
      } else if (isTS && (value == "module" || value == "enum" || value == "type") && cx.stream.match(/^\s*\w/, false)) {
375
        cx.marked = "keyword"
376
        if (value == "enum") return cont(enumdef);
377
        else if (value == "type") return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
378
        else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
379
      } else if (isTS && value == "namespace") {
380
        cx.marked = "keyword"
381
        return cont(pushlex("form"), expression, block, poplex)
382
      } else if (isTS && value == "abstract") {
383
        cx.marked = "keyword"
384
        return cont(statement)
385
      } else {
386
        return cont(pushlex("stat"), maybelabel);
387
      }
388
    }
389
    if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), pushblockcontext,
390
                                      block, poplex, poplex, popcontext);
391
    if (type == "case") return cont(expression, expect(":"));
392
    if (type == "default") return cont(expect(":"));
393
    if (type == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);
394
    if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
395
    if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
396
    if (type == "async") return cont(statement)
397
    if (value == "@") return cont(expression, statement)
398
    return pass(pushlex("stat"), expression, expect(";"), poplex);
399
  }
400
  function maybeCatchBinding(type) {
401
    if (type == "(") return cont(funarg, expect(")"))
402
  }
403
  function expression(type, value) {
404
    return expressionInner(type, value, false);
405
  }
406
  function expressionNoComma(type, value) {
407
    return expressionInner(type, value, true);
408
  }
409
  function parenExpr(type) {
410
    if (type != "(") return pass()
411
    return cont(pushlex(")"), expression, expect(")"), poplex)
412
  }
413
  function expressionInner(type, value, noComma) {
414
    if (cx.state.fatArrowAt == cx.stream.start) {
415
      var body = noComma ? arrowBodyNoComma : arrowBody;
416
      if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, expect("=>"), body, popcontext);
417
      else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
418
    }
419
420
    var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
421
    if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
422
    if (type == "function") return cont(functiondef, maybeop);
423
    if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), classExpression, poplex); }
424
    if (type == "keyword c" || type == "async") return cont(noComma ? expressionNoComma : expression);
425
    if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
426
    if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
427
    if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
428
    if (type == "{") return contCommasep(objprop, "}", null, maybeop);
429
    if (type == "quasi") return pass(quasi, maybeop);
430
    if (type == "new") return cont(maybeTarget(noComma));
431
    if (type == "import") return cont(expression);
432
    return cont();
433
  }
434
  function maybeexpression(type) {
435
    if (type.match(/[;\}\)\],]/)) return pass();
436
    return pass(expression);
437
  }
438
439
  function maybeoperatorComma(type, value) {
440
    if (type == ",") return cont(expression);
441
    return maybeoperatorNoComma(type, value, false);
442
  }
443
  function maybeoperatorNoComma(type, value, noComma) {
444
    var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
445
    var expr = noComma == false ? expression : expressionNoComma;
446
    if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
447
    if (type == "operator") {
448
      if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me);
449
      if (isTS && value == "<" && cx.stream.match(/^([^>]|<.*?>)*>\s*\(/, false))
450
        return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me);
451
      if (value == "?") return cont(expression, expect(":"), expr);
452
      return cont(expr);
453
    }
454
    if (type == "quasi") { return pass(quasi, me); }
455
    if (type == ";") return;
456
    if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
457
    if (type == ".") return cont(property, me);
458
    if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
459
    if (isTS && value == "as") { cx.marked = "keyword"; return cont(typeexpr, me) }
460
    if (type == "regexp") {
461
      cx.state.lastType = cx.marked = "operator"
462
      cx.stream.backUp(cx.stream.pos - cx.stream.start - 1)
463
      return cont(expr)
464
    }
465
  }
466
  function quasi(type, value) {
467
    if (type != "quasi") return pass();
468
    if (value.slice(value.length - 2) != "${") return cont(quasi);
469
    return cont(expression, continueQuasi);
470
  }
471
  function continueQuasi(type) {
472
    if (type == "}") {
473
      cx.marked = "string-2";
474
      cx.state.tokenize = tokenQuasi;
475
      return cont(quasi);
476
    }
477
  }
478
  function arrowBody(type) {
479
    findFatArrow(cx.stream, cx.state);
480
    return pass(type == "{" ? statement : expression);
481
  }
482
  function arrowBodyNoComma(type) {
483
    findFatArrow(cx.stream, cx.state);
484
    return pass(type == "{" ? statement : expressionNoComma);
485
  }
486
  function maybeTarget(noComma) {
487
    return function(type) {
488
      if (type == ".") return cont(noComma ? targetNoComma : target);
489
      else if (type == "variable" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma)
490
      else return pass(noComma ? expressionNoComma : expression);
491
    };
492
  }
493
  function target(_, value) {
494
    if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
495
  }
496
  function targetNoComma(_, value) {
497
    if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
498
  }
499
  function maybelabel(type) {
500
    if (type == ":") return cont(poplex, statement);
501
    return pass(maybeoperatorComma, expect(";"), poplex);
502
  }
503
  function property(type) {
504
    if (type == "variable") {cx.marked = "property"; return cont();}
505
  }
506
  function objprop(type, value) {
507
    if (type == "async") {
508
      cx.marked = "property";
509
      return cont(objprop);
510
    } else if (type == "variable" || cx.style == "keyword") {
511
      cx.marked = "property";
512
      if (value == "get" || value == "set") return cont(getterSetter);
513
      var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params
514
      if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\s*:\s*/, false)))
515
        cx.state.fatArrowAt = cx.stream.pos + m[0].length
516
      return cont(afterprop);
517
    } else if (type == "number" || type == "string") {
518
      cx.marked = jsonldMode ? "property" : (cx.style + " property");
519
      return cont(afterprop);
520
    } else if (type == "jsonld-keyword") {
521
      return cont(afterprop);
522
    } else if (isTS && isModifier(value)) {
523
      cx.marked = "keyword"
524
      return cont(objprop)
525
    } else if (type == "[") {
526
      return cont(expression, maybetype, expect("]"), afterprop);
527
    } else if (type == "spread") {
528
      return cont(expressionNoComma, afterprop);
529
    } else if (value == "*") {
530
      cx.marked = "keyword";
531
      return cont(objprop);
532
    } else if (type == ":") {
533
      return pass(afterprop)
534
    }
535
  }
536
  function getterSetter(type) {
537
    if (type != "variable") return pass(afterprop);
538
    cx.marked = "property";
539
    return cont(functiondef);
540
  }
541
  function afterprop(type) {
542
    if (type == ":") return cont(expressionNoComma);
543
    if (type == "(") return pass(functiondef);
544
  }
545
  function commasep(what, end, sep) {
546
    function proceed(type, value) {
547
      if (sep ? sep.indexOf(type) > -1 : type == ",") {
548
        var lex = cx.state.lexical;
549
        if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
550
        return cont(function(type, value) {
551
          if (type == end || value == end) return pass()
552
          return pass(what)
553
        }, proceed);
554
      }
555
      if (type == end || value == end) return cont();
556
      return cont(expect(end));
557
    }
558
    return function(type, value) {
559
      if (type == end || value == end) return cont();
560
      return pass(what, proceed);
561
    };
562
  }
563
  function contCommasep(what, end, info) {
564
    for (var i = 3; i < arguments.length; i++)
565
      cx.cc.push(arguments[i]);
566
    return cont(pushlex(end, info), commasep(what, end), poplex);
567
  }
568
  function block(type) {
569
    if (type == "}") return cont();
570
    return pass(statement, block);
571
  }
572
  function maybetype(type, value) {
573
    if (isTS) {
574
      if (type == ":") return cont(typeexpr);
575
      if (value == "?") return cont(maybetype);
576
    }
577
  }
578
  function mayberettype(type) {
579
    if (isTS && type == ":") {
580
      if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr)
581
      else return cont(typeexpr)
582
    }
583
  }
584
  function isKW(_, value) {
585
    if (value == "is") {
586
      cx.marked = "keyword"
587
      return cont()
588
    }
589
  }
590
  function typeexpr(type, value) {
591
    if (value == "keyof" || value == "typeof") {
592
      cx.marked = "keyword"
593
      return cont(value == "keyof" ? typeexpr : expressionNoComma)
594
    }
595
    if (type == "variable" || value == "void") {
596
      cx.marked = "type"
597
      return cont(afterType)
598
    }
599
    if (type == "string" || type == "number" || type == "atom") return cont(afterType);
600
    if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)
601
    if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
602
    if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
603
    if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr)
604
  }
605
  function maybeReturnType(type) {
606
    if (type == "=>") return cont(typeexpr)
607
  }
608
  function typeprop(type, value) {
609
    if (type == "variable" || cx.style == "keyword") {
610
      cx.marked = "property"
611
      return cont(typeprop)
612
    } else if (value == "?") {
613
      return cont(typeprop)
614
    } else if (type == ":") {
615
      return cont(typeexpr)
616
    } else if (type == "[") {
617
      return cont(expression, maybetype, expect("]"), typeprop)
618
    }
619
  }
620
  function typearg(type, value) {
621
    if (type == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg)
622
    if (type == ":") return cont(typeexpr)
623
    return pass(typeexpr)
624
  }
625
  function afterType(type, value) {
626
    if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
627
    if (value == "|" || type == "." || value == "&") return cont(typeexpr)
628
    if (type == "[") return cont(expect("]"), afterType)
629
    if (value == "extends" || value == "implements") { cx.marked = "keyword"; return cont(typeexpr) }
630
  }
631
  function maybeTypeArgs(_, value) {
632
    if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
633
  }
634
  function typeparam() {
635
    return pass(typeexpr, maybeTypeDefault)
636
  }
637
  function maybeTypeDefault(_, value) {
638
    if (value == "=") return cont(typeexpr)
639
  }
640
  function vardef(_, value) {
641
    if (value == "enum") {cx.marked = "keyword"; return cont(enumdef)}
642
    return pass(pattern, maybetype, maybeAssign, vardefCont);
643
  }
644
  function pattern(type, value) {
645
    if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(pattern) }
646
    if (type == "variable") { register(value); return cont(); }
647
    if (type == "spread") return cont(pattern);
648
    if (type == "[") return contCommasep(eltpattern, "]");
649
    if (type == "{") return contCommasep(proppattern, "}");
650
  }
651
  function proppattern(type, value) {
652
    if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
653
      register(value);
654
      return cont(maybeAssign);
655
    }
656
    if (type == "variable") cx.marked = "property";
657
    if (type == "spread") return cont(pattern);
658
    if (type == "}") return pass();
659
    return cont(expect(":"), pattern, maybeAssign);
660
  }
661
  function eltpattern() {
662
    return pass(pattern, maybeAssign)
663
  }
664
  function maybeAssign(_type, value) {
665
    if (value == "=") return cont(expressionNoComma);
666
  }
667
  function vardefCont(type) {
668
    if (type == ",") return cont(vardef);
669
  }
670
  function maybeelse(type, value) {
671
    if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
672
  }
673
  function forspec(type, value) {
674
    if (value == "await") return cont(forspec);
675
    if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
676
  }
677
  function forspec1(type) {
678
    if (type == "var") return cont(vardef, expect(";"), forspec2);
679
    if (type == ";") return cont(forspec2);
680
    if (type == "variable") return cont(formaybeinof);
681
    return pass(expression, expect(";"), forspec2);
682
  }
683
  function formaybeinof(_type, value) {
684
    if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
685
    return cont(maybeoperatorComma, forspec2);
686
  }
687
  function forspec2(type, value) {
688
    if (type == ";") return cont(forspec3);
689
    if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
690
    return pass(expression, expect(";"), forspec3);
691
  }
692
  function forspec3(type) {
693
    if (type != ")") cont(expression);
694
  }
695
  function functiondef(type, value) {
696
    if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
697
    if (type == "variable") {register(value); return cont(functiondef);}
698
    if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, statement, popcontext);
699
    if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondef)
700
  }
701
  function funarg(type, value) {
702
    if (value == "@") cont(expression, funarg)
703
    if (type == "spread") return cont(funarg);
704
    if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(funarg); }
705
    return pass(pattern, maybetype, maybeAssign);
706
  }
707
  function classExpression(type, value) {
708
    // Class expressions may have an optional name.
709
    if (type == "variable") return className(type, value);
710
    return classNameAfter(type, value);
711
  }
712
  function className(type, value) {
713
    if (type == "variable") {register(value); return cont(classNameAfter);}
714
  }
715
  function classNameAfter(type, value) {
716
    if (value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, classNameAfter)
717
    if (value == "extends" || value == "implements" || (isTS && type == ",")) {
718
      if (value == "implements") cx.marked = "keyword";
719
      return cont(isTS ? typeexpr : expression, classNameAfter);
720
    }
721
    if (type == "{") return cont(pushlex("}"), classBody, poplex);
722
  }
723
  function classBody(type, value) {
724
    if (type == "async" ||
725
        (type == "variable" &&
726
         (value == "static" || value == "get" || value == "set" || (isTS && isModifier(value))) &&
727
         cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) {
728
      cx.marked = "keyword";
729
      return cont(classBody);
730
    }
731
    if (type == "variable" || cx.style == "keyword") {
732
      cx.marked = "property";
733
      return cont(isTS ? classfield : functiondef, classBody);
734
    }
735
    if (type == "[")
736
      return cont(expression, maybetype, expect("]"), isTS ? classfield : functiondef, classBody)
737
    if (value == "*") {
738
      cx.marked = "keyword";
739
      return cont(classBody);
740
    }
741
    if (type == ";") return cont(classBody);
742
    if (type == "}") return cont();
743
    if (value == "@") return cont(expression, classBody)
744
  }
745
  function classfield(type, value) {
746
    if (value == "?") return cont(classfield)
747
    if (type == ":") return cont(typeexpr, maybeAssign)
748
    if (value == "=") return cont(expressionNoComma)
749
    return pass(functiondef)
750
  }
751
  function afterExport(type, value) {
752
    if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
753
    if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
754
    if (type == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";"));
755
    return pass(statement);
756
  }
757
  function exportField(type, value) {
758
    if (value == "as") { cx.marked = "keyword"; return cont(expect("variable")); }
759
    if (type == "variable") return pass(expressionNoComma, exportField);
760
  }
761
  function afterImport(type) {
762
    if (type == "string") return cont();
763
    if (type == "(") return pass(expression);
764
    return pass(importSpec, maybeMoreImports, maybeFrom);
765
  }
766
  function importSpec(type, value) {
767
    if (type == "{") return contCommasep(importSpec, "}");
768
    if (type == "variable") register(value);
769
    if (value == "*") cx.marked = "keyword";
770
    return cont(maybeAs);
771
  }
772
  function maybeMoreImports(type) {
773
    if (type == ",") return cont(importSpec, maybeMoreImports)
774
  }
775
  function maybeAs(_type, value) {
776
    if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
777
  }
778
  function maybeFrom(_type, value) {
779
    if (value == "from") { cx.marked = "keyword"; return cont(expression); }
780
  }
781
  function arrayLiteral(type) {
782
    if (type == "]") return cont();
783
    return pass(commasep(expressionNoComma, "]"));
784
  }
785
  function enumdef() {
786
    return pass(pushlex("form"), pattern, expect("{"), pushlex("}"), commasep(enummember, "}"), poplex, poplex)
787
  }
788
  function enummember() {
789
    return pass(pattern, maybeAssign);
790
  }
791
792
  function isContinuedStatement(state, textAfter) {
793
    return state.lastType == "operator" || state.lastType == "," ||
794
      isOperatorChar.test(textAfter.charAt(0)) ||
795
      /[,.]/.test(textAfter.charAt(0));
796
  }
797
798
  function expressionAllowed(stream, state, backUp) {
799
    return state.tokenize == tokenBase &&
800
      /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
801
      (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
802
  }
803
804
  // Interface
805
806
  return {
807
    startState: function(basecolumn) {
808
      var state = {
809
        tokenize: tokenBase,
810
        lastType: "sof",
811
        cc: [],
812
        lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
813
        localVars: parserConfig.localVars,
814
        context: parserConfig.localVars && new Context(null, null, false),
815
        indented: basecolumn || 0
816
      };
817
      if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
818
        state.globalVars = parserConfig.globalVars;
819
      return state;
820
    },
821
822
    token: function(stream, state) {
823
      if (stream.sol()) {
824
        if (!state.lexical.hasOwnProperty("align"))
825
          state.lexical.align = false;
826
        state.indented = stream.indentation();
827
        findFatArrow(stream, state);
828
      }
829
      if (state.tokenize != tokenComment && stream.eatSpace()) return null;
830
      var style = state.tokenize(stream, state);
831
      if (type == "comment") return style;
832
      state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
833
      return parseJS(state, style, type, content, stream);
834
    },
835
836
    indent: function(state, textAfter) {
837
      if (state.tokenize == tokenComment) return CodeMirror.Pass;
838
      if (state.tokenize != tokenBase) return 0;
839
      var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
840
      // Kludge to prevent 'maybelse' from blocking lexical scope pops
841
      if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
842
        var c = state.cc[i];
843
        if (c == poplex) lexical = lexical.prev;
844
        else if (c != maybeelse) break;
845
      }
846
      while ((lexical.type == "stat" || lexical.type == "form") &&
847
             (firstChar == "}" || ((top = state.cc[state.cc.length - 1]) &&
848
                                   (top == maybeoperatorComma || top == maybeoperatorNoComma) &&
849
                                   !/^[,\.=+\-*:?[\(]/.test(textAfter))))
850
        lexical = lexical.prev;
851
      if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
852
        lexical = lexical.prev;
853
      var type = lexical.type, closing = firstChar == type;
854
855
      if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info.length + 1 : 0);
856
      else if (type == "form" && firstChar == "{") return lexical.indented;
857
      else if (type == "form") return lexical.indented + indentUnit;
858
      else if (type == "stat")
859
        return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
860
      else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
861
        return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
862
      else if (lexical.align) return lexical.column + (closing ? 0 : 1);
863
      else return lexical.indented + (closing ? 0 : indentUnit);
864
    },
865
866
    electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
867
    blockCommentStart: jsonMode ? null : "/*",
868
    blockCommentEnd: jsonMode ? null : "*/",
869
    blockCommentContinue: jsonMode ? null : " * ",
870
    lineComment: jsonMode ? null : "//",
871
    fold: "brace",
872
    closeBrackets: "()[]{}''\"\"``",
873
874
    helperType: jsonMode ? "json" : "javascript",
875
    jsonldMode: jsonldMode,
876
    jsonMode: jsonMode,
877
878
    expressionAllowed: expressionAllowed,
879
880
    skipExpression: function(state) {
881
      var top = state.cc[state.cc.length - 1]
882
      if (top == expression || top == expressionNoComma) state.cc.pop()
883
    }
884
  };
885
});
886
887
CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
888
889
CodeMirror.defineMIME("text/javascript", "javascript");
890
CodeMirror.defineMIME("text/ecmascript", "javascript");
891
CodeMirror.defineMIME("application/javascript", "javascript");
892
CodeMirror.defineMIME("application/x-javascript", "javascript");
893
CodeMirror.defineMIME("application/ecmascript", "javascript");
894
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
895
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
896
CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
897
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
898
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
899
900
});
(-)a/koha-tmpl/intranet-tmpl/lib/codemirror/javascript.min.js (+1 lines)
Line 0 Link Here
1
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(Le){"use strict";Le.defineMode("javascript",function(e,l){var n,a,d=e.indentUnit,p=l.statementIndent,o=l.jsonld,c=l.json||o,s=l.typescript,f=l.wordCharacters||/[\w$\xa1-\uffff]/,u=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),a=e("keyword d"),i=e("operator"),o={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:a,break:a,continue:a,new:e("new"),delete:n,void:n,throw:n,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:i,typeof:i,instanceof:i,true:o,false:o,null:o,undefined:o,NaN:o,Infinity:o,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n}}(),m=/[+\-*&%=<>!?|~^@]/,v=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function k(e,t,r){return n=e,a=r,t}function y(e,t){var a,r=e.next();if('"'==r||"'"==r)return t.tokenize=(a=r,function(e,t){var r,n=!1;if(o&&"@"==e.peek()&&e.match(v))return t.tokenize=y,k("jsonld-keyword","meta");for(;null!=(r=e.next())&&(r!=a||n);)n=!n&&"\\"==r;return n||(t.tokenize=y),k("string","string")}),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return k("number","number");if("."==r&&e.match(".."))return k("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return k(r);if("="==r&&e.eat(">"))return k("=>","operator");if("0"==r&&e.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i))return k("number","number");if(/\d/.test(r))return e.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/),k("number","number");if("/"==r)return e.eat("*")?(t.tokenize=w)(e,t):e.eat("/")?(e.skipToEnd(),k("comment","comment")):Ke(e,t,1)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),k("regexp","string-2")):(e.eat("="),k("operator","operator",e.current()));if("`"==r)return(t.tokenize=b)(e,t);if("#"==r)return e.skipToEnd(),k("error","error");if(m.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),k("operator","operator",e.current());if(f.test(r)){e.eatWhile(f);var n=e.current();if("."!=t.lastType){if(u.propertyIsEnumerable(n)){var i=u[n];return k(i.type,i.style,n)}if("async"==n&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return k("async","keyword",n)}return k("variable","variable",n)}}function w(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=y;break}n="*"==r}return k("comment","comment")}function b(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=y;break}n=!n&&"\\"==r}return k("quasi","string-2",e.current())}var x="([{}])";function i(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){if(s){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r));n&&(r=n.index)}for(var a=0,i=!1,o=r-1;0<=o;--o){var c=e.string.charAt(o),u=x.indexOf(c);if(0<=u&&u<3){if(!a){++o;break}if(0==--a){"("==c&&(i=!0);break}}else if(3<=u&&u<6)++a;else if(f.test(c))i=!0;else{if(/["'\/]/.test(c))return;if(i&&!a){++o;break}}}i&&!a&&(t.fatArrowAt=o)}}var h={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function g(e,t,r,n,a,i){this.indented=e,this.column=t,this.type=r,this.prev=a,this.info=i,null!=n&&(this.align=n)}function j(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}var M={state:null,column:null,marked:null,cc:null};function V(){for(var e=arguments.length-1;0<=e;e--)M.cc.push(arguments[e])}function A(){return V.apply(null,arguments),!0}function E(e,t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}function r(e){var t=M.state;if(M.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var r=function e(t,r){{if(r){if(r.block){var n=e(t,r.prev);return n?n==r.prev?r:new I(n,r.vars,!0):null}return E(t,r.vars)?r:new I(r.prev,new T(t,r.vars),!1)}return null}}(e,t.context);if(null!=r)return void(t.context=r)}else if(!E(e,t.localVars))return void(t.localVars=new T(e,t.localVars));l.globalVars&&!E(e,t.globalVars)&&(t.globalVars=new T(e,t.globalVars))}function z(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function I(e,t,r){this.prev=e,this.vars=t,this.block=r}function T(e,t){this.name=e,this.next=t}var t=new T("this",new T("arguments",null));function $(){M.state.context=new I(M.state.context,M.state.localVars,!1),M.state.localVars=t}function C(){M.state.context=new I(M.state.context,M.state.localVars,!0),M.state.localVars=null}function q(){M.state.localVars=M.state.context.vars,M.state.context=M.state.context.prev}function O(n,a){var e=function(){var e=M.state,t=e.indented;if("stat"==e.lexical.type)t=e.lexical.indented;else for(var r=e.lexical;r&&")"==r.type&&r.align;r=r.prev)t=r.indented;e.lexical=new g(t,M.stream.column(),n,null,e.lexical,a)};return e.lex=!0,e}function P(){var e=M.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function S(r){return function e(t){return t==r?A():";"==r||"}"==t||")"==t||"]"==t?V():A(e)}}function N(e,t){return"var"==e?A(O("vardef",t),ye,S(";"),P):"keyword a"==e?A(O("form"),W,N,P):"keyword b"==e?A(O("form"),N,P):"keyword d"==e?M.stream.match(/^\s*$/,!1)?A():A(O("stat"),F,S(";"),P):"debugger"==e?A(S(";")):"{"==e?A(O("}"),C,ie,P,q):";"==e?A():"if"==e?("else"==M.state.lexical.info&&M.state.cc[M.state.cc.length-1]==P&&M.state.cc.pop()(),A(O("form"),W,N,P,je)):"function"==e?A(Ie):"for"==e?A(O("form"),Me,N,P):"class"==e||s&&"interface"==t?(M.marked="keyword",A(O("form"),Ce,P)):"variable"==e?s&&"declare"==t?(M.marked="keyword",A(N)):s&&("module"==t||"enum"==t||"type"==t)&&M.stream.match(/^\s*\w/,!1)?(M.marked="keyword","enum"==t?A(Ge):"type"==t?A(se,S("operator"),se,S(";")):A(O("form"),we,S("{"),O("}"),ie,P,P)):s&&"namespace"==t?(M.marked="keyword",A(O("form"),B,ie,P)):s&&"abstract"==t?(M.marked="keyword",A(N)):A(O("stat"),Z):"switch"==e?A(O("form"),W,S("{"),O("}","switch"),C,ie,P,P,q):"case"==e?A(B,S(":")):"default"==e?A(S(":")):"catch"==e?A(O("form"),$,U,N,P,q):"export"==e?A(O("stat"),Se,P):"import"==e?A(O("stat"),Ue,P):"async"==e?A(N):"@"==t?A(B,N):V(O("stat"),B,S(";"),P)}function U(e){if("("==e)return A(Te,S(")"))}function B(e,t){return D(e,t,!1)}function H(e,t){return D(e,t,!0)}function W(e){return"("!=e?V():A(O(")"),B,S(")"),P)}function D(e,t,r){if(M.state.fatArrowAt==M.stream.start){var n=r?R:Q;if("("==e)return A($,O(")"),ne(Te,")"),P,S("=>"),n,q);if("variable"==e)return V($,we,S("=>"),n,q)}var a,i=r?J:G;return h.hasOwnProperty(e)?A(i):"function"==e?A(Ie,i):"class"==e||s&&"interface"==t?(M.marked="keyword",A(O("form"),$e,P)):"keyword c"==e||"async"==e?A(r?H:B):"("==e?A(O(")"),F,S(")"),P,i):"operator"==e||"spread"==e?A(r?H:B):"["==e?A(O("]"),Fe,P,i):"{"==e?ae(ee,"}",null,i):"quasi"==e?V(K,i):"new"==e?A((a=r,function(e){return"."==e?A(a?Y:X):"variable"==e&&s?A(me,a?J:G):V(a?H:B)})):"import"==e?A(B):A()}function F(e){return e.match(/[;\}\)\],]/)?V():V(B)}function G(e,t){return","==e?A(B):J(e,t,!1)}function J(e,t,r){var n=0==r?G:J,a=0==r?B:H;return"=>"==e?A($,r?R:Q,q):"operator"==e?/\+\+|--/.test(t)||s&&"!"==t?A(n):s&&"<"==t&&M.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?A(O(">"),ne(se,">"),P,n):"?"==t?A(B,S(":"),a):A(a):"quasi"==e?V(K,n):";"!=e?"("==e?ae(H,")","call",n):"."==e?A(_,n):"["==e?A(O("]"),F,S("]"),P,n):s&&"as"==t?(M.marked="keyword",A(se,n)):"regexp"==e?(M.state.lastType=M.marked="operator",M.stream.backUp(M.stream.pos-M.stream.start-1),A(a)):void 0:void 0}function K(e,t){return"quasi"!=e?V():"${"!=t.slice(t.length-2)?A(K):A(B,L)}function L(e){if("}"==e)return M.marked="string-2",M.state.tokenize=b,A(K)}function Q(e){return i(M.stream,M.state),V("{"==e?N:B)}function R(e){return i(M.stream,M.state),V("{"==e?N:H)}function X(e,t){if("target"==t)return M.marked="keyword",A(G)}function Y(e,t){if("target"==t)return M.marked="keyword",A(J)}function Z(e){return":"==e?A(P,N):V(G,S(";"),P)}function _(e){if("variable"==e)return M.marked="property",A()}function ee(e,t){if("async"==e)return M.marked="property",A(ee);if("variable"==e||"keyword"==M.style){return M.marked="property","get"==t||"set"==t?A(te):(s&&M.state.fatArrowAt==M.stream.start&&(r=M.stream.match(/^\s*:\s*/,!1))&&(M.state.fatArrowAt=M.stream.pos+r[0].length),A(re));var r}else{if("number"==e||"string"==e)return M.marked=o?"property":M.style+" property",A(re);if("jsonld-keyword"==e)return A(re);if(s&&z(t))return M.marked="keyword",A(ee);if("["==e)return A(B,oe,S("]"),re);if("spread"==e)return A(H,re);if("*"==t)return M.marked="keyword",A(ee);if(":"==e)return V(re)}}function te(e){return"variable"!=e?V(re):(M.marked="property",A(Ie))}function re(e){return":"==e?A(H):"("==e?V(Ie):void 0}function ne(n,a,i){function o(e,t){if(i?-1<i.indexOf(e):","==e){var r=M.state.lexical;return"call"==r.info&&(r.pos=(r.pos||0)+1),A(function(e,t){return e==a||t==a?V():V(n)},o)}return e==a||t==a?A():A(S(a))}return function(e,t){return e==a||t==a?A():V(n,o)}}function ae(e,t,r){for(var n=3;n<arguments.length;n++)M.cc.push(arguments[n]);return A(O(t,r),ne(e,t),P)}function ie(e){return"}"==e?A():V(N,ie)}function oe(e,t){if(s){if(":"==e)return A(se);if("?"==t)return A(oe)}}function ce(e){if(s&&":"==e)return M.stream.match(/^\s*\w+\s+is\b/,!1)?A(B,ue,se):A(se)}function ue(e,t){if("is"==t)return M.marked="keyword",A()}function se(e,t){return"keyof"==t||"typeof"==t?(M.marked="keyword",A("keyof"==t?se:H)):"variable"==e||"void"==t?(M.marked="type",A(pe)):"string"==e||"number"==e||"atom"==e?A(pe):"["==e?A(O("]"),ne(se,"]",","),P,pe):"{"==e?A(O("}"),ne(le,"}",",;"),P,pe):"("==e?A(ne(de,")"),fe):"<"==e?A(ne(se,">"),se):void 0}function fe(e){if("=>"==e)return A(se)}function le(e,t){return"variable"==e||"keyword"==M.style?(M.marked="property",A(le)):"?"==t?A(le):":"==e?A(se):"["==e?A(B,oe,S("]"),le):void 0}function de(e,t){return"variable"==e&&M.stream.match(/^\s*[?:]/,!1)||"?"==t?A(de):":"==e?A(se):V(se)}function pe(e,t){return"<"==t?A(O(">"),ne(se,">"),P,pe):"|"==t||"."==e||"&"==t?A(se):"["==e?A(S("]"),pe):"extends"==t||"implements"==t?(M.marked="keyword",A(se)):void 0}function me(e,t){if("<"==t)return A(O(">"),ne(se,">"),P,pe)}function ve(){return V(se,ke)}function ke(e,t){if("="==t)return A(se)}function ye(e,t){return"enum"==t?(M.marked="keyword",A(Ge)):V(we,oe,he,ge)}function we(e,t){return s&&z(t)?(M.marked="keyword",A(we)):"variable"==e?(r(t),A()):"spread"==e?A(we):"["==e?ae(xe,"]"):"{"==e?ae(be,"}"):void 0}function be(e,t){return"variable"!=e||M.stream.match(/^\s*:/,!1)?("variable"==e&&(M.marked="property"),"spread"==e?A(we):"}"==e?V():A(S(":"),we,he)):(r(t),A(he))}function xe(){return V(we,he)}function he(e,t){if("="==t)return A(H)}function ge(e){if(","==e)return A(ye)}function je(e,t){if("keyword b"==e&&"else"==t)return A(O("form","else"),N,P)}function Me(e,t){return"await"==t?A(Me):"("==e?A(O(")"),Ve,S(")"),P):void 0}function Ve(e){return"var"==e?A(ye,S(";"),Ee):";"==e?A(Ee):"variable"==e?A(Ae):V(B,S(";"),Ee)}function Ae(e,t){return"in"==t||"of"==t?(M.marked="keyword",A(B)):A(G,Ee)}function Ee(e,t){return";"==e?A(ze):"in"==t||"of"==t?(M.marked="keyword",A(B)):V(B,S(";"),ze)}function ze(e){")"!=e&&A(B)}function Ie(e,t){return"*"==t?(M.marked="keyword",A(Ie)):"variable"==e?(r(t),A(Ie)):"("==e?A($,O(")"),ne(Te,")"),P,ce,N,q):s&&"<"==t?A(O(">"),ne(ve,">"),P,Ie):void 0}function Te(e,t){return"@"==t&&A(B,Te),"spread"==e?A(Te):s&&z(t)?(M.marked="keyword",A(Te)):V(we,oe,he)}function $e(e,t){return"variable"==e?Ce(e,t):qe(e,t)}function Ce(e,t){if("variable"==e)return r(t),A(qe)}function qe(e,t){return"<"==t?A(O(">"),ne(ve,">"),P,qe):"extends"==t||"implements"==t||s&&","==e?("implements"==t&&(M.marked="keyword"),A(s?se:B,qe)):"{"==e?A(O("}"),Oe,P):void 0}function Oe(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||s&&z(t))&&M.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(M.marked="keyword",A(Oe)):"variable"==e||"keyword"==M.style?(M.marked="property",A(s?Pe:Ie,Oe)):"["==e?A(B,oe,S("]"),s?Pe:Ie,Oe):"*"==t?(M.marked="keyword",A(Oe)):";"==e?A(Oe):"}"==e?A():"@"==t?A(B,Oe):void 0}function Pe(e,t){return"?"==t?A(Pe):":"==e?A(se,he):"="==t?A(H):V(Ie)}function Se(e,t){return"*"==t?(M.marked="keyword",A(De,S(";"))):"default"==t?(M.marked="keyword",A(B,S(";"))):"{"==e?A(ne(Ne,"}"),De,S(";")):V(N)}function Ne(e,t){return"as"==t?(M.marked="keyword",A(S("variable"))):"variable"==e?V(H,Ne):void 0}function Ue(e){return"string"==e?A():"("==e?V(B):V(Be,He,De)}function Be(e,t){return"{"==e?ae(Be,"}"):("variable"==e&&r(t),"*"==t&&(M.marked="keyword"),A(We))}function He(e){if(","==e)return A(Be,He)}function We(e,t){if("as"==t)return M.marked="keyword",A(Be)}function De(e,t){if("from"==t)return M.marked="keyword",A(B)}function Fe(e){return"]"==e?A():V(ne(H,"]"))}function Ge(){return V(O("form"),we,S("{"),O("}"),ne(Je,"}"),P,P)}function Je(){return V(we,he)}function Ke(e,t,r){return t.tokenize==y&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}return P.lex=q.lex=!0,{startState:function(e){var t={tokenize:y,lastType:"sof",cc:[],lexical:new g((e||0)-d,0,"block",!1),localVars:l.localVars,context:l.localVars&&new I(null,null,!1),indented:e||0};return l.globalVars&&"object"==typeof l.globalVars&&(t.globalVars=l.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),i(e,t)),t.tokenize!=w&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==n?r:(t.lastType="operator"!=n||"++"!=a&&"--"!=a?n:"incdec",function(e,t,r,n,a){var i=e.cc;for(M.state=e,M.stream=a,M.marked=null,M.cc=i,M.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((i.length?i.pop():c?B:N)(r,n)){for(;i.length&&i[i.length-1].lex;)i.pop()();return M.marked?M.marked:"variable"==r&&j(e,n)?"variable-2":t}}(t,r,n,a,e))},indent:function(e,t){if(e.tokenize==w)return Le.Pass;if(e.tokenize!=y)return 0;var r,n=t&&t.charAt(0),a=e.lexical;if(!/^\s*else\b/.test(t))for(var i=e.cc.length-1;0<=i;--i){var o=e.cc[i];if(o==P)a=a.prev;else if(o!=je)break}for(;("stat"==a.type||"form"==a.type)&&("}"==n||(r=e.cc[e.cc.length-1])&&(r==G||r==J)&&!/^[,\.=+\-*:?[\(]/.test(t));)a=a.prev;p&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev);var c,u,s=a.type,f=n==s;return"vardef"==s?a.indented+("operator"==e.lastType||","==e.lastType?a.info.length+1:0):"form"==s&&"{"==n?a.indented:"form"==s?a.indented+d:"stat"==s?a.indented+(u=t,"operator"==(c=e).lastType||","==c.lastType||m.test(u.charAt(0))||/[,.]/.test(u.charAt(0))?p||d:0):"switch"!=a.info||f||0==l.doubleIndentSwitch?a.align?a.column+(f?0:1):a.indented+(f?0:d):a.indented+(/^(?:case|default)\b/.test(t)?d:2*d)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:c?null:"/*",blockCommentEnd:c?null:"*/",blockCommentContinue:c?null:" * ",lineComment:c?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:c?"json":"javascript",jsonldMode:o,jsonMode:c,expressionAllowed:Ke,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=B&&t!=H||e.cc.pop()}}}),Le.registerHelper("wordChars","javascript",/[\w$]/),Le.defineMIME("text/javascript","javascript"),Le.defineMIME("text/ecmascript","javascript"),Le.defineMIME("application/javascript","javascript"),Le.defineMIME("application/x-javascript","javascript"),Le.defineMIME("application/ecmascript","javascript"),Le.defineMIME("application/json",{name:"javascript",json:!0}),Le.defineMIME("application/x-json",{name:"javascript",json:!0}),Le.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),Le.defineMIME("text/typescript",{name:"javascript",typescript:!0}),Le.defineMIME("application/typescript",{name:"javascript",typescript:!0})});
(-)a/koha-tmpl/intranet-tmpl/lib/codemirror/xml.js (+402 lines)
Line 0 Link Here
1
// CodeMirror, copyright (c) by Marijn Haverbeke and others
2
// Distributed under an MIT license: https://codemirror.net/LICENSE
3
4
(function(mod) {
5
  if (typeof exports == "object" && typeof module == "object") // CommonJS
6
    mod(require("../../lib/codemirror"));
7
  else if (typeof define == "function" && define.amd) // AMD
8
    define(["../../lib/codemirror"], mod);
9
  else // Plain browser env
10
    mod(CodeMirror);
11
})(function(CodeMirror) {
12
"use strict";
13
14
var htmlConfig = {
15
  autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
16
                    'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
17
                    'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
18
                    'track': true, 'wbr': true, 'menuitem': true},
19
  implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
20
                     'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
21
                     'th': true, 'tr': true},
22
  contextGrabbers: {
23
    'dd': {'dd': true, 'dt': true},
24
    'dt': {'dd': true, 'dt': true},
25
    'li': {'li': true},
26
    'option': {'option': true, 'optgroup': true},
27
    'optgroup': {'optgroup': true},
28
    'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
29
          'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
30
          'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
31
          'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
32
          'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
33
    'rp': {'rp': true, 'rt': true},
34
    'rt': {'rp': true, 'rt': true},
35
    'tbody': {'tbody': true, 'tfoot': true},
36
    'td': {'td': true, 'th': true},
37
    'tfoot': {'tbody': true},
38
    'th': {'td': true, 'th': true},
39
    'thead': {'tbody': true, 'tfoot': true},
40
    'tr': {'tr': true}
41
  },
42
  doNotIndent: {"pre": true},
43
  allowUnquoted: true,
44
  allowMissing: true,
45
  caseFold: true
46
}
47
48
var xmlConfig = {
49
  autoSelfClosers: {},
50
  implicitlyClosed: {},
51
  contextGrabbers: {},
52
  doNotIndent: {},
53
  allowUnquoted: false,
54
  allowMissing: false,
55
  allowMissingTagName: false,
56
  caseFold: false
57
}
58
59
CodeMirror.defineMode("xml", function(editorConf, config_) {
60
  var indentUnit = editorConf.indentUnit
61
  var config = {}
62
  var defaults = config_.htmlMode ? htmlConfig : xmlConfig
63
  for (var prop in defaults) config[prop] = defaults[prop]
64
  for (var prop in config_) config[prop] = config_[prop]
65
66
  // Return variables for tokenizers
67
  var type, setStyle;
68
69
  function inText(stream, state) {
70
    function chain(parser) {
71
      state.tokenize = parser;
72
      return parser(stream, state);
73
    }
74
75
    var ch = stream.next();
76
    if (ch == "<") {
77
      if (stream.eat("!")) {
78
        if (stream.eat("[")) {
79
          if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
80
          else return null;
81
        } else if (stream.match("--")) {
82
          return chain(inBlock("comment", "-->"));
83
        } else if (stream.match("DOCTYPE", true, true)) {
84
          stream.eatWhile(/[\w\._\-]/);
85
          return chain(doctype(1));
86
        } else {
87
          return null;
88
        }
89
      } else if (stream.eat("?")) {
90
        stream.eatWhile(/[\w\._\-]/);
91
        state.tokenize = inBlock("meta", "?>");
92
        return "meta";
93
      } else {
94
        type = stream.eat("/") ? "closeTag" : "openTag";
95
        state.tokenize = inTag;
96
        return "tag bracket";
97
      }
98
    } else if (ch == "&") {
99
      var ok;
100
      if (stream.eat("#")) {
101
        if (stream.eat("x")) {
102
          ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
103
        } else {
104
          ok = stream.eatWhile(/[\d]/) && stream.eat(";");
105
        }
106
      } else {
107
        ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
108
      }
109
      return ok ? "atom" : "error";
110
    } else {
111
      stream.eatWhile(/[^&<]/);
112
      return null;
113
    }
114
  }
115
  inText.isInText = true;
116
117
  function inTag(stream, state) {
118
    var ch = stream.next();
119
    if (ch == ">" || (ch == "/" && stream.eat(">"))) {
120
      state.tokenize = inText;
121
      type = ch == ">" ? "endTag" : "selfcloseTag";
122
      return "tag bracket";
123
    } else if (ch == "=") {
124
      type = "equals";
125
      return null;
126
    } else if (ch == "<") {
127
      state.tokenize = inText;
128
      state.state = baseState;
129
      state.tagName = state.tagStart = null;
130
      var next = state.tokenize(stream, state);
131
      return next ? next + " tag error" : "tag error";
132
    } else if (/[\'\"]/.test(ch)) {
133
      state.tokenize = inAttribute(ch);
134
      state.stringStartCol = stream.column();
135
      return state.tokenize(stream, state);
136
    } else {
137
      stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
138
      return "word";
139
    }
140
  }
141
142
  function inAttribute(quote) {
143
    var closure = function(stream, state) {
144
      while (!stream.eol()) {
145
        if (stream.next() == quote) {
146
          state.tokenize = inTag;
147
          break;
148
        }
149
      }
150
      return "string";
151
    };
152
    closure.isInAttribute = true;
153
    return closure;
154
  }
155
156
  function inBlock(style, terminator) {
157
    return function(stream, state) {
158
      while (!stream.eol()) {
159
        if (stream.match(terminator)) {
160
          state.tokenize = inText;
161
          break;
162
        }
163
        stream.next();
164
      }
165
      return style;
166
    }
167
  }
168
169
  function doctype(depth) {
170
    return function(stream, state) {
171
      var ch;
172
      while ((ch = stream.next()) != null) {
173
        if (ch == "<") {
174
          state.tokenize = doctype(depth + 1);
175
          return state.tokenize(stream, state);
176
        } else if (ch == ">") {
177
          if (depth == 1) {
178
            state.tokenize = inText;
179
            break;
180
          } else {
181
            state.tokenize = doctype(depth - 1);
182
            return state.tokenize(stream, state);
183
          }
184
        }
185
      }
186
      return "meta";
187
    };
188
  }
189
190
  function Context(state, tagName, startOfLine) {
191
    this.prev = state.context;
192
    this.tagName = tagName;
193
    this.indent = state.indented;
194
    this.startOfLine = startOfLine;
195
    if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
196
      this.noIndent = true;
197
  }
198
  function popContext(state) {
199
    if (state.context) state.context = state.context.prev;
200
  }
201
  function maybePopContext(state, nextTagName) {
202
    var parentTagName;
203
    while (true) {
204
      if (!state.context) {
205
        return;
206
      }
207
      parentTagName = state.context.tagName;
208
      if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
209
          !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
210
        return;
211
      }
212
      popContext(state);
213
    }
214
  }
215
216
  function baseState(type, stream, state) {
217
    if (type == "openTag") {
218
      state.tagStart = stream.column();
219
      return tagNameState;
220
    } else if (type == "closeTag") {
221
      return closeTagNameState;
222
    } else {
223
      return baseState;
224
    }
225
  }
226
  function tagNameState(type, stream, state) {
227
    if (type == "word") {
228
      state.tagName = stream.current();
229
      setStyle = "tag";
230
      return attrState;
231
    } else if (config.allowMissingTagName && type == "endTag") {
232
      setStyle = "tag bracket";
233
      return attrState(type, stream, state);
234
    } else {
235
      setStyle = "error";
236
      return tagNameState;
237
    }
238
  }
239
  function closeTagNameState(type, stream, state) {
240
    if (type == "word") {
241
      var tagName = stream.current();
242
      if (state.context && state.context.tagName != tagName &&
243
          config.implicitlyClosed.hasOwnProperty(state.context.tagName))
244
        popContext(state);
245
      if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
246
        setStyle = "tag";
247
        return closeState;
248
      } else {
249
        setStyle = "tag error";
250
        return closeStateErr;
251
      }
252
    } else if (config.allowMissingTagName && type == "endTag") {
253
      setStyle = "tag bracket";
254
      return closeState(type, stream, state);
255
    } else {
256
      setStyle = "error";
257
      return closeStateErr;
258
    }
259
  }
260
261
  function closeState(type, _stream, state) {
262
    if (type != "endTag") {
263
      setStyle = "error";
264
      return closeState;
265
    }
266
    popContext(state);
267
    return baseState;
268
  }
269
  function closeStateErr(type, stream, state) {
270
    setStyle = "error";
271
    return closeState(type, stream, state);
272
  }
273
274
  function attrState(type, _stream, state) {
275
    if (type == "word") {
276
      setStyle = "attribute";
277
      return attrEqState;
278
    } else if (type == "endTag" || type == "selfcloseTag") {
279
      var tagName = state.tagName, tagStart = state.tagStart;
280
      state.tagName = state.tagStart = null;
281
      if (type == "selfcloseTag" ||
282
          config.autoSelfClosers.hasOwnProperty(tagName)) {
283
        maybePopContext(state, tagName);
284
      } else {
285
        maybePopContext(state, tagName);
286
        state.context = new Context(state, tagName, tagStart == state.indented);
287
      }
288
      return baseState;
289
    }
290
    setStyle = "error";
291
    return attrState;
292
  }
293
  function attrEqState(type, stream, state) {
294
    if (type == "equals") return attrValueState;
295
    if (!config.allowMissing) setStyle = "error";
296
    return attrState(type, stream, state);
297
  }
298
  function attrValueState(type, stream, state) {
299
    if (type == "string") return attrContinuedState;
300
    if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}
301
    setStyle = "error";
302
    return attrState(type, stream, state);
303
  }
304
  function attrContinuedState(type, stream, state) {
305
    if (type == "string") return attrContinuedState;
306
    return attrState(type, stream, state);
307
  }
308
309
  return {
310
    startState: function(baseIndent) {
311
      var state = {tokenize: inText,
312
                   state: baseState,
313
                   indented: baseIndent || 0,
314
                   tagName: null, tagStart: null,
315
                   context: null}
316
      if (baseIndent != null) state.baseIndent = baseIndent
317
      return state
318
    },
319
320
    token: function(stream, state) {
321
      if (!state.tagName && stream.sol())
322
        state.indented = stream.indentation();
323
324
      if (stream.eatSpace()) return null;
325
      type = null;
326
      var style = state.tokenize(stream, state);
327
      if ((style || type) && style != "comment") {
328
        setStyle = null;
329
        state.state = state.state(type || style, stream, state);
330
        if (setStyle)
331
          style = setStyle == "error" ? style + " error" : setStyle;
332
      }
333
      return style;
334
    },
335
336
    indent: function(state, textAfter, fullLine) {
337
      var context = state.context;
338
      // Indent multi-line strings (e.g. css).
339
      if (state.tokenize.isInAttribute) {
340
        if (state.tagStart == state.indented)
341
          return state.stringStartCol + 1;
342
        else
343
          return state.indented + indentUnit;
344
      }
345
      if (context && context.noIndent) return CodeMirror.Pass;
346
      if (state.tokenize != inTag && state.tokenize != inText)
347
        return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
348
      // Indent the starts of attribute names.
349
      if (state.tagName) {
350
        if (config.multilineTagIndentPastTag !== false)
351
          return state.tagStart + state.tagName.length + 2;
352
        else
353
          return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
354
      }
355
      if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
356
      var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
357
      if (tagAfter && tagAfter[1]) { // Closing tag spotted
358
        while (context) {
359
          if (context.tagName == tagAfter[2]) {
360
            context = context.prev;
361
            break;
362
          } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {
363
            context = context.prev;
364
          } else {
365
            break;
366
          }
367
        }
368
      } else if (tagAfter) { // Opening tag spotted
369
        while (context) {
370
          var grabbers = config.contextGrabbers[context.tagName];
371
          if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
372
            context = context.prev;
373
          else
374
            break;
375
        }
376
      }
377
      while (context && context.prev && !context.startOfLine)
378
        context = context.prev;
379
      if (context) return context.indent + indentUnit;
380
      else return state.baseIndent || 0;
381
    },
382
383
    electricInput: /<\/[\s\w:]+>$/,
384
    blockCommentStart: "<!--",
385
    blockCommentEnd: "-->",
386
387
    configuration: config.htmlMode ? "html" : "xml",
388
    helperType: config.htmlMode ? "html" : "xml",
389
390
    skipAttribute: function(state) {
391
      if (state.state == attrValueState)
392
        state.state = attrState
393
    }
394
  };
395
});
396
397
CodeMirror.defineMIME("text/xml", "xml");
398
CodeMirror.defineMIME("application/xml", "xml");
399
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
400
  CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
401
402
});
(-)a/koha-tmpl/intranet-tmpl/lib/codemirror/xml.min.js (+1 lines)
Line 0 Link Here
1
!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(y){"use strict";var N={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},z={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};y.defineMode("xml",function(t,e){var i,a,l=t.indentUnit,u={},n=e.htmlMode?N:z;for(var r in n)u[r]=n[r];for(var r in e)u[r]=e[r];function d(e,n){function t(t){return(n.tokenize=t)(e,n)}var r=e.next();return"<"==r?e.eat("!")?e.eat("[")?e.match("CDATA[")?t(o("atom","]]>")):null:e.match("--")?t(o("comment","--\x3e")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),t(function r(o){return function(t,e){for(var n;null!=(n=t.next());){if("<"==n)return e.tokenize=r(o+1),e.tokenize(t,e);if(">"==n){if(1!=o)return e.tokenize=r(o-1),e.tokenize(t,e);e.tokenize=d;break}}return"meta"}}(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),n.tokenize=o("meta","?>"),"meta"):(i=e.eat("/")?"closeTag":"openTag",n.tokenize=c,"tag bracket"):"&"!=r?(e.eatWhile(/[^&<]/),null):(e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"))?"atom":"error"}function c(t,e){var n=t.next();if(">"==n||"/"==n&&t.eat(">"))return e.tokenize=d,i=">"==n?"endTag":"selfcloseTag","tag bracket";if("="==n)return i="equals",null;if("<"!=n)return/[\'\"]/.test(n)?(e.tokenize=(r=n,(o=function(t,e){for(;!t.eol();)if(t.next()==r){e.tokenize=c;break}return"string"}).isInAttribute=!0,o),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word");e.tokenize=d,e.state=g,e.tagName=e.tagStart=null;var r,o,a=e.tokenize(t,e);return a?a+" tag error":"tag error"}function o(n,r){return function(t,e){for(;!t.eol();){if(t.match(r)){e.tokenize=d;break}t.next()}return n}}function s(t,e,n){this.prev=t.context,this.tagName=e,this.indent=t.indented,this.startOfLine=n,(u.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function f(t){t.context&&(t.context=t.context.prev)}function m(t,e){for(var n;;){if(!t.context)return;if(n=t.context.tagName,!u.contextGrabbers.hasOwnProperty(n)||!u.contextGrabbers[n].hasOwnProperty(e))return;f(t)}}function g(t,e,n){return"openTag"==t?(n.tagStart=e.column(),p):"closeTag"==t?h:g}function p(t,e,n){return"word"==t?(n.tagName=e.current(),a="tag",k):u.allowMissingTagName&&"endTag"==t?(a="tag bracket",k(t,e,n)):(a="error",p)}function h(t,e,n){if("word"!=t)return u.allowMissingTagName&&"endTag"==t?(a="tag bracket",x(t,e,n)):(a="error",b);var r=e.current();return n.context&&n.context.tagName!=r&&u.implicitlyClosed.hasOwnProperty(n.context.tagName)&&f(n),n.context&&n.context.tagName==r||!1===u.matchClosing?(a="tag",x):(a="tag error",b)}function x(t,e,n){return"endTag"!=t?(a="error",x):(f(n),g)}function b(t,e,n){return a="error",x(t,0,n)}function k(t,e,n){if("word"==t)return a="attribute",w;if("endTag"!=t&&"selfcloseTag"!=t)return a="error",k;var r=n.tagName,o=n.tagStart;return n.tagName=n.tagStart=null,"selfcloseTag"==t||u.autoSelfClosers.hasOwnProperty(r)?m(n,r):(m(n,r),n.context=new s(n,r,o==n.indented)),g}function w(t,e,n){return"equals"==t?v:(u.allowMissing||(a="error"),k(t,0,n))}function v(t,e,n){return"string"==t?T:"word"==t&&u.allowUnquoted?(a="string",k):(a="error",k(t,0,n))}function T(t,e,n){return"string"==t?T:k(t,0,n)}return d.isInText=!0,{startState:function(t){var e={tokenize:d,state:g,indented:t||0,tagName:null,tagStart:null,context:null};return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null;i=null;var n=e.tokenize(t,e);return(n||i)&&"comment"!=n&&(a=null,e.state=e.state(i||n,t,e),a&&(n="error"==a?n+" error":a)),n},indent:function(t,e,n){var r=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+l;if(r&&r.noIndent)return y.Pass;if(t.tokenize!=c&&t.tokenize!=d)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return!1!==u.multilineTagIndentPastTag?t.tagStart+t.tagName.length+2:t.tagStart+l*(u.multilineTagIndentFactor||1);if(u.alignCDATA&&/<!\[CDATA\[/.test(e))return 0;var o=e&&/^<(\/)?([\w_:\.-]*)/.exec(e);if(o&&o[1])for(;r;){if(r.tagName==o[2]){r=r.prev;break}if(!u.implicitlyClosed.hasOwnProperty(r.tagName))break;r=r.prev}else if(o)for(;r;){var a=u.contextGrabbers[r.tagName];if(!a||!a.hasOwnProperty(o[2]))break;r=r.prev}for(;r&&r.prev&&!r.startOfLine;)r=r.prev;return r?r.indent+l:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:u.htmlMode?"html":"xml",helperType:u.htmlMode?"html":"xml",skipAttribute:function(t){t.state==v&&(t.state=k)}}}),y.defineMIME("text/xml","xml"),y.defineMIME("application/xml","xml"),y.mimeModes.hasOwnProperty("text/html")||y.defineMIME("text/html",{name:"xml",htmlMode:!0})});
(-)a/koha-tmpl/intranet-tmpl/prog/css/preferences.css (+6 lines)
Lines 128-131 span.overridden { Link Here
128
128
129
.sortable li.ui-sortable-helper {
129
.sortable li.ui-sortable-helper {
130
    background-color: #FFC;
130
    background-color: #FFC;
131
}
132
133
.CodeMirror {
134
    border: 1px solid #EEE;
135
    margin: 1em 1em 1em 0;
136
    resize:  vertical;
131
}
137
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (-6 / +12 lines)
Lines 8-13 Link Here
8
[% Asset.css("css/preferences.css") | $raw %]
8
[% Asset.css("css/preferences.css") | $raw %]
9
[% Asset.css("lib/jquery/plugins/multiple-select/multiple-select.css") | $raw %]
9
[% Asset.css("lib/jquery/plugins/multiple-select/multiple-select.css") | $raw %]
10
[% Asset.css("css/humanmsg.css") | $raw %]
10
[% Asset.css("css/humanmsg.css") | $raw %]
11
[% Asset.css("lib/codemirror/codemirror.css") | $raw %]
11
</head>
12
</head>
12
<body id="admin_preferences" class="admin">
13
<body id="admin_preferences" class="admin">
13
[% INCLUDE 'header.inc' %]
14
[% INCLUDE 'header.inc' %]
Lines 95-107 Link Here
95
                    <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
96
                    <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
96
                        [% FOREACH CHOICE IN CHUNK.CHOICES %][% IF ( CHOICE.selected ) %]<option value="[% CHOICE.value | html %]" selected="selected">[% ELSE %]<option value="[% CHOICE.value | html %]">[% END %][% CHOICE.text | html %]</option>[% END %]
97
                        [% FOREACH CHOICE IN CHUNK.CHOICES %][% IF ( CHOICE.selected ) %]<option value="[% CHOICE.value | html %]" selected="selected">[% ELSE %]<option value="[% CHOICE.value | html %]">[% END %][% CHOICE.text | html %]</option>[% END %]
97
                    </select>
98
                    </select>
98
                    [% ELSIF ( CHUNK.type_textarea ) || ( CHUNK.type_htmlarea )%]
99
                    [% ELSIF ( CHUNK.type_textarea )%]
99
                        [% IF ( CHUNK.type_htmlarea ) && ( Koha.Preference('UseWYSIWYGinSystemPreferences') ) %]
100
                        [% IF ( CHUNK.syntax == "text/html" && Koha.Preference('UseWYSIWYGinSystemPreferences') ) %]
100
                        <textarea name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %] mce" rows="20" cols="60">[% CHUNK.value | html %]</textarea>
101
                            <textarea name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %] mce" rows="20" cols="60">[% CHUNK.value | html %]</textarea>
101
                        [% ELSE %]
102
                        [% ELSE %]
102
                        <a class="expand-textarea" style="display: none" href="#">Click to Edit</a>
103
                            <a class="expand-textarea" id="expand_[% CHUNK.name | html %]" data-target="[% CHUNK.name | html %]" data-syntax="[% CHUNK.syntax | html %]" href="#">Click to edit</a>
103
                        <textarea name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %]" rows="10" cols="40">[% CHUNK.value | html %]</textarea>
104
                            <textarea style="display:none" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %] codemirror" rows="10" cols="40">[% CHUNK.value | html %]</textarea>
104
                        <a class="collapse-textarea" style="display:none" href="#">Click to collapse</br></a>
105
                            <a class="collapse-textarea" id="collapse_[% CHUNK.name | html %]" data-target="[% CHUNK.name | html %]" data-syntax="[% CHUNK.syntax | html %]" style="display:none" href="#">Click to collapse</br></a>
105
                        [% END %]
106
                        [% END %]
106
                    [% ELSIF ( CHUNK.type_languages ) %]
107
                    [% ELSIF ( CHUNK.type_languages ) %]
107
                        <ul class="sortable">
108
                        <ul class="sortable">
Lines 166-171 Link Here
166
    [% INCLUDE 'datatables.inc' %]
167
    [% INCLUDE 'datatables.inc' %]
167
    [% Asset.js("lib/hc-sticky.js") | $raw %]
168
    [% Asset.js("lib/hc-sticky.js") | $raw %]
168
    [% Asset.js("lib/jquery/plugins/multiple-select/jquery.multiple.select.js") | $raw %]
169
    [% Asset.js("lib/jquery/plugins/multiple-select/jquery.multiple.select.js") | $raw %]
170
    [% Asset.js( "lib/codemirror/codemirror-compressed.js" ) | $raw %]
171
    [% Asset.js( "lib/codemirror/css.min.js" ) | $raw %]
172
    [% Asset.js( "lib/codemirror/javascript.min.js" ) | $raw %]
173
    [% Asset.js( "lib/codemirror/xml.min.js" ) | $raw %]
169
    <script>
174
    <script>
170
        var Sticky;
175
        var Sticky;
171
        $(document).ready(function(){
176
        $(document).ready(function(){
Lines 187-192 Link Here
187
                e.preventDefault();
192
                e.preventDefault();
188
                window.location.reload(true);
193
                window.location.reload(true);
189
            });
194
            });
195
190
        });
196
        });
191
        // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
197
        // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
192
        var to_highlight = "[% searchfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
198
        var to_highlight = "[% searchfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (+1 lines)
Lines 197-202 Cataloging: Link Here
197
            - "Use the following as the staff ISBD template:"
197
            - "Use the following as the staff ISBD template:"
198
            - pref: ISBD
198
            - pref: ISBD
199
              type: textarea
199
              type: textarea
200
              syntax: text/html
200
              class: code
201
              class: code
201
        -
202
        -
202
            - pref: OpacSuppression
203
            - pref: OpacSuppression
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 876-881 Circulation: Link Here
876
            - "Include the following HTML on the self check-in screen:"
876
            - "Include the following HTML on the self check-in screen:"
877
            - pref: SelfCheckInMainUserBlock
877
            - pref: SelfCheckInMainUserBlock
878
              type: textarea
878
              type: textarea
879
              syntax: text/html
879
              class: code
880
              class: code
880
        -
881
        -
881
            - pref: SelfCheckInModule
882
            - pref: SelfCheckInModule
Lines 892-918 Circulation: Link Here
892
            - "Include the following CSS on all the self check-in screens:"
893
            - "Include the following CSS on all the self check-in screens:"
893
            - pref: SelfCheckInUserCSS
894
            - pref: SelfCheckInUserCSS
894
              type: textarea
895
              type: textarea
896
              syntax: css
895
              class: code
897
              class: code
896
        -
898
        -
897
            - "Include the following JavaScript on all the self check-in screens:"
899
            - "Include the following JavaScript on all the self check-in screens:"
898
            - pref: SelfCheckInUserJS
900
            - pref: SelfCheckInUserJS
899
              type: textarea
901
              type: textarea
902
              syntax: javascript
900
              class: code
903
              class: code
901
    Self Checkout:
904
    Self Checkout:
902
        -
905
        -
903
            - "Include the following JavaScript on all pages in the web-based self checkout:"
906
            - "Include the following JavaScript on all pages in the web-based self checkout:"
904
            - pref: SCOUserJS
907
            - pref: SCOUserJS
905
              type: textarea
908
              type: textarea
909
              syntax: javascript
906
              class: code
910
              class: code
907
        -
911
        -
908
            - "Include the following HTML on the the web-based self checkout screen:"
912
            - "Include the following HTML on the the web-based self checkout screen:"
909
            - pref: SCOMainUserBlock
913
            - pref: SCOMainUserBlock
910
              type: textarea
914
              type: textarea
915
              syntax: text/html
911
              class: code
916
              class: code
912
        -
917
        -
913
            - "Include the following CSS on all pages in the web-based self checkout:"
918
            - "Include the following CSS on all pages in the web-based self checkout:"
914
            - pref: SCOUserCSS
919
            - pref: SCOUserCSS
915
              type: textarea
920
              type: textarea
921
              syntax: css
916
              class: code
922
              class: code
917
        -
923
        -
918
            - pref: ShowPatronImageInWebBasedSelfCheck
924
            - pref: ShowPatronImageInWebBasedSelfCheck
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-12 / +31 lines)
Lines 70-76 OPAC: Link Here
70
        -
70
        -
71
            - "Show the following HTML when OpacMaintenance is enabled:"
71
            - "Show the following HTML when OpacMaintenance is enabled:"
72
            - pref: OpacMaintenanceNotice
72
            - pref: OpacMaintenanceNotice
73
              type: htmlarea
73
              type: textarea
74
              syntax: text/html
74
              class: code
75
              class: code
75
        -
76
        -
76
            - By default, show bib records
77
            - By default, show bib records
Lines 197-202 OPAC: Link Here
197
            - "Include the following JavaScript on all pages in the OPAC:"
198
            - "Include the following JavaScript on all pages in the OPAC:"
198
            - pref: OPACUserJS
199
            - pref: OPACUserJS
199
              type: textarea
200
              type: textarea
201
              syntax: javascript
200
              class: code
202
              class: code
201
        -
203
        -
202
            - Include the additional CSS stylesheet
204
            - Include the additional CSS stylesheet
Lines 212-268 OPAC: Link Here
212
            - "Include the following CSS on all pages in the OPAC:"
214
            - "Include the following CSS on all pages in the OPAC:"
213
            - pref: OPACUserCSS
215
            - pref: OPACUserCSS
214
              type: textarea
216
              type: textarea
217
              syntax: css
215
              class: code
218
              class: code
216
        -
219
        -
217
            - "Show the following HTML in its own column on the main page of the OPAC:"
220
            - "Show the following HTML in its own column on the main page of the OPAC:"
218
            - pref: OpacMainUserBlock
221
            - pref: OpacMainUserBlock
219
              type: htmlarea
222
              type: textarea
223
              syntax: text/html
220
              class: code
224
              class: code
221
        -
225
        -
222
            - "Show the following HTML on the left hand column of the main page and patron account on the OPAC (generally navigation links):"
226
            - "Show the following HTML on the left hand column of the main page and patron account on the OPAC (generally navigation links):"
223
            - pref: OpacNav
227
            - pref: OpacNav
224
              type: htmlarea
228
              type: textarea
229
              syntax: text/html
225
              class: code
230
              class: code
226
        -
231
        -
227
            - "Show the following HTML in the right hand column of the main page under the main login form:"
232
            - "Show the following HTML in the right hand column of the main page under the main login form:"
228
            - pref: OpacNavRight
233
            - pref: OpacNavRight
229
              type: htmlarea
234
              type: textarea
235
              syntax: text/html
230
              class: code
236
              class: code
231
        -
237
        -
232
            - "Show the following HTML on the left hand column of the main page and patron account on the OPAC, after OpacNav, and before patron account links if available:"
238
            - "Show the following HTML on the left hand column of the main page and patron account on the OPAC, after OpacNav, and before patron account links if available:"
233
            - pref: OpacNavBottom
239
            - pref: OpacNavBottom
234
              type: htmlarea
240
              type: textarea
241
              syntax: text/html
235
              class: code
242
              class: code
236
        -
243
        -
237
            - "Include the following HTML in the header of all pages in the OPAC:"
244
            - "Include the following HTML in the header of all pages in the OPAC:"
238
            - pref: opacheader
245
            - pref: opacheader
239
              type: htmlarea
246
              type: textarea
247
              syntax: text/html
240
              class: code
248
              class: code
241
        -
249
        -
242
            - "Include the following HTML in the footer of all pages in the OPAC:"
250
            - "Include the following HTML in the footer of all pages in the OPAC:"
243
            - pref: opaccredits
251
            - pref: opaccredits
244
              type: htmlarea
252
              type: textarea
253
              syntax: text/html
245
              class: code
254
              class: code
246
        -
255
        -
247
            - 'Include a "More Searches" box on the detail pages of items on the OPAC, with the following HTML (leave blank to disable):'
256
            - 'Include a "More Searches" box on the detail pages of items on the OPAC, with the following HTML (leave blank to disable):'
248
            - '<br />Note: The placeholders {BIBLIONUMBER}, {CONTROLNUMBER}, {TITLE}, {ISBN}, {ISSN} and {AUTHOR} will be replaced with information from the displayed record.'
257
            - '<br />Note: The placeholders {BIBLIONUMBER}, {CONTROLNUMBER}, {TITLE}, {ISBN}, {ISSN} and {AUTHOR} will be replaced with information from the displayed record.'
249
            - pref: OPACSearchForTitleIn
258
            - pref: OPACSearchForTitleIn
250
              type: textarea
259
              type: textarea
260
              syntax: text/html
251
              class: code
261
              class: code
252
        -
262
        -
253
            - 'Include a "Links" column on the "my summary" and "my reading history" tabs when a user is logged in to the OPAC, with the following HTML (leave blank to disable):'
263
            - 'Include a "Links" column on the "my summary" and "my reading history" tabs when a user is logged in to the OPAC, with the following HTML (leave blank to disable):'
254
            - '<br />Note: The placeholders {BIBLIONUMBER}, {TITLE}, {ISBN} and {AUTHOR} will be replaced with information from the displayed record.'
264
            - '<br />Note: The placeholders {BIBLIONUMBER}, {TITLE}, {ISBN} and {AUTHOR} will be replaced with information from the displayed record.'
255
            - pref: OPACMySummaryHTML
265
            - pref: OPACMySummaryHTML
256
              type: htmlarea
266
              type: textarea
267
              syntax: text/html
257
              class: code
268
              class: code
258
        -
269
        -
259
            - "Note to display on the patron summary page. This note only appears if the patron is logged in:"
270
            - "Note to display on the patron summary page. This note only appears if the patron is logged in:"
260
            - pref: OPACMySummaryNote
271
            - pref: OPACMySummaryNote
261
              type: textarea
272
              type: textarea
273
              syntax: text/html
262
        -
274
        -
263
            - "Include the following HTML under the facets in OPAC search results:"
275
            - "Include the following HTML under the facets in OPAC search results:"
264
            - pref: OPACResultsSidebar
276
            - pref: OPACResultsSidebar
265
              type: htmlarea
277
              type: textarea
278
              syntax: text/html
266
              class: code
279
              class: code
267
        -
280
        -
268
            - pref: OpacAddMastheadLibraryPulldown
281
            - pref: OpacAddMastheadLibraryPulldown
Lines 274-280 OPAC: Link Here
274
            - 'Display this HTML when no results are found for a search in the OPAC:'
287
            - 'Display this HTML when no results are found for a search in the OPAC:'
275
            - '<br />Note: You can insert placeholders {QUERY_KW} that will be replaced with the keywords of the query.'
288
            - '<br />Note: You can insert placeholders {QUERY_KW} that will be replaced with the keywords of the query.'
276
            - pref: OPACNoResultsFound
289
            - pref: OPACNoResultsFound
277
              type: htmlarea
290
              type: textarea
291
              syntax: text/html
278
              class: code
292
              class: code
279
        -
293
        -
280
            - 'Display the URI in the 856u field as an image on: '
294
            - 'Display the URI in the 856u field as an image on: '
Lines 330-341 OPAC: Link Here
330
        -
344
        -
331
            - "Show the following HTML on the OPAC login form when a patron is not logged in:"
345
            - "Show the following HTML on the OPAC login form when a patron is not logged in:"
332
            - pref: OpacLoginInstructions
346
            - pref: OpacLoginInstructions
333
              type: htmlarea
347
              type: textarea
348
              syntax: text/html
334
              class: code
349
              class: code
335
        -
350
        -
336
            - "Replace the search box at the top of OPAC pages with the following HTML:"
351
            - "Replace the search box at the top of OPAC pages with the following HTML:"
337
            - pref: OpacCustomSearch
352
            - pref: OpacCustomSearch
338
              type: textarea
353
              type: textarea
354
              syntax: text/html
339
              class: code
355
              class: code
340
        -
356
        -
341
            - "Display language selector on "
357
            - "Display language selector on "
Lines 516-521 OPAC: Link Here
516
            - "Use the following as the OPAC ISBD template:"
532
            - "Use the following as the OPAC ISBD template:"
517
            - pref: OPACISBD
533
            - pref: OPACISBD
518
              type: textarea
534
              type: textarea
535
              syntax: text/html
519
              class: code
536
              class: code
520
    Policy:
537
    Policy:
521
        -
538
        -
Lines 682-687 OPAC: Link Here
682
            - "HTML content of your restricted page"
699
            - "HTML content of your restricted page"
683
            - pref: RestrictedPageContent
700
            - pref: RestrictedPageContent
684
              type: textarea
701
              type: textarea
702
              syntax: text/html
685
              class: HTML
703
              class: HTML
686
        -
704
        -
687
            - Use
705
            - Use
Lines 761-767 OPAC: Link Here
761
        -
779
        -
762
            - "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):"
780
            - "Display the following additional instructions for patrons who self register via the OPAC ( HTML is allowed ):"
763
            - pref: PatronSelfRegistrationAdditionalInstructions
781
            - pref: PatronSelfRegistrationAdditionalInstructions
764
              type: htmlarea
782
              type: textarea
783
              syntax: text/html
765
              class: html
784
              class: html
766
        -
785
        -
767
            - pref: PatronSelfRegistrationEmailMustBeUnique
786
            - pref: PatronSelfRegistrationEmailMustBeUnique
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref (+4 lines)
Lines 26-36 Staff Client: Link Here
26
            - "Use the following JavaScript for printing slips. See detailed description on the <a href='https://wiki.koha-community.org/wiki/Setting_up_slip_printer_to_print_silently'>Koha Wiki</a> and eventually Firefox PlugIn <a href='https://github.com/edabg/jsprintsetup/wiki'>jsPrintSetup documentation</a>:"
26
            - "Use the following JavaScript for printing slips. See detailed description on the <a href='https://wiki.koha-community.org/wiki/Setting_up_slip_printer_to_print_silently'>Koha Wiki</a> and eventually Firefox PlugIn <a href='https://github.com/edabg/jsprintsetup/wiki'>jsPrintSetup documentation</a>:"
27
            - pref: IntranetSlipPrinterJS
27
            - pref: IntranetSlipPrinterJS
28
              type: textarea
28
              type: textarea
29
              syntax: javascript
29
              class: code
30
              class: code
30
        -
31
        -
31
            - "Include the following CSS on all pages in the staff client:"
32
            - "Include the following CSS on all pages in the staff client:"
32
            - pref: IntranetUserCSS
33
            - pref: IntranetUserCSS
33
              type: textarea
34
              type: textarea
35
              syntax: css
34
              class: code
36
              class: code
35
        -
37
        -
36
            - Include the additional CSS stylesheet
38
            - Include the additional CSS stylesheet
Lines 51-61 Staff Client: Link Here
51
            - "Show the following HTML to the left of the More menu at the top of each page on the staff client (should be a list of links or blank):"
53
            - "Show the following HTML to the left of the More menu at the top of each page on the staff client (should be a list of links or blank):"
52
            - pref: IntranetNav
54
            - pref: IntranetNav
53
              type: textarea
55
              type: textarea
56
              syntax: html
54
              class: code
57
              class: code
55
        -
58
        -
56
            - "Include the following JavaScript on all pages in the staff client:"
59
            - "Include the following JavaScript on all pages in the staff client:"
57
            - pref: IntranetUserJS
60
            - pref: IntranetUserJS
58
              type: textarea
61
              type: textarea
62
              syntax: javascript
59
              class: code
63
              class: code
60
        -
64
        -
61
            - Use the image at
65
            - Use the image at
(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js (-17 / +35 lines)
Lines 1-3 Link Here
1
/* global KOHA MSG_MADE_CHANGES CodeMirror MSG_CLICK_TO_EXPAND MSG_CLICK_TO_COLLAPSE to_highlight search_jumped humanMsg MSG_NOTHING_TO_SAVE MSG_MODIFIED MSG_SAVING MSG_SAVED_PREFERENCE dataTablesDefaults */
1
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX
2
// We can assume 'KOHA' exists, as we depend on KOHA.AJAX
2
3
3
KOHA.Preferences = {
4
KOHA.Preferences = {
Lines 92-98 $( document ).ready( function () { Link Here
92
        if ( KOHA.Preferences.Modified ) {
93
        if ( KOHA.Preferences.Modified ) {
93
            return MSG_MADE_CHANGES;
94
            return MSG_MADE_CHANGES;
94
        }
95
        }
95
    }
96
    };
96
97
97
    $( '.prefs-tab .action .cancel' ).click( function () { KOHA.Preferences.Modified = false } );
98
    $( '.prefs-tab .action .cancel' ).click( function () { KOHA.Preferences.Modified = false } );
98
99
Lines 101-123 $( document ).ready( function () { Link Here
101
        return false;
102
        return false;
102
    } );
103
    } );
103
104
104
    $( '.prefs-tab .expand-textarea' ).show().click( function () {
105
    $( ".expand-textarea" ).on("click", function(e){
105
        $( this ).hide().nextAll( 'textarea, input[type=submit], a' )
106
        e.preventDefault();
106
            .animate( { height: 'show', queue: false } )
107
        $(this).hide();
107
            .animate( { opacity: 1 } );
108
        var target = $(this).data("target");
108
109
        var syntax = $(this).data("syntax");
109
        return false;
110
        $("#collapse_" + target ).show();
110
    } ).nextAll( 'textarea, input[type=submit]' ).hide().css( { opacity: 0 } );
111
        if( syntax ){
111
112
            var editor = CodeMirror.fromTextArea( document.getElementById( "pref_" + target ), {
112
    $( '.prefs-tab .collapse-textarea' ).hide().click( function () {
113
                lineNumbers: true,
113
        $( this ).show().prevAll( 'textarea, input[type=submit]' )
114
                mode: syntax,
114
            .animate( { height: 'hide', queue: false } )
115
                lineWrapping: true
115
            .animate( { opacity: 0 } );
116
            });
116
117
            editor.on("change", function(){
117
        $( this ).hide().prevAll( 'a' ).show();
118
                mark_modified.call( $("#pref_" + target )[0]);
118
        return false;
119
            });
120
            editor.on("blur", function(){
121
                editor.save();
122
            });
123
        } else {
124
            $("#pref_" + target ).show();
125
        }
119
    });
126
    });
120
127
128
    $( ".collapse-textarea" ).on("click", function(e){
129
        e.preventDefault();
130
        $(this).hide();
131
        var target = $(this).data("target");
132
        var syntax = $(this).data("syntax");
133
        $("#expand_" + target ).show();
134
        if( syntax ){
135
            var editor = $("#pref_" + target ).next(".CodeMirror")[0].CodeMirror;
136
            editor.toTextArea();
137
        }
138
        $("#pref_" + target ).hide();
139
    });
121
140
122
    $("h3").attr("class","expanded").attr("title",MSG_CLICK_TO_EXPAND);
141
    $("h3").attr("class","expanded").attr("title",MSG_CLICK_TO_EXPAND);
123
    var collapsible = $(".collapsed,.expanded");
142
    var collapsible = $(".collapsed,.expanded");
124
- 

Return to bug 21582