(function($){ $(document).ready(function() { $('.cke_sc').prepend(''); var btn_template = $('#btn_template'); btn_template.click(function() { var templatesListForm; templatesListForm = '
'; templatesListForm += '
'; $('.cke_sc').append(templatesListForm); getTemplateList(); }); $(document).on('click', '.template_content_inner', function(){ var skin = $(this).data("skin"); getTemplateContent(skin); removeTemplateFom(); }); $(document).on('click', '.tem-close-icon', function(){ removeTemplateFom(); }); function getTemplateList() { // 리스트 $.ajax({ url: g5_url+"/plugin/smarteditor_template/ajax.templateList.php", type: "POST", error: function(xhr){ }, success: function(data){ if (data) { $("#templatesListForm").html(data); } } }); } function getTemplateContent(skin) { $.ajax({ url: g5_url+"/plugin/smarteditor_template/ajax.template.php", data: { "skin" : skin }, type: "POST", async:false, error: function(xhr){ }, success: function(data){ if (data) { editerPasteHTML('wr_content', data); } } }); } function removeTemplateFom() { $('#templatesListForm').remove(); } function editerPasteHTML(obj,str) { var sHTML = str + '
'; oEditors.getById[obj].exec("PASTE_HTML", [sHTML]); } function editerResetHTML(obj) { oEditors.getById[obj].exec("SET_CONTENTS", [""]); } function editerGetHTML(obj) { var varContent = oEditors.getById[obj].getIR(); return varContent; } }); $(window).load(function(){ var smareditorIframe = $('iframe').contents().find('iframe#se2_iframe'); if(smareditorIframe.length > 0){ var editorCompleteLoadCheck = setInterval(function() { if(smareditorIframe.contents().find('head title')){ smareditorIframe.contents().find('head').append(''); clearInterval(editorCompleteLoadCheck); } }, 500); } }); })(jQuery);