github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/public/libs/tinymce/plugins/jbimages/js/dialog.js (about) 1 /** 2 * Justboil.me - a TinyMCE image upload plugin 3 * jbimages/js/dialog.js 4 * 5 * Released under Creative Commons Attribution 3.0 Unported License 6 * 7 * License: http://creativecommons.org/licenses/by/3.0/ 8 * Plugin info: http://justboil.me/ 9 * Author: Viktor Kuzhelnyi 10 * 11 * Version: 2.3 released 23/06/2013 12 */ 13 14 tinyMCEPopup.requireLangPack(); 15 16 var jbImagesDialog = { 17 18 resized : false, 19 iframeOpened : false, 20 timeoutStore : false, 21 22 init : function() { 23 document.getElementById("upload_target").src += '/' + tinyMCEPopup.getLang('jbimages_dlg.lang_id', 'english'); 24 if (navigator.userAgent.indexOf('Opera') > -1) 25 { 26 document.getElementById("close_link").style.display = 'block'; 27 } 28 }, 29 30 inProgress : function() { 31 document.getElementById("upload_infobar").style.display = 'none'; 32 document.getElementById("upload_additional_info").innerHTML = ''; 33 document.getElementById("upload_form_container").style.display = 'none'; 34 document.getElementById("upload_in_progress").style.display = 'block'; 35 this.timeoutStore = window.setTimeout(function(){ 36 document.getElementById("upload_additional_info").innerHTML = tinyMCEPopup.getLang('jbimages_dlg.longer_than_usual', 0) + '<br />' + tinyMCEPopup.getLang('jbimages_dlg.maybe_an_error', 0) + '<br /><a href="#" onClick="jbImagesDialog.showIframe()">' + tinyMCEPopup.getLang('jbimages_dlg.view_output', 0) + '</a>'; 37 tinyMCEPopup.editor.windowManager.resizeBy(0, 30, tinyMCEPopup.id); 38 }, 20000); 39 }, 40 41 showIframe : function() { 42 if (this.iframeOpened == false) 43 { 44 document.getElementById("upload_target").className = 'upload_target_visible'; 45 tinyMCEPopup.editor.windowManager.resizeBy(0, 190, tinyMCEPopup.id); 46 this.iframeOpened = true; 47 } 48 }, 49 50 uploadFinish : function(result) { 51 if (result.resultCode == 'failed') 52 { 53 window.clearTimeout(this.timeoutStore); 54 document.getElementById("upload_in_progress").style.display = 'none'; 55 document.getElementById("upload_infobar").style.display = 'block'; 56 document.getElementById("upload_infobar").innerHTML = result.result; 57 document.getElementById("upload_form_container").style.display = 'block'; 58 59 if (this.resized == false) 60 { 61 tinyMCEPopup.editor.windowManager.resizeBy(0, 30, tinyMCEPopup.id); 62 this.resized = true; 63 } 64 } 65 else 66 { 67 document.getElementById("upload_in_progress").style.display = 'none'; 68 document.getElementById("upload_infobar").style.display = 'block'; 69 document.getElementById("upload_infobar").innerHTML = tinyMCEPopup.getLang('jbimages_dlg.upload_complete', 0); 70 tinyMCEPopup.editor.execCommand('mceInsertContent', false, '<img src="' + result.filename +'" />'); 71 tinyMCEPopup.close(); 72 } 73 } 74 75 }; 76 77 tinyMCEPopup.onInit.add(jbImagesDialog.init, jbImagesDialog);