Simple Custom CSS and JS - Version 2.2

Version Description

  • 06/22/2016
  • Check compatibility WordPress 4.5.3
  • Add special offer for Simple Custom CSS and JS pro
Download this release

Release Info

Developer diana_burduja
Plugin Icon 128x128 Simple Custom CSS and JS
Version 2.2
Comparing to
See all releases

Code changes from version 2.10 to 2.2

assets/ccj_admin.css CHANGED
@@ -32,6 +32,7 @@
32
  /**
33
  * Change the `edit` screen
34
  */
 
35
  .inline.hide-if-no-js{ display: none; }
36
  .view-switch { display: none; }
37
  #modified { width: 140px; }
@@ -46,11 +47,7 @@
46
  }
47
  .language-js { background: #e4a228; }
48
  .language-php { background: #e45126; }
49
- .language-html { background: #e45126; }
50
  .widefat td, .widefat th, .type.column-type, .check-column, .column-active { vertical-align: middle !important; }
51
- .type.column-type {
52
- text-align: center;
53
- }
54
  .column-options span { margin-left: 7px; }
55
  .column-active .dashicons { font-size: 17px; }
56
  .column-active a, .column-active a:active, .column-active a:hover, .column-active a:focus { display: block; outline: 0; border: 0; text-decoration: none; }
@@ -62,14 +59,17 @@
62
  */
63
  #content {
64
  width: 100%;
 
65
  padding-left: 36px;
66
  border-top: 0;
67
  border-bottom: 0;
68
  }
69
 
 
70
  #minor-publishing { display: none; }
71
  #post-body #normal-sortables { min-height: 0px; }
72
  .CodeMirror {
 
73
  margin-top: 0px;
74
  border: 1px solid #ddd;
75
  border-bottom: none;
@@ -163,10 +163,6 @@ i.ccj-i-fullscreen:before {
163
  .radio-group { line-height: 30px; padding-left: 10px; }
164
  .radio-group .dashicons-before:before { margin: 7px 3px 0 3px; }
165
  .options_meta_box select { margin-left: 10px; }
166
- #custom-code-options .options_meta_box select {
167
- margin-left: 0px;
168
- width: 100%;
169
- }
170
 
171
 
172
 
@@ -358,7 +354,7 @@ height: 3px;
358
  color: white;
359
  }
360
  .ccj_only_premium>div {
361
- font-family:sans-serif;font-size:13px;text-align: center; border-radius: 5px; float: left; background-color: rgb(51, 51, 51); color: white; width: 207px; padding: 20px 20px;
362
  }
363
  .ccj_only_premium a {
364
  color: white; text-decoration: none;
@@ -370,10 +366,9 @@ height: 3px;
370
  .ccj_only_premium-right {
371
  width: 80px;
372
  margin-left: 130px;
373
- margin-top: -120px;
374
  }
375
  .ccj_only_premium-right>div {
376
- width: 200px;
377
  padding: 10px;
378
- margin-left: -110px;
379
  }
32
  /**
33
  * Change the `edit` screen
34
  */
35
+ h1 .page-title-action { display: none; }
36
  .inline.hide-if-no-js{ display: none; }
37
  .view-switch { display: none; }
38
  #modified { width: 140px; }
47
  }
48
  .language-js { background: #e4a228; }
49
  .language-php { background: #e45126; }
 
50
  .widefat td, .widefat th, .type.column-type, .check-column, .column-active { vertical-align: middle !important; }
 
 
 
51
  .column-options span { margin-left: 7px; }
52
  .column-active .dashicons { font-size: 17px; }
53
  .column-active a, .column-active a:active, .column-active a:hover, .column-active a:focus { display: block; outline: 0; border: 0; text-decoration: none; }
59
  */
60
  #content {
61
  width: 100%;
62
+ height: 352px;
63
  padding-left: 36px;
64
  border-top: 0;
65
  border-bottom: 0;
66
  }
67
 
68
+ .page-title-action { display: none; }
69
  #minor-publishing { display: none; }
70
  #post-body #normal-sortables { min-height: 0px; }
71
  .CodeMirror {
72
+ height: 372px !important;
73
  margin-top: 0px;
74
  border: 1px solid #ddd;
75
  border-bottom: none;
163
  .radio-group { line-height: 30px; padding-left: 10px; }
164
  .radio-group .dashicons-before:before { margin: 7px 3px 0 3px; }
165
  .options_meta_box select { margin-left: 10px; }
 
 
 
 
166
 
167
 
168
 
354
  color: white;
355
  }
356
  .ccj_only_premium>div {
357
+ font-family:sans-serif;font-size:13px;text-align: center; border-radius: 5px; float: left; background-color: rgb(51, 51, 51); color: white; width: 147px; padding: 20px 50px;
358
  }
359
  .ccj_only_premium a {
360
  color: white; text-decoration: none;
366
  .ccj_only_premium-right {
367
  width: 80px;
368
  margin-left: 130px;
369
+ margin-top: -60px;
370
  }
371
  .ccj_only_premium-right>div {
372
+ width: 100px;
373
  padding: 10px;
 
374
  }
assets/ccj_admin.js CHANGED
@@ -1,60 +1,12 @@
1
  jQuery(document).ready( function($) {
2
 
3
- $('.page-title-action').hide();
4
-
5
  // Initialize the CodeMirror editor
6
  if ( $('#content').length > 0 ) {
7
- var content_mode = $("#content").attr('mode');
8
- if ( content_mode == 'html' ) {
9
- var content_mode = {
10
- name: "htmlmixed",
11
- scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
12
- mode: null}]
13
- };
14
- }
15
- var options = {
16
  lineNumbers: true,
17
- mode: content_mode,
18
- matchBrackets: true
19
- };
20
- if ( typeof CCJ !== 'undefined' && CCJ.scroll !== '0' ) {
21
- options['scrollbarStyle'] = "simple";
22
- }
23
-
24
-
25
- var cm_width = $('#title').width() + 16;
26
- var cm_height = 500;
27
-
28
- var editor = CodeMirror.fromTextArea(document.getElementById("content"), options);
29
-
30
- editor.setSize(cm_width, cm_height);
31
-
32
- $('.CodeMirror').resizable({
33
- resize: function() {
34
- editor.setSize($(this).width(), $(this).height());
35
- } ,
36
- maxWidth: cm_width,
37
- minWidth: cm_width,
38
- minHeight: 200
39
-
40
- });
41
-
42
- $(window).resize(function () {
43
- var cm_width = $('#title').width() + 16;
44
- var cm_height = $('.CodeMirror').height();
45
- editor.setSize(cm_width, cm_height);
46
  });
47
-
48
-
49
-
50
  }
51
-
52
- // Make the inactive rows opaque
53
- if ( $('.dashicons-star-empty.ccj_row').length > 0 ) {
54
- $('.dashicons-star-empty.ccj_row').each(function(){
55
- $(this).parent().parent().parent().css('opacity', '0.4');
56
- });
57
- }
58
-
59
  });
60
 
1
  jQuery(document).ready( function($) {
2
 
 
 
3
  // Initialize the CodeMirror editor
4
  if ( $('#content').length > 0 ) {
5
+ var editor = CodeMirror.fromTextArea(document.getElementById("content"), {
 
 
 
 
 
 
 
 
6
  lineNumbers: true,
7
+ mode: $("#content").attr('mode'),
8
+ matchBrackets: true,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  });
 
 
 
10
  }
 
 
 
 
 
 
 
 
11
  });
12
 
assets/codemirror/addon/dialog.css DELETED
@@ -1,32 +0,0 @@
1
- .CodeMirror-dialog {
2
- position: absolute;
3
- left: 0; right: 0;
4
- background: inherit;
5
- z-index: 15;
6
- padding: .1em .8em;
7
- overflow: hidden;
8
- color: inherit;
9
- }
10
-
11
- .CodeMirror-dialog-top {
12
- border-bottom: 1px solid #eee;
13
- top: 0;
14
- }
15
-
16
- .CodeMirror-dialog-bottom {
17
- border-top: 1px solid #eee;
18
- bottom: 0;
19
- }
20
-
21
- .CodeMirror-dialog input {
22
- border: none;
23
- outline: none;
24
- background: transparent;
25
- width: 20em;
26
- color: inherit;
27
- font-family: monospace;
28
- }
29
-
30
- .CodeMirror-dialog button {
31
- font-size: 70%;
32
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/codemirror/addon/dialog.js DELETED
@@ -1,157 +0,0 @@
1
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
- // Distributed under an MIT license: http://codemirror.net/LICENSE
3
-
4
- // Open simple dialogs on top of an editor. Relies on dialog.css.
5
-
6
- (function(mod) {
7
- if (typeof exports == "object" && typeof module == "object") // CommonJS
8
- mod(require("../../lib/codemirror"));
9
- else if (typeof define == "function" && define.amd) // AMD
10
- define(["../../lib/codemirror"], mod);
11
- else // Plain browser env
12
- mod(CodeMirror);
13
- })(function(CodeMirror) {
14
- function dialogDiv(cm, template, bottom) {
15
- var wrap = cm.getWrapperElement();
16
- var dialog;
17
- dialog = wrap.appendChild(document.createElement("div"));
18
- if (bottom)
19
- dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom";
20
- else
21
- dialog.className = "CodeMirror-dialog CodeMirror-dialog-top";
22
-
23
- if (typeof template == "string") {
24
- dialog.innerHTML = template;
25
- } else { // Assuming it's a detached DOM element.
26
- dialog.appendChild(template);
27
- }
28
- return dialog;
29
- }
30
-
31
- function closeNotification(cm, newVal) {
32
- if (cm.state.currentNotificationClose)
33
- cm.state.currentNotificationClose();
34
- cm.state.currentNotificationClose = newVal;
35
- }
36
-
37
- CodeMirror.defineExtension("openDialog", function(template, callback, options) {
38
- if (!options) options = {};
39
-
40
- closeNotification(this, null);
41
-
42
- var dialog = dialogDiv(this, template, options.bottom);
43
- var closed = false, me = this;
44
- function close(newVal) {
45
- if (typeof newVal == 'string') {
46
- inp.value = newVal;
47
- } else {
48
- if (closed) return;
49
- closed = true;
50
- dialog.parentNode.removeChild(dialog);
51
- me.focus();
52
-
53
- if (options.onClose) options.onClose(dialog);
54
- }
55
- }
56
-
57
- var inp = dialog.getElementsByTagName("input")[0], button;
58
- if (inp) {
59
- inp.focus();
60
-
61
- if (options.value) {
62
- inp.value = options.value;
63
- if (options.selectValueOnOpen !== false) {
64
- inp.select();
65
- }
66
- }
67
-
68
- if (options.onInput)
69
- CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);});
70
- if (options.onKeyUp)
71
- CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);});
72
-
73
- CodeMirror.on(inp, "keydown", function(e) {
74
- if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; }
75
- if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {
76
- inp.blur();
77
- CodeMirror.e_stop(e);
78
- close();
79
- }
80
- if (e.keyCode == 13) callback(inp.value, e);
81
- });
82
-
83
- if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close);
84
- } else if (button = dialog.getElementsByTagName("button")[0]) {
85
- CodeMirror.on(button, "click", function() {
86
- close();
87
- me.focus();
88
- });
89
-
90
- if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close);
91
-
92
- button.focus();
93
- }
94
- return close;
95
- });
96
-
97
- CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) {
98
- closeNotification(this, null);
99
- var dialog = dialogDiv(this, template, options && options.bottom);
100
- var buttons = dialog.getElementsByTagName("button");
101
- var closed = false, me = this, blurring = 1;
102
- function close() {
103
- if (closed) return;
104
- closed = true;
105
- dialog.parentNode.removeChild(dialog);
106
- me.focus();
107
- }
108
- buttons[0].focus();
109
- for (var i = 0; i < buttons.length; ++i) {
110
- var b = buttons[i];
111
- (function(callback) {
112
- CodeMirror.on(b, "click", function(e) {
113
- CodeMirror.e_preventDefault(e);
114
- close();
115
- if (callback) callback(me);
116
- });
117
- })(callbacks[i]);
118
- CodeMirror.on(b, "blur", function() {
119
- --blurring;
120
- setTimeout(function() { if (blurring <= 0) close(); }, 200);
121
- });
122
- CodeMirror.on(b, "focus", function() { ++blurring; });
123
- }
124
- });
125
-
126
- /*
127
- * openNotification
128
- * Opens a notification, that can be closed with an optional timer
129
- * (default 5000ms timer) and always closes on click.
130
- *
131
- * If a notification is opened while another is opened, it will close the
132
- * currently opened one and open the new one immediately.
133
- */
134
- CodeMirror.defineExtension("openNotification", function(template, options) {
135
- closeNotification(this, close);
136
- var dialog = dialogDiv(this, template, options && options.bottom);
137
- var closed = false, doneTimer;
138
- var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000;
139
-
140
- function close() {
141
- if (closed) return;
142
- closed = true;
143
- clearTimeout(doneTimer);
144
- dialog.parentNode.removeChild(dialog);
145
- }
146
-
147
- CodeMirror.on(dialog, 'click', function(e) {
148
- CodeMirror.e_preventDefault(e);
149
- close();
150
- });
151
-
152
- if (duration)
153
- doneTimer = setTimeout(close, duration);
154
-
155
- return close;
156
- });
157
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/codemirror/addon/jump-to-line.js DELETED
@@ -1,49 +0,0 @@
1
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
- // Distributed under an MIT license: http://codemirror.net/LICENSE
3
-
4
- // Defines jumpToLine command. Uses dialog.js if present.
5
-
6
- (function(mod) {
7
- if (typeof exports == "object" && typeof module == "object") // CommonJS
8
- mod(require("../../lib/codemirror"), require("../dialog/dialog"));
9
- else if (typeof define == "function" && define.amd) // AMD
10
- define(["../../lib/codemirror", "../dialog/dialog"], mod);
11
- else // Plain browser env
12
- mod(CodeMirror);
13
- })(function(CodeMirror) {
14
- "use strict";
15
-
16
- function dialog(cm, text, shortText, deflt, f) {
17
- if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});
18
- else f(prompt(shortText, deflt));
19
- }
20
-
21
- var jumpDialog =
22
- 'Jump to line: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use line:column or scroll% syntax)</span>';
23
-
24
- function interpretLine(cm, string) {
25
- var num = Number(string)
26
- if (/^[-+]/.test(string)) return cm.getCursor().line + num
27
- else return num - 1
28
- }
29
-
30
- CodeMirror.commands.jumpToLine = function(cm) {
31
- var cur = cm.getCursor();
32
- dialog(cm, jumpDialog, "Jump to line:", (cur.line + 1) + ":" + cur.ch, function(posStr) {
33
- if (!posStr) return;
34
-
35
- var match;
36
- if (match = /^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(posStr)) {
37
- cm.setCursor(interpretLine(cm, match[1]), Number(match[2]))
38
- } else if (match = /^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(posStr)) {
39
- var line = Math.round(cm.lineCount() * Number(match[1]) / 100);
40
- if (/^[-+]/.test(match[1])) line = cur.line + line + 1;
41
- cm.setCursor(line - 1, cur.ch);
42
- } else if (match = /^\s*\:?\s*([\+\-]?\d+)\s*/.exec(posStr)) {
43
- cm.setCursor(interpretLine(cm, match[1]), cur.ch);
44
- }
45
- });
46
- };
47
-
48
- CodeMirror.keyMap["default"]["Alt-G"] = "jumpToLine";
49
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/codemirror/addon/matchesonscrollbar.css DELETED
@@ -1,8 +0,0 @@
1
- .CodeMirror-search-match {
2
- background: gold;
3
- border-top: 1px solid orange;
4
- border-bottom: 1px solid orange;
5
- -moz-box-sizing: border-box;
6
- box-sizing: border-box;
7
- opacity: .5;
8
- }
 
 
 
 
 
 
 
 
assets/codemirror/addon/scroll/simplescrollbars.css DELETED
@@ -1,66 +0,0 @@
1
- .CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div {
2
- position: absolute;
3
- background: #ccc;
4
- -moz-box-sizing: border-box;
5
- box-sizing: border-box;
6
- border: 1px solid #bbb;
7
- border-radius: 2px;
8
- }
9
-
10
- .CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical {
11
- position: absolute;
12
- z-index: 6;
13
- background: #eee;
14
- }
15
-
16
- .CodeMirror-simplescroll-horizontal {
17
- bottom: 0; left: 0;
18
- height: 8px;
19
- }
20
- .CodeMirror-simplescroll-horizontal div {
21
- bottom: 0;
22
- height: 100%;
23
- }
24
-
25
- .CodeMirror-simplescroll-vertical {
26
- right: 0; top: 0;
27
- width: 8px;
28
- }
29
- .CodeMirror-simplescroll-vertical div {
30
- right: 0;
31
- width: 100%;
32
- }
33
-
34
-
35
- .CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler {
36
- display: none;
37
- }
38
-
39
- .CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div {
40
- position: absolute;
41
- background: #bcd;
42
- border-radius: 3px;
43
- }
44
-
45
- .CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical {
46
- position: absolute;
47
- z-index: 6;
48
- }
49
-
50
- .CodeMirror-overlayscroll-horizontal {
51
- bottom: 0; left: 0;
52
- height: 6px;
53
- }
54
- .CodeMirror-overlayscroll-horizontal div {
55
- bottom: 0;
56
- height: 100%;
57
- }
58
-
59
- .CodeMirror-overlayscroll-vertical {
60
- right: 0; top: 0;
61
- width: 6px;
62
- }
63
- .CodeMirror-overlayscroll-vertical div {
64
- right: 0;
65
- width: 100%;
66
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/codemirror/addon/scroll/simplescrollbars.js DELETED
@@ -1,152 +0,0 @@
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"));
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
- function Bar(cls, orientation, scroll) {
15
- this.orientation = orientation;
16
- this.scroll = scroll;
17
- this.screen = this.total = this.size = 1;
18
- this.pos = 0;
19
-
20
- this.node = document.createElement("div");
21
- this.node.className = cls + "-" + orientation;
22
- this.inner = this.node.appendChild(document.createElement("div"));
23
-
24
- var self = this;
25
- CodeMirror.on(this.inner, "mousedown", function(e) {
26
- if (e.which != 1) return;
27
- CodeMirror.e_preventDefault(e);
28
- var axis = self.orientation == "horizontal" ? "pageX" : "pageY";
29
- var start = e[axis], startpos = self.pos;
30
- function done() {
31
- CodeMirror.off(document, "mousemove", move);
32
- CodeMirror.off(document, "mouseup", done);
33
- }
34
- function move(e) {
35
- if (e.which != 1) return done();
36
- self.moveTo(startpos + (e[axis] - start) * (self.total / self.size));
37
- }
38
- CodeMirror.on(document, "mousemove", move);
39
- CodeMirror.on(document, "mouseup", done);
40
- });
41
-
42
- CodeMirror.on(this.node, "click", function(e) {
43
- CodeMirror.e_preventDefault(e);
44
- var innerBox = self.inner.getBoundingClientRect(), where;
45
- if (self.orientation == "horizontal")
46
- where = e.clientX < innerBox.left ? -1 : e.clientX > innerBox.right ? 1 : 0;
47
- else
48
- where = e.clientY < innerBox.top ? -1 : e.clientY > innerBox.bottom ? 1 : 0;
49
- self.moveTo(self.pos + where * self.screen);
50
- });
51
-
52
- function onWheel(e) {
53
- var moved = CodeMirror.wheelEventPixels(e)[self.orientation == "horizontal" ? "x" : "y"];
54
- var oldPos = self.pos;
55
- self.moveTo(self.pos + moved);
56
- if (self.pos != oldPos) CodeMirror.e_preventDefault(e);
57
- }
58
- CodeMirror.on(this.node, "mousewheel", onWheel);
59
- CodeMirror.on(this.node, "DOMMouseScroll", onWheel);
60
- }
61
-
62
- Bar.prototype.setPos = function(pos, force) {
63
- if (pos < 0) pos = 0;
64
- if (pos > this.total - this.screen) pos = this.total - this.screen;
65
- if (!force && pos == this.pos) return false;
66
- this.pos = pos;
67
- this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =
68
- (pos * (this.size / this.total)) + "px";
69
- return true
70
- };
71
-
72
- Bar.prototype.moveTo = function(pos) {
73
- if (this.setPos(pos)) this.scroll(pos, this.orientation);
74
- }
75
-
76
- var minButtonSize = 10;
77
-
78
- Bar.prototype.update = function(scrollSize, clientSize, barSize) {
79
- var sizeChanged = this.screen != clientSize || this.total != scrollSize || this.size != barSize
80
- if (sizeChanged) {
81
- this.screen = clientSize;
82
- this.total = scrollSize;
83
- this.size = barSize;
84
- }
85
-
86
- var buttonSize = this.screen * (this.size / this.total);
87
- if (buttonSize < minButtonSize) {
88
- this.size -= minButtonSize - buttonSize;
89
- buttonSize = minButtonSize;
90
- }
91
- this.inner.style[this.orientation == "horizontal" ? "width" : "height"] =
92
- buttonSize + "px";
93
- this.setPos(this.pos, sizeChanged);
94
- };
95
-
96
- function SimpleScrollbars(cls, place, scroll) {
97
- this.addClass = cls;
98
- this.horiz = new Bar(cls, "horizontal", scroll);
99
- place(this.horiz.node);
100
- this.vert = new Bar(cls, "vertical", scroll);
101
- place(this.vert.node);
102
- this.width = null;
103
- }
104
-
105
- SimpleScrollbars.prototype.update = function(measure) {
106
- if (this.width == null) {
107
- var style = window.getComputedStyle ? window.getComputedStyle(this.horiz.node) : this.horiz.node.currentStyle;
108
- if (style) this.width = parseInt(style.height);
109
- }
110
- var width = this.width || 0;
111
-
112
- var needsH = measure.scrollWidth > measure.clientWidth + 1;
113
- var needsV = measure.scrollHeight > measure.clientHeight + 1;
114
- this.vert.node.style.display = needsV ? "block" : "none";
115
- this.horiz.node.style.display = needsH ? "block" : "none";
116
-
117
- if (needsV) {
118
- this.vert.update(measure.scrollHeight, measure.clientHeight,
119
- measure.viewHeight - (needsH ? width : 0));
120
- this.vert.node.style.bottom = needsH ? width + "px" : "0";
121
- }
122
- if (needsH) {
123
- this.horiz.update(measure.scrollWidth, measure.clientWidth,
124
- measure.viewWidth - (needsV ? width : 0) - measure.barLeft);
125
- this.horiz.node.style.right = needsV ? width + "px" : "0";
126
- this.horiz.node.style.left = measure.barLeft + "px";
127
- }
128
-
129
- return {right: needsV ? width : 0, bottom: needsH ? width : 0};
130
- };
131
-
132
- SimpleScrollbars.prototype.setScrollTop = function(pos) {
133
- this.vert.setPos(pos);
134
- };
135
-
136
- SimpleScrollbars.prototype.setScrollLeft = function(pos) {
137
- this.horiz.setPos(pos);
138
- };
139
-
140
- SimpleScrollbars.prototype.clear = function() {
141
- var parent = this.horiz.node.parentNode;
142
- parent.removeChild(this.horiz.node);
143
- parent.removeChild(this.vert.node);
144
- };
145
-
146
- CodeMirror.scrollbarModel.simple = function(place, scroll) {
147
- return new SimpleScrollbars("CodeMirror-simplescroll", place, scroll);
148
- };
149
- CodeMirror.scrollbarModel.overlay = function(place, scroll) {
150
- return new SimpleScrollbars("CodeMirror-overlayscroll", place, scroll);
151
- };
152
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/codemirror/addon/search.js DELETED
@@ -1,249 +0,0 @@
1
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
- // Distributed under an MIT license: http://codemirror.net/LICENSE
3
-
4
- // Define search commands. Depends on dialog.js or another
5
- // implementation of the openDialog method.
6
-
7
- // Replace works a little oddly -- it will do the replace on the next
8
- // Ctrl-G (or whatever is bound to findNext) press. You prevent a
9
- // replace by making sure the match is no longer selected when hitting
10
- // Ctrl-G.
11
-
12
- (function(mod) {
13
- if (typeof exports == "object" && typeof module == "object") // CommonJS
14
- mod(require("../../lib/codemirror"), require("./searchcursor"), require("../dialog/dialog"));
15
- else if (typeof define == "function" && define.amd) // AMD
16
- define(["../../lib/codemirror", "./searchcursor", "../dialog/dialog"], mod);
17
- else // Plain browser env
18
- mod(CodeMirror);
19
- })(function(CodeMirror) {
20
- "use strict";
21
-
22
- function searchOverlay(query, caseInsensitive) {
23
- if (typeof query == "string")
24
- query = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), caseInsensitive ? "gi" : "g");
25
- else if (!query.global)
26
- query = new RegExp(query.source, query.ignoreCase ? "gi" : "g");
27
-
28
- return {token: function(stream) {
29
- query.lastIndex = stream.pos;
30
- var match = query.exec(stream.string);
31
- if (match && match.index == stream.pos) {
32
- stream.pos += match[0].length || 1;
33
- return "searching";
34
- } else if (match) {
35
- stream.pos = match.index;
36
- } else {
37
- stream.skipToEnd();
38
- }
39
- }};
40
- }
41
-
42
- function SearchState() {
43
- this.posFrom = this.posTo = this.lastQuery = this.query = null;
44
- this.overlay = null;
45
- }
46
-
47
- function getSearchState(cm) {
48
- return cm.state.search || (cm.state.search = new SearchState());
49
- }
50
-
51
- function queryCaseInsensitive(query) {
52
- return typeof query == "string" && query == query.toLowerCase();
53
- }
54
-
55
- function getSearchCursor(cm, query, pos) {
56
- // Heuristic: if the query string is all lowercase, do a case insensitive search.
57
- return cm.getSearchCursor(query, pos, queryCaseInsensitive(query));
58
- }
59
-
60
- function persistentDialog(cm, text, deflt, onEnter, onKeyDown) {
61
- cm.openDialog(text, onEnter, {
62
- value: deflt,
63
- selectValueOnOpen: true,
64
- closeOnEnter: false,
65
- onClose: function() { clearSearch(cm); },
66
- onKeyDown: onKeyDown
67
- });
68
- }
69
-
70
- function dialog(cm, text, shortText, deflt, f) {
71
- if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});
72
- else f(prompt(shortText, deflt));
73
- }
74
-
75
- function confirmDialog(cm, text, shortText, fs) {
76
- if (cm.openConfirm) cm.openConfirm(text, fs);
77
- else if (confirm(shortText)) fs[0]();
78
- }
79
-
80
- function parseString(string) {
81
- return string.replace(/\\(.)/g, function(_, ch) {
82
- if (ch == "n") return "\n"
83
- if (ch == "r") return "\r"
84
- return ch
85
- })
86
- }
87
-
88
- function parseQuery(query) {
89
- var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
90
- if (isRE) {
91
- try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); }
92
- catch(e) {} // Not a regular expression after all, do a string search
93
- } else {
94
- query = parseString(query)
95
- }
96
- if (typeof query == "string" ? query == "" : query.test(""))
97
- query = /x^/;
98
- return query;
99
- }
100
-
101
- var queryDialog =
102
- 'Search: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>';
103
-
104
- function startSearch(cm, state, query) {
105
- state.queryText = query;
106
- state.query = parseQuery(query);
107
- cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));
108
- state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));
109
- cm.addOverlay(state.overlay);
110
- if (cm.showMatchesOnScrollbar) {
111
- if (state.annotate) { state.annotate.clear(); state.annotate = null; }
112
- state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query));
113
- }
114
- }
115
-
116
- function doSearch(cm, rev, persistent, immediate) {
117
- var state = getSearchState(cm);
118
- if (state.query) return findNext(cm, rev);
119
- var q = cm.getSelection() || state.lastQuery;
120
- if (persistent && cm.openDialog) {
121
- var hiding = null
122
- var searchNext = function(query, event) {
123
- CodeMirror.e_stop(event);
124
- if (!query) return;
125
- if (query != state.queryText) {
126
- startSearch(cm, state, query);
127
- state.posFrom = state.posTo = cm.getCursor();
128
- }
129
- if (hiding) hiding.style.opacity = 1
130
- findNext(cm, event.shiftKey, function(_, to) {
131
- var dialog
132
- if (to.line < 3 && document.querySelector &&
133
- (dialog = cm.display.wrapper.querySelector(".CodeMirror-dialog")) &&
134
- dialog.getBoundingClientRect().bottom - 4 > cm.cursorCoords(to, "window").top)
135
- (hiding = dialog).style.opacity = .4
136
- })
137
- };
138
- persistentDialog(cm, queryDialog, q, searchNext, function(event, query) {
139
- var cmd = CodeMirror.keyMap[cm.getOption("keyMap")][CodeMirror.keyName(event)];
140
- if (cmd == "findNext" || cmd == "findPrev") {
141
- CodeMirror.e_stop(event);
142
- startSearch(cm, getSearchState(cm), query);
143
- cm.execCommand(cmd);
144
- } else if (cmd == "find" || cmd == "findPersistent") {
145
- CodeMirror.e_stop(event);
146
- searchNext(query, event);
147
- }
148
- });
149
- if (immediate) {
150
- startSearch(cm, state, q);
151
- findNext(cm, rev);
152
- }
153
- } else {
154
- dialog(cm, queryDialog, "Search for:", q, function(query) {
155
- if (query && !state.query) cm.operation(function() {
156
- startSearch(cm, state, query);
157
- state.posFrom = state.posTo = cm.getCursor();
158
- findNext(cm, rev);
159
- });
160
- });
161
- }
162
- }
163
-
164
- function findNext(cm, rev, callback) {cm.operation(function() {
165
- var state = getSearchState(cm);
166
- var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
167
- if (!cursor.find(rev)) {
168
- cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0));
169
- if (!cursor.find(rev)) return;
170
- }
171
- cm.setSelection(cursor.from(), cursor.to());
172
- cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 20);
173
- state.posFrom = cursor.from(); state.posTo = cursor.to();
174
- if (callback) callback(cursor.from(), cursor.to())
175
- });}
176
-
177
- function clearSearch(cm) {cm.operation(function() {
178
- var state = getSearchState(cm);
179
- state.lastQuery = state.query;
180
- if (!state.query) return;
181
- state.query = state.queryText = null;
182
- cm.removeOverlay(state.overlay);
183
- if (state.annotate) { state.annotate.clear(); state.annotate = null; }
184
- });}
185
-
186
- var replaceQueryDialog =
187
- ' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>';
188
- var replacementQueryDialog = 'With: <input type="text" style="width: 10em" class="CodeMirror-search-field"/>';
189
- var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>";
190
-
191
- function replaceAll(cm, query, text) {
192
- cm.operation(function() {
193
- for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
194
- if (typeof query != "string") {
195
- var match = cm.getRange(cursor.from(), cursor.to()).match(query);
196
- cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
197
- } else cursor.replace(text);
198
- }
199
- });
200
- }
201
-
202
- function replace(cm, all) {
203
- if (cm.getOption("readOnly")) return;
204
- var query = cm.getSelection() || getSearchState(cm).lastQuery;
205
- var dialogText = all ? "Replace all:" : "Replace:"
206
- dialog(cm, dialogText + replaceQueryDialog, dialogText, query, function(query) {
207
- if (!query) return;
208
- query = parseQuery(query);
209
- dialog(cm, replacementQueryDialog, "Replace with:", "", function(text) {
210
- text = parseString(text)
211
- if (all) {
212
- replaceAll(cm, query, text)
213
- } else {
214
- clearSearch(cm);
215
- var cursor = getSearchCursor(cm, query, cm.getCursor("from"));
216
- var advance = function() {
217
- var start = cursor.from(), match;
218
- if (!(match = cursor.findNext())) {
219
- cursor = getSearchCursor(cm, query);
220
- if (!(match = cursor.findNext()) ||
221
- (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
222
- }
223
- cm.setSelection(cursor.from(), cursor.to());
224
- cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
225
- confirmDialog(cm, doReplaceConfirm, "Replace?",
226
- [function() {doReplace(match);}, advance,
227
- function() {replaceAll(cm, query, text)}]);
228
- };
229
- var doReplace = function(match) {
230
- cursor.replace(typeof query == "string" ? text :
231
- text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
232
- advance();
233
- };
234
- advance();
235
- }
236
- });
237
- });
238
- }
239
-
240
- CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
241
- CodeMirror.commands.findPersistent = function(cm) {clearSearch(cm); doSearch(cm, false, true);};
242
- CodeMirror.commands.findPersistentNext = function(cm) {doSearch(cm, false, true, true);};
243
- CodeMirror.commands.findPersistentPrev = function(cm) {doSearch(cm, true, true, true);};
244
- CodeMirror.commands.findNext = doSearch;
245
- CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
246
- CodeMirror.commands.clearSearch = clearSearch;
247
- CodeMirror.commands.replace = replace;
248
- CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
249
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/codemirror/addon/searchcursor.js DELETED
@@ -1,189 +0,0 @@
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"));
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
- var Pos = CodeMirror.Pos;
14
-
15
- function SearchCursor(doc, query, pos, caseFold) {
16
- this.atOccurrence = false; this.doc = doc;
17
- if (caseFold == null && typeof query == "string") caseFold = false;
18
-
19
- pos = pos ? doc.clipPos(pos) : Pos(0, 0);
20
- this.pos = {from: pos, to: pos};
21
-
22
- // The matches method is filled in based on the type of query.
23
- // It takes a position and a direction, and returns an object
24
- // describing the next occurrence of the query, or null if no
25
- // more matches were found.
26
- if (typeof query != "string") { // Regexp match
27
- if (!query.global) query = new RegExp(query.source, query.ignoreCase ? "ig" : "g");
28
- this.matches = function(reverse, pos) {
29
- if (reverse) {
30
- query.lastIndex = 0;
31
- var line = doc.getLine(pos.line).slice(0, pos.ch), cutOff = 0, match, start;
32
- for (;;) {
33
- query.lastIndex = cutOff;
34
- var newMatch = query.exec(line);
35
- if (!newMatch) break;
36
- match = newMatch;
37
- start = match.index;
38
- cutOff = match.index + (match[0].length || 1);
39
- if (cutOff == line.length) break;
40
- }
41
- var matchLen = (match && match[0].length) || 0;
42
- if (!matchLen) {
43
- if (start == 0 && line.length == 0) {match = undefined;}
44
- else if (start != doc.getLine(pos.line).length) {
45
- matchLen++;
46
- }
47
- }
48
- } else {
49
- query.lastIndex = pos.ch;
50
- var line = doc.getLine(pos.line), match = query.exec(line);
51
- var matchLen = (match && match[0].length) || 0;
52
- var start = match && match.index;
53
- if (start + matchLen != line.length && !matchLen) matchLen = 1;
54
- }
55
- if (match && matchLen)
56
- return {from: Pos(pos.line, start),
57
- to: Pos(pos.line, start + matchLen),
58
- match: match};
59
- };
60
- } else { // String query
61
- var origQuery = query;
62
- if (caseFold) query = query.toLowerCase();
63
- var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;};
64
- var target = query.split("\n");
65
- // Different methods for single-line and multi-line queries
66
- if (target.length == 1) {
67
- if (!query.length) {
68
- // Empty string would match anything and never progress, so
69
- // we define it to match nothing instead.
70
- this.matches = function() {};
71
- } else {
72
- this.matches = function(reverse, pos) {
73
- if (reverse) {
74
- var orig = doc.getLine(pos.line).slice(0, pos.ch), line = fold(orig);
75
- var match = line.lastIndexOf(query);
76
- if (match > -1) {
77
- match = adjustPos(orig, line, match);
78
- return {from: Pos(pos.line, match), to: Pos(pos.line, match + origQuery.length)};
79
- }
80
- } else {
81
- var orig = doc.getLine(pos.line).slice(pos.ch), line = fold(orig);
82
- var match = line.indexOf(query);
83
- if (match > -1) {
84
- match = adjustPos(orig, line, match) + pos.ch;
85
- return {from: Pos(pos.line, match), to: Pos(pos.line, match + origQuery.length)};
86
- }
87
- }
88
- };
89
- }
90
- } else {
91
- var origTarget = origQuery.split("\n");
92
- this.matches = function(reverse, pos) {
93
- var last = target.length - 1;
94
- if (reverse) {
95
- if (pos.line - (target.length - 1) < doc.firstLine()) return;
96
- if (fold(doc.getLine(pos.line).slice(0, origTarget[last].length)) != target[target.length - 1]) return;
97
- var to = Pos(pos.line, origTarget[last].length);
98
- for (var ln = pos.line - 1, i = last - 1; i >= 1; --i, --ln)
99
- if (target[i] != fold(doc.getLine(ln))) return;
100
- var line = doc.getLine(ln), cut = line.length - origTarget[0].length;
101
- if (fold(line.slice(cut)) != target[0]) return;
102
- return {from: Pos(ln, cut), to: to};
103
- } else {
104
- if (pos.line + (target.length - 1) > doc.lastLine()) return;
105
- var line = doc.getLine(pos.line), cut = line.length - origTarget[0].length;
106
- if (fold(line.slice(cut)) != target[0]) return;
107
- var from = Pos(pos.line, cut);
108
- for (var ln = pos.line + 1, i = 1; i < last; ++i, ++ln)
109
- if (target[i] != fold(doc.getLine(ln))) return;
110
- if (fold(doc.getLine(ln).slice(0, origTarget[last].length)) != target[last]) return;
111
- return {from: from, to: Pos(ln, origTarget[last].length)};
112
- }
113
- };
114
- }
115
- }
116
- }
117
-
118
- SearchCursor.prototype = {
119
- findNext: function() {return this.find(false);},
120
- findPrevious: function() {return this.find(true);},
121
-
122
- find: function(reverse) {
123
- var self = this, pos = this.doc.clipPos(reverse ? this.pos.from : this.pos.to);
124
- function savePosAndFail(line) {
125
- var pos = Pos(line, 0);
126
- self.pos = {from: pos, to: pos};
127
- self.atOccurrence = false;
128
- return false;
129
- }
130
-
131
- for (;;) {
132
- if (this.pos = this.matches(reverse, pos)) {
133
- this.atOccurrence = true;
134
- return this.pos.match || true;
135
- }
136
- if (reverse) {
137
- if (!pos.line) return savePosAndFail(0);
138
- pos = Pos(pos.line-1, this.doc.getLine(pos.line-1).length);
139
- }
140
- else {
141
- var maxLine = this.doc.lineCount();
142
- if (pos.line == maxLine - 1) return savePosAndFail(maxLine);
143
- pos = Pos(pos.line + 1, 0);
144
- }
145
- }
146
- },
147
-
148
- from: function() {if (this.atOccurrence) return this.pos.from;},
149
- to: function() {if (this.atOccurrence) return this.pos.to;},
150
-
151
- replace: function(newText, origin) {
152
- if (!this.atOccurrence) return;
153
- var lines = CodeMirror.splitLines(newText);
154
- this.doc.replaceRange(lines, this.pos.from, this.pos.to, origin);
155
- this.pos.to = Pos(this.pos.from.line + lines.length - 1,
156
- lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0));
157
- }
158
- };
159
-
160
- // Maps a position in a case-folded line back to a position in the original line
161
- // (compensating for codepoints increasing in number during folding)
162
- function adjustPos(orig, folded, pos) {
163
- if (orig.length == folded.length) return pos;
164
- for (var pos1 = Math.min(pos, orig.length);;) {
165
- var len1 = orig.slice(0, pos1).toLowerCase().length;
166
- if (len1 < pos) ++pos1;
167
- else if (len1 > pos) --pos1;
168
- else return pos1;
169
- }
170
- }
171
-
172
- CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
173
- return new SearchCursor(this.doc, query, pos, caseFold);
174
- });
175
- CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) {
176
- return new SearchCursor(this, query, pos, caseFold);
177
- });
178
-
179
- CodeMirror.defineExtension("selectMatches", function(query, caseFold) {
180
- var ranges = [];
181
- var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold);
182
- while (cur.findNext()) {
183
- if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break;
184
- ranges.push({anchor: cur.from(), head: cur.to()});
185
- }
186
- if (ranges.length)
187
- this.setSelections(ranges, 0);
188
- });
189
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/codemirror/mode/xml/xml.js DELETED
@@ -1,394 +0,0 @@
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"));
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
- caseFold: false
56
- }
57
-
58
- CodeMirror.defineMode("xml", function(editorConf, config_) {
59
- var indentUnit = editorConf.indentUnit
60
- var config = {}
61
- var defaults = config_.htmlMode ? htmlConfig : xmlConfig
62
- for (var prop in defaults) config[prop] = defaults[prop]
63
- for (var prop in config_) config[prop] = config_[prop]
64
-
65
- // Return variables for tokenizers
66
- var type, setStyle;
67
-
68
- function inText(stream, state) {
69
- function chain(parser) {
70
- state.tokenize = parser;
71
- return parser(stream, state);
72
- }
73
-
74
- var ch = stream.next();
75
- if (ch == "<") {
76
- if (stream.eat("!")) {
77
- if (stream.eat("[")) {
78
- if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
79
- else return null;
80
- } else if (stream.match("--")) {
81
- return chain(inBlock("comment", "-->"));
82
- } else if (stream.match("DOCTYPE", true, true)) {
83
- stream.eatWhile(/[\w\._\-]/);
84
- return chain(doctype(1));
85
- } else {
86
- return null;
87
- }
88
- } else if (stream.eat("?")) {
89
- stream.eatWhile(/[\w\._\-]/);
90
- state.tokenize = inBlock("meta", "?>");
91
- return "meta";
92
- } else {
93
- type = stream.eat("/") ? "closeTag" : "openTag";
94
- state.tokenize = inTag;
95
- return "tag bracket";
96
- }
97
- } else if (ch == "&") {
98
- var ok;
99
- if (stream.eat("#")) {
100
- if (stream.eat("x")) {
101
- ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
102
- } else {
103
- ok = stream.eatWhile(/[\d]/) && stream.eat(";");
104
- }
105
- } else {
106
- ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
107
- }
108
- return ok ? "atom" : "error";
109
- } else {
110
- stream.eatWhile(/[^&<]/);
111
- return null;
112
- }
113
- }
114
- inText.isInText = true;
115
-
116
- function inTag(stream, state) {
117
- var ch = stream.next();
118
- if (ch == ">" || (ch == "/" && stream.eat(">"))) {
119
- state.tokenize = inText;
120
- type = ch == ">" ? "endTag" : "selfcloseTag";
121
- return "tag bracket";
122
- } else if (ch == "=") {
123
- type = "equals";
124
- return null;
125
- } else if (ch == "<") {
126
- state.tokenize = inText;
127
- state.state = baseState;
128
- state.tagName = state.tagStart = null;
129
- var next = state.tokenize(stream, state);
130
- return next ? next + " tag error" : "tag error";
131
- } else if (/[\'\"]/.test(ch)) {
132
- state.tokenize = inAttribute(ch);
133
- state.stringStartCol = stream.column();
134
- return state.tokenize(stream, state);
135
- } else {
136
- stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
137
- return "word";
138
- }
139
- }
140
-
141
- function inAttribute(quote) {
142
- var closure = function(stream, state) {
143
- while (!stream.eol()) {
144
- if (stream.next() == quote) {
145
- state.tokenize = inTag;
146
- break;
147
- }
148
- }
149
- return "string";
150
- };
151
- closure.isInAttribute = true;
152
- return closure;
153
- }
154
-
155
- function inBlock(style, terminator) {
156
- return function(stream, state) {
157
- while (!stream.eol()) {
158
- if (stream.match(terminator)) {
159
- state.tokenize = inText;
160
- break;
161
- }
162
- stream.next();
163
- }
164
- return style;
165
- };
166
- }
167
- function doctype(depth) {
168
- return function(stream, state) {
169
- var ch;
170
- while ((ch = stream.next()) != null) {
171
- if (ch == "<") {
172
- state.tokenize = doctype(depth + 1);
173
- return state.tokenize(stream, state);
174
- } else if (ch == ">") {
175
- if (depth == 1) {
176
- state.tokenize = inText;
177
- break;
178
- } else {
179
- state.tokenize = doctype(depth - 1);
180
- return state.tokenize(stream, state);
181
- }
182
- }
183
- }
184
- return "meta";
185
- };
186
- }
187
-
188
- function Context(state, tagName, startOfLine) {
189
- this.prev = state.context;
190
- this.tagName = tagName;
191
- this.indent = state.indented;
192
- this.startOfLine = startOfLine;
193
- if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
194
- this.noIndent = true;
195
- }
196
- function popContext(state) {
197
- if (state.context) state.context = state.context.prev;
198
- }
199
- function maybePopContext(state, nextTagName) {
200
- var parentTagName;
201
- while (true) {
202
- if (!state.context) {
203
- return;
204
- }
205
- parentTagName = state.context.tagName;
206
- if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
207
- !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
208
- return;
209
- }
210
- popContext(state);
211
- }
212
- }
213
-
214
- function baseState(type, stream, state) {
215
- if (type == "openTag") {
216
- state.tagStart = stream.column();
217
- return tagNameState;
218
- } else if (type == "closeTag") {
219
- return closeTagNameState;
220
- } else {
221
- return baseState;
222
- }
223
- }
224
- function tagNameState(type, stream, state) {
225
- if (type == "word") {
226
- state.tagName = stream.current();
227
- setStyle = "tag";
228
- return attrState;
229
- } else {
230
- setStyle = "error";
231
- return tagNameState;
232
- }
233
- }
234
- function closeTagNameState(type, stream, state) {
235
- if (type == "word") {
236
- var tagName = stream.current();
237
- if (state.context && state.context.tagName != tagName &&
238
- config.implicitlyClosed.hasOwnProperty(state.context.tagName))
239
- popContext(state);
240
- if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
241
- setStyle = "tag";
242
- return closeState;
243
- } else {
244
- setStyle = "tag error";
245
- return closeStateErr;
246
- }
247
- } else {
248
- setStyle = "error";
249
- return closeStateErr;
250
- }
251
- }
252
-
253
- function closeState(type, _stream, state) {
254
- if (type != "endTag") {
255
- setStyle = "error";
256
- return closeState;
257
- }
258
- popContext(state);
259
- return baseState;
260
- }
261
- function closeStateErr(type, stream, state) {
262
- setStyle = "error";
263
- return closeState(type, stream, state);
264
- }
265
-
266
- function attrState(type, _stream, state) {
267
- if (type == "word") {
268
- setStyle = "attribute";
269
- return attrEqState;
270
- } else if (type == "endTag" || type == "selfcloseTag") {
271
- var tagName = state.tagName, tagStart = state.tagStart;
272
- state.tagName = state.tagStart = null;
273
- if (type == "selfcloseTag" ||
274
- config.autoSelfClosers.hasOwnProperty(tagName)) {
275
- maybePopContext(state, tagName);
276
- } else {
277
- maybePopContext(state, tagName);
278
- state.context = new Context(state, tagName, tagStart == state.indented);
279
- }
280
- return baseState;
281
- }
282
- setStyle = "error";
283
- return attrState;
284
- }
285
- function attrEqState(type, stream, state) {
286
- if (type == "equals") return attrValueState;
287
- if (!config.allowMissing) setStyle = "error";
288
- return attrState(type, stream, state);
289
- }
290
- function attrValueState(type, stream, state) {
291
- if (type == "string") return attrContinuedState;
292
- if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}
293
- setStyle = "error";
294
- return attrState(type, stream, state);
295
- }
296
- function attrContinuedState(type, stream, state) {
297
- if (type == "string") return attrContinuedState;
298
- return attrState(type, stream, state);
299
- }
300
-
301
- return {
302
- startState: function(baseIndent) {
303
- var state = {tokenize: inText,
304
- state: baseState,
305
- indented: baseIndent || 0,
306
- tagName: null, tagStart: null,
307
- context: null}
308
- if (baseIndent != null) state.baseIndent = baseIndent
309
- return state
310
- },
311
-
312
- token: function(stream, state) {
313
- if (!state.tagName && stream.sol())
314
- state.indented = stream.indentation();
315
-
316
- if (stream.eatSpace()) return null;
317
- type = null;
318
- var style = state.tokenize(stream, state);
319
- if ((style || type) && style != "comment") {
320
- setStyle = null;
321
- state.state = state.state(type || style, stream, state);
322
- if (setStyle)
323
- style = setStyle == "error" ? style + " error" : setStyle;
324
- }
325
- return style;
326
- },
327
-
328
- indent: function(state, textAfter, fullLine) {
329
- var context = state.context;
330
- // Indent multi-line strings (e.g. css).
331
- if (state.tokenize.isInAttribute) {
332
- if (state.tagStart == state.indented)
333
- return state.stringStartCol + 1;
334
- else
335
- return state.indented + indentUnit;
336
- }
337
- if (context && context.noIndent) return CodeMirror.Pass;
338
- if (state.tokenize != inTag && state.tokenize != inText)
339
- return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
340
- // Indent the starts of attribute names.
341
- if (state.tagName) {
342
- if (config.multilineTagIndentPastTag !== false)
343
- return state.tagStart + state.tagName.length + 2;
344
- else
345
- return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
346
- }
347
- if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
348
- var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
349
- if (tagAfter && tagAfter[1]) { // Closing tag spotted
350
- while (context) {
351
- if (context.tagName == tagAfter[2]) {
352
- context = context.prev;
353
- break;
354
- } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {
355
- context = context.prev;
356
- } else {
357
- break;
358
- }
359
- }
360
- } else if (tagAfter) { // Opening tag spotted
361
- while (context) {
362
- var grabbers = config.contextGrabbers[context.tagName];
363
- if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
364
- context = context.prev;
365
- else
366
- break;
367
- }
368
- }
369
- while (context && context.prev && !context.startOfLine)
370
- context = context.prev;
371
- if (context) return context.indent + indentUnit;
372
- else return state.baseIndent || 0;
373
- },
374
-
375
- electricInput: /<\/[\s\w:]+>$/,
376
- blockCommentStart: "<!--",
377
- blockCommentEnd: "-->",
378
-
379
- configuration: config.htmlMode ? "html" : "xml",
380
- helperType: config.htmlMode ? "html" : "xml",
381
-
382
- skipAttribute: function(state) {
383
- if (state.state == attrValueState)
384
- state.state = attrState
385
- }
386
- };
387
- });
388
-
389
- CodeMirror.defineMIME("text/xml", "xml");
390
- CodeMirror.defineMIME("application/xml", "xml");
391
- if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
392
- CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
393
-
394
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
custom-css-js.php CHANGED
@@ -3,9 +3,9 @@
3
  * Plugin Name: Simple Custom CSS and JS
