if (typeof alexantr === 'undefined' || !alexantr) {
    var alexantr = {};
}

alexantr.ckEditorWidget = (function ($) {
    'use strict';

    var baseUrl,
        callbacks = [],
        loading = false,
        loaded = false;

    function callPlugin(inputId, options) {
        $('#' + inputId).ckeditor(options);

        /*CKEDITOR.replace(inputId, options);
        CKEDITOR && CKEDITOR.instances[inputId] && CKEDITOR.instances[inputId].on('change', function () {
            CKEDITOR.instances[inputId].updateElement();
            $('#' + inputId).trigger('change');
            return false;
        });*/
    }

    $.getCachedScript = function (url, options) {
        options = $.extend(options || {}, {
            dataType: 'script',
            cache: true,
            url: url
        });
        return $.ajax(options);
    };

    return {
        setBaseUrl: function (url) {
            if (!baseUrl) {
                baseUrl = url;
            }
        },
        register: function (inputId, options) {
            if (loaded) {
                callPlugin(inputId, options);
            } else {
                callbacks.push({inputId: inputId, options: options});
                if (!loading && baseUrl) {
                    loading = true;
                    $.when(
                        $.getCachedScript(baseUrl + 'ckeditor.js'),
                        $.getCachedScript(baseUrl + 'adapters/jquery.js')
                    ).then(function () {
                        loaded = true;
                        loading = false;
                        for (var i = 0; i < callbacks.length; i++) {
                            callPlugin(callbacks[i].inputId, callbacks[i].options);
                        }
                    });
                }
            }
        },
        registerCsrfUploadHandler: function () {
            var selector = '.cke_dialog_tabs a[id^="cke_Upload_"], .cke_dialog_tabs a[id^="cke_upload_"]';
            yii && $(document).off('click', selector).on('click', selector, function () {
                var csrfParam = yii.getCsrfParam(),
                    csrfToken = yii.getCsrfToken();
                var $forms = $('.cke_dialog_ui_input_file iframe').contents().find('form');
                $forms.each(function () {
                    if (!$(this).find('input[name=' + csrfParam + ']').length) {
                        var csrfTokenInput = $('<input/>').attr({
                            type: 'hidden',
                            name: csrfParam
                        }).val(csrfToken);
                        $(this).append(csrfTokenInput);
                    }
                });
            });
        }
    }
})(jQuery);
@@ -1268,40 +1268,8 @@
 ue;%0A
-                    $.when(%0A    
     
@@ -1326,17 +1326,35 @@
 tor.js')
-,
+.done(function () %7B
 %0A       
@@ -1423,35 +1423,13 @@
 js')
-%0A                    ).then
+.done
 (fun
@@ -1455,32 +1455,36 @@
                 
+    
 loaded = true;%0A 
@@ -1474,32 +1474,36 @@
  loaded = true;%0A
+    
                 
@@ -1551,16 +1551,20 @@
         
+    
 for (var
@@ -1596,24 +1596,28 @@
 gth; i++) %7B%0A
+    
             
@@ -1704,33 +1704,65 @@
                 
-%7D
+    %7D%0A                        %7D);
 %0A               

Load scripts one by one