Index: branches/5.3.x/core/admin_templates/js/script.js =================================================================== diff -u -N -r15483 -r15677 --- branches/5.3.x/core/admin_templates/js/script.js (.../script.js) (revision 15483) +++ branches/5.3.x/core/admin_templates/js/script.js (.../script.js) (revision 15677) @@ -1,13 +1,14 @@ if ( !( isset($init_made) && $init_made ) ) { var Application = new kApplication(); - var Grids = new Array(); - var GridScrollers = new Array(); - var Toolbars = new Array(); - var $Menus = new Array(); - var $ViewMenus = new Array(); - var $nls_menus = new Array(); - var $MenuNames = new Array(); + var Grids = [], + GridScrollers = [], + Toolbars = [], + $Menus = [], + $ViewMenus = [], + $nls_menus = [], + $MenuNames = []; + var $CKEditors = {}; // input name VS ck options mapping var $form_name = 'kernel_form'; @@ -16,15 +17,16 @@ var $fw_menus = new Array(); } - var $env = ''; - var submitted = false; - var unload_legal = false; - var $edit_mode = false; - var $init_made = true; // in case of double inclusion of script.js :) + var $env = '', + submitted = false, + unload_legal = false, + $edit_mode = false, + $init_made = true; // in case of double inclusion of script.js :) // hook processing var hBEFORE = 1; // this is const, but including this twice causes errors var hAFTER = 2; // this is const, but including this twice causes errors + replaceFireBug(); } @@ -468,16 +470,15 @@ if ( $pm ) { // popup manager was found in head frame - $pm.ResponceFunction = function ($responce) { - if ( !$responce.match(/([\d]+)x([\d]+)/) ) { - // invalid responce was received, may be php fatal error during AJAX request - $responce = $default_size; + $pm.GetSize($t, function ($response) { + if ( !$response.match(/([\d]+)x([\d]+)/) ) { + // invalid response was received, may be php fatal error during AJAX request + $response = $default_size; } - open_popup($prefix_special, $event, $t, $responce, $onAfterOpenPopup); - } + open_popup($prefix_special, $event, $t, $response, $onAfterOpenPopup); + }); - $pm.GetSize($t); return; } @@ -1907,4 +1908,29 @@ } return crc ^ (-1); +} + +function ckeditors_apply_typekit() { + if ( $typekit_id === undefined || $typekit_id.length == 0 ) { + return; + } + + CKEDITOR.on( + 'instanceReady', + function (ev) { + setTimeout(function () { + var $script = document.createElement('script'), + $editor_instance = CKEDITOR.instances[ev.editor.name]; + + $script.src = '//use.typekit.com/' + $typekit_id + '.js'; + $script.onload = function () { + try { + $editor_instance.window.$.Typekit.load(); + } catch (e) {} + }; + + $editor_instance.document.getHead().$.appendChild($script); + }, 1000); + } + ); } \ No newline at end of file