1
+ // eslint-disable-next-line no-unused-vars
2
+ const EasyCoder_Plugins = {
3
+
4
+ getGlobalPlugins : ( timestamp , path , setPluginCount , getPlugin , addPlugin ) => {
5
+
6
+ console . log ( `${ Date . now ( ) - timestamp } ms: Load plugins` ) ;
7
+
8
+ /*
9
+ * To include EasyCoder global plugins in your site, add them here.
10
+ * It adds the selected plugins to every page of your site that uses EasyCoder.
11
+ * You can also dynamically load plugins before launching a script; see getLocalPlugin() below.
12
+ *
13
+ * setPluginCount() sets the number of plugins to add.
14
+ * getPlugin() loads a plugin from any URL.
15
+ * addPlugin() adds it to the EasyCoder system.
16
+ * When all the plugins have been added, EasyCoder starts up.
17
+ */
18
+
19
+ setPluginCount ( 5 ) ; // *** IMPORTANT *** the number of plugins you will be adding
20
+
21
+ getPlugin ( `browser` ,
22
+ `/easycoder/plugins/browser.js` ,
23
+ function ( ) {
24
+ addPlugin ( `browser` , EasyCoder_Browser ) ;
25
+ } ) ;
26
+
27
+ getPlugin ( `json` ,
28
+ `/easycoder/plugins/json.js` ,
29
+ function ( ) {
30
+ addPlugin ( `json` , EasyCoder_Json ) ;
31
+ } ) ;
32
+
33
+ getPlugin ( `rest` ,
34
+ `/easycoder/plugins/rest.js` ,
35
+ function ( ) {
36
+ addPlugin ( `rest` , EasyCoder_Rest ) ;
37
+ } ) ;
38
+
39
+ getPlugin ( `svg` ,
40
+ `/easycoder/plugins/svg.js` ,
41
+ function ( ) {
42
+ addPlugin ( `svg` , EasyCoder_SVG ) ;
43
+ } ) ;
44
+
45
+ getPlugin ( `showdown` ,
46
+ `/easycoder/plugins/showdown.js` ,
47
+ function ( ) {
48
+ addPlugin ( `showdown` , EasyCoder_Showdown ) ;
49
+ } ) ;
50
+
51
+ } ,
52
+
53
+ getLocalPlugin : ( path , name , getPlugin , addPlugin , callback ) => {
54
+
55
+ /*
56
+ * This lets you add a plugin before launching a script, using the 'plugin' command.
57
+ * You must provide a case for every plugin you will be adding;
58
+ * use 'ckeditor' as the pattern to follow.
59
+ */
60
+
61
+ switch ( name ) {
62
+ case `codemirror` :
63
+ getPlugin ( name ,
64
+ `/easycoder/plugins/codemirror.js` ,
65
+ function ( ) {
66
+ addPlugin ( name , EasyCoder_CodeMirror , callback ) ;
67
+ } ) ;
68
+ break ;
69
+ case `ckeditor` :
70
+ getPlugin ( name ,
71
+ `/easycoder/plugins/ckeditor.js` ,
72
+ function ( ) {
73
+ addPlugin ( name , EasyCoder_CKEditor , callback ) ;
74
+ } ) ;
75
+ break ;
76
+ case `ui` :
77
+ getPlugin ( name ,
78
+ `/easycoder/plugins/ui.js` ,
79
+ function ( ) {
80
+ addPlugin ( name , EasyCoder_UI , callback ) ;
81
+ } ) ;
82
+ break ;
83
+ case `anagrams` :
84
+ getPlugin ( name ,
85
+ `/easycoder/plugins/anagrams.js` ,
86
+ function ( ) {
87
+ addPlugin ( name , EasyCoder_Anagrams , callback ) ;
88
+ } ) ;
89
+ break ;
90
+ case `gmap` :
91
+ getPlugin ( name ,
92
+ `/easycoder/plugins/gmap.js` ,
93
+ function ( ) {
94
+ addPlugin ( name , EasyCoder_GMap , callback ) ;
95
+ } ) ;
96
+ break ;
97
+ case `wof` :
98
+ getPlugin ( name ,
99
+ `/easycoder/plugins/wof.js` ,
100
+ function ( ) {
101
+ addPlugin ( name , EasyCoder_WOF , callback ) ;
102
+ } ) ;
103
+ break ;
104
+ default :
105
+ console . log ( `Plugin '${ name } ' not found.` ) ;
106
+ break ;
107
+ }
108
+ } ,
109
+
110
+ rest : ( ) => {
111
+ return `rest.php` ;
112
+ }
113
+ } ;
0 commit comments