4
  * Plugin URI: https://wordpress.org/plugins/custom-css-js/
5
  * Description: Easily add Custom CSS or JS to your website with an awesome editor.
6
- * Version: 2.10
7
  * Author: Diana Burduja
8
- * Author URI: https://www.silkypress.com/
9
  * License: GPL2
10
  *
11
  */
@@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  }
16
 
17
  if ( ! class_exists( 'CustomCSSandJS' ) ) :
18
- define( 'CCJ_VERSION', '2.10' );
19
  /**
20
  * Main CustomCSSandJS Class
21
  *
@@ -73,9 +73,8 @@ final class CustomCSSandJS {
73
  $this->upload_url = $wp_upload_dir['baseurl'] . '/custom-css-js';
74
  if ( is_admin() ) {
75
  include_once( 'includes/admin-screens.php' );
76
- include_once( 'includes/admin-addons.php' );
77
- include_once( 'includes/admin-warnings.php' );
78
  include_once( 'includes/admin-notices.php' );
 
79
  }
80
 
81
  $this->search_tree = get_option( 'custom-css-js-tree' );
@@ -84,9 +83,8 @@ final class CustomCSSandJS {
84
  return false;
85
  }
86
 
87
- if ( is_null( self::$_instance ) ) {
88
- $this->print_code_actions();
89
- }
90
  }
91
 
92
  /**
@@ -94,15 +92,40 @@ final class CustomCSSandJS {
94
  */
