Changeset 3446052
- Timestamp:
- 01/24/2026 10:08:19 AM (2 months ago)
- Location:
- css-js-files
- Files:
-
- 7 added
- 4 edited
-
tags/1.5.4 (added)
-
tags/1.5.4/css (added)
-
tags/1.5.4/css-js-files.php (added)
-
tags/1.5.4/css/css-js-files.css (added)
-
tags/1.5.4/js (added)
-
tags/1.5.4/js/css-js-files.js (added)
-
tags/1.5.4/readme.txt (added)
-
trunk/css-js-files.php (modified) (4 diffs)
-
trunk/css/css-js-files.css (modified) (1 diff)
-
trunk/js/css-js-files.js (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
css-js-files/trunk/css-js-files.php
r3208104 r3446052 4 4 Plugin URI: https://wordpress.org/plugins/css-js-files/ 5 5 Description: Add CSS files and/or CSS custom rules to any single page or post or globally 6 Version: 1.5. 36 Version: 1.5.4 7 7 Author: James Low 8 8 Author URI: http://jameslow.com … … 13 13 14 14 class CSS_JS_Files { 15 public static $_version; 16 public static function version() { 17 if (!self::$_version) { 18 $data = get_plugin_data(__FILE__); 19 self::$_version = $data['Version']; 20 } 21 return self::$_version; 22 } 23 15 24 public static function add_hooks() { 16 25 /* Define the custom box */ … … 179 188 $screen = get_current_screen(); 180 189 if (strpos($_SERVER['REQUEST_URI'],'post.php') !== false || strpos($screen->base, 'css-js-files') !== false || strpos($screen->base, 'css-js-files-editor') !== false) { 181 wp_enqueue_style('css-js-files.css', plugins_url('css/css-js-files.css', __FILE__)); 182 wp_enqueue_script('css-js-files.js', plugins_url('js/css-js-files.js', __FILE__), array(), '1.0.0', true); 190 wp_enqueue_style('css-js-files.css', plugins_url('css/css-js-files.css', __FILE__), array(), self::version()); 191 wp_enqueue_script('css-js-files.js', plugins_url('js/css-js-files.js', __FILE__), array(), self::version(), true); 192 wp_enqueue_code_editor(['type' => 'text/css']); 193 wp_enqueue_code_editor(['type' => 'text/javascript']); 194 wp_enqueue_code_editor(['type' => 'text/html']); 195 wp_enqueue_script('wp-theme-plugin-editor'); 196 wp_enqueue_style('wp-codemirror'); 183 197 } 184 198 } … … 275 289 echo '<h2>'.strtoupper($type).'</h2>'; 276 290 echo '<div class="row"><label>Select '.$upper.' files</label><br />'.self::get_file(explode(',', $files), $type).' <button type="button" id="css-js-files-'.$type.'-button" class="css-js-files-button button button-primary button-large">Add other file</button><hr /></div>'; 291 echo '<div class="row"><label for="css-js-files-'.$type.'-rules">Enter '.$upper.' links here (one URL per line)</label><br /><textarea class="css-js-files-text" id="css-js-files-'.$type.'-links" name="css_js_files_'.$type.'_links">'.htmlentities($links).'</textarea></div>'; 277 292 echo '<div class="row"><label for="css-js-files-'.$type.'-rules">Write your custom '.$upper.'</label><br /><textarea class="css-js-files-text" id="css-js-files-'.$type.'-rules" name="css_js_files_'.$type.'_rules">'.htmlentities($rules).'</textarea></div>'; 278 echo '<div class="row"><label for="css-js-files-'.$type.'-rules">Enter '.$upper.' links here</label><br /><textarea class="css-js-files-text" id="css-js-files-'.$type.'-links" name="css_js_files_'.$type.'_links">'.htmlentities($links).'</textarea></div>';279 293 if ($post == null) { 280 294 echo '<div class="row"><label for="css-js-files-'.$type.'-admin">Enter admin '.$upper.' here</label><br /><textarea class="css-js-files-text" id="css-js-files-'.$type.'-admin" name="css_js_files_'.$type.'_admin">'.htmlentities($admin).'</textarea></div>'; -
css-js-files/trunk/css/css-js-files.css
r1557309 r3446052 1 1 .css-js-files-text { 2 width:100%;3 min-height: 250px;4 box-sizing: border-box;2 width:100%; 3 min-height: 250px; 4 box-sizing: border-box; 5 5 } 6 6 .css-js-files-text-full { 7 7 min-height: 1024px; 8 8 } 9 body.wp-block-editor .CodeMirror-wrap pre, 10 body.block-editor-page .CodeMirror-wrap pre { 11 margin-left: 16px; 12 } -
css-js-files/trunk/js/css-js-files.js
r2407090 r3446052 17 17 } 18 18 }); 19 } 20 21 function initEditor(id, mode) { 22 console.log(initEditor); 23 if ( ! window.wp || ! wp.codeEditor ) { 24 return; 25 } 26 27 const textarea = document.getElementById( id ); 28 if ( ! textarea ) { 29 return; 30 } 31 32 const settings = _.clone( wp.codeEditor.defaultSettings ); 33 settings.codemirror = settings.codemirror || {}; 34 settings.codemirror.mode = mode; 35 settings.codemirror.lineNumbers = false; 36 settings.codemirror.autoCloseBrackets = true; 37 38 wp.codeEditor.initialize( textarea, settings ); 19 39 } 20 40 … … 56 76 init('css'); 57 77 init('js'); 78 document.addEventListener( 'DOMContentLoaded', function () { 79 initEditor('css-js-files-css-rules', 'css'); 80 initEditor('css-js-files-css-admin', 'css'); 81 initEditor('css-js-files-js-rules', 'javascript'); 82 initEditor('css-js-files-js-admin', 'javascript'); 83 initEditor('css-js-files-head-rules', 'htmlmixed'); 84 initEditor('css-js-files-body-rules', 'htmlmixed'); 85 initEditor('css-js-files-footer-rules', 'htmlmixed'); 86 }); 58 87 }(jQuery)); -
css-js-files/trunk/readme.txt
r3208104 r3446052 3 3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=PGV92BZCFTDL4&item_name=Donation%20to%20jameslow%2ecom¤cy_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8 4 4 Tags: css, page, post, custom css, file css, js, javascript, file js, custom js, custom, global, cdn 5 Requires at least: 3.05 Requires at least: 4.9.0 6 6 Tested up to: 6.5.5 7 Stable tag: 1.5.37 Stable tag: trunk 8 8 License: MIT Licens 9 9 License URI: https://opensource.org/licenses/MIT … … 29 29 30 30 == Changelog == 31 32 = 1.5.4 = 33 * Add syntax highlighting for CSS/JS 31 34 32 35 = 1.5.3 =
Note: See TracChangeset
for help on using the changeset viewer.