Plugin Directory

Changeset 1067775


Ignore:
Timestamp:
01/14/2015 10:15:06 AM (11 years ago)
Author:
forde
Message:

v 1.1 - Solarized theme for the editors

Location:
safe-editor/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • safe-editor/trunk/css/safe_editor.css

    r938323 r1067775  
    2828  .safe_editor_wrapper .CodeMirror {
    2929    border: 1px solid #ddd;
     30    font-size:16px;
     31    line-height:20px;
     32    height:800px;
     33    font-family: "Courier New";
    3034    margin-bottom: 20px; }
    3135  .safe_editor_wrapper .button {
  • safe-editor/trunk/index.php

    r938323 r1067775  
    22/*
    33Plugin Name: Safe Editor
    4 Plugin URI:     
    5 Description: Safe Editor allows you to write custom CSS / Javascript to manipulate the appearance and behavior of themes / plugins on your website without worrying that your changes will be overwritten with the future theme / plugin updates. 
    6 Version: 1.0
     4Plugin URI:
     5Description: Safe Editor allows you to write custom CSS / Javascript to manipulate the appearance and behavior of themes / plugins on your website without worrying that your changes will be overwritten with the future theme / plugin updates.
     6Version: 1.1
    77Author: Konrad Węgrzyniak
    88Author URI: http://forde.pl/
     
    1616
    1717        if(!wp_script_is('jquery')) wp_enqueue_script('jquery',false,array(),false, true);
     18
     19        wp_enqueue_style('codemirror-theme-ambiance', plugins_url('/theme/ambiance.css', __FILE__));
     20        wp_enqueue_style('codemirror-theme-monokai', plugins_url('/theme/monokai.css', __FILE__));
     21        wp_enqueue_style('codemirror-theme-solarized', plugins_url('/theme/solarized.css', __FILE__));
     22        wp_enqueue_style('codemirror-theme-tomorrow-night-eighties', plugins_url('/theme/tomorrow-night-eighties.css', __FILE__));
     23
    1824        wp_enqueue_style('codemirror-css', plugins_url('/codemirror/codemirror.css', __FILE__));
    1925        wp_enqueue_script('codemirror', plugins_url( '/codemirror/codemirror.js', __FILE__ ),array(),false, true);
     
    4450            <?php ( isset($_GET['tab']) )? $this->se_tabs($_GET['tab']) : $this->se_tabs('css'); ?>
    4551            <?php $tab = ( isset($_GET['tab']) )? $_GET['tab'] : false; ?>
    46            
     52
    4753            <div class="safe_editor_wrapper <?php if($tab == 'css' || !isset($_GET['tab'])) echo 'tab_vis' ?>">
    48                 <?php 
    49                     $css = get_option('safe_edit_css'); 
    50                     $css = ($css)? stripcslashes($css) : ''; 
     54                <?php
     55                    $css = get_option('safe_edit_css');
     56                    $css = ($css)? stripcslashes($css) : '';
    5157                ?>
    5258                <p class="se_tab_desc">Your custom css will be added to the <i>&lt;body&gt;</i> tag on your website "front-end" (wrapped in <i>&lt;style&gt;</i> tags).</p>
     
    5763
    5864            <div class="safe_editor_wrapper <?php if($tab == 'js') echo 'tab_vis' ?>">
    59                 <?php 
    60                     $js = get_option('safe_edit_js'); 
    61                     $js = ($js)? stripcslashes($js) : ''; 
     65                <?php
     66                    $js = get_option('safe_edit_js');
     67                    $js = ($js)? stripcslashes($js) : '';
    6268                ?>
    6369                <p class="se_tab_desc">Your custom Javascript will be added to the footer of your website "front-end" (wrapped in <i>&lt;script&gt;</i> tags).</p>
     
    7682                </form>
    7783            </div>
    78            
    7984
    8085
    81            
     86
     87
    8288            <script type="text/javascript">
    83                 jQuery(document).ready(function( $ ) {                 
     89                jQuery(document).ready(function( $ ) {
    8490                    var css_editor = CodeMirror.fromTextArea(document.getElementById("safe_css_editor"), {
    8591                        mode:  "css",
    8692                        indentUnit: 4,
    87                         lineNumbers: true
     93                        lineNumbers: true,
     94                        theme: "solarized light"
    8895                    });
    8996                    var js_editor = CodeMirror.fromTextArea(document.getElementById("safe_js_editor"), {
    9097                        mode:  "javascript",
    9198                        indentUnit: 4,
    92                         lineNumbers: true
     99                        lineNumbers: true,
     100                        theme: "solarized light"
    93101                    });
    94102
     
    113121                            textarea = $('.safe_editor_js_textarea');
    114122                            value = js_editor.getValue();
    115                             saving_js = true;   
     123                            saving_js = true;
    116124                        }
    117125
     
    123131                            url: scriptsajax.ajaxurl,
    124132                            data: {
    125                                 action: 'se_save', 
     133                                action: 'se_save',
    126134                                type: type,
    127135                                data: value
     
    130138                                t.parent().after(data);
    131139                                t.parent().find('.saving').addClass('saved').fadeOut(4000, function() { $(this).remove() });
    132                                 if(type == 'css') saving_css = false; 
     140                                if(type == 'css') saving_css = false;
    133141                                if(type == 'js') saving_js = false;
    134142                            },
     
    167175
    168176function se_save() {
    169     //echo "<pre>"; print_r($_POST); echo "</pre>"; 
     177    //echo "<pre>"; print_r($_POST); echo "</pre>";
    170178    switch($_POST['type']) {
    171         case 'css' : 
     179        case 'css' :
    172180            update_option( 'safe_edit_css', $_POST['data']);
    173181            break;
    174         case 'js' : 
     182        case 'js' :
    175183            update_option( 'safe_edit_js', $_POST['data']);
    176184            break;
  • safe-editor/trunk/readme.txt

    r938339 r1067775  
    3131== Change Log ==
    3232
     33= 1.1 =
     34* Solarized light theme for css and javascript editor added
     35
    3336= 1.0 =
    3437* First release.
Note: See TracChangeset for help on using the changeset viewer.