Simple Custom CSS and JS - Version 3.33

Version Description

  • 08/20/2020
  • Fix: the user language preferrence was ignored in favor of the site defined language
  • Fix: allow the jQuery library added by plugins like Enable jQuery Migrate Helper or Test jQuery Updates
  • Fix: permalink was not editable with WordPress 5.5
  • Feature: fullscreen editor
  • Feature: button for beautifying the code
Download this release

Release Info

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

Code changes from version 3.32.3 to 3.33

assets/ccj_admin.css CHANGED
@@ -125,15 +125,23 @@ th.column-published, th.column-modified {
125
  width: 20px;
126
  height: 20px;
127
  }
 
 
 
128
  i.ccj-i-fullscreen:before {
129
  content: "\f211";
130
  }
 
 
 
 
 
 
131
 
132
  .code-mirror-before {
133
  border: 1px solid #ddd;
134
  border-bottom: none;
135
  background-color: #f7f7f7;
136
- margin-top: 24px;
137
  }
138
  .code-mirror-before div {
139
  color: #8F8F8F;
@@ -385,6 +393,12 @@ height: 3px;
385
  padding: 10px;
386
  margin-left: -110px;
387
  }
 
 
 
 
 
 
388
  pre.CodeMirror-line {
389
  direction: ltr;
390
  }
125
  width: 20px;
126
  height: 20px;
127
  }
128
+ .button-left, .button-right {
129
+ display: inline-block;
130
+ }
131
  i.ccj-i-fullscreen:before {
132
  content: "\f211";
133
  }
134
+ i.ccj-i-find:before {
135
+ content: "Find";
136
+ }
137
+ i.ccj-i-beautifier:before {
138
+ content: "\f100";
139
+ }
140
 
141
  .code-mirror-before {
142
  border: 1px solid #ddd;
143
  border-bottom: none;
144
  background-color: #f7f7f7;
 
145
  }
146
  .code-mirror-before div {
147
  color: #8F8F8F;
393
  padding: 10px;
394
  margin-left: -110px;
395
  }
396
+ .CodeMirror-fullscreen {
397
+ position: fixed !important;
398
+ top: 0; left: 0; right: 0; bottom: 0;
399
+ height: auto;
400
+ z-index: 100004;
401
+ }
402
  pre.CodeMirror-line {
403
  direction: ltr;
404
  }
