PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.7.31.4
Pods – Custom Content Types and Fields v2.7.31.4
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / ui / js / codemirror / addon / mode / loadmode.js
pods / ui / js / codemirror / addon / mode Last commit date
loadmode.js 1 week ago overlay.js 1 week ago show-hint.js 1 week ago
loadmode.js
65 lines
1 // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 // Distributed under an MIT license: http://codemirror.net/LICENSE
3
4 (function(mod) {
5 if (typeof exports == "object" && typeof module == "object") // CommonJS
6 mod(require("../../lib/codemirror"), "cjs");
7 else if (typeof define == "function" && define.amd) // AMD
8 define(["../../lib/codemirror"], function(CM) { mod(CM, "amd"); });
9 else // Plain browser env
10 mod(CodeMirror, "plain");
11 })(function(CodeMirror, env) {
12 if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
13
14 var loading = {};
15 function splitCallback(cont, n) {
16 var countDown = n;
17 return function() { if (--countDown == 0) cont(); };
18 }
19 function ensureDeps(mode, cont) {
20 var deps = CodeMirror.modes[mode].dependencies;
21 if (!deps) return cont();
22 var missing = [];
23 for (var i = 0; i < deps.length; ++i) {
24 if (!CodeMirror.modes.hasOwnProperty(deps[i]))
25 missing.push(deps[i]);
26 }
27 if (!missing.length) return cont();
28 var split = splitCallback(cont, missing.length);
29 for (var i = 0; i < missing.length; ++i)
30 CodeMirror.requireMode(missing[i], split);
31 }
32
33 CodeMirror.requireMode = function(mode, cont) {
34 if (typeof mode != "string") mode = mode.name;
35 if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
36 if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
37
38 var file = CodeMirror.modeURL.replace(/%N/g, mode);
39 if (env == "plain") {
40 var script = document.createElement("script");
41 script.src = file;
42 var others = document.getElementsByTagName("script")[0];
43 var list = loading[mode] = [cont];
44 CodeMirror.on(script, "load", function() {
45 ensureDeps(mode, function() {
46 for (var i = 0; i < list.length; ++i) list[i]();
47 });
48 });
49 others.parentNode.insertBefore(script, others);
50 } else if (env == "cjs") {
51 require(file);
52 cont();
53 } else if (env == "amd") {
54 requirejs([file], cont);
55 }
56 };
57
58 CodeMirror.autoLoadMode = function(instance, mode) {
59 if (!CodeMirror.modes.hasOwnProperty(mode))
60 CodeMirror.requireMode(mode, function() {
61 instance.setOption("mode", instance.getOption("mode"));
62 });
63 };
64 });
65