95
  function print_code_actions() {
96
  foreach( $this->search_tree as $_key => $_value ) {
97
- $action = 'wp_';
98
- if ( strpos( $_key, 'admin' ) !== false ) {
99
- $action = 'admin_';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  }
101
- if ( strpos( $_key, 'header' ) !== false ) {
102
- $action .= 'head';
103
- } else {
104
- $action .= 'footer';
105
  }
 
106
  add_action( $action, array( $this, 'print_' . $_key ) );
107
  }
108
  }
@@ -112,7 +135,7 @@ final class CustomCSSandJS {
112
  */
113
  public function __call( $function, $args ) {
114
 
115
- if ( strpos( $function, 'print_' ) === false ) {
116
  return false;
117
  }
118
 
@@ -129,15 +152,15 @@ final class CustomCSSandJS {
129
  }
130
 
131
  // print the `internal` code
132
- if ( strpos( $function, 'internal' ) !== false ) {
133
 
134
  $before = '<!-- start Simple Custom CSS and JS -->' . PHP_EOL;
135
  $after = '<!-- end Simple Custom CSS and JS -->' . PHP_EOL;
136
- if ( strpos( $function, 'css' ) !== false ) {
137
  $before .= '<style type="text/css">' . PHP_EOL;
138
  $after = '</style>' . PHP_EOL . $after;
139
  }
140
- if ( strpos( $function, 'js' ) !== false ) {
141
  $before .= '<script type="text/javascript">' . PHP_EOL;
142
  $after = '</script>' . PHP_EOL . $after;
143
  }
@@ -154,35 +177,25 @@ final class CustomCSSandJS {
154
  }
155
 
156
  // link the `external` code
157
- if ( strpos( $function, 'external' ) !== false) {
158
  $in_footer = false;
159
- if ( strpos( $function, 'footer' ) !== false ) {
160
  $in_footer = true;
161
  }
162
 
163
- if ( strpos( $function, 'js' ) !== false ) {
164
  foreach( $args as $_filename ) {
165
  echo PHP_EOL . "<script type='text/javascript' src='".$this->upload_url . '/' . $_filename."'></script>" . PHP_EOL;
166
  }
167
  }
168
 
169
- if ( strpos( $function, 'css' ) !== false ) {
170
  foreach( $args as $_filename ) {
171
  $shortfilename = preg_replace( '@\.css\?v=.*$@', '', $_filename );
172
  echo PHP_EOL . "<link rel='stylesheet' id='".$shortfilename ."-css' href='".$this->upload_url . '/' . $_filename ."' type='text/css' media='all' />" . PHP_EOL;
173
  }
174
  }
175
  }
176
-
177
- // link the HTML code
178
- if ( strpos( $function, 'html' ) !== false ) {
179
- foreach( $args as $_post_id ) {
180
- $_post_id = str_replace('.html', '', $_post_id);
181
- $post = get_post( $_post_id );
182
- echo $post->post_content . PHP_EOL;
183
- }
184
-
185
- }
186
  }
187
 
188
  /**
@@ -246,6 +259,32 @@ function CustomCSSandJS() {
246
  CustomCSSandJS();
247
 
248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  /**
250
  * Plugin action link to Settings page
251
  */
3
  * Plugin Name: Simple Custom CSS and JS
4
  * Plugin URI: https://wordpress.org/plugins/custom-css-js/
5
  * Description: Easily add Custom CSS or JS to your website with an awesome editor.
6
+ * Version: 2.2
7
  * Author: Diana Burduja
8
+ * Author URI: http://www.silkypress.com/
9
  * License: GPL2
10
  *
11
  */
15
  }
16
 
17
  if ( ! class_exists( 'CustomCSSandJS' ) ) :
18
+ define( 'CCJ_VERSION', '2.2' );
19
  /**
20
  * Main CustomCSSandJS Class
21
  *
73
  $this->upload_url = $wp_upload_dir['baseurl'] . '/custom-css-js';
74
  if ( is_admin() ) {
75
  include_once( 'includes/admin-screens.php' );
 
 
76
  include_once( 'includes/admin-notices.php' );
77
+ include_once( 'includes/admin-addons.php' );
78
  }
79
 
80
  $this->search_tree = get_option( 'custom-css-js-tree' );
83
  return false;
84
  }
85
 
86
+ $this->print_code_actions();
87
+
 
88
  }
89
 
90
  /**
92
  */
93
  function print_code_actions() {
94
  foreach( $this->search_tree as $_key => $_value ) {
95
+ $action = '';
96
+ switch( $_key ) {
97
+ case 'admin-css-header-external' :
98
+ case 'admin-js-header-external' :
99
+ case 'admin-css-header-internal' :
100
+ case 'admin-js-header-internal' :
101
+ $action = 'admin_head';
102
+ break;
103
+
104
+ case 'admin-css-footer-external' :
105
+ case 'admin-js-footer-external' :
106
+ case 'admin-css-footer-internal' :
107
+ case 'admin-js-footer-internal' :
108
+ $action = 'admin_footer';
109
+ break;
110
+
111
+ case 'frontend-css-header-external' :
112
+ case 'frontend-css-footer-external' :
113
+ case 'frontend-css-header-internal' :
114
+ case 'frontend-js-header-internal' :
115
+ case 'frontend-js-header-external' :
116
+ $action = 'wp_head';
117
+ break;
118
+ case 'frontend-css-footer-internal' :
119
+ case 'frontend-js-footer-internal' :
120
+ case 'frontend-js-footer-external' :
121
+ $action = 'wp_footer';
122
+ break;
123
  }
124
+
125
+ if ( $action == '' ) {
126
+ continue;
 
127
  }
128
+
129
  add_action( $action, array( $this, 'print_' . $_key ) );
130
  }
131
  }
135
  */
136
  public function __call( $function, $args ) {
137
 
138
+ if ( strstr( $function, 'print_' ) == false ) {
139
  return false;
140
  }
141
 
152
  }
153
 
154
  // print the `internal` code
155
+ if ( strstr( $function, 'internal' ) ) {
156
 
157
  $before = '<!-- start Simple Custom CSS and JS -->' . PHP_EOL;
158
  $after = '<!-- end Simple Custom CSS and JS -->' . PHP_EOL;
159
+ if ( strstr( $function, 'css' ) ) {
160
  $before .= '<style type="text/css">' . PHP_EOL;
161
  $after = '</style>' . PHP_EOL . $after;
162
  }
163
+ if ( strstr( $function, 'js' ) ) {
164
  $before .= '<script type="text/javascript">' . PHP_EOL;
165
  $after = '</script>' . PHP_EOL . $after;
166
  }
177
  }
178
 
179
  // link the `external` code
180
+ if ( strstr( $function, 'external' ) ) {
181
  $in_footer = false;
182
+ if ( strstr( $function, 'footer' ) ) {
183
  $in_footer = true;
184
  }
185
 
186
+ if ( strstr( $function, 'js' ) ) {
187
  foreach( $args as $_filename ) {
188
  echo PHP_EOL . "<script type='text/javascript' src='".$this->upload_url . '/' . $_filename."'></script>" . PHP_EOL;
189
  }
190
  }
191
 
192
+ if ( strstr( $function, 'css' ) ) {
193
  foreach( $args as $_filename ) {
194
  $shortfilename = preg_replace( '@\.css\?v=.*$@', '', $_filename );
195
  echo PHP_EOL . "<link rel='stylesheet' id='".$shortfilename ."-css' href='".$this->upload_url . '/' . $_filename ."' type='text/css' media='all' />" . PHP_EOL;
196
  }
197
  }
198
  }
 
 
 
 
 
 
 
 
 
 
199
  }