assets/ccj_admin.js CHANGED
@@ -18,6 +18,14 @@ jQuery(document).ready( function($) {
18
  matchBrackets: true,
19
  autoCloseBrackets: true,
20
  extraKeys: {
 
 
 
 
 
 
 
 
21
  "Ctrl-Space": "autocomplete",
22
  "Cmd-Space": "autocomplete",
23
  "Ctrl-F": "findPersistent",
@@ -50,6 +58,13 @@ jQuery(document).ready( function($) {
50
  editor.setSize(cm_width, cm_height);
51
  });
52
 
 
 
 
 
 
 
 
53
 
54
  // Autocomplete
55
  if ( CCJ.autocomplete === '1' ) {
@@ -83,6 +98,51 @@ jQuery(document).ready( function($) {
83
 
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  // For post.php or post-new.php pages show the code's title in the page title
88
  if ( $('#titlediv #title').length > 0 ) {
@@ -208,6 +268,13 @@ jQuery(document).ready( function($) {
208
  $el = $( '#editable-post-name' );
209
  revert_e = $el.html();
210
 
 
 
 
 
 
 
 
211
  buttons.html( '<button type="button" class="save button button-small">' + postL10n.ok + '</button> <button type="button" class="cancel button- link">' + postL10n.cancel + '</button>' );
212
 
213
 
18
  matchBrackets: true,
19
  autoCloseBrackets: true,
20
  extraKeys: {
21
+ "F11": function(cm) {
22
+ cm.setOption("fullScreen", !cm.getOption("fullScreen"));
23
+ fullscreen_buttons( true );
24
+ },
25
+ "Esc": function(cm) {
26
+ if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
27
+ fullscreen_buttons( false );
28
+ },
29
  "Ctrl-Space": "autocomplete",
30
  "Cmd-Space": "autocomplete",
31
  "Ctrl-F": "findPersistent",
58
  editor.setSize(cm_width, cm_height);
59
  });
60
 
61
+ // Code Beautifier
62
+ $("#ccj-beautifier").click(function(e){
63
+ CodeMirror.commands["selectAll"](editor);
64
+ editor.autoFormatRange(editor.getCursor(true), editor.getCursor(false));
65
+ editor.setCursor(0);
66
+ e.preventDefault();
67
+ });
68
 
69
  // Autocomplete
70
  if ( CCJ.autocomplete === '1' ) {
98
 
99
  }
100
 
101
+ // Action for the `fullscreen` button
102
+ $("#ccj-fullscreen-button").click( function() {
103
+ var toggle = editor.getOption("fullScreen");
104
+ editor.setOption("fullScreen", !toggle);
105
+ fullscreen_buttons( !toggle );
106
+ });
107
+
108
+ $("#publish").click(function(e){
109
+ if ( editor.getOption("fullScreen") === true ) {
110
+ Cookies.set('fullScreen', 'true');
111
+ }
112
+ });
113
+
114
+ // Show fullscreen
115
+ if ( Cookies.get('fullScreen') == 'true' ) {
116
+ var toggle = editor.getOption("fullScreen");
117
+ editor.setOption("fullScreen", !toggle);
118
+ fullscreen_buttons( !toggle );
119
+ Cookies.remove('fullScreen');
120
+ }
121
+
122
+ // Enable the tipsy
123
+ $('span[rel=tipsy].tipsy-no-html').tipsy({fade: true, gravity: 's'});
124
+ $('span[rel=tipsy]').tipsy({fade: true, gravity: 's', html: true});
125
+
126
+ // Toggle the buttons when in fullscreen mode
127
+ function fullscreen_buttons( mode ) {
128
+ editor.focus();
129
+ if ( mode === true ) {
130
+ $("#publish").css({
131
+ 'position' : 'fixed',
132
+ 'right' : '40px',
133
+ 'bottom' : '40px',
134
+ 'z-index' : 100005,
135
+ });
136
+ } else {
137
+ $("#publish").css({
138
+ 'position' : 'static',
139
+ 'right' : 'initial',
140
+ 'bottom' : 'initial',
141
+ 'z-index' : 10,
142
+ });
143
+ }
144
+ }
145
+
146
 
147
  // For post.php or post-new.php pages show the code's title in the page title
148
  if ( $('#titlediv #title').length > 0 ) {
268
  $el = $( '#editable-post-name' );
269
  revert_e = $el.html();
270
 
271
+ if ( typeof postL10n === 'undefined' ) {
272
+ postL10n = {
273
+ ok : wp.i18n.__( 'OK' ),
274
+ cancel : wp.i18n.__( 'Cancel' ),
275
+ }
276
+ }
277
+
278
  buttons.html( '<button type="button" class="save button button-small">' + postL10n.ok + '</button> <button type="button" class="cancel button- link">' + postL10n.cancel + '</button>' );
279
 
280
 
assets/codemirror/addon/display/fullscreen.css ADDED
@@ -0,0 +1 @@
 
1
+ .CodeMirror-fullscreen{position:fixed;top:0;left:0;right:0;bottom:0;height:auto;z-index:9}
assets/codemirror/addon/display/fullscreen.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ 'use strict';(function(c){"object"==typeof exports&&"object"==typeof module?c(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],c):c(CodeMirror)})(function(c){c.defineOption("fullScreen",!1,function(d,a,b){b==c.Init&&(b=!1);!b!=!a&&(a?(a=d.getWrapperElement(),d.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:a.style.width,height:a.style.height},a.style.width="",a.style.height="auto",a.className+=" CodeMirror-fullscreen",
2
+ document.documentElement.style.overflow="hidden"):(a=d.getWrapperElement(),a.className=a.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="",b=d.state.fullScreenRestore,a.style.width=b.width,a.style.height=b.height,window.scrollTo(b.scrollLeft,b.scrollTop)),d.refresh())})});
assets/codemirror/lib/util/formatting.js ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function() {
2
+
3
+ CodeMirror.extendMode("css", {
4
+ commentStart: "/*",
5
+ commentEnd: "*/",
6
+ newlineAfterToken: function(type, content) {
7
+ return /^[;{}]$/.test(content);
8
+ }
9
+ });
10
+
11
+ CodeMirror.extendMode("javascript", {
12
+ commentStart: "/*",
13
+ commentEnd: "*/",
14
+ // FIXME semicolons inside of for
15
+ newlineAfterToken: function(type, content, textAfter, state) {
16
+ if (this.jsonMode) {
17
+ return /^[\[,{]$/.test(content) || /^}/.test(textAfter);
18
+ } else {
19
+ if (content == ";" && state.lexical && state.lexical.type == ")") return false;
20
+ return /^[;{}]$/.test(content) && !/^;/.test(textAfter);
21
+ }
22
+ }
23
+ });
24
+
25
+ CodeMirror.extendMode("xml", {
26
+ commentStart: "<!--",
27
+ commentEnd: "-->",
28
+ newlineAfterToken: function(type, content, textAfter) {
29
+ return type == "tag" && />$/.test(content) || /^</.test(textAfter);
30
+ }
31
+ });
32
+
33
+ // Comment/uncomment the specified range
34
+ CodeMirror.defineExtension("commentRange", function (isComment, from, to) {
35
+ var cm = this, curMode = CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(from).state).mode;
36
+ cm.operation(function() {
37
+ if (isComment) { // Comment range
38
+ cm.replaceRange(curMode.commentEnd, to);
39
+ cm.replaceRange(curMode.commentStart, from);
40
+ if (from.line == to.line && from.ch == to.ch) // An empty comment inserted - put cursor inside
41
+ cm.setCursor(from.line, from.ch + curMode.commentStart.length);
42
+ } else { // Uncomment range
43
+ var selText = cm.getRange(from, to);
44
+ var startIndex = selText.indexOf(curMode.commentStart);
45
+ var endIndex = selText.lastIndexOf(curMode.commentEnd);
46
+ if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) {
47
+ // Take string till comment start
48
+ selText = selText.substr(0, startIndex)
49
+ // From comment start till comment end
50
+ + selText.substring(startIndex + curMode.commentStart.length, endIndex)
51
+ // From comment end till string end
52
+ + selText.substr(endIndex + curMode.commentEnd.length);
53
+ }
54
+ cm.replaceRange(selText, from, to);
55
+ }
56
+ });
57
+ });
58
+
59
+ // Applies automatic mode-aware indentation to the specified range
60
+ CodeMirror.defineExtension("autoIndentRange", function (from, to) {
61
+ var cmInstance = this;
62
+ this.operation(function () {
63
+ for (var i = from.line; i <= to.line; i++) {
64
+ cmInstance.indentLine(i, "smart");
65
+ }
66
+ });
67
+ });
68
+
69
+ // Applies automatic formatting to the specified range
70
+ CodeMirror.defineExtension("autoFormatRange", function (from, to) {
71
+ var cm = this;
72
+ var outer = cm.getMode(), text = cm.getRange(from, to).split("\n");
73
+ var state = CodeMirror.copyState(outer, cm.getTokenAt(from).state);
74
+ var tabSize = cm.getOption("tabSize");
75
+
76
+ var out = "", lines = 0, atSol = from.ch == 0;
77
+ function newline() {
78
+ out += "\n";
79
+ atSol = true;
80
+ ++lines;
81
+ }
82
+
83
+ for (var i = 0; i < text.length; ++i) {
84
+ var stream = new CodeMirror.StringStream(text[i], tabSize);
85
+ while (!stream.eol()) {
86
+ var inner = CodeMirror.innerMode(outer, state);
87
+ var style = outer.token(stream, state), cur = stream.current();
88
+ stream.start = stream.pos;
89
+ if (!atSol || /\S/.test(cur)) {
90
+ out += cur;
91
+ atSol = false;
92
+ }
93
+ if (!atSol && inner.mode.newlineAfterToken &&
94
+ inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i+1] || "", inner.state))
95
+ newline();
96
+ }
97
+ if (!stream.pos && outer.blankLine) outer.blankLine(state);
98
+ if (!atSol) newline();
99
+ }
100
+
101
+ cm.operation(function () {
102
+ cm.replaceRange(out, from, to);
103
+ for (var cur = from.line + 1, end = from.line + lines; cur <= end; ++cur)
104
+ cm.indentLine(cur, "smart");
105
+ cm.setSelection(from, cm.getCursor(false));
106
+ });
107
+ });
108
+ })();
assets/jquery.tipsy.js ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // tipsy, facebook style tooltips for jquery
2
+ // version 1.0.0a
3
+ // (c) 2008-2010 jason frame [jason@onehackoranother.com]
4
+ // released under the MIT license
5
+
6
+ (function($) {
7
+
8
+ function maybeCall(thing, ctx) {
9
+ return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
10
+ };
11
+
12
+ function isElementInDOM(ele) {
13
+ while (ele = ele.parentNode) {
14
+ if (ele == document) return true;
15
+ }
16
+ return false;
17
+ };
18
+
19
+ function Tipsy(element, options) {
20
+ this.$element = $(element);
21
+ this.options = options;
22
+ this.enabled = true;
23
+ this.fixTitle();
24
+ };
25
+
26
+ Tipsy.prototype = {
27
+ show: function() {
28
+ var title = this.getTitle();
29
+ if (title && this.enabled) {
30
+ var $tip = this.tip();
31
+
32
+ $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
33
+ $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
34
+ $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
35
+
36
+ var pos = $.extend({}, this.$element.offset(), {
37
+ width: this.$element[0].offsetWidth,
38
+ height: this.$element[0].offsetHeight
39
+ });
40
+
41
+ var actualWidth = $tip[0].offsetWidth,
42
+ actualHeight = $tip[0].offsetHeight,
43
+ gravity = maybeCall(this.options.gravity, this.$element[0]);
44
+
45
+ var tp;
46
+ switch (gravity.charAt(0)) {
47
+ case 'n':
48
+ tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
49
+ break;
50
+ case 's':
51
+ tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
52
+ break;
53
+ case 'e':
54
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
55
+ break;
56
+ case 'w':
57
+ tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
58
+ break;
59
+ }
60
+
61
+ if (gravity.length == 2) {
62
+ if (gravity.charAt(1) == 'w') {
63
+ tp.left = pos.left + pos.width / 2 - 15;
64
+ } else {
65
+ tp.left = pos.left + pos.width / 2 - actualWidth + 15;
66
+ }
67
+ }
68
+
69
+ $tip.css(tp).addClass('tipsy-' + gravity);
70
+ $tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
71
+ if (this.options.className) {
72
+ $tip.addClass(maybeCall(this.options.className, this.$element[0]));
73
+ }
74
+
75
+ if (this.options.fade) {
76
+ $tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
77
+ } else {
78
+ $tip.css({visibility: 'visible', opacity: this.options.opacity});
79
+ }
80
+ }
81
+ },
82
+
83
+ hide: function() {
84
+ if (this.options.fade) {
85
+ this.tip().stop().fadeOut(function() { $(this).remove(); });
86
+ } else {
87
+ this.tip().remove();
88
+ }
89
+ },
90
+
91
+ fixTitle: function() {
92
+ var $e = this.$element;
93
+ if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
94
+ $e.attr('original-title', $e.attr('title') || '').removeAttr('title');
95
+ }
96
+ },
97
+
98
+ getTitle: function() {
99
+ var title, $e = this.$element, o = this.options;
100
+ this.fixTitle();
101
+ var title, o = this.options;
102
+ if (typeof o.title == 'string') {
103
+ title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
104
+ } else if (typeof o.title == 'function') {
105
+ title = o.title.call($e[0]);
106
+ }
107
+ title = ('' + title).replace(/(^\s*|\s*$)/, "");
108
+ return title || o.fallback;
109
+ },
110
+
111
+ tip: function() {
112
+ if (!this.$tip) {
113
+ this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
114
+ this.$tip.data('tipsy-pointee', this.$element[0]);
115
+ }
116
+ return this.$tip;
117
+ },
118
+
119
+ validate: function() {
120
+ if (!this.$element[0].parentNode) {
121
+ this.hide();
122
+ this.$element = null;
123
+ this.options = null;
124
+ }
125
+ },
126
+
127
+ enable: function() { this.enabled = true; },
128
+ disable: function() { this.enabled = false; },
129
+ toggleEnabled: function() { this.enabled = !this.enabled; }
130
+ };
131
+
132
+ $.fn.tipsy = function(options) {
133
+
134
+ if (options === true) {
135
+ return this.data('tipsy');
136
+ } else if (typeof options == 'string') {
137
+ var tipsy = this.data('tipsy');
138
+ if (tipsy) tipsy[options]();
139
+ return this;
140
+ }
141
+
142
+ options = $.extend({}, $.fn.tipsy.defaults, options);
143
+
144
+ function get(ele) {
145
+ var tipsy = $.data(ele, 'tipsy');
146
+ if (!tipsy) {
147
+ tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
148
+ $.data(ele, 'tipsy', tipsy);
149
+ }
150
+ return tipsy;
151
+ }
152
+
153
+ function enter() {
154
+ var tipsy = get(this);
155
+ tipsy.hoverState = 'in';
156
+ if (options.delayIn == 0) {
157
+ tipsy.show();
158
+ } else {
159
+ tipsy.fixTitle();
160
+ setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
161
+ }
162
+ };
163
+
164
+ function leave() {
165
+ var tipsy = get(this);
166
+ tipsy.hoverState = 'out';
167
+ if (options.delayOut == 0) {
168
+ tipsy.hide();
169
+ } else {
170
+ setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
171
+ }
172
+ };
173
+
174
+ if (!options.live) this.each(function() { get(this); });
175
+
176
+ if (options.trigger != 'manual') {
177
+ var binder = options.live ? 'live' : 'bind',
178
+ eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
179
+ eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
180
+ this[binder](eventIn, enter)[binder](eventOut, leave);
181
+ }
182
+
183
+ return this;
184
+
185
+ };
186
+
187
+ $.fn.tipsy.defaults = {
188
+ className: null,
189
+ delayIn: 0,
190
+ delayOut: 0,
191
+ fade: false,
192
+ fallback: '',
193
+ gravity: 'n',
194
+ html: false,
195
+ live: false,
196
+ offset: 0,
197
+ opacity: 0.8,
198
+ title: 'title',
199
+ trigger: 'hover'
200
+ };
201
+
202
+ $.fn.tipsy.revalidate = function() {
203
+ $('.tipsy').each(function() {
204
+ var pointee = $.data(this, 'tipsy-pointee');
205
+ if (!pointee || !isElementInDOM(pointee)) {
206
+ $(this).remove();
207
+ }
208
+ });
209
+ };
210
+
211
+ // Overwrite this method to provide options on a per-element basis.
212
+ // For example, you could store the gravity in a 'tipsy-gravity' attribute:
213
+ // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
214
+ // (remember - do not modify 'options' in place!)
215
+ $.fn.tipsy.elementOptions = function(ele, options) {
216
+ return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
217
+ };
218
+
219
+ $.fn.tipsy.autoNS = function() {
220
+ return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
221
+ };
222
+
223
+ $.fn.tipsy.autoWE = function() {
224
+ return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
225
+ };
226
+
227
+ /**
228
+ * yields a closure of the supplied parameters, producing a function that takes
229
+ * no arguments and is suitable for use as an autogravity function like so:
230
+ *
231
+ * @param margin (int) - distance from the viewable region edge that an
232
+ * element should be before setting its tooltip's gravity to be away
233
+ * from that edge.
234
+ * @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
235
+ * if there are no viewable region edges effecting the tooltip's
236
+ * gravity. It will try to vary from this minimally, for example,
237
+ * if 'sw' is preferred and an element is near the right viewable
238
+ * region edge, but not the top edge, it will set the gravity for
239
+ * that element's tooltip to be 'se', preserving the southern
240
+ * component.
241
+ */
242
+ $.fn.tipsy.autoBounds = function(margin, prefer) {
243
+ return function() {
244
+ var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
245
+ boundTop = $(document).scrollTop() + margin,
246
+ boundLeft = $(document).scrollLeft() + margin,
247
+ $this = $(this);
248
+
249
+ if ($this.offset().top < boundTop) dir.ns = 'n';
250
+ if ($this.offset().left < boundLeft) dir.ew = 'w';
251
+ if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
252
+ if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';
253
+
254
+ return dir.ns + (dir.ew ? dir.ew : '');
255
+ }
256
+ };
257
+
258
+ })(jQuery);
assets/js.cookie.js ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * JavaScript Cookie v2.1.3
3
+ * https://github.com/js-cookie/js-cookie
4
+ *
5
+ * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
6
+ * Released under the MIT license
7
+ */
8
+ ;(function (factory) {
9
+ var registeredInModuleLoader = false;
10
+ if (typeof define === 'function' && define.amd) {
11
+ define(factory);
12
+ registeredInModuleLoader = true;
13
+ }
14
+ if (typeof exports === 'object') {
15
+ module.exports = factory();
16
+ registeredInModuleLoader = true;
17
+ }
18
+ if (!registeredInModuleLoader) {
19
+ var OldCookies = window.Cookies;
20
+ var api = window.Cookies = factory();
21
+ api.noConflict = function () {
22
+ window.Cookies = OldCookies;
23
+ return api;
24
+ };
25
+ }
26
+ }(function () {
27
+ function extend () {
28
+ var i = 0;
29
+ var result = {};
30
+ for (; i < arguments.length; i++) {
31
+ var attributes = arguments[ i ];
32
+ for (var key in attributes) {
33
+ result[key] = attributes[key];
34
+ }
35
+ }
36
+ return result;
37
+ }
38
+
39
+ function init (converter) {
40
+ function api (key, value, attributes) {
41
+ var result;
42
+ if (typeof document === 'undefined') {
43
+ return;
44
+ }
45
+
46
+ // Write
47
+
48
+ if (arguments.length > 1) {
49
+ attributes = extend({
50
+ path: '/'
51
+ }, api.defaults, attributes);
52
+
53
+ if (typeof attributes.expires === 'number') {
54
+ var expires = new Date();
55
+ expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
56
+ attributes.expires = expires;
57
+ }
58
+
59
+ try {
60
+ result = JSON.stringify(value);
61
+ if (/^[\{\[]/.test(result)) {
62
+ value = result;
63
+ }
64
+ } catch (e) {}
65
+
66
+ if (!converter.write) {
67
+ value = encodeURIComponent(String(value))
68
+ .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
69
+ } else {
70
+ value = converter.write(value, key);
71
+ }
72
+
73
+ key = encodeURIComponent(String(key));
74
+ key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
75
+ key = key.replace(/[\(\)]/g, escape);
76
+
77
+ return (document.cookie = [
78
+ key, '=', value,
79
+ attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
80
+ attributes.path ? '; path=' + attributes.path : '',
81
+ attributes.domain ? '; domain=' + attributes.domain : '',
82
+ attributes.secure ? '; secure' : ''
83
+ ].join(''));
84
+ }
85
+
86
+ // Read
87
+
88
+ if (!key) {
89
+ result = {};
90
+ }
91
+
92
+ // To prevent the for loop in the first place assign an empty array
93
+ // in case there are no cookies at all. Also prevents odd result when
94
+ // calling "get()"
95
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
96
+ var rdecode = /(%[0-9A-Z]{2})+/g;
97
+ var i = 0;
98
+
99
+ for (; i < cookies.length; i++) {
100
+ var parts = cookies[i].split('=');
101
+ var cookie = parts.slice(1).join('=');
102
+
103
+ if (cookie.charAt(0) === '"') {
104
+ cookie = cookie.slice(1, -1);
105
+ }
106
+
107
+ try {
108
+ var name = parts[0].replace(rdecode, decodeURIComponent);
109
+ cookie = converter.read ?
110
+ converter.read(cookie, name) : converter(cookie, name) ||
111
+ cookie.replace(rdecode, decodeURIComponent);
112
+
113
+ if (this.json) {
114
+ try {
115
+ cookie = JSON.parse(cookie);
116
+ } catch (e) {}
117
+ }
118
+
119
+ if (key === name) {
120
+ result = cookie;
121
+ break;
122
+ }
123
+
124
+ if (!key) {
125
+ result[name] = cookie;
126
+ }
127
+ } catch (e) {}
128
+ }
129
+
130
+ return result;
131
+ }
132
+
133
+ api.set = api;
134
+ api.get = function (key) {
135
+ return api.call(api, key);
136
+ };
137
+ api.getJSON = function () {
138
+ return api.apply({
139
+ json: true
140
+ }, [].slice.call(arguments));
141
+ };
142
+ api.defaults = {};
143
+
144
+ api.remove = function (key, attributes) {
145
+ api(key, '', extend(attributes, {
146
+ expires: -1
147
+ }));
148
+ };
149
+
150
+ api.withConverter = init;
151
+
152
+ return api;
153
+ }
154
+
155
+ return init(function () {});
156
+ }));
assets/tipsy.css ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .tipsy { font-size: 12px; position: absolute; padding: 5px; z-index: 100000; }
2
+ .tipsy-inner { background-color: #000; color: #FFF; max-width: 200px; padding: 5px 8px 4px 8px; text-align: center; }
3
+
4
+ /* Rounded corners */
5
+ .tipsy-inner { border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; }
6
+
7
+ /* Uncomment for shadow */
8
+ /*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/
9
+
10
+ .tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; }
11
+
12
+ /* Rules to colour arrows */
13
+ .tipsy-arrow-n { border-bottom-color: #000; }
14
+ .tipsy-arrow-s { border-top-color: #000; }
15
+ .tipsy-arrow-e { border-left-color: #000; }
16
+ .tipsy-arrow-w { border-right-color: #000; }
17
+
18
+ .tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; }
19
+ .tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
20
+ .tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
21
+ .tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
22
+ .tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
23
+ .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
24
+ .tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; }
25
+ .tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; }
custom-css-js.php CHANGED
@@ -3,7 +3,7 @@
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: 3.32.3
7
  * Author: SilkyPress.com
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
@@ -75,7 +75,7 @@ if ( ! class_exists( 'CustomCSSandJS' ) ) :
75
  $this->set_constants();
76
 
77
  if ( is_admin() ) {
78
- $this->load_plugin_textdomain();
79
  include_once 'includes/admin-screens.php';
80
  include_once 'includes/admin-config.php';
81
  include_once 'includes/admin-addons.php';
@@ -217,7 +217,7 @@ if ( ! class_exists( 'CustomCSSandJS' ) ) :
217
  function set_constants() {
218
  $dir = wp_upload_dir();
219
  $constants = array(
220
- 'CCJ_VERSION' => '3.32.3',
221
  'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
222
  'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
223
  'CCJ_PLUGIN_FILE' => __FILE__,
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: 3.33
7
  * Author: SilkyPress.com
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
75
  $this->set_constants();
76
 
77
  if ( is_admin() ) {
78
+ add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
79
  include_once 'includes/admin-screens.php';
80
  include_once 'includes/admin-config.php';
81
  include_once 'includes/admin-addons.php';
217
  function set_constants() {
218
  $dir = wp_upload_dir();
219
  $constants = array(
220
+ 'CCJ_VERSION' => '3.33',
221
  'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
222
  'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
223
  'CCJ_PLUGIN_FILE' => __FILE__,
includes/admin-screens.php CHANGED
@@ -125,6 +125,9 @@ class CustomCSSandJS_Admin {
125
  $cm = $a . '/codemirror';
126
  $v = CCJ_VERSION;
127
 
 
 
 
128
  wp_register_script( 'ccj-admin', $a . '/ccj_admin.js', array( 'jquery', 'jquery-ui-resizable' ), $v, false );
129
  wp_localize_script( 'ccj-admin', 'CCJ', $this->cm_localize() );
130
  wp_enqueue_script( 'ccj-admin' );
@@ -153,7 +156,9 @@ class CustomCSSandJS_Admin {
153
  wp_enqueue_script( 'cm-search', $cma . 'search/search.js', array( 'ccj-codemirror' ), $v, false );
154
  wp_enqueue_script( 'cm-searchcursor', $cma . 'search/searchcursor.js', array( 'ccj-codemirror' ), $v, false );
155
  wp_enqueue_script( 'cm-jump-to-line', $cma . 'search/jump-to-line.js', array( 'ccj-codemirror' ), $v, false );
 
156
  wp_enqueue_style( 'cm-dialog', $cma . 'dialog/dialog.css', array(), $v );
 
157
  wp_enqueue_script( 'ccj-comment', $cma . 'comment/comment.js', array( 'ccj-codemirror' ), $v, false );
158
 
159
  // Hint Addons
@@ -177,6 +182,7 @@ class CustomCSSandJS_Admin {
177
  && strstr( $_value->src, 'plugins/custom-css-js/assets' ) === false
178
  && strstr( $_value->src, 'plugins/advanced-custom-fields/' ) === false
179
  && strstr( $_value->src, 'plugins/wp-jquery-update-test/' ) === false
 
180
  && strstr( $_value->src, 'plugins/advanced-custom-fields-pro/' ) === false ) {
181
  unset( $wp_scripts->registered[ $_key ] );
182
  }
@@ -755,6 +761,15 @@ End of comment */ ',
755
  ?>
756
  <form style="position: relative; margin-top: .5em;">
757
 
 
 
 
 
 
 
 
 
 
758
  <div class="code-mirror-before"><div><?php echo htmlentities( $code_mirror_before ); ?></div></div>
759
  <textarea class="wp-editor-area" id="ccj_content" mode="<?php echo htmlentities( $code_mirror_mode ); ?>" name="content"><?php echo $post->post_content; ?></textarea>
760
  <div class="code-mirror-after"><div><?php echo htmlentities( $code_mirror_after ); ?></div></div>
125
  $cm = $a . '/codemirror';
126
  $v = CCJ_VERSION;
127
 
128
+ wp_enqueue_script( 'ccj-tipsy', $a . '/jquery.tipsy.js', array( 'jquery' ), $v, false );
129
+ wp_enqueue_style( 'ccj-tipsy', $a . '/tipsy.css', array(), $v );
130
+ wp_enqueue_script( 'ccj-cookie', $a . '/js.cookie.js', array( 'jquery' ), $v, false );
131
  wp_register_script( 'ccj-admin', $a . '/ccj_admin.js', array( 'jquery', 'jquery-ui-resizable' ), $v, false );
132
  wp_localize_script( 'ccj-admin', 'CCJ', $this->cm_localize() );
133
  wp_enqueue_script( 'ccj-admin' );
156
  wp_enqueue_script( 'cm-search', $cma . 'search/search.js', array( 'ccj-codemirror' ), $v, false );
157
  wp_enqueue_script( 'cm-searchcursor', $cma . 'search/searchcursor.js', array( 'ccj-codemirror' ), $v, false );
158
  wp_enqueue_script( 'cm-jump-to-line', $cma . 'search/jump-to-line.js', array( 'ccj-codemirror' ), $v, false );
159
+ wp_enqueue_script( 'ccj-fullscreen', $cma . 'display/fullscreen.js', array( 'ccj-codemirror' ), $v, false );
160
  wp_enqueue_style( 'cm-dialog', $cma . 'dialog/dialog.css', array(), $v );
161
+ wp_enqueue_script( 'ccj-formatting', $cm . '/lib/util/formatting.js', array( 'ccj-codemirror' ), $v, false );
162
  wp_enqueue_script( 'ccj-comment', $cma . 'comment/comment.js', array( 'ccj-codemirror' ), $v, false );
163
 
164
  // Hint Addons
182
  && strstr( $_value->src, 'plugins/custom-css-js/assets' ) === false
183
  && strstr( $_value->src, 'plugins/advanced-custom-fields/' ) === false
184
  && strstr( $_value->src, 'plugins/wp-jquery-update-test/' ) === false
185
+ && strstr( $_value->src, 'plugins/enable-jquery-migrate-helper/' ) === false
186
  && strstr( $_value->src, 'plugins/advanced-custom-fields-pro/' ) === false ) {
187
  unset( $wp_scripts->registered[ $_key ] );
188
  }
761
  ?>
762
  <form style="position: relative; margin-top: .5em;">
763
 
764
+ <div class="code-mirror-buttons">
765
+ <div class="button-left"><span rel="tipsy" original-title="<?php _e( 'Beautify Code', 'custom-css-js-pro' ); ?>"><button type="button" tabindex="-1" id="ccj-beautifier"><i class="ccj-i-beautifier"></i></button></span></div>
766
+ <!--div class="button-left"><span rel="tipsy" original-title="<?php _e( 'Editor Settings', 'custom-css-js-pro' ); ?>"><button type="button" tabindex="-1" id="ccj-settings"><i class="ccj-i-settings"></i></button></span></div -->
767
+ <div class="button-right" id="ccj-fullscreen-button" alt="<?php _e( 'Distraction-free writing mode', 'custom-css-js-pro' ); ?>"><span rel="tipsy" original-title="<?php _e( 'Fullscreen', 'custom-css-js-pro' ); ?>"><button role="presentation" type="button" tabindex="-1"><i class="ccj-i-fullscreen"></i></button></span></div>
768
+ <input type="hidden" name="fullscreen" id="ccj-fullscreen-hidden" value="false" />
769
+ <!-- div class="button-right" id="ccj-search-button" alt="Search"><button role="presentation" type="button" tabindex="-1"><i class="ccj-i-find"></i></button></div -->
770
+
771
+ </div>
772
+
773
  <div class="code-mirror-before"><div><?php echo htmlentities( $code_mirror_before ); ?></div></div>
774
  <textarea class="wp-editor-area" id="ccj_content" mode="<?php echo htmlentities( $code_mirror_mode ); ?>" name="content"><?php echo $post->post_content; ?></textarea>
775
  <div class="code-mirror-after"><div><?php echo htmlentities( $code_mirror_after ); ?></div></div>
readme.txt CHANGED
@@ -5,7 +5,7 @@ Email: diana@burduja.eu
5
  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
6
  Requires at least: 3.0.1
7
  Tested up to: 5.5
8
- Stable tag: 3.32.3
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Requires PHP: 5.2.4
@@ -105,6 +105,14 @@ $. Add/Edit HTML
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
 
 
108
  = 3.32.3 =
109
  * 08/02/2020
110
  * Fix: add "Cmd + " editor shortcuts for MacOS computers
5
  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
6
  Requires at least: 3.0.1
7
  Tested up to: 5.5
8
+ Stable tag: 3.33
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Requires PHP: 5.2.4
105
 
106
  == Changelog ==
107
 
108
+ = 3.33 =
109
+ * 08/20/2020
110
+ * Fix: the user language preferrence was ignored in favor of the site defined language
111
+ * Fix: allow the jQuery library added by plugins like Enable jQuery Migrate Helper or Test jQuery Updates
112
+ * Fix: permalink was not editable with WordPress 5.5
113
+ * Feature: fullscreen editor
114
+ * Feature: button for beautifying the code
115
+
116
  = 3.32.3 =
117
  * 08/02/2020
118
  * Fix: add "Cmd + " editor shortcuts for MacOS computers