Version Description
- 06/10/2022
- Feature: keep the user-set editor's height upon page loads and custom code saves
- Feature: save the custom code upon "Ctrl-S" in the editor
- Tweak: admin side adjustments for RTL languages
Download this release
Release Info
Developer | diana_burduja |
Plugin | Simple Custom CSS and JS |
Version | 3.40 |
Comparing to | |
See all releases |
Code changes from version 3.39 to 3.40
- assets/ccj_admin.css +136 -50
- assets/ccj_admin.js +50 -31
- custom-css-js.php +3 -3
- includes/admin-screens.php +25 -3
- includes/admin-warnings.php +4 -0
- readme.txt +9 -3
assets/ccj_admin.css
CHANGED
@@ -21,20 +21,33 @@
|
|
21 |
background: #2eaadd;
|
22 |
text-decoration: none;
|
23 |
}
|
24 |
-
.custom-js-btn {
|
25 |
-
|
26 |
-
|
27 |
-
.custom-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
.update.notice a { display: none; }
|
30 |
|
31 |
|
32 |
/**
|
33 |
* Change the `edit` screen
|
34 |
*/
|
35 |
-
.inline.hide-if-no-js{
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
.language {
|
39 |
background: #0c73b8;
|
40 |
border-radius: 2px;
|
@@ -44,27 +57,48 @@
|
|
44 |
text-decoration: none;
|
45 |
word-wrap: normal !important;
|
46 |
}
|
47 |
-
.language-js {
|
48 |
-
|
49 |
-
|
50 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
.type.column-type {
|
52 |
text-align: center;
|
53 |
}
|
54 |
-
.column-options span {
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
th.column-published, th.column-modified {
|
59 |
width: 15%;
|
60 |
}
|
61 |
@media screen and (max-width:782px){
|
62 |
-
.wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column)::before {
|
63 |
-
|
|
|
|
|
|
|
|
|
64 |
}
|
65 |
|
66 |
-
|
67 |
-
|
68 |
/**
|
69 |
* Code Mirror editor
|
70 |
*/
|
@@ -75,16 +109,22 @@ th.column-published, th.column-modified {
|
|
75 |
border-bottom: 0;
|
76 |
}
|
77 |
|
78 |
-
#minor-publishing {
|
79 |
-
|
|
|
|
|
|
|
|
|
80 |
.CodeMirror {
|
81 |
margin-top: 0px;
|
82 |
border: 1px solid #ddd;
|
83 |
border-bottom: none;
|
84 |
border-top: none;
|
85 |
}
|
86 |
-
.CodeMirror pre {
|
87 |
-
|
|
|
|
|
88 |
.code-mirror-buttons {
|
89 |
margin-top: 15px;
|
90 |
width: calc(100% - 2px);
|
@@ -128,16 +168,15 @@ th.column-published, th.column-modified {
|
|
128 |
.button-left, .button-right {
|
129 |
display: inline-block;
|
130 |
}
|
131 |
-
i.ccj-i-fullscreen
|
132 |
content: "\f211";
|
133 |
}
|
134 |
-
i.ccj-i-find
|
135 |
content: "Find";
|
136 |
}
|
137 |
-
i.ccj-i-beautifier
|
138 |
content: "\f100";
|
139 |
}
|
140 |
-
|
141 |
.code-mirror-before {
|
142 |
border: 1px solid #ddd;
|
143 |
border-bottom: none;
|
@@ -150,7 +189,6 @@ i.ccj-i-beautifier:before {
|
|
150 |
padding: 3px 8px;
|
151 |
background-color: #fff;
|
152 |
}
|
153 |
-
|
154 |
.code-mirror-after {
|
155 |
border: 1px solid #ddd;
|
156 |
border-top: none;
|
@@ -163,29 +201,34 @@ i.ccj-i-beautifier:before {
|
|
163 |
padding: 3px 8px;
|
164 |
background-color: #fff;
|
165 |
}
|
166 |
-
/*
|
167 |
-
.cm-s-default .cm-atom { color: #549d18; }
|
168 |
-
.cm-s-default .cm-property { color: #b62625; }
|
169 |
-
.cm-s-default .cm-qualifier, .cm-s-default .cm-tag { color: #4731E4; }
|
170 |
-
*/
|
171 |
-
|
172 |
|
173 |
/**
|
174 |
* Options meta box
|
175 |
*/
|
176 |
-
.radio-group input {
|
177 |
-
|
178 |
-
|
179 |
-
.radio-group {
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
#custom-code-options .options_meta_box select {
|
183 |
margin-left: 0px;
|
184 |
width: 100%;
|
185 |
}
|
186 |
|
187 |
-
|
188 |
-
|
189 |
/**
|
190 |
* Revisions
|
191 |
*/
|
@@ -316,13 +359,9 @@ padding-left: 21px;
|
|
316 |
.wplnst-elist tr td.wplnst-elist-close .wplnst-elist-close-link:hover {
|
317 |
background: url(images/button-close-hover.png) left top no-repeat;
|
318 |
}
|
319 |
-
|
320 |
.wplnst-elist tr td.wplnst-elist-split {
|
321 |
-
height: 3px;
|
322 |
}
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
#ccj-preview_url {
|
327 |
width: 78%;
|
328 |
}
|
@@ -366,7 +405,7 @@ height: 3px;
|
|
366 |
opacity: 0.4;
|
367 |
}
|
368 |
.ccj_only_premium {
|
369 |
-
z-index:9999;
|
370 |
width: 160px;
|
371 |
height: 60px;
|
372 |
position: absolute;
|
@@ -374,7 +413,15 @@ height: 3px;
|
|
374 |
color: white;
|
375 |
}
|
376 |
.ccj_only_premium>div {
|
377 |
-
font-family:sans-serif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
}
|
379 |
.ccj_only_premium a {
|
380 |
color: white; text-decoration: none;
|
@@ -408,3 +455,42 @@ pre.CodeMirror-line {
|
|
408 |
.post-type-custom-css-js #url-rules[style], .post-type-custom-css-js #revisionsdiv[style], .post-type-custom-css-js #previewdiv[style], .post-type-custom-css-js #custom-code-options[style] {
|
409 |
display: block !important;
|
410 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
background: #2eaadd;
|
22 |
text-decoration: none;
|
23 |
}
|
24 |
+
.custom-js-btn {
|
25 |
+
background: #e4a228;
|
26 |
+
}
|
27 |
+
.custom-js-btn:hover {
|
28 |
+
background: #eebf31;
|
29 |
+
}
|
30 |
+
.custom-php-btn {
|
31 |
+
background: #e45126;
|
32 |
+
}
|
33 |
+
.custom-php-btn:hover {
|
34 |
+
background: #f6652c;
|
35 |
+
}
|
36 |
.update.notice a { display: none; }
|
37 |
|
38 |
|
39 |
/**
|
40 |
* Change the `edit` screen
|
41 |
*/
|
42 |
+
.inline.hide-if-no-js {
|
43 |
+
display: none;
|
44 |
+
}
|
45 |
+
.view-switch {
|
46 |
+
display: none;
|
47 |
+
}
|
48 |
+
#type.manage-column {
|
49 |
+
width: 70px;
|
50 |
+
}
|
51 |
.language {
|
52 |
background: #0c73b8;
|
53 |
border-radius: 2px;
|
57 |
text-decoration: none;
|
58 |
word-wrap: normal !important;
|
59 |
}
|
60 |
+
.language-js {
|
61 |
+
background: #e4a228;
|
62 |
+
}
|
63 |
+
.language-php {
|
64 |
+
background: #e45126;
|
65 |
+
}
|
66 |
+
.language-html {
|
67 |
+
background: #e45126;
|
68 |
+
}
|
69 |
+
.widefat td, .widefat th, .type.column-type, .check-column, .column-active {
|
70 |
+
vertical-align: middle !important;
|
71 |
+
}
|
72 |
.type.column-type {
|
73 |
text-align: center;
|
74 |
}
|
75 |
+
.column-options span {
|
76 |
+
margin-left: 7px;
|
77 |
+
}
|
78 |
+
.column-active .dashicons {
|
79 |
+
font-size: 17px;
|
80 |
+
}
|
81 |
+
.column-active a, .column-active a:active, .column-active a:hover, .column-active a:focus {
|
82 |
+
display: block;
|
83 |
+
outline: 0;
|
84 |
+
border: 0;
|
85 |
+
text-decoration: none;
|
86 |
+
}
|
87 |
+
#active.manage-column {
|
88 |
+
width: 54px;
|
89 |
+
}
|
90 |
th.column-published, th.column-modified {
|
91 |
width: 15%;
|
92 |
}
|
93 |
@media screen and (max-width:782px){
|
94 |
+
.wp-list-table tr:not(.inline-edit-row):not(.no-items) td:not(.check-column)::before {
|
95 |
+
display: none !important;
|
96 |
+
}
|
97 |
+
.wp-list-table .toggle-row {
|
98 |
+
display: none !important;
|
99 |
+
}
|
100 |
}
|
101 |
|
|
|
|
|
102 |
/**
|
103 |
* Code Mirror editor
|
104 |
*/
|
109 |
border-bottom: 0;
|
110 |
}
|
111 |
|
112 |
+
#minor-publishing {
|
113 |
+
display: none;
|
114 |
+
}
|
115 |
+
#post-body #normal-sortables {
|
116 |
+
min-height: 0px;
|
117 |
+
}
|
118 |
.CodeMirror {
|
119 |
margin-top: 0px;
|
120 |
border: 1px solid #ddd;
|
121 |
border-bottom: none;
|
122 |
border-top: none;
|
123 |
}
|
124 |
+
.CodeMirror pre {
|
125 |
+
padding-left: 7px;
|
126 |
+
line-height: 1.25;
|
127 |
+
}
|
128 |
.code-mirror-buttons {
|
129 |
margin-top: 15px;
|
130 |
width: calc(100% - 2px);
|
168 |
.button-left, .button-right {
|
169 |
display: inline-block;
|
170 |
}
|
171 |
+
i.ccj-i-fullscreen::before {
|
172 |
content: "\f211";
|
173 |
}
|
174 |
+
i.ccj-i-find::before {
|
175 |
content: "Find";
|
176 |
}
|
177 |
+
i.ccj-i-beautifier::before {
|
178 |
content: "\f100";
|
179 |
}
|
|
|
180 |
.code-mirror-before {
|
181 |
border: 1px solid #ddd;
|
182 |
border-bottom: none;
|
189 |
padding: 3px 8px;
|
190 |
background-color: #fff;
|
191 |
}
|
|
|
192 |
.code-mirror-after {
|
193 |
border: 1px solid #ddd;
|
194 |
border-top: none;
|
201 |
padding: 3px 8px;
|
202 |
background-color: #fff;
|
203 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
/**
|
206 |
* Options meta box
|
207 |
*/
|
208 |
+
.radio-group input {
|
209 |
+
margin-top: 1px;
|
210 |
+
}
|
211 |
+
.radio-group label {
|
212 |
+
padding: 2px 0;
|
213 |
+
}
|
214 |
+
.options_meta_box h3 {
|
215 |
+
margin-top: 10px !important;
|
216 |
+
}
|
217 |
+
.radio-group {
|
218 |
+
line-height: 30px;
|
219 |
+
padding-left: 10px;
|
220 |
+
}
|
221 |
+
.radio-group .dashicons-before::before {
|
222 |
+
margin: 7px 3px 0 3px;
|
223 |
+
}
|
224 |
+
.options_meta_box select {
|
225 |
+
margin-left: 10px;
|
226 |
+
}
|
227 |
#custom-code-options .options_meta_box select {
|
228 |
margin-left: 0px;
|
229 |
width: 100%;
|
230 |
}
|
231 |
|
|
|
|
|
232 |
/**
|
233 |
* Revisions
|
234 |
*/
|
359 |
.wplnst-elist tr td.wplnst-elist-close .wplnst-elist-close-link:hover {
|
360 |
background: url(images/button-close-hover.png) left top no-repeat;
|
361 |
}
|
|
|
362 |
.wplnst-elist tr td.wplnst-elist-split {
|
363 |
+
height: 3px;
|
364 |
}
|
|
|
|
|
|
|
365 |
#ccj-preview_url {
|
366 |
width: 78%;
|
367 |
}
|
405 |
opacity: 0.4;
|
406 |
}
|
407 |
.ccj_only_premium {
|
408 |
+
z-index: 9999;
|
409 |
width: 160px;
|
410 |
height: 60px;
|
411 |
position: absolute;
|
413 |
color: white;
|
414 |
}
|
415 |
.ccj_only_premium>div {
|
416 |
+
font-family: sans-serif;
|
417 |
+
font-size: 13px;
|
418 |
+
text-align: center;
|
419 |
+
border-radius: 5px;
|
420 |
+
float: left;
|
421 |
+
background-color: rgb(51, 51, 51);
|
422 |
+
color: white;
|
423 |
+
width: 207px;
|
424 |
+
padding: 20px 20px
|
425 |
}
|
426 |
.ccj_only_premium a {
|
427 |
color: white; text-decoration: none;
|
455 |
.post-type-custom-css-js #url-rules[style], .post-type-custom-css-js #revisionsdiv[style], .post-type-custom-css-js #previewdiv[style], .post-type-custom-css-js #custom-code-options[style] {
|
456 |
display: block !important;
|
457 |
}
|
458 |
+
|
459 |
+
/**
|
460 |
+
* RTL
|
461 |
+
*/
|
462 |
+
.rtl #custom-code-options.postbox .radio-group{
|
463 |
+
padding-left: 0;
|
464 |
+
padding-right: 10px
|
465 |
+
}
|
466 |
+
.rtl #custom-code-options.postbox .ccj_only_premium-right{
|
467 |
+
margin-left: 0;
|
468 |
+
margin-right: 130px
|
469 |
+
}
|
470 |
+
.rtl #custom-code-options.postbox .ccj_only_premium>div{
|
471 |
+
margin-left: 0;
|
472 |
+
margin-right: -110px;
|
473 |
+
float:right
|
474 |
+
}
|
475 |
+
.rtl .ccj_only_premium.ccj_only_premium-first{
|
476 |
+
margin-left: 0;
|
477 |
+
margin-right: 254px
|
478 |
+
}
|
479 |
+
.rtl .ccj_only_premium.ccj_only_premium-first>div{
|
480 |
+
float: right
|
481 |
+
}
|
482 |
+
.rtl #revisionsdiv table.revisions thead th{
|
483 |
+
text-align: right
|
484 |
+
}
|
485 |
+
.rtl #edit-slug-box.hide-if-no-js #ccj-edit-slug-buttons{
|
486 |
+
margin-right: 5px
|
487 |
+
}
|
488 |
+
.rtl table#post-status-info .autosave-info{
|
489 |
+
text-align: right
|
490 |
+
}
|
491 |
+
.rtl .code-mirror-buttons, .rtl .code-mirror-before, .rtl .CodeMirror.cm-s-default.ui-resizable, .rtl .code-mirror-after{
|
492 |
+
direction: ltr
|
493 |
+
}
|
494 |
+
.rtl .CodeMirror-gutter-wrapper{
|
495 |
+
left: -30px !important
|
496 |
+
}
|
assets/ccj_admin.js
CHANGED
@@ -2,6 +2,8 @@ jQuery(document).ready( function($) {
|
|
2 |
|
3 |
$('.page-title-action').hide();
|
4 |
|
|
|
|
|
5 |
// Initialize the CodeMirror editor
|
6 |
if ( $('#ccj_content').length > 0 ) {
|
7 |
var content_mode = $("#ccj_content").attr('mode');
|
@@ -17,16 +19,24 @@ jQuery(document).ready( function($) {
|
|
17 |
CCJ.codemirror.extraKeys.F11 = function(cm) {
|
18 |
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
|
19 |
fullscreen_buttons( true );
|
|
|
|
|
20 |
};
|
21 |
CCJ.codemirror.extraKeys.Esc = function(cm) {
|
22 |
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
|
23 |
fullscreen_buttons( false );
|
|
|
|
|
24 |
};
|
25 |
|
26 |
-
var cm_width = $('#title').width() + 16;
|
27 |
-
var cm_height = 500;
|
28 |
-
|
29 |
var editor = CodeMirror.fromTextArea(document.getElementById("ccj_content"), CCJ.codemirror);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
editor.setSize(cm_width, cm_height);
|
31 |
|
32 |
$('.CodeMirror').resizable({
|
@@ -62,50 +72,52 @@ jQuery(document).ready( function($) {
|
|
62 |
});
|
63 |
}
|
64 |
|
65 |
-
var postID = document.getElementById('post_ID') != null ? document.getElementById('post_ID').value : 0;
|
66 |
-
|
67 |
-
var getCookie = function (name) {
|
68 |
-
var value = '; ' + document.cookie;
|
69 |
-
var parts = value.split('; ' + name + '=');
|
70 |
-
if (parts.length === 2) return parts.pop().split(';').shift();
|
71 |
-
};
|
72 |
-
|
73 |
-
|
74 |
// Saving cursor state
|
75 |
editor.on('cursorActivity', function () {
|
76 |
var curPos = editor.getCursor();
|
77 |
-
document.cookie = '
|
78 |
});
|
79 |
|
80 |
// Restoring cursor state
|
81 |
-
|
82 |
-
if (postID === curPos[0]) {
|
83 |
-
editor.setCursor(parseFloat(curPos[1]), parseFloat(curPos[2]));
|
84 |
-
}
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
}
|
87 |
|
88 |
// Action for the `fullscreen` button
|
89 |
$("#ccj-fullscreen-button").click( function() {
|
90 |
-
|
91 |
-
editor.setOption("fullScreen", !toggle);
|
92 |
-
fullscreen_buttons( !toggle );
|
93 |
});
|
94 |
|
95 |
$("#publish").click(function(e){
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
});
|
100 |
|
101 |
-
// Show fullscreen
|
102 |
-
if ( Cookies.get('fullScreen') == 'true' ) {
|
103 |
-
var toggle = editor.getOption("fullScreen");
|
104 |
-
editor.setOption("fullScreen", !toggle);
|
105 |
-
fullscreen_buttons( !toggle );
|
106 |
-
Cookies.remove('fullScreen');
|
107 |
-
}
|
108 |
-
|
109 |
// Enable the tipsy
|
110 |
$('span[rel=tipsy].tipsy-no-html').tipsy({fade: true, gravity: 's'});
|
111 |
$('span[rel=tipsy]').tipsy({fade: true, gravity: 's', html: true});
|
@@ -228,6 +240,13 @@ jQuery(document).ready( function($) {
|
|
228 |
}
|
229 |
}
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
|
232 |
// Permalink slug
|
233 |
$( '#titlediv' ).on( 'click', '.ccj-edit-slug', function() {
|
2 |
|
3 |
$('.page-title-action').hide();
|
4 |
|
5 |
+
var postID = document.getElementById('post_ID') != null ? document.getElementById('post_ID').value : 0;
|
6 |
+
|
7 |
// Initialize the CodeMirror editor
|
8 |
if ( $('#ccj_content').length > 0 ) {
|
9 |
var content_mode = $("#ccj_content").attr('mode');
|
19 |
CCJ.codemirror.extraKeys.F11 = function(cm) {
|
20 |
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
|
21 |
fullscreen_buttons( true );
|
22 |
+
var cookies = (getCookie('ccj-' + postID) || '0,0,0,0').split(',');
|
23 |
+
document.cookie = 'ccj-' + postID + '=' + [cookies[0], cookies[1], cookies[2], 1].join(',') + '; SameSite=Lax';
|
24 |
};
|
25 |
CCJ.codemirror.extraKeys.Esc = function(cm) {
|
26 |
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
|
27 |
fullscreen_buttons( false );
|
28 |
+
var cookies = (getCookie('ccj-' + postID) || '0,0,0,0').split(',');
|
29 |
+
document.cookie = 'ccj-' + postID + '=' + [cookies[0], cookies[1], cookies[2], 0].join(',') + '; SameSite=Lax';
|
30 |
};
|
31 |
|
|
|
|
|
|
|
32 |
var editor = CodeMirror.fromTextArea(document.getElementById("ccj_content"), CCJ.codemirror);
|
33 |
+
|
34 |
+
// Note: ccj-postID cookie will save cursor line, cursor character, editor height and fullscreen values
|
35 |
+
var cookies = (getCookie('ccj-' + postID) || '0,0,0,0').split(',');
|
36 |
+
|
37 |
+
// Make the editor resizable
|
38 |
+
var cm_width = $('#title').width() + 16;
|
39 |
+
var cm_height = (parseFloat(cookies[2]) >= 200) ? parseFloat(cookies[2]) : 500;
|
40 |
editor.setSize(cm_width, cm_height);
|
41 |
|
42 |
$('.CodeMirror').resizable({
|
72 |
});
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
// Saving cursor state
|
76 |
editor.on('cursorActivity', function () {
|
77 |
var curPos = editor.getCursor();
|
78 |
+
document.cookie = 'ccj-' + postID + '=' + [curPos.line, curPos.ch, cookies[2], cookies[3]].join(',') + '; SameSite=Lax';
|
79 |
});
|
80 |
|
81 |
// Restoring cursor state
|
82 |
+
editor.setCursor(parseFloat(cookies[0]), parseFloat(cookies[1]));
|
|
|
|
|
|
|
83 |
|
84 |
+
// Save the editor's height
|
85 |
+
editor.on('refresh', function() {
|
86 |
+
var height = ( !editor.getOption('fullScreen') ) ? $('.CodeMirror').height() : cookies[2];
|
87 |
+
var curPos = editor.getCursor();
|
88 |
+
document.cookie = 'ccj-' + postID + '=' + [curPos.line, curPos.ch, height, Number(editor.getOption('fullScreen'))].join(',') + '; SameSite=Lax';
|
89 |
+
});
|
90 |
+
|
91 |
+
// Save the custom code when hitting "Ctrl-S"
|
92 |
+
editor.on('keydown', function(cm, event) {
|
93 |
+
if ( ! event.ctrlKey && ! event.metaKey || event.which !== 83 ) return;
|
94 |
+
|
95 |
+
var height = ( !editor.getOption('fullScreen') ) ? $('.CodeMirror').height() : cookies[2];
|
96 |
+
var curPos = editor.getCursor();
|
97 |
+
document.cookie = 'ccj-' + postID + '=' + [curPos.line, curPos.ch, height, Number(editor.getOption('fullScreen'))].join(',') + '; SameSite=Lax';
|
98 |
+
|
99 |
+
$("form#post").submit();
|
100 |
+
event.preventDefault();
|
101 |
+
return false;
|
102 |
+
});
|
103 |
+
|
104 |
+
|
105 |
+
// Restoring fullscreen
|
106 |
+
editor.setOption("fullScreen", parseFloat(cookies[3]));
|
107 |
+
fullscreen_buttons( Boolean(parseFloat(cookies[3])) );
|
108 |
}
|
109 |
|
110 |
// Action for the `fullscreen` button
|
111 |
$("#ccj-fullscreen-button").click( function() {
|
112 |
+
editor.triggerOnKeyDown({type: 'keydown', keyCode: 122});
|
|
|
|
|
113 |
});
|
114 |
|
115 |
$("#publish").click(function(e){
|
116 |
+
var cookies = (getCookie('ccj-' + postID) || '0,0,0,0').split(',');
|
117 |
+
var curPos = editor.getCursor();
|
118 |
+
document.cookie = 'ccj-' + postID + '=' + [curPos.line, curPos.ch, cookies[2], Number(editor.getOption('fullScreen'))].join(',') + '; SameSite=Lax';
|
119 |
});
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
// Enable the tipsy
|
122 |
$('span[rel=tipsy].tipsy-no-html').tipsy({fade: true, gravity: 's'});
|
123 |
$('span[rel=tipsy]').tipsy({fade: true, gravity: 's', html: true});
|
240 |
}
|
241 |
}
|
242 |
|
243 |
+
function getCookie(name) {
|
244 |
+
var value = '; ' + document.cookie;
|
245 |
+
var parts = value.split('; ' + name + '=');
|
246 |
+
if (parts.length === 2) return parts.pop().split(';').shift();
|
247 |
+
}
|
248 |
+
|
249 |
+
|
250 |
|
251 |
// Permalink slug
|
252 |
$( '#titlediv' ).on( 'click', '.ccj-edit-slug', function() {
|
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.
|
7 |
* Author: SilkyPress.com
|
8 |
* Author URI: https://www.silkypress.com
|
9 |
* License: GPL2
|
@@ -12,7 +12,7 @@
|
|
12 |
* Domain Path: /languages/
|
13 |
*
|
14 |
* WC requires at least: 3.0.0
|
15 |
-
* WC tested up to: 6.
|
16 |
*/
|
17 |
|
18 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -228,7 +228,7 @@ if ( ! class_exists( 'CustomCSSandJS' ) ) :
|
|
228 |
public function set_constants() {
|
229 |
$dir = wp_upload_dir();
|
230 |
$constants = array(
|
231 |
-
'CCJ_VERSION' => '3.
|
232 |
'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
|
233 |
'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
|
234 |
'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.40
|
7 |
* Author: SilkyPress.com
|
8 |
* Author URI: https://www.silkypress.com
|
9 |
* License: GPL2
|
12 |
* Domain Path: /languages/
|
13 |
*
|
14 |
* WC requires at least: 3.0.0
|
15 |
+
* WC tested up to: 6.9
|
16 |
*/
|
17 |
|
18 |
if ( ! defined( 'ABSPATH' ) ) {
|
228 |
public function set_constants() {
|
229 |
$dir = wp_upload_dir();
|
230 |
$constants = array(
|
231 |
+
'CCJ_VERSION' => '3.40',
|
232 |
'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
|
233 |
'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
|
234 |
'CCJ_PLUGIN_FILE' => __FILE__,
|
includes/admin-screens.php
CHANGED
@@ -848,7 +848,9 @@ End of comment */ ',
|
|
848 |
$meta = $this->get_options_meta_html();
|
849 |
}
|
850 |
|
851 |
-
|
|
|
|
|
852 |
|
853 |
?>
|
854 |
<div class="options_meta_box">
|
@@ -861,8 +863,7 @@ End of comment */ ',
|
|
861 |
|
862 |
if ( ( $_key == 'preprocessor' && $options['language'] == 'css' ) ||
|
863 |
( $_key == 'linking' && $options['language'] == 'html' ) ||
|
864 |
-
$_key
|
865 |
-
$_key == 'minify' ) {
|
866 |
$close_div = true;
|
867 |
$output .= '<div class="ccj_opaque">';
|
868 |
}
|
@@ -1001,6 +1002,16 @@ End of comment */ ',
|
|
1001 |
),
|
1002 |
);
|
1003 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1004 |
return $options;
|
1005 |
}
|
1006 |
|
@@ -1094,6 +1105,16 @@ End of comment */ ',
|
|
1094 |
$options['type']['values']['footer'] = $tmp['footer'];
|
1095 |
}
|
1096 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1097 |
return $options;
|
1098 |
}
|
1099 |
|
@@ -1540,6 +1561,7 @@ endif;
|
|
1540 |
<tr><td><strong>Auto Complete</strong></td><td> <code>Ctrl</code> + <code>Space</code></td></tr>
|
1541 |
<tr><td><strong>Find</strong></td><td> <code>Ctrl</code> + <code>F</code></td></tr>
|
1542 |
<tr><td><strong>Replace</strong></td><td> <code>Shift</code> + <code>Ctrl</code> + <code>F</code></td></tr>
|
|
|
1543 |
<tr><td><strong>Comment line/block</strong></td><td> <code>Ctrl</code> + <code>/</code></td></tr>
|
1544 |
</table></p>',
|
1545 |
)
|
848 |
$meta = $this->get_options_meta_html();
|
849 |
}
|
850 |
|
851 |
+
$options['multisite'] = false;
|
852 |
+
|
853 |
+
wp_nonce_field( 'options_save_meta_box_data', 'custom-css-js_meta_box_nonce' );
|
854 |
|
855 |
?>
|
856 |
<div class="options_meta_box">
|
863 |
|
864 |
if ( ( $_key == 'preprocessor' && $options['language'] == 'css' ) ||
|
865 |
( $_key == 'linking' && $options['language'] == 'html' ) ||
|
866 |
+
in_array( $_key, ['priority', 'minify', 'multisite' ] ) ) {
|
|
|
867 |
$close_div = true;
|
868 |
$output .= '<div class="ccj_opaque">';
|
869 |
}
|
1002 |
),
|
1003 |
);
|
1004 |
|
1005 |
+
if ( is_multisite() && is_super_admin() && is_main_site() ) {
|
1006 |
+
$options['multisite'] = array(
|
1007 |
+
'title' => __( 'Apply network wide', 'custom-css-js-pro' ),
|
1008 |
+
'type' => 'checkbox',
|
1009 |
+
'default' => false,
|
1010 |
+
'dashicon' => 'admin-multisite',
|
1011 |
+
'disabled' => true,
|
1012 |
+
);
|
1013 |
+
}
|
1014 |
+
|
1015 |
return $options;
|
1016 |
}
|
1017 |
|
1105 |
$options['type']['values']['footer'] = $tmp['footer'];
|
1106 |
}
|
1107 |
|
1108 |
+
if ( is_multisite() && is_super_admin() && is_main_site() ) {
|
1109 |
+
$options['multisite'] = array(
|
1110 |
+
'title' => __( 'Apply network wide', 'custom-css-js-pro' ),
|
1111 |
+
'type' => 'checkbox',
|
1112 |
+
'default' => false,
|
1113 |
+
'dashicon' => 'admin-multisite',
|
1114 |
+
'disabled' => true,
|
1115 |
+
);
|
1116 |
+
}
|
1117 |
+
|
1118 |
return $options;
|
1119 |
}
|
1120 |
|
1561 |
<tr><td><strong>Auto Complete</strong></td><td> <code>Ctrl</code> + <code>Space</code></td></tr>
|
1562 |
<tr><td><strong>Find</strong></td><td> <code>Ctrl</code> + <code>F</code></td></tr>
|
1563 |
<tr><td><strong>Replace</strong></td><td> <code>Shift</code> + <code>Ctrl</code> + <code>F</code></td></tr>
|
1564 |
+
<tr><td><strong>Save</strong></td><td> <code>Ctrl</code> + <code>S</code></td></tr>
|
1565 |
<tr><td><strong>Comment line/block</strong></td><td> <code>Ctrl</code> + <code>/</code></td></tr>
|
1566 |
</table></p>',
|
1567 |
)
|
includes/admin-warnings.php
CHANGED
@@ -32,6 +32,10 @@ class CustomCSSandJS_Warnings {
|
|
32 |
|
33 |
/**
|
34 |
* Check if qTranslate plugin is active and doesn't have the custom-css-js removed from the settings
|
|
|
|
|
|
|
|
|
35 |
*/
|
36 |
function check_qtranslatex() {
|
37 |
|
32 |
|
33 |
/**
|
34 |
* Check if qTranslate plugin is active and doesn't have the custom-css-js removed from the settings
|
35 |
+
*
|
36 |
+
* The qTranslate-x plugin was removed from the wordpress.org repository in August 2021.
|
37 |
+
*
|
38 |
+
* So, theoretically, this error message is not necessary anymore.
|
39 |
*/
|
40 |
function check_qtranslatex() {
|
41 |
|
readme.txt
CHANGED
@@ -4,8 +4,8 @@ Contributors: diana_burduja
|
|
4 |
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: 6.
|
8 |
-
Stable tag: 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,12 @@ $. Add/Edit HTML
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
= 3.39 =
|
109 |
* 03/16/2022
|
110 |
* Fix: load the CodeMirror options from a localized variable
|
@@ -117,7 +123,7 @@ $. Add/Edit HTML
|
|
117 |
= 3.38 =
|
118 |
* 11/09/2021
|
119 |
* Fix: escape labels on the "Add new custom code" page
|
120 |
-
* Feature:
|
121 |
|
122 |
= 3.37 =
|
123 |
* 07/12/2021
|
4 |
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: 6.1
|
8 |
+
Stable tag: 3.40
|
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.40 =
|
109 |
+
* 06/10/2022
|
110 |
+
* Feature: keep the user-set editor's height upon page loads and custom code saves
|
111 |
+
* Feature: save the custom code upon "Ctrl-S" in the editor
|
112 |
+
* Tweak: admin side adjustments for RTL languages
|
113 |
+
|
114 |
= 3.39 =
|
115 |
* 03/16/2022
|
116 |
* Fix: load the CodeMirror options from a localized variable
|
123 |
= 3.38 =
|
124 |
* 11/09/2021
|
125 |
* Fix: escape labels on the "Add new custom code" page
|
126 |
+
* Feature: keep the last cursor position in the editor and let the editor get focus when the page loads
|
127 |
|
128 |
= 3.37 =
|
129 |
* 07/12/2021
|