200
 
201
  /**
259
  CustomCSSandJS();
260
 
261
 
262
+ /**
263
+ * Delete options, posts and files on uninstall
264
+ */
265
+ function custom_css_js_uninstall() {
266
+
267
+ delete_option( 'custom-css-js-tree' );
268
+
269
+ $wp_upload_dir = wp_upload_dir();
270
+ $upload_dir = $wp_upload_dir['basedir'] . '/custom-css-js';
271
+ @array_map( 'unlink', $upload_dir . '/*' );
272
+ @unlink( $upload_dir );
273
+
274
+ $posts = query_posts( 'post_type=custom-css-js' );
275
+
276
+ if ( ! is_array( $posts ) || count( $posts ) == 0 ) {
277
+ return false;
278
+ }
279
+
280
+ foreach ( $posts as $_post ) {
281
+ wp_delete_post( $_post, true );
282
+ }
283
+
284
+ }
285
+ register_uninstall_hook( __FILE__, 'custom_css_js_uninstall' );
286
+
287
+
288
  /**
289
  * Plugin action link to Settings page
290
  */
includes/admin-addons.php CHANGED
@@ -39,7 +39,7 @@ class CustomCSSandJS_Addons {
39
  ?>
40
  <div class="ccj_only_premium ccj_only_premium-first">
41
  <div>
42
- <a href="https://www.silkypress.com/simple-custom-css-js-pro/?utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner" target="_blank">Available only in <br />Simple Custom CSS and JS Pro</a>
43
  </div>
44
  </div>
45
  <?php
39
  ?>
40
  <div class="ccj_only_premium ccj_only_premium-first">
41
  <div>
42
+ <a href="http://www.silkypress.com/simple-custom-css-js-pro/">Only available in Premium version</a>
43
  </div>
44
  </div>
45
  <?php
includes/admin-notices.php CHANGED
@@ -17,7 +17,7 @@ class CustomCSSandJS_Notices {
17
  var $activation_time = '';
18
  var $version = '';
19
  var $dismiss_notice = '';
20
- var $expiration_days = 2;
21
 
22
  /**
23
  * Constructor
@@ -40,17 +40,10 @@ class CustomCSSandJS_Notices {
40
  * Hooked from 'admin_notices'
41
  */
42
  public function admin_notices() {
43
- $screen = get_current_screen();
44
-
45
- if ( !isset($screen->post_type) || $screen->post_type !== 'custom-css-js' )
46
- return;
47
 
48
  if ( ! $notice = $this->choose_notice() )
49
  return;
50
 
51
- if ( time() - $this->activation_time <= 3600 )
52
- return;
53
-
54
  $message = $this->get_message( $notice );
55
 
56
  $this->print_message( $notice, $message );
@@ -88,16 +81,16 @@ class CustomCSSandJS_Notices {
88
  switch ( $days_passed ) {
89
  case 1 : return '1_day';
90
  case 2 : return '2_day';
91
- case 3 : break; //return '3_day';
92
- case 4 : break;
93
- case 5 : break;
94
- case 6 : break;
95
- case 7 : break; // return '7_day';
96
- case 8 : break;
97
- case 9 : break;
98
- case 10 : break;
99
- case 11 : break;
100
- case 12 : break; //return '12_day';
101
  }
102
  }
103
 
@@ -107,30 +100,28 @@ class CustomCSSandJS_Notices {
107
  public function get_message( $notice ) {
108
 
109
  $message = '';
110
- $percentage = '30';
111
  $product_name = 'Simple Custom CSS and JS PRO';
112
 
113
  $expiration_date = $this->activation_time + ( $this->expiration_days * 86400 );
114
  $expiration_date = date( get_option( 'date_format') , $expiration_date );
115
 
116
- $expiration_period = date('j M', $this->activation_time - 3*86400 ) . ' - ' . date('j M', $this->activation_time + 2*86400 );
117
-
118
 
119
  if ( $notice == '12_days' ) {
120
- $link = 'https://www.silkypress.com/simple-custom-css-js-pro/?utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner';
121
  } else {
122
- $link = 'https://www.silkypress.com/simple-custom-css-js-pro/?a=' . $this->convert_numbers_letters( $this->activation_time ) . '&utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner';
123
  }
124
 
125
- $lower_part = sprintf( '<div style="margin-top: 7px;"><a href="%s" target="_blank">%s</a> | <a href="#" class="dismiss_notice" target="_parent">%s</a></div>', $link, 'Get your discount now', 'Dismiss this notice' );
126
 
127
  switch ( $notice ) {
128
  case '1_day' :
129
- $message = '<div>Only between '. $expiration_period .': <b>'.$percentage.'% Off from <a href="'.$link.'" target="_blank">'.$product_name.'</a></b> for our WordPress.org users.</div>' . $lower_part;
130
  break;
131
 
132
  case '2_day' :
133
- $message = '<div><b>Limited offer ending today</b>. '.$percentage.'% Off from <a href="'.$link.'" target="_blank">'.$product_name.'</a> for our WordPress.org users. </div>' . $lower_part;
134
  break;
135
 
136
  case '3_day' :
17
  var $activation_time = '';
18
  var $version = '';
19
  var $dismiss_notice = '';
20
+ var $expiration_days = 3;
21
 
22
  /**
23
  * Constructor
40
  * Hooked from 'admin_notices'
41
  */
42
  public function admin_notices() {
 
 
 
 
43
 
44
  if ( ! $notice = $this->choose_notice() )
45
  return;
46
 
 
 
 
47
  $message = $this->get_message( $notice );
48
 
49
  $this->print_message( $notice, $message );
81
  switch ( $days_passed ) {
82
  case 1 : return '1_day';
83
  case 2 : return '2_day';
84
+ case 3 : return '3_day';
85
+ case 4 :
86
+ case 5 :
87
+ case 6 :
88
+ case 7 : return '7_day';
89
+ case 8 :
90
+ case 9 :
91
+ case 10 :
92
+ case 11 :
93
+ case 12 : return '12_day';
94
  }
95
  }
96
 
100
  public function get_message( $notice ) {
101
 
102
  $message = '';
103
+ $percentage = '40';
104
  $product_name = 'Simple Custom CSS and JS PRO';
105
 
106
  $expiration_date = $this->activation_time + ( $this->expiration_days * 86400 );
107
  $expiration_date = date( get_option( 'date_format') , $expiration_date );
108
 
 
 
109
 
110
  if ( $notice == '12_days' ) {
111
+ $link = 'http://www.silkypress.com/simple-custom-css-js-pro-offer/';
112
  } else {
113
+ $link = 'http://www.silkypress.com/simple-custom-css-js-pro-special-offer/?a=' . $this->convert_numbers_letters( $this->activation_time );
114
  }
115
 
116
+ $lower_part = sprintf( '<div style="margin-top: 7px;"><a href="%s">%s</a> | <a href="#" class="dismiss_notice" target="_parent">%s</a></div>', $link, 'Get ' . $product_name, 'Dismiss this notice' );
117
 
118
  switch ( $notice ) {
119
  case '1_day' :
120
+ $message = '<div><b>Limited offer ending on '. $expiration_date .'</b>. '.$percentage.'% Off from '.$product_name.' for our WordPress.org users.</div>' . $lower_part;
121
  break;
122
 
123
  case '2_day' :
124
+ $message = '<div><b>Limited offer ending in 1 day (on '. $expiration_date .')</b>. '.$percentage.'% Off from '.$product_name.' for our WordPress.org users. </div>' . $lower_part;
125
  break;
126
 
127
  case '3_day' :
includes/admin-screens.php CHANGED
@@ -62,6 +62,7 @@ class CustomCSSandJS_Admin {
62
  'admin_menu' => 'admin_menu',
63
  'admin_enqueue_scripts' => 'admin_enqueue_scripts',
64
  'current_screen' => 'current_screen',
 
65
  'admin_notices' => 'create_uploads_directory',
66
  'edit_form_after_title' => 'codemirror_editor',
67
  'add_meta_boxes' => 'add_meta_boxes',
@@ -95,9 +96,6 @@ class CustomCSSandJS_Admin {
95
  $title = __('Add Custom JS');
96
  add_submenu_page( $menu_slug, $title, $title, 'manage_options', $submenu_slug . '&language=js');
97
 
98
- $title = __('Add Custom HTML');
99
- add_submenu_page( $menu_slug, $title, $title, 'manage_options', $submenu_slug . '&language=html');
100
-
101
  remove_submenu_page( $menu_slug, $submenu_slug);
102
  }
103
 
@@ -118,70 +116,16 @@ class CustomCSSandJS_Admin {
118
  $cm = $a . '/codemirror';
119
  $v = CCJ_VERSION;
120
 
121
- wp_register_script( 'ccj_admin', $a . '/ccj_admin.js', array('jquery', 'jquery-ui-resizable'), $v, false );
122
- wp_localize_script( 'ccj_admin', 'CCJ', $this->cm_localize() );
123
- wp_enqueue_script( 'ccj_admin' );
124
  wp_enqueue_style( 'ccj_admin', $a . '/ccj_admin.css', array(), $v );
125
 
126
-
127
  // Only for the new/edit Code's page
128
  if ( $hook == 'post-new.php' || $hook == 'post.php' ) {
129
- wp_enqueue_style( 'jquery-ui', 'https://code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css', array(), $v );
130
- wp_enqueue_script( 'ccj_codemirror', $cm . '/codemirror-compressed.js', array( 'jquery' ), $v, false);
131
- wp_enqueue_style( 'ccj_codemirror', $cm . '/codemirror-compressed.css', array(), $v );
132
  wp_enqueue_script( 'ccj_admin_url_rules', $a . '/ccj_admin-url_rules.js', array('jquery'), $v, false );
133
- wp_enqueue_script( 'ccj_scrollbars', $cm . '/addon/scroll/simplescrollbars.js', array('ccj_codemirror'), $v, false );
134
- wp_enqueue_style( 'ccj_scrollbars', $cm . '/addon/scroll/simplescrollbars.css', array(), $v );
135
-
136
- // Add the language modes
137
- $cmm = $cm . '/mode/';
138
- wp_enqueue_script('cm-xml', $cmm . 'xml/xml.js', array('ccj_codemirror'), $v, false);
139
- wp_enqueue_script('cm-js', $cmm . 'javascript/javascript.js', array('ccj_codemirror'), $v, false);
140
- wp_enqueue_script('cm-css', $cmm . 'css/css.js', array('ccj_codemirror'), $v, false);
141
- wp_enqueue_script('cm-htmlmixed', $cmm . 'htmlmixed/htmlmixed.js', array('ccj_codemirror'), $v, false);
142
-
143
- $cma = $cm . '/addon/';
144
- wp_enqueue_script('cm-dialog', $cma . 'dialog.js', array('ccj_codemirror'), $v, false);
145
- wp_enqueue_script('cm-search', $cma . 'search.js', array('ccj_codemirror'), $v, false);
146
- wp_enqueue_script('cm-searchcursor', $cma . 'searchcursor.js',array('ccj_codemirror'), $v, false);
147
- wp_enqueue_script('cm-jump-to-line', $cma . 'jump-to-line.js', array('ccj_codemirror'), $v, false);
148
- wp_enqueue_style('cm-matchesonscrollbar', $cma . 'matchesonscrollbar.css', array(), $v );
149
- wp_enqueue_style('cm-dialog', $cma . 'dialog.css', array(), $v );
150
- wp_enqueue_style('cm-matchesonscrollbar', $cma . 'matchesonscrollbar.css', array(), $v );
151
-
152
-
153
- }
154
- }
155
-
156
-
157
- /**
158
- * Send variables to the ccj_admin.js script
159
- */
160
- public function cm_localize() {
161
 
162
- $vars = array(
163
- 'scroll' => '1'
164
- );
165
-
166
- if ( ! function_exists( 'is_plugin_active' ) ) {
167
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
168
  }
169
-
170
- // Plugins which conflict with the CodeMirror editor
171
- $conflicting_plugins = array(
172
- 'types/wpcf.php',
173
- 'advanced-ads-code-highlighter/advanced-ads-code-highlighter.php',
174
- 'wp-custom-backend-css/wp-custom-backend-css.php',
175
- 'custom-css-whole-site-and-per-post/h5ab-custom-styling.php',
176
- );
177
-
178
- foreach( $conflicting_plugins as $_plugin ) {
179
- if ( is_plugin_active( $_plugin ) ) {
180
- $vars['scroll'] = '0';
181
- }
182
- }
183
-
184
- return $vars;
185
  }
186
 
187
  public function add_meta_boxes() {
@@ -225,10 +169,6 @@ class CustomCSSandJS_Admin {
225
  add_action( 'admin_head', array( $this, 'current_screen_post' ) );
226
  }
227
 
228
- if ( $current_screen->base == 'edit' ) {
229
- add_action( 'admin_head', array( $this, 'current_screen_edit' ) );
230
- }
231
-
232
  wp_deregister_script( 'autosave' );
233
  }
234
 
@@ -240,14 +180,13 @@ class CustomCSSandJS_Admin {
240
  function add_new_buttons() {
241
  $current_screen = get_current_screen();
242
 
243
- if ( (isset($current_screen->action ) && $current_screen->action == 'add') || $current_screen->post_type != 'custom-css-js' ) {
244
  return false;
245
  }
246
  ?>
247
  <div class="updated buttons">
248
  <a href="post-new.php?post_type=custom-css-js&language=css" class="custom-btn custom-css-btn">Add CSS code</a>
249
  <a href="post-new.php?post_type=custom-css-js&language=js" class="custom-btn custom-js-btn">Add JS code</a>
250
- <a href="post-new.php?post_type=custom-css-js&language=html" class="custom-btn custom-js-btn">Add HTML code</a>
251
  <!-- a href="post-new.php?post_type=custom-css-js&language=php" class="custom-btn custom-php-btn">Add PHP code</a -->
252
  </div>
253
  <?php
@@ -282,16 +221,7 @@ class CustomCSSandJS_Admin {
282
  }
283
 
284
  if ( $column == 'modified' ) {
285
- if ( ! isset( $wp_version ) ) {
286
- include( ABSPATH . WPINC . '/version.php' );
287
- }
288
-
289
- if ( version_compare( $wp_version, '4.6', '>=' ) ) {
290
- $m_time = get_the_modified_time( 'G', $post_id );
291
- } else {
292
- $m_time = get_the_modified_time( 'G', false, $post_id );
293
- }
294
-
295
  $time_diff = time() - $m_time;
296
 
297
  if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
@@ -309,7 +239,7 @@ class CustomCSSandJS_Admin {
309
  if ( $this->is_active( $post_id ) ) {
310
  echo '<span class="dashicons dashicons-star-filled" title="The code is active. Click to inactivate it"></span>';
311
  } else {
312
- echo '<span class="dashicons dashicons-star-empty ccj_row" title="The code is inactive. Click to activate it"></span>';
313
  }
314
  echo '</a>';
315
 
@@ -351,25 +281,6 @@ class CustomCSSandJS_Admin {
351
  return get_post_meta( $post_id, '_active', true ) !== 'no';
352
  }
353
 
354
- /**
355
- * Reformat the `edit` screen
356
- */
357
- function current_screen_edit() {
358
- ?>
359
- <script type="text/javascript">
360
- /* <![CDATA[ */
361
- jQuery(window).ready(function($){
362
- var h1 = 'Custom Code ';
363
- h1 += '<a href="post-new.php?post_type=custom-css-js&language=css" class="page-title-action">Add CSS Code</a>';
364
- h1 += '<a href="post-new.php?post_type=custom-css-js&language=js" class="page-title-action">Add JS Code</a>';
365
- h1 += '<a href="post-new.php?post_type=custom-css-js&language=html" class="page-title-action">Add HTML Code</a>';
366
- $("#wpbody-content h1").html(h1);
367
- });
368
-
369
- </script>
370
- <?php
371
- }
372
-
373
 
374
 
375
  /**
@@ -390,17 +301,11 @@ class CustomCSSandJS_Admin {
390
 
391
  $title = $action . ' ' . strtoupper( $language ) . ' code';
392
 
393
- if ( $action == 'Edit' ) {
394
- $title .= ' <a href="post-new.php?post_type=custom-css-js&language=css" class="page-title-action">Add CSS Code</a> ';
395
- $title .= '<a href="post-new.php?post_type=custom-css-js&language=js" class="page-title-action">Add JS Code</a>';
396
- $title .= '<a href="post-new.php?post_type=custom-css-js&language=html" class="page-title-action">Add HTML Code</a>';
397
- }
398
-
399
  ?>
400
  <script type="text/javascript">
401
  /* <![CDATA[ */
402
  jQuery(window).ready(function($){
403
- $("#wpbody-content h1").html('<?php echo $title; ?>');
404
  $("#message.updated.notice").html('<p>Code updated</p>');
405
 
406
  var from_top = -$("#normal-sortables").height();
@@ -470,37 +375,12 @@ class CustomCSSandJS_Admin {
470
  switch ( $language ) {
471
  case 'js' :
472
  if ( $new_post ) {
473
- $post->post_content = '/* Add your JavaScript code here.
474
-
475
- If you are using the jQuery library, then don\'t forget to wrap your code inside jQuery.ready() as follows:
476
-
477
- jQuery(document).ready(function( $ ){
478
- // Your code in here
479
- });
480
-
481
- End of comment */ ' . PHP_EOL . PHP_EOL;
482
  }
483
  $code_mirror_mode = 'text/javascript';
484
  $code_mirror_before = '<script type="text/javascript">';
485
  $code_mirror_after = '</script>';
486
  break;
487
- case 'html' :
488
- if ( $new_post ) {
489
- $post->post_content = '<!-- Add HTML code to the header or the footer.
490
-
491
- For example, you can use the following code for loading the jQuery library from Google CDN:
492
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
493
-
494
- or the following one for loading the Bootstrap library from MaxCDN:
495
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
496
-
497
- -- End of the comment --> ' . PHP_EOL . PHP_EOL;
498
- }
499
- $code_mirror_mode = 'html';
500
- $code_mirror_before = '';
501
- $code_mirror_after = '';
502
- break;
503
-
504
  case 'php' :
505
  if ( $new_post ) {
506
  $post->post_content = '/* The following will be executed as if it were written in functions.php. */' . PHP_EOL . PHP_EOL;
@@ -512,17 +392,9 @@ or the following one for loading the Bootstrap library from MaxCDN:
512
  break;
513
  default :
514
  if ( $new_post ) {
515
- $post->post_content = '/* Add your CSS code here.
516
-
517
- For example:
518
- .example {
519
- color: red;
520
- }
521
-
522
- For brushing up on your CSS knowledge, check out http://www.w3schools.com/css/css_syntax.asp
523
-
524
- End of comment */ ' . PHP_EOL . PHP_EOL;
525
-
526
  }
527
  $code_mirror_mode = 'text/css';
528
  $code_mirror_before = '<style type="text/css">';
@@ -534,7 +406,7 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
534
  <form style="position: relative; margin-top: .5em;">
535
 
536
  <div class="code-mirror-before"><div><?php echo htmlentities( $code_mirror_before );?></div></div>
537
- <textarea class="wp-editor-area" id="content" mode="<?php echo htmlentities($code_mirror_mode); ?>" name="content"><?php echo htmlentities($post->post_content); ?></textarea>
538
  <div class="code-mirror-after"><div><?php echo htmlentities( $code_mirror_after );?></div></div>
539
 
540
  <input type="hidden" id="update-post_<?php echo $post->ID ?>" value="<?php echo wp_create_nonce('update-post_'. $post->ID ); ?>" />
@@ -554,16 +426,12 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
554
  if ( ! isset($options['preprocessor'] ) )
555
  $options['preprocessor'] = 'none';
556
 
 
557
 
558
  if ( isset( $_GET['language'] ) ) {
559
  $options['language'] = $_GET['language'];
560
  }
561
 
562
- $meta = $this->get_options_meta();
563
- if ( $options['language'] == 'html' ) {
564
- $meta = $this->get_options_meta_html();
565
- }
566
-
567
 
568
  wp_nonce_field( 'options_save_meta_box_data', 'custom-css-js_meta_box_nonce' );
569
 
@@ -574,13 +442,8 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
574
  $output = '';
575
 
576
  foreach( $meta as $_key => $a ) {
577
- $close_div = false;
578
 
579
- if ( ($_key == 'preprocessor' && $options['language'] == 'css') ||
580
- ($_key == 'linking' && $options['language'] == 'html') ||
581
- $_key == 'priority' ||
582
- $_key == 'minify' ) {
583
- $close_div = true;
584
  $output .= '<div class="ccj_opaque">';
585
  }
586
 
@@ -589,11 +452,41 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
589
  continue;
590
  }
591
 
592
- $output .= '<h3>' . $a['title'] . '</h3>' . PHP_EOL;
593
 
594
- $output .= $this->render_input( $_key, $a, $options );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
595
 
596
- if ( $close_div ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  $output .= '</div>';
598
  }
599
 
@@ -611,7 +504,7 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
611
 
612
  <div class="ccj_only_premium ccj_only_premium-right">
613
  <div>
614
- <a href="https://www.silkypress.com/simple-custom-css-js-pro/?utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner" target="_blank">Available only in <br />Simple Custom CSS and JS Pro</a>
615
  </div>
616
  </div>
617
 
@@ -694,113 +587,12 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
694
  'dashicon' => 'editor-contract',
695
  'disabled' => true,
696
  ),
697
- 'priority' => array(
698
- 'title' => 'Priority',
699
- 'type' => 'select',
700
- 'default' => 5,
701
- 'dashicon' => 'sort',
702
- 'values' => array(
703
- 1 => '1 (highest)',
704
- 2 => '2',
705
- 3 => '3',
706
- 4 => '4',
707
- 5 => '5',
708
- 6 => '6',
709
- 7 => '7',
710
- 8 => '8',
711
- 9 => '9',
712
- 10 => '10 (lowest)',
713
- ),
714
- 'disabled' => true,
715
- ),
716
- );
717
-
718
- return $options;
719
- }
720
-
721
-
722
- /**
723
- * Get an array with all the information for building the code's options
724
- */
725
- function get_options_meta_html() {
726
- $options = array(
727
- 'type' => array(
728
- 'title' => 'Where on page',
729
- 'type' => 'radio',
730
- 'default' => 'header',
731
- 'values' => array(
732
- 'header' => array(
733
- 'title' => 'Header',
734
- 'dashicon' => 'arrow-up-alt2',
735
- ),
736
- 'footer' => array(
737
- 'title' => 'Footer',
738
- 'dashicon' => 'arrow-down-alt2',
739
- ),
740
- ),
741
- ),
742
- 'side' => array(
743
- 'title' => 'Where in site',
744
- 'type' => 'radio',
745
- 'default' => 'frontend',
746
- 'values' => array(
747
- 'frontend' => array(
748
- 'title' => 'In Frontend',
749
- 'dashicon' => 'tagcloud',
750
- ),
751
- 'admin' => array(
752
- 'title' => 'In Admin',
753
- 'dashicon' => 'id',
754
- ),
755
- ),
756
- ),
757
- 'linking' => array(
758
- 'title' => 'On which device',
759
- 'type' => 'radio',
760
- 'default' => 'both',
761
- 'dashicon' => '',
762
- 'values' => array(
763
- 'desktop' => array(
764
- 'title' => 'Desktop',
765
- 'dashicon' => 'desktop',
766
- ),
767
- 'mobile' => array(
768
- 'title' => 'Mobile',
769
- 'dashicon' => 'smartphone',
770
- ),
771
- 'both' => array(
772
- 'title' => 'Both',
773
- 'dashicon' => 'tablet',
774
- ),
775
- ),
776
- 'disabled' => true,
777
- ),
778
- 'priority' => array(
779
- 'title' => 'Priority',
780
- 'type' => 'select',
781
- 'default' => 5,
782
- 'dashicon' => 'sort',
783
- 'values' => array(
784
- 1 => '1 (highest)',
785
- 2 => '2',
786
- 3 => '3',
787
- 4 => '4',
788
- 5 => '5',
789
- 6 => '6',
790
- 7 => '7',
791
- 8 => '8',
792
- 9 => '9',
793
- 10 => '10 (lowest)',
794
- ),
795
- 'disabled' => true,
796
- ),
797
 
798
  );
799
 
800
  return $options;
801
  }
802
 
803
-
804
  /**
805
  * Save the post and the metadata
806
  */
@@ -832,27 +624,12 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
832
  'language' => 'css',
833
  );
834
 
835
- if ( $_POST['custom_code_language'] == 'html' ) {
836
- $defaults = array(
837
- 'type' => 'header',
838
- 'linking' => 'both',
839
- 'side' => 'frontend',
840
- 'language' => 'html',
841
- 'priority' => 5,
842
- );
843
- }
844
-
845
  foreach( $defaults as $_field => $_default ) {
846
  $options[ $_field ] = isset( $_POST['custom_code_'.$_field] ) ? $_POST['custom_code_'.$_field] : $_default;
847
  }
848
 
849
  update_post_meta( $post_id, 'options', $options );
850
 
851
- if ( $options['language'] == 'html' ) {
852
- $this->build_search_tree();
853
- return;
854
- }
855
-
856
 
857
  // Save the Custom Code in a file in `wp-content/uploads/custom-css-js`
858
  if ( $options['linking'] == 'internal' ) {
@@ -992,61 +769,6 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
992
  return str_replace( 'QTags.addButton', '// QTags.addButton', $html );
993
  }
994
 
995
- /**
996
- * Render the checkboxes, radios, selects and inputs
997
- */
998
- function render_input( $_key, $a, $options ) {
999
- $name = 'custom_code_' . $_key;
1000
- $output = '';
1001
-
1002
- // Show radio type options
1003
- if ( $a['type'] === 'radio' ) {
1004
- $output .= '<div class="radio-group">' . PHP_EOL;
1005
- foreach( $a['values'] as $__key => $__value ) {
1006
- $selected = '';
1007
- $id = $name . '-' . $__key;
1008
- $dashicons = isset($__value['dashicon'] ) ? 'dashicons-before dashicons-' . $__value['dashicon'] : '';
1009
- if ( isset( $a['disabled'] ) && $a['disabled'] ) {
1010
- $selected = ' disabled="disabled"';
1011
- }
1012
- $selected .= ( $__key == $options[$_key] ) ? ' checked="checked" ' : '';
1013
- $output .= '<input type="radio" '. $selected.'value="'.$__key.'" name="'.$name.'" id="'.$id.'">' . PHP_EOL;
1014
- $output .= '<label class="'.$dashicons.'" for="'.$id.'"> '.$__value['title'].'</label><br />' . PHP_EOL;
1015
- }
1016
- $output .= '</div>' . PHP_EOL;
1017
- }
1018
-
1019
- // Show checkbox type options
1020
- if ( $a['type'] == 'checkbox' ) {
1021
- $dashicons = isset($a['dashicon'] ) ? 'dashicons-before dashicons-' . $a['dashicon'] : '';
1022
- $selected = ( isset($options[$_key]) && $options[$_key] == '1') ? ' checked="checked" ' : '';
1023
- if ( isset( $a['disabled'] ) && $a['disabled'] ) {
1024
- $selected .= ' disabled="disabled"';
1025
- }
1026
- $output .= '<div class="radio-group">' . PHP_EOL;
1027
- $output .= '<input type="checkbox" '.$selected.' value="1" name="'.$name.'" id="'.$name.'">' . PHP_EOL;
1028
- $output .= '<label class="'.$dashicons.'" for="'.$name.'"> '.$a['title'].'</label>';
1029
- $output .= '</div>' . PHP_EOL;
1030
- }
1031
-
1032
-
1033
- // Show select type options
1034
- if ( $a['type'] == 'select' ) {
1035
- $output .= '<div class="radio-group">' . PHP_EOL;
1036
- $output .= '<select name="'.$name.'" id="'.$name.'">' . PHP_EOL;
1037
- foreach( $a['values'] as $__key => $__value ) {
1038
- $selected = ( isset($options[$_key]) && $options[$_key] == $__key) ? ' selected="selected"' : '';
1039
- $output .= '<option value="'.$__key.'"'.$selected.'>' . $__value . '</option>' . PHP_EOL;
1040
- }
1041
- $output .= '</select>' . PHP_EOL;
1042
- $output .= '</div>' . PHP_EOL;
1043
- }
1044
-
1045
-
1046
- return $output;
1047
-
1048
- }
1049
-
1050
 
1051
  }
1052
 
62
  'admin_menu' => 'admin_menu',
63
  'admin_enqueue_scripts' => 'admin_enqueue_scripts',
64
  'current_screen' => 'current_screen',
65
+ 'admin_notices' => 'add_new_buttons',
66
  'admin_notices' => 'create_uploads_directory',
67
  'edit_form_after_title' => 'codemirror_editor',
68
  'add_meta_boxes' => 'add_meta_boxes',
96
  $title = __('Add Custom JS');
97
  add_submenu_page( $menu_slug, $title, $title, 'manage_options', $submenu_slug . '&language=js');
98
 
 
 
 
99
  remove_submenu_page( $menu_slug, $submenu_slug);
100
  }
101
 
116
  $cm = $a . '/codemirror';
117
  $v = CCJ_VERSION;
118
 
119
+ wp_enqueue_script( 'ccj_admin', $a . '/ccj_admin.js', array('jquery'), $v, false );
 
 
120
  wp_enqueue_style( 'ccj_admin', $a . '/ccj_admin.css', array(), $v );
121
 
 
122
  // Only for the new/edit Code's page
123
  if ( $hook == 'post-new.php' || $hook == 'post.php' ) {
124
+ wp_enqueue_script( 'codemirror', $cm . '/codemirror-compressed.js', array( 'jquery' ), $v, false);
125
+ wp_enqueue_style( 'codemirror', $cm . '/codemirror-compressed.css', array(), $v );
 
126
  wp_enqueue_script( 'ccj_admin_url_rules', $a . '/ccj_admin-url_rules.js', array('jquery'), $v, false );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
 
 
 
 
 
 
 
128
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  }
130
 
131
  public function add_meta_boxes() {
169
  add_action( 'admin_head', array( $this, 'current_screen_post' ) );
170
  }
171
 
 
 
 
 
172
  wp_deregister_script( 'autosave' );
173
  }
174
 
180
  function add_new_buttons() {
181
  $current_screen = get_current_screen();
182
 
183
+ if ( $current_screen->base != 'edit' || $current_screen->post_type != 'custom-css-js' ) {
184
  return false;
185
  }
186
  ?>
187
  <div class="updated buttons">
188
  <a href="post-new.php?post_type=custom-css-js&language=css" class="custom-btn custom-css-btn">Add CSS code</a>
189
  <a href="post-new.php?post_type=custom-css-js&language=js" class="custom-btn custom-js-btn">Add JS code</a>
 
190
  <!-- a href="post-new.php?post_type=custom-css-js&language=php" class="custom-btn custom-php-btn">Add PHP code</a -->
191
  </div>
192
  <?php
221
  }
222
 
223
  if ( $column == 'modified' ) {
224
+ $m_time = get_the_modified_time( 'G', true, get_post( $post_id ) );
 
 
 
 
 
 
 
 
 
225
  $time_diff = time() - $m_time;
226
 
227
  if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
239
  if ( $this->is_active( $post_id ) ) {
240
  echo '<span class="dashicons dashicons-star-filled" title="The code is active. Click to inactivate it"></span>';
241
  } else {
242
+ echo '<span class="dashicons dashicons-star-empty" title="The code is inactive. Click to activate it"></span>';
243
  }
244
  echo '</a>';
245
 
281
  return get_post_meta( $post_id, '_active', true ) !== 'no';
282
  }
283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
 
285
 
286
  /**
301
 
302
  $title = $action . ' ' . strtoupper( $language ) . ' code';
303
 
 
 
 
 
 
 
304
  ?>
305
  <script type="text/javascript">
306
  /* <![CDATA[ */
307
  jQuery(window).ready(function($){
308
+ $("#wpbody-content h1").text('<?php echo $title; ?>');
309
  $("#message.updated.notice").html('<p>Code updated</p>');
310
 
311
  var from_top = -$("#normal-sortables").height();
375
  switch ( $language ) {
376
  case 'js' :
377
  if ( $new_post ) {
378
+ $post->post_content = '/* Your code goes here */ ' . PHP_EOL . PHP_EOL;
 
 
 
 
 
 
 
 
379
  }
380
  $code_mirror_mode = 'text/javascript';
381
  $code_mirror_before = '<script type="text/javascript">';
382
  $code_mirror_after = '</script>';
383
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
384
  case 'php' :
385
  if ( $new_post ) {
386
  $post->post_content = '/* The following will be executed as if it were written in functions.php. */' . PHP_EOL . PHP_EOL;
392
  break;
393
  default :
394
  if ( $new_post ) {
395
+ $post->post_content .= '.example {' . PHP_EOL;
396
+ $post->post_content .= "\t" . 'color: #eee;' . PHP_EOL;
397
+ $post->post_content .= '}' . PHP_EOL . PHP_EOL;
 
 
 
 
 
 
 
 
398
  }
399
  $code_mirror_mode = 'text/css';
400
  $code_mirror_before = '<style type="text/css">';
406
  <form style="position: relative; margin-top: .5em;">
407
 
408
  <div class="code-mirror-before"><div><?php echo htmlentities( $code_mirror_before );?></div></div>
409
+ <textarea class="wp-editor-area" id="content" mode="<?php echo htmlentities($code_mirror_mode); ?>" name="content"><?php echo $post->post_content; ?></textarea>
410
  <div class="code-mirror-after"><div><?php echo htmlentities( $code_mirror_after );?></div></div>
411
 
412
  <input type="hidden" id="update-post_<?php echo $post->ID ?>" value="<?php echo wp_create_nonce('update-post_'. $post->ID ); ?>" />
426
  if ( ! isset($options['preprocessor'] ) )
427
  $options['preprocessor'] = 'none';
428
 
429
+ $meta = $this->get_options_meta();
430
 
431
  if ( isset( $_GET['language'] ) ) {
432
  $options['language'] = $_GET['language'];
433
  }
434
 
 
 
 
 
 
435
 
436
  wp_nonce_field( 'options_save_meta_box_data', 'custom-css-js_meta_box_nonce' );
437
 
442
  $output = '';
443
 
444
  foreach( $meta as $_key => $a ) {
 
445
 
446
+ if ( $_key == 'preprocessor' ) {
 
 
 
 
447
  $output .= '<div class="ccj_opaque">';
448
  }
449
 
452
  continue;
453
  }
454
 
 
455
 
456
+ $output .= '<h3>' . $a['title'] . '</h3>' . PHP_EOL;
457
+ $name = 'custom_code_' . $_key;
458
+
459
+ // Show radio type options
460
+ if ( $a['type'] === 'radio' ) {
461
+ $output .= '<div class="radio-group">' . PHP_EOL;
462
+ foreach( $a['values'] as $__key => $__value ) {
463
+ $selected = '';
464
+ $id = $name . '-' . $__key;
465
+ $dashicons = isset($__value['dashicon'] ) ? 'dashicons-before dashicons-' . $__value['dashicon'] : '';
466
+ if ( isset( $a['disabled'] ) && $a['disabled'] ) {
467
+ $selected = ' disabled="disabled"';
468
+ }
469
+ $selected .= ( $__key == $options[$_key] ) ? ' checked="checked" ' : '';
470
+ $output .= '<input type="radio" '. $selected.'value="'.$__key.'" name="'.$name.'" id="'.$id.'">' . PHP_EOL;
471
+ $output .= '<label class="'.$dashicons.'" for="'.$id.'"> '.$__value['title'].'</label><br />' . PHP_EOL;
472
+ }
473
+ $output .= '</div>' . PHP_EOL;
474
+ }
475
 
476
+ // Show checkbox type options
477
+ if ( $a['type'] == 'checkbox' ) {
478
+ $dashicons = isset($a['dashicon'] ) ? 'dashicons-before dashicons-' . $a['dashicon'] : '';
479
+ $selected = ( isset($options[$_key]) && $options[$_key] == '1') ? ' checked="checked" ' : '';
480
+ if ( isset( $a['disabled'] ) && $a['disabled'] ) {
481
+ $selected .= ' disabled="disabled"';
482
+ }
483
+ $output .= '<div class="radio-group">' . PHP_EOL;
484
+ $output .= '<input type="checkbox" '.$selected.' value="1" name="'.$name.'" id="'.$name.'">' . PHP_EOL;
485
+ $output .= '<label class="'.$dashicons.'" for="'.$name.'"> '.$a['title'].'</label>';
486
+ $output .= '</div>' . PHP_EOL;
487
+ }
488
+
489
+ if ( $_key == 'minify' ) {
490
  $output .= '</div>';
491
  }
492
 
504
 
505
  <div class="ccj_only_premium ccj_only_premium-right">
506
  <div>
507
+ <a href="http://www.silkypress.com/simple-custom-css-js-pro/">Only available in Premium version</a>
508
  </div>
509
  </div>
510
 
587
  'dashicon' => 'editor-contract',
588
  'disabled' => true,
589
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
590
 
591
  );
592
 
593
  return $options;
594
  }
595
 
 
596
  /**
597
  * Save the post and the metadata
598
  */
624
  'language' => 'css',
625
  );
626
 
 
 
 
 
 
 
 
 
 
 
627
  foreach( $defaults as $_field => $_default ) {
628
  $options[ $_field ] = isset( $_POST['custom_code_'.$_field] ) ? $_POST['custom_code_'.$_field] : $_default;
629
  }
630
 
631
  update_post_meta( $post_id, 'options', $options );
632
 
 
 
 
 
 
633
 
634
  // Save the Custom Code in a file in `wp-content/uploads/custom-css-js`
635
  if ( $options['linking'] == 'internal' ) {
769
  return str_replace( 'QTags.addButton', '// QTags.addButton', $html );
770
  }
771
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
772
 
773
  }
774
 
includes/admin-warnings.php DELETED
@@ -1,100 +0,0 @@
1
- <?php
2
- /**
3
- * Custom CSS and JS
4
- *
5
- */
6
-
7
- if ( ! defined( 'ABSPATH' ) ) {
8
- exit; // Exit if accessed directly
9
- }
10
-
11
- /**
12
- * CustomCSSandJS_Warnings
13
- */
14
- class CustomCSSandJS_Warnings {
15
-
16
- /**
17
- * Constructor
18
- */
19
- public function __construct() {
20
-
21
- if ( ! function_exists( 'is_plugin_active' ) ) {
22
- require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
23
- }
24
-
25
- $this->check_qtranslatex();
26
- add_action( 'wp_ajax_ccj_dismiss', array( $this, 'notice_dismiss' ) );
27
- }
28
-
29
- /**
30
- * Check if qTranslate plugin is active and doesn't have the custom-css-js removed from the settings
31
- */
32
- function check_qtranslatex() {
33
-
34
- if ( ! is_plugin_active( 'qtranslate-x/qtranslate.php' ) ) return false;
35
-
36
- if ( get_option('ccj_dismiss_qtranslate') !== false ) {
37
- return;
38
- }
39
-
40
- $qtranslate_post_type_excluded = get_option('qtranslate_post_type_excluded');
41
-
42
- if ( ! is_array( $qtranslate_post_type_excluded ) || array_search( 'custom-css-js', $qtranslate_post_type_excluded ) === false ) {
43
- var_dump( $qtranslate_post_type_excluded );
44
- add_action( 'admin_notices', array( $this, 'check_qtranslate_notice' ) );
45
- return;
46
- }
47
- }
48
-
49
- /**
50
- * Show a warning about qTranslate
51
- */
52
- function check_qtranslate_notice() {
53
- $id = 'ccj_dismiss_qtranslate';
54
- $class = 'notice notice-warning is-dismissible';
55
- $message = __( 'Please remove the <b>custom-css-js</b> post type from the <b>qTranslate settings</b> in order to avoid some malfunctions in the Simple Custom CSS & JS plugin. Check out <a href="https://www.silkypress.com/wp-content/uploads/2016/08/ccj_qtranslate_compatibility.png" target="_blank">this screenshot</a> for more details on how to do that.' );
56
-
57
- printf( '<div class="%1$s" id="%2$s"><p>%3$s</p></div>', $class, $id, $message );
58
-
59
- $this->dismiss_js( $id );
60
-
61
- }
62
-
63
- /**
64
- * Allow the dismiss button to remove the notice
65
- */
66
- function dismiss_js( $slug ) {
67
- ?>
68
- <script type='text/javascript'>
69
- jQuery(function($){
70
- $(document).on( 'click', '#<?php echo $slug; ?> .notice-dismiss', function() {
71
- var data = {
72
- action: 'ccj_dismiss',
73
- option: '<?php echo $slug; ?>',
74
- };
75
- $.post(ajaxurl, data, function(response ) {
76
- $('#<?php echo $slug; ?>').fadeOut('slow');
77
- });
78
- });
79
- });
80
- </script>
81
- <?php
82
- }
83
-
84
-
85
- /**
86
- * Ajax response for `notice_dismiss` action
87
- */
88
- function notice_dismiss() {
89
-
90
- $option = $_POST['option'];
91
-
92
- update_option( $option, 1 );
93
-
94
- wp_die();
95
- }
96
-
97
- }
98
-
99
-
100
- return new CustomCSSandJS_Warnings();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -5,8 +5,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=diana
5
  Email: diana@burduja.eu
6
  Tags: CSS, JS, javascript, custom CSS, custom JS, custom style, site css, add style, customize theme, custom code, external css, css3, style, styles, stylesheet, theme, editor, design, admin
7
  Requires at least: 3.0.1
8
- Tested up to: 4.7
9
- Stable tag: 2.10
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
 
@@ -25,6 +25,8 @@ Customize your WordPress site's appearance by easily adding custom CSS and JS co
25
  * Keep your changes also when you change the theme
26
 
27
  = Frequently Asked Questions =
 
 
28
 
29
  * **What if I want to add multiple external CSS codes?**
30
  If you write multiple codes of the same type (for example: two external CSS codes), then all of them will be printed one after another
@@ -48,7 +50,7 @@ Yes.
48
  The CSS and JS are independent of the theme and they will persist through a theme change. This is particularly useful if you apply CSS and JS for modifying a plugin's output.
49
 
50
  * **Can I use a CSS preprocesor like LESS or Sass?**
51
- For the moment only plain CSS is supported, but you can check out the [Pro version](https://www.silkypress.com/simple-custom-css-js-pro/?utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner) in case you need a CSS preprocessor.
52
 
53
  * **Can I upload images for use with my CSS?**
54
  Yes. You can upload an image to your Media Library, then refer to it by its direct URL from within the CSS stylesheet. For example:
@@ -100,9 +102,6 @@ PHP >= 5.3
100
  * Internet Explorer - version 8 and up
101
  * Opera - version 9 and up
102
 
103
- = Small incompatibilities =
104
- * If the [qTranslate X](https://wordpress.org/plugins/qtranslate-x/) plugin is adding some `[:]` or `[:en]` characters to your code, then you need to remove the `custom-css-js` post type from the qTranslate settings. Check out [this screenshot](https://www.silkypress.com/wp-content/uploads/2016/08/ccj_qtranslate_compatibility.png) on how to do that.
105
-
106
  == Screenshots ==
107
 
108
  1. Manage Custom Codes
@@ -111,49 +110,8 @@ PHP >= 5.3
111
 
112
  3. Add/Edit CSS
113
 
114
- $. Add/Edit HTML
115
-
116
  == Changelog ==
117
 
118
- = 2.10 =
119
- * 02/05/2016
120
- * Feature: circumvent external file caching by adding a GET parameter
121
- * Add special offer for Simple Custom CSS and JS pro
122
-
123
- = 2.9 =
124
- * 12/05/2016
125
- * Compatibility with WP4.7. The "custom HTML code" was not showing up anymore
126
-
127
- = 2.8 =
128
- * 10/09/2016
129
- * Feature: add search within the editor accessible with Ctrl+F
130
- * Feature: make the inactive rows opaque
131
-
132
- = 2.7 =
133
- * 09/04/2016
134
- * Fix: there was a space in the htmlmixed.%20js url
135
- * Feature: make the editor resizable
136
-
137
- = 2.6 =
138
- * 08/31/2016
139
- * Feature: add HTML code
140
- * Fix: add htmlentities when showing them in the editor
141
- * Feature: when adding a code, show more explanations as comments
142
-
143
- = 2.5 =
144
- * 08/25/2016
145
- * Fix: compatibility with other plugins that interfere with the CodeMirror editor
146
-
147
- = 2.4 =
148
- * 08/01/2016
149
- * Add the "Add CSS Code" and "Add JS Code" buttons next to the page title
150
- * Compatibility with WP 4.6: the "Modified" column in the Codes listing was empty
151
-
152
- = 2.3 =
153
- * 06/22/2016
154
- * Add the includes/admin-notices.php and includes/admin-addons.php
155
- * Feature: change the editor's scrollbar so it can be caught with the mouse
156
-
157
  = 2.2 =
158
  * 06/22/2016
159
  * Check compatibility WordPress 4.5.3
5
  Email: diana@burduja.eu
6
  Tags: CSS, JS, javascript, custom CSS, custom JS, custom style, site css, add style, customize theme, custom code, external css, css3, style, styles, stylesheet, theme, editor, design, admin
7
  Requires at least: 3.0.1
8
+ Tested up to: 4.5
9
+ Stable tag: 2.2
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
 
25
  * Keep your changes also when you change the theme
26
 
27
  = Frequently Asked Questions =
28
+ * **Can I recover the codes if I previous uninstalled the plugin?**
29
+ No, on the `Custom CSS and JS` plugin's uninstall all the added code will be removed. Before uninstalling make sure you don't need the codes anymore.
30
 
31
  * **What if I want to add multiple external CSS codes?**
32
  If you write multiple codes of the same type (for example: two external CSS codes), then all of them will be printed one after another
50
  The CSS and JS are independent of the theme and they will persist through a theme change. This is particularly useful if you apply CSS and JS for modifying a plugin's output.
51
 
52
  * **Can I use a CSS preprocesor like LESS or Sass?**
53
+ No, for the moment only plain CSS is supported.
54
 
55
  * **Can I upload images for use with my CSS?**
56
  Yes. You can upload an image to your Media Library, then refer to it by its direct URL from within the CSS stylesheet. For example:
102
  * Internet Explorer - version 8 and up
103
  * Opera - version 9 and up
104
 
 
 
 
105
  == Screenshots ==
106
 
107
  1. Manage Custom Codes
110
 
111
  3. Add/Edit CSS
112
 
 
 
113
  == Changelog ==
114
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  = 2.2 =
116
  * 06/22/2016
117
  * Check compatibility WordPress 4.5.3
screenshot-1.jpg DELETED
Binary file
screenshot-2.jpg DELETED
Binary file
screenshot-3.jpg DELETED
Binary file
screenshot-4.jpg DELETED
Binary file