Plugin Directory

Changeset 2585543


Ignore:
Timestamp:
08/19/2021 02:45:36 PM (5 years ago)
Author:
rmanaf
Message:

2.4.10

Location:
code-injection/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code-injection/trunk/assets/css/code-editor.css

    r2584954 r2585543  
    171171}
    172172
     173#title.disabled-input{
     174    pointer-events:none;
     175}
     176
     177#titlewrap .copy-btn{
     178    position: absolute;
     179    right: 0%;
     180    top:0;
     181
     182    width: 67px;
     183    height: 30px;
     184    color: #50575e;
     185    text-decoration: none;
     186    text-align: center;
     187    display: flex;
     188    justify-content: space-around;
     189    align-items: center;
     190}
     191
     192#titlewrap .copy-btn:hover{
     193    color: white;
     194}
     195
    173196input.apple-switch {
    174197    position: relative;
  • code-injection/trunk/assets/js/code-editor.js

    r2584954 r2585543  
    3131
    3232
    33     function updatePostTitle(){
    34         var $title =  $("#title");
     33    function updatePostTitle() {
     34        var $title = $("#title");
    3535        var $wrap = $("#titlewrap");
    36         if ($title .val().length == 0) {
     36        if ($title.val().length == 0) {
    3737            $wrap.addClass('busy');
    3838            $.get(_ci.ajax_url, {
     
    4141            }, function (result) {
    4242                $wrap.removeClass('busy');
    43                 if(result.success){
     43                if (result.success) {
    4444                    $title.val(result.data);
     45
    4546                }
    4647            }).fail(function () {
     
    212213        });
    213214
    214 
    215         $("#title").attr("disabled", true);
     215        $("#title").addClass("disabled-input");
     216
     217        $copybtn = $('<a href="javascript:void(0)" class="copy-btn">' +
     218            __("Copy", "code-injection") +
     219            '<span class="dashicons dashicons-external"></span></a>')
     220            .on('click', function () {
     221                window.ci.ctc($("#title")[0] , true);
     222            });
     223
     224        $("#titlewrap").append($copybtn);
    216225
    217226
  • code-injection/trunk/assets/js/essentials.js

    r2584954 r2585543  
    88    window.ci = {};
    99
    10     window.ci.ctc = function (element) {
     10    window.ci.ctc = function (element , val = false) {
    1111
    12         var text = $(element).text();
     12        var text = val ? $(element).val() : $(element).text();
    1313        var $temp = $(`<input value="${text}" />`).css({
    1414            'position': 'absolute',
  • code-injection/trunk/code-injection.php

    r2584954 r2585543  
    55 * Plugin URI: https://github.com/Rmanaf/wp-code-injection
    66 * Description: This plugin allows you to inject code snippets into the pages.
    7  * Version: 2.4.9
     7 * Version: 2.4.10
    88 * Author: Rmanaf
    99 * Author URI: https://profiles.wordpress.org/rmanaf/
     
    3434        private static $role_version = '1.0.0';
    3535
    36         private static $version = '2.4.9';
     36        private static $version = '2.4.10';
    3737
    3838        function __construct()
  • code-injection/trunk/includes/code-type.php

    r2584954 r2585543  
    3232            add_action("admin_enqueue_scripts", "$clazz::print_scripts", 51);
    3333
    34             add_filter("title_save_pre", "$clazz::auto_generate_post_title");
     34            add_filter("title_save_pre", "$clazz::auto_generate_post_title" , 10, 1);
    3535
    3636            add_filter("user_can_richedit", "$clazz::disable_wysiwyg");
     
    297297            }
    298298
    299 
    300299            if (isset($post->ID)) {
    301300
    302                 if (empty($_POST['post_title'])) {
    303 
    304                     if (!empty($title)) {
     301                if ('code' !== get_post_type($post->ID)) {
     302                    return $title;
     303                }
     304
     305                if (empty($_POST['title'])) {
     306
     307                    if (!empty($title) && $title !== "Auto Draft") {
    305308                        return $title;
    306309                    }
    307310
    308                     if ('code' == get_post_type($post->ID)) {
    309                         return WP_Code_Injection_Plugin::generate_id('code-');
    310                     }
    311                 }
     311                    $title = WP_Code_Injection_Plugin::generate_id('code-');
     312                   
     313                }else{
     314
     315                    $title = $_POST['title'];
     316                   
     317                }
     318
    312319            }
    313320
  • code-injection/trunk/languages/code-injection-fa_IR.po

    r2576471 r2585543  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Code Injection 2.4.8\n"
     5"Project-Id-Version: Code Injection 2.4.10\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/code-injection\n"
    77"Last-Translator: \n"
  • code-injection/trunk/languages/code-injection.pot

    r2576471 r2585543  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Code Injection 2.4.8\n"
     5"Project-Id-Version: Code Injection 2.4.10\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/code-injection\n"
    77"Last-Translator: \n"
  • code-injection/trunk/readme.txt

    r2584954 r2585543  
    44Requires at least: 4.5.0
    55Tested up to: 5.8.0
    6 Stable tag: 2.4.9
     6Stable tag: 2.4.10
    77License: MIT License
    88License URI: https://github.com/Rmanaf/wp-code-injection/blob/master/LICENSE
Note: See TracChangeset for help on using the changeset viewer.