code
stringlengths
1
2.08M
language
stringclasses
1 value
function submitForm() { if (dialogHtml == '') { dialogHtml = $('siteInfo').innerHTML; $('siteInfo').innerHTML = ''; } showWindow('open_cloud', dialogHtml, 'html'); $('fwin_open_cloud').style.top = '80px'; $('cloud_api_ip').value = cloudApiIp; return false; } function dealHandle(msg) { getMsg = true; if (msg['status'] == 'error') { $('loadinginner').innerHTML = '<font color="red">' + msg['content'] + '</font>'; return; } $('loading').style.display = 'none'; $('mainArea').style.display = ''; if(cloudStatus == 'upgrade') { $('title').innerHTML = msg['cloudIntroduction']['upgrade_title']; $('msg').innerHTML = msg['cloudIntroduction']['upgrade_content']; } else { $('title').innerHTML = msg['cloudIntroduction']['open_title']; $('msg').innerHTML = msg['cloudIntroduction']['open_content']; } if (msg['navSteps']) { $('nav_steps').innerHTML = msg['navSteps']; } if (msg['protocalUrl']) { $('protocal_url').href = msg['protocalUrl']; } if (msg['cloudApiIp']) { cloudApiIp = msg['cloudApiIp']; } if (msg['manyouUpdateTips']) { $('manyou_update_tips').innerHTML = msg['manyouUpdateTips']; } } function expiration() { if(!getMsg) { $('loadinginner').innerHTML = '<font color="red">' + expirationText + '</font>'; clearTimeout(expirationTimeout); } }
JavaScript
var cloudj = jQuery.noConflict(); if (typeof disallowfloat == 'undefined' || disallowfloat === null) { var disallowfloat = ''; } var currentNormalEditDisplay = 0; cloudj(document).ready(function() { ajaxGetSearchResultThreads(); cloudj('#previewForm').submit(function() { return previewFormSubmit(); }); }); function previewFormSubmit() { saveAllThread(); if (!selectedTopicId) { alert('请推送头条信息'); return false; } if (selectedNormalIds.length < 1) { alert('请至少推送一条信息到列表区域'); return false; } var i = 1; for (var k = 1; k <= 5; k++) { var input_displayorder = cloudj('#normal_thread_' + k).find('.preview_displayorder'); if (input_displayorder.size()) { input_displayorder.val(i); i++; } } return true; } function initSelect() { var initTopicObj = cloudj('#search_result .qqqun_op .qqqun_op_topon'); initTopicObj.addClass('qqqun_op_top'); initTopicObj.removeClass('qqqun_op_topon'); var initNormalObj = cloudj('#search_result .qqqun_op .qqqun_op_liston'); initNormalObj.addClass('qqqun_op_list'); initNormalObj.removeClass('qqqun_op_liston'); selectedTopicId = parseInt(selectedTopicId); if (selectedTopicId) { cloudj('#thread_addtop_' + selectedTopicId).addClass('qqqun_op_topon'); cloudj('#thread_addtop_' + selectedTopicId).removeClass('qqqun_op_top'); } cloudj.each(selectedNormalIds, function(k, v) { v = parseInt(v); if (v) { cloudj('#thread_addlist_' + v).addClass('qqqun_op_liston'); cloudj('#thread_addlist_' + v).removeClass('qqqun_op_list'); } }); } function ajaxChangeSearch() { cloudj('#srchtid').val(''); ajaxGetSearchResultThreads(); } function ajaxGetSearchResultThreads() { cloudj('#search_result').html('<tr><td colspan="3">加载中...</td></tr>'); qqgroupajaxpost('search_form', 'search_result', 'search_result', null, null, function() {initSelect(); return false}); return false; } function ajaxGetPageResultThreads(page, mpurl) { cloudj('#search_result').html('<tr><td colspan="3">加载中...</td></tr>'); if (typeof page == 'undefined' || page === null) { page = 1; } if (typeof mpurl == 'undefined' || !mpurl) { return false; } ajaxget(mpurl + '&page=' + page, 'search_result', null, null, null, function() {initSelect();} ); } function addMiniportalTop(tid) { tid = parseInt(tid); if (cloudj.inArray(tid, selectedNormalIds) > -1) { removeNormalThreadByTid(tid); } addMiniportalTopId(tid); initSelect(); ajaxget(adminscript + '?action=cloud&operation=qqgroup&anchor=block&op=getTopicThread&tid=' + tid, 'topicDiv', null, null, null, function() { clickTopicEditor(); }); } function addMiniportalTopId(tid) { selectedTopicId = tid; } function showPreviewEditor(topic, hideall) { if (hideall) { cloudj('.qqqun_list .qqqun_editor').hide(); cloudj('.qqqun_list .qqqun_xl li').removeClass('current'); cloudj('.qqqun_list').removeClass('qqqun_list_editor'); cloudj('.qqqun_top .qqqun_editor').hide(); cloudj('.qqqun_top').removeClass('qqqun_top_editor'); } else { if (topic) { cloudj('.qqqun_list .qqqun_editor').hide(); cloudj('.qqqun_list .qqqun_xl li').removeClass('current'); cloudj('.qqqun_list').removeClass('qqqun_list_editor'); cloudj('.qqqun_top .qqqun_editor').show(); cloudj('.qqqun_top').addClass('qqqun_top_editor'); } else { cloudj('.qqqun_list .qqqun_editor').show(); cloudj('.qqqun_list').addClass('qqqun_list_editor'); cloudj('.qqqun_list .qqqun_xl li').removeClass('current'); cloudj('.qqqun_top .qqqun_editor').hide(); cloudj('.qqqun_top').removeClass('qqqun_top_editor'); } } } function clickTopicEditor(topicFocus) { if (typeof topicFocus == 'undefined') { var topicFocus = 'title'; } showPreviewEditor(true, false); if (topicFocus == 'title') { cloudj('#topic-editor-input-title').addClass('pt_focus'); cloudj('#topic-editor-input-title').focus(); } else if (topicFocus == 'content') { cloudj('#topic-editor-textarea-content').addClass('pt_focus'); cloudj('#topic-editor-textarea-content').focus(); } currentNormalEditDisplay = 0; } function blurTopic(obj) { var thisobj = cloudj(obj); thisobj.removeClass('pt_focus'); } function clickNormalEditor(obj) { var thisobj = cloudj(obj); showPreviewEditor(false, false); thisobj.addClass('pt_focus'); thisobj.focus(); currentNormalEditDisplay = parseInt(thisobj.parent().attr('displayorder')); } function blurNormalTextarea(obj) { var thisobj = cloudj(obj); liObj = thisobj.parent(); var displayorder = parseInt(liObj.attr('displayorder')); if (displayorder == currentNormalEditDisplay) { liObj.addClass('current'); } cloudj('.qqqun_list .qqqun_xl textarea').removeClass('pt_focus'); } function addMiniportalList(tid) { tid = parseInt(tid); if (cloudj.inArray(tid, selectedNormalIds) > -1) { return false; } if (selectedNormalIds.length >= 5) { alert('推送帖子已达到5条,请在右侧取消一些再重试。'); return false; } if (tid == selectedTopicId) { selectedTopicId = 0; ajaxget(adminscript + '?action=cloud&operation=qqgroup&anchor=block&op=getTopicThread&tid=0', 'topicDiv'); } addMiniportalListId(tid); initSelect(); var insertPos = 'normal_thread_' + selectedNormalIds.length; ajaxget(adminscript + '?action=cloud&operation=qqgroup&anchor=block&op=getNormalThread&tid=' + tid, insertPos, null, null, null, function() { clickNormalEditor(cloudj('#' + insertPos).find('textarea')); }); } function addMiniportalListId(tid) { selectedNormalIds.push(tid); } function editNormalThread() { var threadLi = cloudj('#normal_thread_' + currentNormalEditDisplay); clickNormalEditor(threadLi.find('textarea')); } function saveAllThread() { showPreviewEditor(false, true); currentNormalEditDisplay = 0; } function moveNormalThread(up) { var displayorder = currentNormalEditDisplay; var threadLi = cloudj('#normal_thread_' + displayorder); if (!threadLi.attr('id') || !displayorder) { return false; } var newDisplayorder = 0; if (up) { newDisplayorder = displayorder - 1; } else { newDisplayorder = displayorder + 1; } if (newDisplayorder < 1 || newDisplayorder > 5) { return false; } var newLiId = 'normal_thread_' + newDisplayorder; var newThreadLi = cloudj('#' + newLiId); if (!newThreadLi.find('textarea').size()) { return false; } var tmpHtml = newThreadLi.html(); newThreadLi.html(threadLi.html()); threadLi.html(tmpHtml); newThreadLi.addClass('current'); threadLi.removeClass('current'); currentNormalEditDisplay = newDisplayorder; } function removeTopicThread(tid) { tid = parseInt(tid); selectedTopicId = 0; initSelect(); ajaxget(adminscript + '?action=cloud&operation=qqgroup&anchor=block&op=getTopicThread', 'topicDiv', null, null, null, function() { showPreviewEditor(false, true)}); } function removeNormalThread() { var displayorder = currentNormalEditDisplay; var removeTid = parseInt(cloudj('#normal_thread_' + displayorder).find('.normal_thread_tid').val()); return removeNormalThreadByDisplayorderAndTid(displayorder, removeTid, true); } function removeNormalThreadByTid(tid) { tid = parseInt(tid); var threadInput = cloudj('.qqqun_list .qqqun_xl .normal_thread_tid[value="' + tid + '"]'); if (threadInput.size()) { var displayorder = threadInput.parent().attr('displayorder'); var removeTid = tid; return removeNormalThreadByDisplayorderAndTid(displayorder, removeTid, false); } } function removeNormalThreadByDisplayorderAndTid(displayorder, removeTid, inNormalEditor) { displayorder = parseInt(displayorder); removeTid = parseInt(removeTid); var threadLi = cloudj('#normal_thread_' + displayorder); if (!threadLi.attr('id') || !displayorder) { return false; } threadLi.removeClass('current'); var index = cloudj.inArray(removeTid, selectedNormalIds); if (index != -1) { selectedNormalIds.splice(index, 1); } initSelect(); if (typeof inNormalEditor == 'udefined') { var inNormalEditor = false; } threadLi.slideUp(100, function() { removeNormalThreadRecall(displayorder, inNormalEditor)}); } function removeNormalThreadRecall(displayorder, inNormalEditor) { for (var i = displayorder; i <= 5; i++) { var currentDisplayorder = i; var nextDisplayorder = i + 1; var currentLiId = 'normal_thread_' + currentDisplayorder; var currentThreadLi = cloudj('#' + currentLiId); var nextLiId = 'normal_thread_' + nextDisplayorder; var nextThreadLi = cloudj('#' + nextLiId); if (nextThreadLi.find('textarea').size()) { currentThreadLi.html(nextThreadLi.html()); currentThreadLi.show(); } else { currentThreadLi.html(''); currentThreadLi.hide(); break; } } var threadLi = cloudj('#normal_thread_' + displayorder); var prevDisplayorder = displayorder - 1; if (threadLi.find('textarea').size()) { if (inNormalEditor) { threadLi.addClass('current'); } currentNormalEditDisplay = displayorder; } else if (prevDisplayorder) { var prevThreadLi = cloudj('#normal_thread_' + prevDisplayorder); if (inNormalEditor) { prevThreadLi.addClass('current'); } currentNormalEditDisplay = prevDisplayorder; } else { var firstThreadLi = cloudj('#normal_thread_1'); if (inNormalEditor) { saveAllThread(); } firstThreadLi.html('<div class="tips">点击左侧 <img src="static/image/admincp/cloud/qun_op_list.png" align="absmiddle" /> 将信息推送到列表</div>'); firstThreadLi.show(); } } function ajaxUploadQQGroupImage() { cloudj('#uploadImageResult').parent().show(); cloudj('#uploadImageResult').text('图片上传中,请稍后...'); qqgroupajaxpost('uploadImage', 'uploadImageResult', 'uploadImageResult', null, null, 'uploadRecall()'); } function uploadRecall() { if(cloudj('#uploadImageResult').find('#upload_msg_success').size()) { cloudj('#uploadImageResult').parent().show(); var debug_rand = Math.random(); var imagePath = cloudj('#uploadImageResult #upload_msg_imgpath').text(); var imageUrl = cloudj('#uploadImageResult #upload_msg_imgurl').text(); cloudj('#topic_image_value').val(imagePath); cloudj('#topic_editor_thumb').attr('src', imageUrl + '?' + debug_rand); cloudj('#topic_preview_thumb').attr('src', imageUrl + '?' + debug_rand); setTimeout(function() {hideWindow('uploadImgWin');}, 2000); } } function qqgroupajaxpost(formid, showid, waitid, showidclass, submitbtn, recall) { var waitid = typeof waitid == 'undefined' || waitid === null ? showid : (waitid !== '' ? waitid : ''); var showidclass = !showidclass ? '' : showidclass; var ajaxframeid = 'ajaxframe'; var ajaxframe = $(ajaxframeid); var formtarget = $(formid).target; var handleResult = function() { var s = ''; var evaled = false; showloading('none'); ajaxResponse = cloudj('#' + ajaxframeid).contents().text(); var regex = /<\!\[CDATA\[(.*)\]\]>/; var regexed = regex.exec(ajaxResponse); if (regexed && regexed[1]) { s = regexed[1]; } else { s = ajaxResponse; } if (!s) { s = '内部错误,无法显示此内容'; } if(s != '' && s.indexOf('ajaxerror') != -1) { evalscript(s); evaled = true; } if(showidclass) { if(showidclass != 'onerror') { cloudj(showid).addClass(showidclass); } else { showError(s); ajaxerror = true; } } if(submitbtn) { cloudj(submitbtn).attr('disabled', false); } if(!evaled && (typeof ajaxerror == 'undefined' || !ajaxerror)) { ajaxinnerhtml($(showid), s); } ajaxerror = null; cloudj('#' + formid).attr('target', formtarget); if(typeof recall == 'function') { recall(); } else { eval(recall); } if(!evaled) evalscript(s); ajaxframe.loading = 0; cloudj(ajaxframe.parentNode).remove(); }; if(!ajaxframe) { var div = cloudj('<div>'); div.css('display', 'none'); div.html('<iframe name="' + ajaxframeid + '" id="' + ajaxframeid + '" loading="1">'); cloudj('#append_parent').append(div); ajaxframe = $(ajaxframeid); } else if(ajaxframe.loading) { return false; } _attachEvent(ajaxframe, 'load', handleResult); showloading(); cloudj('#' + formid).attr('target', ajaxframeid); var action = cloudj('#' + formid).attr('action'); action = hostconvert(action); cloudj('#' + formid).attr('action', action.replace(/\&inajax\=1/g, '')+'&inajax=1'); $(formid).submit(); if(submitbtn) { cloudj(submitbtn).attr('disabled', true); } doane(); return false; }
JavaScript
var userAgent = navigator.userAgent.toLowerCase(); var is_opera = userAgent.indexOf('opera') != -1 && opera.version(); var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3); var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3); function $(id) { return document.getElementById(id); } Array.prototype.push = function(value) { this[this.length] = value; return this.length; } function getcookie(name) { var cookie_start = document.cookie.indexOf(name); var cookie_end = document.cookie.indexOf(";", cookie_start); return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length))); } function setcookie(cookieName, cookieValue, seconds, path, domain, secure) { seconds = seconds ? seconds : 8400000; var expires = new Date(); expires.setTime(expires.getTime() + seconds); document.cookie = escape(cookieName) + '=' + escape(cookieValue) + (expires ? '; expires=' + expires.toGMTString() : '') + (path ? '; path=' + path : '/') + (domain ? '; domain=' + domain : '') + (secure ? '; secure' : ''); } function _attachEvent(obj, evt, func) { if(obj.addEventListener) { obj.addEventListener(evt, func, false); } else if(obj.attachEvent) { obj.attachEvent("on" + evt, func); } } function _cancelBubble(e, returnValue) { if(!e) return ; if(is_ie) { if(!returnValue) e.returnValue = false; e.cancelBubble = true; } else { e.stopPropagation(); if(!returnValue) e.preventDefault(); } } function checkall(name) { var e = is_ie ? event : checkall.caller.arguments[0]; obj = is_ie ? e.srcElement : e.target; var arr = document.getElementsByName(name); var k = arr.length; for(var i=0; i<k; i++) { arr[i].checked = obj.checked; } } function getposition(obj) { var r = new Array(); r['x'] = obj.offsetLeft; r['y'] = obj.offsetTop; while(obj = obj.offsetParent) { r['x'] += obj.offsetLeft; r['y'] += obj.offsetTop; } return r; } function addMouseEvent(obj){ var checkbox,atr,ath,i; atr=obj.getElementsByTagName("tr"); for(i=0;i<atr.length;i++){ atr[i].onclick=function(){ ath=this.getElementsByTagName("th"); checkbox=this.getElementsByTagName("input")[0]; if(!ath.length && checkbox.getAttribute("type")=="checkbox"){ if(this.className!="currenttr"){ this.className="currenttr"; checkbox.checked=true; }else{ this.className=""; checkbox.checked=false; } } } } } // editor.js if(is_ie) document.documentElement.addBehavior("#default#userdata"); function setdata(key, value){ if(is_ie){ document.documentElement.load(key); document.documentElement.setAttribute("value", value); document.documentElement.save(key); return document.documentElement.getAttribute("value"); } else { sessionStorage.setItem(key,value); } } function getdata(key){ if(is_ie){ document.documentElement.load(key); return document.documentElement.getAttribute("value"); } else { return sessionStorage.getItem(key) && sessionStorage.getItem(key).toString().length == 0 ? '' : (sessionStorage.getItem(key) == null ? '' : sessionStorage.getItem(key)); } } function form_option_selected(obj, value) { for(var i=0; i<obj.options.length; i++) { if(obj.options[i].value == value) { obj.options[i].selected = true; } } } function switchcredit(obj, value) { var creditsettings = credit[value]; var s = '<select name="credit' + obj + '">'; for(var i in creditsettings) { s += '<option value="' + creditsettings[i][0] + '">' + creditsettings[i][1] + '</option>'; } s += '</select>'; $(obj).innerHTML = s; } function setselect(selectobj, value) { var len = selectobj.options.length; for(i = 0;i < len;i++) { if(selectobj.options[i].value == value) { selectobj.options[i].selected = true; } } } function show(id, display) { if(!$(id)) return false; if(display == 'auto') { $(id).style.display = $(id).style.display == '' ? 'none' : ''; } else { $(id).style.display = display; } }
JavaScript
//Common var userAgent = navigator.userAgent.toLowerCase(); var is_opera = userAgent.indexOf('opera') != -1 && opera.version(); var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3); var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3); function isUndefined(variable) { return typeof variable == 'undefined' ? true : false; } function $(id) { return document.getElementById(id); } function fetchOffset(obj) { var left_offset = obj.offsetLeft; var top_offset = obj.offsetTop; while((obj = obj.offsetParent) != null) { left_offset += obj.offsetLeft; top_offset += obj.offsetTop; } return { 'left' : left_offset, 'top' : top_offset }; } function _attachEvent(obj, evt, func) { if(obj.addEventListener) { obj.addEventListener(evt, func, false); } else if(obj.attachEvent) { obj.attachEvent("on" + evt, func); } } function strlen(str) { return (is_ie && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length; } //Menu var menus = new menu_handler(); function menu_handler() { this.menu = Array(); } function menuitems() { this.ctrlobj = null, this.menuobj = null; this.parentids = Array(); this.allowhide = 1; this.hidelock = 0; this.clickstatus = 0; } function menuobjpos(id, offset) { if(!menus.menu[id]) { return; } if(!offset) { offset = 0; } var showobj = menus.menu[id].ctrlobj; var menuobj = menus.menu[id].menuobj; showobj.pos = fetchOffset(showobj); showobj.X = showobj.pos['left']; showobj.Y = showobj.pos['top']; showobj.w = showobj.offsetWidth; showobj.h = showobj.offsetHeight; menuobj.w = menuobj.offsetWidth; menuobj.h = menuobj.offsetHeight; if(offset < 3) { menuobj.style.left = (showobj.X + menuobj.w > document.body.clientWidth) && (showobj.X + showobj.w - menuobj.w >= 0) ? showobj.X + showobj.w - menuobj.w + 'px' : showobj.X + 'px'; menuobj.style.top = offset == 1 ? showobj.Y + 'px' : (offset == 2 || ((showobj.Y + showobj.h + menuobj.h > document.documentElement.scrollTop + document.documentElement.clientHeight) && (showobj.Y - menuobj.h >= 0)) ? (showobj.Y - menuobj.h) + 'px' : showobj.Y + showobj.h + 'px'); } else if(offset == 3) { menuobj.style.left = (document.body.clientWidth - menuobj.clientWidth) / 2 + document.body.scrollLeft + 'px'; menuobj.style.top = (document.body.clientHeight - menuobj.clientHeight) / 2 + document.body.scrollTop + 'px'; } else if(offset == 4) { menuobj.style.left = (showobj.X + menuobj.w > document.body.clientWidth) && (showobj.X + showobj.w - menuobj.w >= 0) ? showobj.X + showobj.w - menuobj.w + 'px' : showobj.X + showobj.w + 'px'; menuobj.style.top = showobj.Y + 'px'; } if(menuobj.style.clip && !is_opera) { menuobj.style.clip = 'rect(auto, auto, auto, auto)'; } } function showmenu(event, id, click, position) { if(isUndefined(click)) click = false; if(!menus.menu[id]) { menus.menu[id] = new menuitems(); menus.menu[id].ctrlobj = $(id); if(!menus.menu[id].ctrlobj.getAttribute('parentmenu')) { menus.menu[id].parentids = Array(); } else { menus.menu[id].parentids = menus.menu[id].ctrlobj.getAttribute('parentmenu').split(','); } menus.menu[id].menuobj = $(id + '_menu'); menus.menu[id].menuobj.style.position = 'absolute'; if(event.type == 'mouseover') { _attachEvent(menus.menu[id].ctrlobj, 'mouseout', function() { setTimeout(function() {hidemenu(id)}, 100); }); _attachEvent(menus.menu[id].menuobj, 'mouseover', function() { lockmenu(id, 0); }); _attachEvent(menus.menu[id].menuobj, 'mouseout', function() { lockmenu(id, 1);setTimeout(function() {hidemenu(id)}, 100); }); } else if(click || event.type == 'click') { menus.menu[id].clickstatus = 1; lockmenu(id, 0); } } else if(menus.menu[id].clickstatus == 1) { lockmenu(id, 1); hidemenu(id); menus.menu[id].clickstatus = 0; return; } menuobjpos(id, position); menus.menu[id].menuobj.style.display = ''; } function hidemenu(id) { if(!menus.menu[id] || !menus.menu[id].allowhide || menus.menu[id].hidelock) { return; } menus.menu[id].menuobj.style.display = 'none'; } function lockmenu(id, value) { if(!menus.menu[id]) { return; } for(i = 0;i < menus.menu[id].parentids.length;i++) { menus.menu[menus.menu[id].parentids[i]].hidelock = value == 0 ? 1 : 0; } menus.menu[id].allowhide = value; } //Editor var lang = new Array(); function insertunit(text, textend, moveend) { $('pm_textarea').focus(); textend = isUndefined(textend) ? '' : textend; moveend = isUndefined(textend) ? 0 : moveend; startlen = strlen(text); endlen = strlen(textend); if(!isUndefined($('pm_textarea').selectionStart)) { var opn = $('pm_textarea').selectionStart + 0; if(textend != '') { text = text + $('pm_textarea').value.substring($('pm_textarea').selectionStart, $('pm_textarea').selectionEnd) + textend; } $('pm_textarea').value = $('pm_textarea').value.substr(0, $('pm_textarea').selectionStart) + text + $('pm_textarea').value.substr($('pm_textarea').selectionEnd); if(!moveend) { $('pm_textarea').selectionStart = opn + strlen(text) - endlen; $('pm_textarea').selectionEnd = opn + strlen(text) - endlen; } } else if(document.selection && document.selection.createRange) { var sel = document.selection.createRange(); if(textend != '') { text = text + sel.text + textend; } sel.text = text.replace(/\r?\n/g, '\r\n'); if(!moveend) { sel.moveStart('character', -endlen); sel.moveEnd('character', -endlen); } sel.select(); } else { $('pm_textarea').value += text; } } function getSel() { if(!isUndefined($('pm_textarea').selectionStart)) { return $('pm_textarea').value.substr($('pm_textarea').selectionStart, $('pm_textarea').selectionEnd - $('pm_textarea').selectionStart); } else if(document.selection && document.selection.createRange) { return document.selection.createRange().text; } else if(window.getSelection) { return window.getSelection() + ''; } else { return false; } } function insertlist(type) { txt = getSel(); type = isUndefined(type) ? '' : '=' + type; if(txt) { var regex = new RegExp('([\r\n]+|^[\r\n]*)(?!\\[\\*\\]|\\[\\/?list)(?=[^\r\n])', 'gi'); txt = '[list' + type + ']\n' + txt.replace(regex, '$1[*]') + '\n' + '[/list]'; insertunit(txt); } else { insertunit('[list' + type + ']\n', '[/list]'); while(listvalue = prompt(lang['pm_prompt_list'], '')) { if(is_opera > 8) { listvalue = '\n' + '[*]' + listvalue; insertunit(listvalue); } else { listvalue = '[*]' + listvalue + '\n'; insertunit(listvalue); } } } } function inserttag(tag, type) { txt = getSel(); type = isUndefined(type) ? 0 : type; if(!type) { if(!txt) { txt = prompt(lang['pm_prompt_' + tag], '') } if(txt) { insertunit('[' + tag + ']' + txt + '[/' + tag + ']'); } } else { txt1 = prompt(lang['pm_prompt_' + tag], ''); if(!txt) { txt = txt1; } if(txt1) { insertunit('[' + tag + '=' + txt1 + ']' + txt + '[/' + tag + ']'); } } }
JavaScript
var controlid = null; var currdate = null; var startdate = null; var enddate = null; var yy = null; var mm = null; var hh = null; var ii = null; var currday = null; var addtime = false; var today = new Date(); var lastcheckedyear = false; var lastcheckedmonth = false; function loadcalendar() { s = ''; s += '<div id="calendar" style="display:none; position:absolute;z-index:100;" onclick="_cancelBubble(event)">'; s += '<iframe id="calendariframe" frameborder="0" style="height:200px; z-index: 110; position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"></iframe>'; s += '<div style="padding:5px; width: 210px; border: 1px solid #B5CFD9; background:#F2F9FD; position: absolute; z-index: 120">'; s += '<table cellspacing="0" cellpadding="0" width="100%" style="text-align: center;" class="table1">'; s += '<thead>'; s += '<tr align="center" id="calendar_week">'; s += '<th><a href="###" onclick="refreshcalendar(yy, mm-1)" title="上一月">《</a></th>'; s += '<th colspan="5" style="text-align: center"><a href="###" onclick="showdiv(\'year\');_cancelBubble(event)" title="点击选择年份" id="year"></a>&nbsp; - &nbsp;<a id="month" title="点击选择月份" href="###" onclick="showdiv(\'month\');_cancelBubble(event)"></a></th>'; s += '<th><A href="###" onclick="refreshcalendar(yy, mm+1)" title="下一月">》</A></th>'; s += '</tr>'; s += '<tr id="calendar_header"><td>日</td><td>一</td><td>二</td><td>三</td><td>四</td><td>五</td><td>六</td></tr>'; s += '</thead>'; s += '<tbody>'; for(var i = 0; i < 6; i++) { s += '<tr>'; for(var j = 1; j <= 7; j++) s += "<td id=d" + (i * 7 + j) + " height=\"19\">0</td>"; s += "</tr>"; } s += '<tr id="hourminute"><td colspan="7" align="center"><input type="text" size="2" value="" id="hour" onKeyUp=\'this.value=this.value > 23 ? 23 : zerofill(this.value);controlid.value=controlid.value.replace(/\\d+(\:\\d+)/ig, this.value+"$1")\'> 点 <input type="text" size="2" value="" id="minute" onKeyUp=\'this.value=this.value > 59 ? 59 : zerofill(this.value);controlid.value=controlid.value.replace(/(\\d+\:)\\d+/ig, "$1"+this.value)\'> 分</td></tr>'; s += '</tbody>'; s += '</table></div></div>'; s += '<div id="calendar_year" onclick="_cancelBubble(event)" style="display: none; z-index: 130;" class="calendarmenu"><div class="col" style="float: left; margin-right: 5px;">'; for(var k = 1930; k <= 2019; k++) { s += k != 1930 && k % 10 == 0 ? '</div><div style="float: left; margin-right: 5px;">' : ''; s += '<a href="###" onclick="refreshcalendar(' + k + ', mm);$(\'calendar_year\').style.display=\'none\'"><span' + (today.getFullYear() == k ? ' class="bold"' : '') + ' id="calendar_year_' + k + '">' + k + '</span></a><br />'; } s += '</div></div>'; s += '<div id="calendar_month" onclick="_cancelBubble(event)" style="display: none; padding: 3px; z-index: 140" class="calendarmenu">'; for(var k = 1; k <= 12; k++) { s += '<a href="###" onclick="refreshcalendar(yy, ' + (k - 1) + ');$(\'calendar_month\').style.display=\'none\'; "><span' + (today.getMonth()+1 == k ? ' class="bold"' : '') + ' id="calendar_month_' + k + '">' + k + ( k < 10 ? '&nbsp;' : '') + ' 月</span></a><br />'; } s += '</div>'; var div = document.createElement('div'); div.innerHTML = s; $('append').appendChild(div); _attachEvent(document, 'click', function() { $('calendar').style.display = 'none'; $('calendar_year').style.display = 'none'; $('calendar_month').style.display = 'none'; }); $('calendar').onclick = function(e) { e = is_ie ? event : e; _cancelBubble(e); $('calendar_year').style.display = 'none'; $('calendar_month').style.display = 'none'; } } function parsedate(s) { /(\d+)\-(\d+)\-(\d+)\s*(\d*):?(\d*)/.exec(s); var m1 = (RegExp.$1 && RegExp.$1 > 1899 && RegExp.$1 < 2101) ? parseFloat(RegExp.$1) : today.getFullYear(); var m2 = (RegExp.$2 && (RegExp.$2 > 0 && RegExp.$2 < 13)) ? parseFloat(RegExp.$2) : today.getMonth() + 1; var m3 = (RegExp.$3 && (RegExp.$3 > 0 && RegExp.$3 < 32)) ? parseFloat(RegExp.$3) : today.getDate(); var m4 = (RegExp.$4 && (RegExp.$4 > -1 && RegExp.$4 < 24)) ? parseFloat(RegExp.$4) : 0; var m5 = (RegExp.$5 && (RegExp.$5 > -1 && RegExp.$5 < 60)) ? parseFloat(RegExp.$5) : 0; /(\d+)\-(\d+)\-(\d+)\s*(\d*):?(\d*)/.exec("0000-00-00 00\:00"); return new Date(m1, m2 - 1, m3, m4, m5); } function settime(d) { $('calendar').style.display = 'none'; $('calendar_month').style.display = 'none'; controlid.value = yy + "-" + zerofill(mm + 1) + "-" + zerofill(d) + (addtime ? ' ' + zerofill($('hour').value) + ':' + zerofill($('minute').value) : ''); } function showcalendar(addtime1, startdate1, enddate1) { e = is_ie ? event : showcalendar.caller.arguments[0]; controlid1 = is_ie ? e.srcElement : e.target; controlid = controlid1; addtime = addtime1; startdate = startdate1 ? parsedate(startdate1) : false; enddate = enddate1 ? parsedate(enddate1) : false; currday = controlid.value ? parsedate(controlid.value) : today; hh = currday.getHours(); ii = currday.getMinutes(); var p = getposition(controlid); $('calendar').style.display = 'block'; $('calendar').style.left = p['x']+'px'; $('calendar').style.top = (p['y'] + 20)+'px'; _cancelBubble(e); refreshcalendar(currday.getFullYear(), currday.getMonth()); if(lastcheckedyear != false) { $('calendar_year_' + lastcheckedyear).className = ''; $('calendar_year_' + today.getFullYear()).className = 'bold'; } if(lastcheckedmonth != false) { $('calendar_month_' + lastcheckedmonth).className = ''; $('calendar_month_' + (today.getMonth() + 1)).className = 'bold'; } $('calendar_year_' + currday.getFullYear()).className = 'error bold'; $('calendar_month_' + (currday.getMonth() + 1)).className = 'error bold'; $('hourminute').style.display = addtime ? '' : 'none'; lastcheckedyear = currday.getFullYear(); lastcheckedmonth = currday.getMonth() + 1; } function refreshcalendar(y, m) { var x = new Date(y, m, 1); var mv = x.getDay(); var d = x.getDate(); var dd = null; yy = x.getFullYear(); mm = x.getMonth(); $("year").innerHTML = yy; $("month").innerHTML = mm + 1 > 9 ? (mm + 1) : '0' + (mm + 1); for(var i = 1; i <= mv; i++) { dd = $("d" + i); dd.innerHTML = "&nbsp;"; dd.className = ""; } while(x.getMonth() == mm) { dd = $("d" + (d + mv)); dd.innerHTML = '<a href="###" onclick="settime(' + d + ');return false">' + d + '</a>'; if(x.getTime() < today.getTime() || (enddate && x.getTime() > enddate.getTime()) || (startdate && x.getTime() < startdate.getTime())) { dd.className = 'grey'; } else { dd.className = ''; } if(x.getFullYear() == today.getFullYear() && x.getMonth() == today.getMonth() && x.getDate() == today.getDate()) { dd.className = 'bold'; dd.firstChild.title = '今天'; } if(x.getFullYear() == currday.getFullYear() && x.getMonth() == currday.getMonth() && x.getDate() == currday.getDate()) { dd.className = 'error bold'; } x.setDate(++d); } while(d + mv <= 42) { dd = $("d" + (d + mv)); dd.innerHTML = "&nbsp;"; d++; } if(addtime) { $('hour').value = zerofill(hh); $('minute').value = zerofill(ii); } } function showdiv(id) { var p = getposition($(id)); $('calendar_' + id).style.left = p['x']+'px'; $('calendar_' + id).style.top = (p['y'] + 16)+'px'; $('calendar_' + id).style.display = 'block'; } function zerofill(s) { var s = parseFloat(s.toString().replace(/(^[\s0]+)|(\s+$)/g, '')); s = isNaN(s) ? 0 : s; return (s < 10 ? '0' : '') + s.toString(); } window.onload = function() { loadcalendar(); }
JavaScript
var Ajaxs = new Array(); function Ajax(waitId) { var aj = new Object(); aj.waitId = waitId ? $(waitId) : null; aj.targetUrl = ''; aj.sendString = ''; aj.resultHandle = null; aj.loading = '<img src="image/common/loading.gif" style="margin: 3px; vertical-align: middle" />Loading... '; aj.createXMLHttpRequest = function() { var request = false; if(window.XMLHttpRequest) { request = new XMLHttpRequest(); if(request.overrideMimeType) request.overrideMimeType('text/xml'); } else if(window.ActiveXObject) { var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP']; for(var i=0; i<versions.length; i++) { try { request = new ActiveXObject(versions[i]); if(request) return request; } catch(e) {/*alert(e.message);*/} } } return request; } aj.request = aj.createXMLHttpRequest(); if(aj.waitId) { aj.waitId.orgdisplay = aj.waitId.style.display; aj.waitId.style.display = ''; aj.waitId.innerHTML = aj.loading; } aj.processHandle = function() { if(aj.request.readyState == 4 && aj.request.status == 200) { for(k in Ajaxs) { if(Ajaxs[k] == aj.targetUrl) Ajaxs[k] = null; } if(aj.waitId) { aj.waitId.style.display = 'none'; aj.waitId.style.display = aj.waitId.orgdisplay; } aj.resultHandle(aj.request.responseXML.lastChild.firstChild.nodeValue); } } aj.get = function(targetUrl, resultHandle) { if(in_array(targetUrl, Ajaxs)) { return false; } else { Ajaxs.push(targetUrl); } aj.targetUrl = targetUrl; aj.request.onreadystatechange = aj.processHandle; aj.resultHandle = resultHandle; if(window.XMLHttpRequest) { aj.request.open('GET', aj.targetUrl); aj.request.send(null); } else { aj.request.open("GET", targetUrl, true); aj.request.send(); } } /* aj.post = function(targetUrl, sendString, resultHandle) { aj.targetUrl = targetUrl; aj.sendString = sendString; aj.request.onreadystatechange = aj.processHandle; aj.resultHandle = resultHandle; aj.request.open('POST', targetUrl); aj.request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); aj.request.send(aj.sendString); }*/ return aj; } function show(id, display) { if(display == 'auto') { $(id).style.display = $(id).style.display == '' ? 'none' : ''; } else { $(id).style.display = display; } } /* ajaxget('www.baidu.com', 'showid', 'waitid', 'display(\'showid\', 1)'); */ function ajaxget(url, showId, waitId, display, recall) { e = is_ie ? event : ajaxget.caller.arguments[0]; ajaxget2(e, url, showId, waitId, display, recall); _cancelBubble(e); } function ajaxget2(e, url, showId, waitId, display, recall) { target = e ? (is_ie ? e.srcElement : e.target) : null; display = display ? display : ''; var x = new Ajax(waitId); x.showId = showId; x.display = display; var sep = url.indexOf('?') != -1 ? '&' : '?'; x.target = target; x.recall = recall; x.get(url+sep+'inajax=1', function(s) { if(x.display == 'auto' && x.target) { x.target.onclick = newfunc('show', x.showId, 'auto'); } show(x.showId, x.display); $(x.showId).innerHTML = s; evalscript(s); if(x.recall)eval(x.recall); }); _cancelBubble(e); } /* function stripscript(s) { return s.replace(/<script.*?>.*?<\/script>/ig, ''); }*/ var evalscripts = new Array(); function evalscript(s) { if(!s || s.indexOf('<script') == -1) return s; var p = /<script[^\>]*?src=\"([^\x00]+?)\"[^\>]*( reload=\"1\")?><\/script>/ig; var arr = new Array(); while(arr = p.exec(s)) appendscript(arr[1], '', arr[2]); p = /<script[^\>]*?( reload=\"1\")?>([^\x00]+?)<\/script>/ig; while(arr = p.exec(s)) appendscript('', arr[2], arr[1]); return s; } function appendscript(src, text, reload) { var id = hash(src + text); if(!reload && in_array(id, evalscripts)) return; if(reload && $(id)) { $(id).parentNode.removeChild($(id)); } evalscripts.push(id); var scriptNode = document.createElement("script"); scriptNode.type = "text/javascript"; scriptNode.id = id; if(src) { scriptNode.src = src; } else if(text){ scriptNode.text = text; } $('append').appendChild(scriptNode); } // 得到一个定长的 hash 值, 依赖于 stringxor() function hash(string, length) { var length = length ? length : 32; var start = 0; var i = 0; var result = ''; filllen = length - string.length % length; for(i = 0; i < filllen; i++){ string += "0"; } while(start < string.length) { result = stringxor(result, string.substr(start, length)); start += length; } return result; } function stringxor(s1, s2) { var s = ''; var hash = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; var max = Math.max(s1.length, s2.length); for(var i=0; i<max; i++) { var k = s1.charCodeAt(i) ^ s2.charCodeAt(i); s += hash.charAt(k % 52); } return s; } function in_array(needle, haystack) { for(var i in haystack) {if(haystack[i] == needle) return true;} return false; } function newfunc(func){ var args = new Array(); for(var i=1; i<arguments.length; i++) args.push(arguments[i]); return function(e){ window[func].apply(window, args); _cancelBubble(is_ie ? event : e); } } function ajaxmenu(url, position) { e = is_ie ? event : ajaxmenu.caller.arguments[0]; controlid = is_ie ? e.srcElement : e.target; var menuid = hash(url);// 使每个 url 对应一个弹出层,避免重复请求 createmenu(menuid); showmenu2(e, menuid, position, controlid); if(!$(menuid).innerHTML) { ajaxget2(e, url, menuid, menuid, '', "setposition('" + menuid + "', '" + position + "', '" + controlid + "')"); } else { //alert(menuid.innerHTML); } _cancelBubble(e); } var ajaxpostHandle = null; function ajaxpost(formid, showid, recall) { var ajaxframeid = 'ajaxframe'; var ajaxframe = $(ajaxframeid); if(ajaxframe == null) { if (is_ie) { ajaxframe = document.createElement("<iframe name='" + ajaxframeid + "' id='" + ajaxframeid + "'></iframe>"); } else { ajaxframe = document.createElement("iframe"); ajaxframe.name = ajaxframeid; ajaxframe.id = ajaxframeid; } ajaxframe.style.display = 'none'; $('append').appendChild(ajaxframe); } $(formid).target = ajaxframeid; ajaxpostHandle = [formid, showid, ajaxframeid, recall]; _attachEvent(ajaxframe, 'load', ajaxpost_load); $(formid).submit(); return false; } function ajaxpost_load() { var s = (is_ie && $(ajaxpostHandle[2])) ? $(ajaxpostHandle[2]).contentWindow.document.XMLDocument.text : $(ajaxpostHandle[2]).contentWindow.document.documentElement.firstChild.nodeValue; evalscript(s); if(s) { // setMenuPosition($(ajaxpostHandle[0]).ctrlid, 0); $(ajaxpostHandle[1]).innerHTML = s; if(ajaxpostHandle[3]) { eval(ajaxpostHandle[3]); } // setTimeout("hideMenu()", 3000); } // $(ajaxpostHandle[2]).target = ajaxpostHandle[3]; // ajaxpostHandle = null; }
JavaScript
/* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: soso_smilies.js 28110 2012-02-22 08:54:16Z songlixin $ */ var sosojs = document.createElement('script'); sosojs.type = 'text/javascript'; sosojs.charset = "utf-8"; sosojs.src = 'http://bq.soso.com/js/sosoexp_platform.js'; var sosolo = document.getElementsByTagName('script')[0]; sosolo.parentNode.insertBefore(sosojs, sosolo); function bbcode2html_sososmilies(sososmilieid, getsrc) { var imgsrc = ''; sososmilieid = String(sososmilieid); var imgid = 'soso_' + sososmilieid; if(sososmilieid.indexOf('_') == 0) { var realsmilieid = sososmilieid.substr(0, sososmilieid.length-2); var serverid = sososmilieid.substr(sososmilieid.length-1); imgsrc = "http://piccache"+serverid+".soso.com/face/"+realsmilieid; } else { imgsrc = "http://cache.soso.com/img/img/"+sososmilieid+".gif"; } if(!isUndefined(getsrc)) { return imgsrc; } return '<img src="'+imgsrc+'" smilieid="'+imgid+'" border="0" alt="" />'; } function html2bbcode_sososmilies(htmlsmilies) { if(htmlsmilies) { htmlsmilies = htmlsmilies.replace(/<img[^>]+smilieid=(["']?)soso_(\w+)(\1)[^>]*>/ig, function($1, $2, $3) { return sososmileycode($3);}); } return htmlsmilies; } function sososmileycode(sososmilieid) { if(sososmilieid) { return "{:soso_"+sososmilieid+":}"; } } function sososmiliesurl2id(sosourl) { var sososmilieid = ''; if(sosourl && sosourl.length > 30) { var idindex = sosourl.lastIndexOf('/'); if(sosourl.indexOf('http://piccache') == 0) { var serverid = sosourl.substr(15,1); var realsmilieid = sosourl.substr(idindex+1); sososmilieid = realsmilieid+'_'+serverid; } else if(sosourl.indexOf('http://cache.soso.com') == 0) { sososmilieid = sosourl.substring(idindex+1, sosourl.length-4); } return sososmilieid; } } function insertsosoSmiley(sosourl) { var sososmilieid = sososmiliesurl2id(sosourl); if(sososmilieid) { var code = sososmileycode(sososmilieid); var src = bbcode2html_sososmilies(sososmilieid, true); checkFocus(); if(wysiwyg && allowsmilies && (!$('smileyoff') || $('smileyoff').checked == false)) { insertText(bbcode2html_sososmilies(sososmilieid), false); } else { code += ' '; insertText(code, strlen(code), 0); } hideMenu(); } } function insertfastpostSmiley(sosourl, textareaid) { var sososmilieid = sososmiliesurl2id(sosourl); if(sososmilieid) { var code = sososmileycode(sososmilieid); seditor_insertunit(textareaid, code); } } var TimeCounter = 0; function SOSO_EXP_CHECK(textareaid) { TimeCounter++; if(typeof editorid!='undefined' && textareaid == 'newthread') { var eExpBtn = $(editorid + '_sml'), eEditBox = $(editorid + '_textarea'); eExpBtn.setAttribute('init', 1); fFillEditBox = function(editbox, url) { insertsosoSmiley(url); }; } else if(in_array(textareaid, ['post', 'fastpost', 'pm', 'send', 'reply', 'sightml'])) { var eExpBtn = $(textareaid+"sml"), eEditBox = $(textareaid+"message"), fFillEditBox = function(editbox, url) { insertfastpostSmiley(url, textareaid); }; } else { return false; } if(typeof SOSO_EXP != "undefined" && typeof SOSO_EXP.Register == "function" && eExpBtn && eEditBox) { var pos = 'bottom'; if(in_array(textareaid, ['fastpost', 'pm', 'reply'])) { pos = 'top'; } eExpBtn.onclick = function() { return null; }; SOSO_EXP.Register(60001, 'discuz', eExpBtn, pos, eEditBox, fFillEditBox); if(typeof editdoc != "undefined" && editdoc && editdoc.body) { editdoc.body.onclick = extrafunc_soso_showmenu; document.body.onclick = extrafunc_soso_showmenu; } return true; } else if(TimeCounter<15) { setTimeout(function () { SOSO_EXP_CHECK(textareaid) ; }, 2000); return false; } else if(typeof SOSO_EXP == "undefined" || typeof SOSO_EXP.Register != "function") { return false; } else { return false; } } if(typeof EXTRAFUNC['bbcode2html'] != "undefined") { EXTRAFUNC['bbcode2html']['soso'] = 'extrafunc_soso_bbcode2html'; EXTRAFUNC['html2bbcode']['soso'] = 'extrafunc_soso_html2bbcode'; if(typeof editdoc != "undefined") { EXTRAFUNC['showmenu']['soso'] = 'extrafunc_soso_showmenu'; } } function extrafunc_soso_showmenu() { SOSO_EXP.Platform.hideBox(); } function extrafunc_soso_bbcode2html() { if(!fetchCheckbox('smileyoff') && allowsmilies) { EXTRASTR = EXTRASTR.replace(/\{\:soso_(\w+)\:\}/ig, function($1, $2) { return bbcode2html_sososmilies($2);}); } return EXTRASTR; } function extrafunc_soso_html2bbcode() { if((allowhtml && fetchCheckbox('htmlon')) || (!fetchCheckbox('bbcodeoff') && allowbbcode)) { EXTRASTR = html2bbcode_sososmilies(EXTRASTR); } return EXTRASTR; }
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','cy',{placeholder:{title:"Priodweddau'r Daliwr Geiriau",toolbar:'Creu Daliwr Geiriau',text:'Testun y Daliwr Geiriau',edit:"Golygu'r Dailwr Geiriau",textMissing:"Mae'n rhaid i'r daliwr geiriau gynnwys testun."}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','tr',{placeholder:{title:'Yer tutucu özellikleri',toolbar:'Yer tutucu oluşturun',text:'Yer tutucu metini',edit:'Yer tutucuyu düzenle',textMissing:'Yer tutucu metin içermelidir.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','nb',{placeholder:{title:'Egenskaper for plassholder',toolbar:'Opprett plassholder',text:'Tekst for plassholder',edit:'Rediger plassholder',textMissing:'Plassholderen må inneholde tekst.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','fr',{placeholder:{title:"Propriétés de l'Espace réservé",toolbar:"Créer l'Espace réservé",text:"Texte de l'Espace réservé",edit:"Modifier l'Espace réservé",textMissing:"L'Espace réservé doit contenir du texte."}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','fa',{placeholder:{title:'ویژگیهای محل نگهداری',toolbar:'ایجاد یک محل نگهداری',text:'متن محل نگهداری',edit:'ویرایش محل نگهداری',textMissing:'محل نگهداری باید محتوی متن باشد.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','eo',{placeholder:{title:'Atributoj de la rezervita spaco',toolbar:'Krei la rezervitan spacon',text:'Texto de la rezervita spaco',edit:'Modifi la rezervitan spacon',textMissing:'La rezervita spaco devas enteni tekston.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','uk',{placeholder:{title:'Налаштування Заповнювача',toolbar:'Створити Заповнювач',text:'Текст Заповнювача',edit:'Редагувати Заповнювач',textMissing:'Заповнювач повинен містити текст.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','he',{placeholder:{title:'מאפייני שומר מקום',toolbar:'צור שומר מקום',text:'תוכן שומר המקום',edit:'ערוך שומר מקום',textMissing:'שומר המקום חייב להכיל טקסט.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','de',{placeholder:{title:'Platzhalter Einstellungen',toolbar:'Platzhalter erstellen',text:'Platzhalter Text',edit:'Platzhalter bearbeiten',textMissing:'Der Platzhalter muss einen Text beinhalten.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','no',{placeholder:{title:'Egenskaper for plassholder',toolbar:'Opprett plassholder',text:'Tekst for plassholder',edit:'Rediger plassholder',textMissing:'Plassholderen må inneholde tekst.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','el',{placeholder:{title:'Ιδιότητες Υποκατάστατου Κειμένου',toolbar:'Δημιουργία Υποκατάσταστου Κειμένου',text:'Υποκαθιστόμενο Κείμενο',edit:'Επεξεργασία Υποκατάσταστου Κειμένου',textMissing:'Πρέπει να υπάρχει υποκαθιστόμενο κείμενο.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','vi',{placeholder:{title:'Thuộc tính đặt chỗ',toolbar:'Tạo đặt chỗ',text:'Văn bản đặt chỗ',edit:'Edit Placeholder',textMissing:'The placeholder must contain text.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','it',{placeholder:{title:'Proprietà segnaposto',toolbar:'Crea segnaposto',text:'Testo segnaposto',edit:'Modifica segnaposto',textMissing:'Il segnaposto deve contenere del testo.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','nl',{placeholder:{title:'Eigenschappen placeholder',toolbar:'Placeholder aanmaken',text:'Placeholder tekst',edit:'Placeholder wijzigen',textMissing:'De placeholder moet tekst bevatten.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','da',{placeholder:{title:'Egenskaber for pladsholder',toolbar:'Opret pladsholder',text:'Tekst til pladsholder',edit:'Rediger pladsholder',textMissing:'Pladsholder skal indeholde tekst'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','et',{placeholder:{title:'Kohahoidja omadused',toolbar:'Kohahoidja loomine',text:'Kohahoidja tekst',edit:'Kohahoidja muutmine',textMissing:'Kohahoidja peab sisaldama teksti.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','pl',{placeholder:{title:'Właściwości wypełniacza',toolbar:'Utwórz wypełniacz',text:'Tekst wypełnienia',edit:'Edytuj wypełnienie',textMissing:'Wypełnienie musi posiadać jakiś tekst.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','cs',{placeholder:{title:'Vlastnosti vyhrazeného prostoru',toolbar:'Vytvořit vyhrazený prostor',text:'Vyhrazený text',edit:'Upravit vyhrazený prostor',textMissing:'Vyhrazený prostor musí obsahovat text.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','hr',{placeholder:{title:'Svojstva rezerviranog mjesta',toolbar:'Napravi rezervirano mjesto',text:'Tekst rezerviranog mjesta',edit:'Uredi rezervirano mjesto',textMissing:'Rezervirano mjesto mora sadržavati tekst.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','fi',{placeholder:{title:'Paikkamerkin ominaisuudet',toolbar:'Luo paikkamerkki',text:'Paikkamerkin teksti',edit:'Muokkaa paikkamerkkiä',textMissing:'Paikkamerkin täytyy sisältää tekstiä'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','ug',{placeholder:{title:'ئورۇن بەلگە خاسلىقى',toolbar:'ئورۇن بەلگە قۇر',text:'ئورۇن بەلگە تېكىستى',edit:'ئورۇن بەلگە تەھرىر',textMissing:'ئورۇن بەلگىسىدە چوقۇم تېكىست بولۇشى لازىم'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','zh-cn',{placeholder:{title:'占位符属性',toolbar:'创建占位符',text:'占位符文字',edit:'编辑占位符',textMissing:'占位符必需包含有文字'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','bg',{placeholder:{title:'Настройки на контейнера',toolbar:'Нов контейнер',text:'Текст за контейнера',edit:'Промяна на контейнер',textMissing:'Контейнера трябва да съдържа текст.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('placeholder','en',{placeholder:{title:'Placeholder Properties',toolbar:'Create Placeholder',text:'Placeholder Text',edit:'Edit Placeholder',textMissing:'The placeholder must contain text.'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add('docprops',{init:function(a){var b=new CKEDITOR.dialogCommand('docProps');b.modes={wysiwyg:a.config.fullPage};a.addCommand('docProps',b);CKEDITOR.dialog.add('docProps',this.path+'dialogs/docprops.js');a.ui.addButton('DocProps',{label:a.lang.docprops.label,command:'docProps'});}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','cy',{uicolor:{title:"Dewisydd Lliwiau'r UI",preview:'Rhagolwg Byw',config:"Gludwch y llinyn hwn i'ch ffeil config.js",predefined:"Setiau lliw wedi'u cyn-ddiffinio"}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','tr',{uicolor:{title:'UI Renk Seçicisi',preview:'Canlı önizleme',config:'Bu dizeyi config.js dosyasının içine yapıştırın',predefined:'Önceden tanımlanmış renk kümeleri'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','nb',{uicolor:{title:'Fargevelger for brukergrensesnitt',preview:'Forhåndsvisning i sanntid',config:'Lim inn følgende tekst i din config.js-fil',predefined:'Forhåndsdefinerte fargesett'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','fr',{uicolor:{title:'UI Sélecteur de couleur',preview:'Aperçu',config:'Collez cette chaîne de caractères dans votre fichier config.js',predefined:'Palettes de couleurs prédéfinies'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','fa',{uicolor:{title:'انتخاب رنگ UI',preview:'پیشنمایش زنده',config:'این رشته را در فایل config.js خود بچسبانید.',predefined:'مجموعه رنگ از پیش تعریف شده'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','eo',{uicolor:{title:'UI Kolorselektilo',preview:'Vidigi la aspekton',config:'Gluu tiun signoĉenon en vian dosieron config.js',predefined:'Antaŭdifinita koloraro'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','uk',{uicolor:{title:'Color Picker Інтерфейс',preview:'Перегляд наживо',config:'Вставте цей рядок у файл config.js',predefined:'Стандартний набір кольорів'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','he',{uicolor:{title:'בחירת צבע ממשק משתמש',preview:'תצוגה מקדימה',config:'הדבק את הטקסט הבא לתוך הקובץ config.js',predefined:'קבוצות צבעים מוגדרות מראש'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','de',{uicolor:{title:'UI Pipette',preview:'Live-Vorschau',config:"Fügen Sie diese Zeichenfolge in die 'config.js' Datei.",predefined:'Vordefinierte Farbsätze'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','no',{uicolor:{title:'Fargevelger for brukergrensesnitt',preview:'Forhåndsvisning i sanntid',config:'Lim inn følgende tekst i din config.js-fil',predefined:'Forhåndsdefinerte fargesett'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','el',{uicolor:{title:'Διεπαφή Επιλογέα Χρωμάτων',preview:'Ζωντανή Προεπισκόπηση',config:'Επικολλήστε αυτό το κείμενο στο αρχείο config.js',predefined:'Προκαθορισμένα σύνολα χρωμάτων'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','vi',{uicolor:{title:'Giao diện người dùng Color Picker',preview:'Xem trước trực tiếp',config:'Dán chuỗi này vào tập tin config.js của bạn',predefined:'Tập màu định nghĩa sẵn'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','mk',{uicolor:{title:'Палета со бои',preview:'Преглед',config:'Залепи го овој текст во config.js датотеката',predefined:'Предефинирани множества на бои'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','it',{uicolor:{title:'Selettore Colore UI',preview:'Anteprima Live',config:'Incolla questa stringa nel tuo file config.js',predefined:'Set di colori predefiniti'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','nl',{uicolor:{title:'UI Kleurenkiezer',preview:'Live voorbeeld',config:'Plak deze tekst in jouw config.js bestand',predefined:'Voorgedefinieerde kleurensets'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','da',{uicolor:{title:'Brugerflade på farvevælger',preview:'Vis liveeksempel',config:'Indsæt denne streng i din config.js fil',predefined:'Prædefinerede farveskemaer'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','et',{uicolor:{title:'Värvivalija kasutajaliides',preview:'Automaatne eelvaade',config:'Aseta see sõne oma config.js faili.',predefined:'Eelmääratud värvikomplektid'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','pl',{uicolor:{title:'Wybór koloru interfejsu',preview:'Podgląd na żywo',config:'Wklej poniższy łańcuch znaków do pliku config.js:',predefined:'Predefiniowane zestawy kolorów'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','cs',{uicolor:{title:'Výběr barvy rozhraní',preview:'Živý náhled',config:'Vložte tento řetězec do Vašeho souboru config.js',predefined:'Přednastavené sady barev'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','hr',{uicolor:{title:'UI odabir boja',preview:'Pregled uživo',config:'Zalijepite ovaj tekst u Vašu config.js datoteku.',predefined:'Već postavljeni setovi boja'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','fi',{uicolor:{title:'Käyttöliittymän värivalitsin',preview:'Esikatsele',config:'Liitä tämä merkkijono config.js tiedostoosi',predefined:'Esimääritellyt värijoukot'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','ug',{uicolor:{title:'ئىشلەتكۈچى ئارايۈزى رەڭ تاللىغۇچ',preview:'شۇئان ئالدىن كۆزىتىش',config:'بۇ ھەرپ تىزىقىنى config.js ھۆججەتكە چاپلايدۇ',predefined:'ئالدىن بەلگىلەنگەن رەڭلەر'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','zh-cn',{uicolor:{title:'用户界面颜色选择器',preview:'即时预览',config:'粘贴此字符串到你的 config.js 文件',predefined:'预定义颜色集'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','bg',{uicolor:{title:'ПИ избор на цвят',preview:'Преглед',config:'Вмъкнете този низ във Вашия config.js fajl',predefined:'Предефинирани цветови палитри'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('uicolor','en',{uicolor:{title:'UI Color Picker',preview:'Live preview',config:'Paste this string into your config.js file',predefined:'Predefined color sets'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','cy',{devTools:{title:'Gwybodaeth am yr Elfen',dialogName:'Enw ffenestr y deialog',tabName:"Enw'r tab",elementId:'ID yr Elfen',elementType:'Math yr elfen'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','tr',{devTools:{title:'Eleman Bilgisi',dialogName:'İletişim pencere ismi',tabName:'Sekme adı',elementId:'Eleman ID',elementType:'Eleman türü'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','nb',{devTools:{title:'Elementinformasjon',dialogName:'Navn på dialogvindu',tabName:'Navn på fane',elementId:'Element-ID',elementType:'Elementtype'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','fr',{devTools:{title:"Information sur l'élément",dialogName:'Nom de la fenêtre de dialogue',tabName:"Nom de l'onglet",elementId:"ID de l'élément",elementType:"Type de l'élément"}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','fa',{devTools:{title:'اطلاعات عنصر',dialogName:'نام پنجره محاورهای',tabName:'نام برگه',elementId:'ID عنصر',elementType:'نوع عنصر'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','eo',{devTools:{title:'Informo pri la elemento',dialogName:'Nomo de la dialogfenestro',tabName:'Langetnomo',elementId:'ID de la elemento',elementType:'Tipo de la elemento'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','uk',{devTools:{title:'Відомості про Елемент',dialogName:'Заголовок діалогового вікна',tabName:'Назва вкладки',elementId:'Ідентифікатор Елемента',elementType:'Тип Елемента'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','he',{devTools:{title:'מידע על האלמנט',dialogName:'שם הדיאלוג',tabName:'שם הטאב',elementId:'ID של האלמנט',elementType:'סוג האלמנט'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','de',{devTools:{title:'Elementinformation',dialogName:'Dialogfenstername',tabName:'Reitername',elementId:'Element ID',elementType:'Elementtyp'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','no',{devTools:{title:'Elementinformasjon',dialogName:'Navn på dialogvindu',tabName:'Navn på fane',elementId:'Element-ID',elementType:'Elementtype'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','el',{devTools:{title:'Πληροφορίες Στοιχείου',dialogName:'Όνομα παραθύρου διαλόγου',tabName:'Όνομα καρτέλας',elementId:'ID Στοιχείου',elementType:'Τύπος στοιχείου'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','vi',{devTools:{title:'Thông tin thành ph',dialogName:'Tên hộp tho',tabName:'Tên th',elementId:'Mã thành ph',elementType:'Loại thành ph'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','it',{devTools:{title:'Informazioni elemento',dialogName:'Nome finestra di dialogo',tabName:'Nome Tab',elementId:'ID Elemento',elementType:'Tipo elemento'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','nl',{devTools:{title:'Elementinformatie',dialogName:'Naam dialoogvenster',tabName:'Tabnaam',elementId:'Element ID',elementType:'Elementtype'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','da',{devTools:{title:'Information på elementet',dialogName:'Dialogboks',tabName:'Tab beskrivelse',elementId:'ID på element',elementType:'Type af element'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','et',{devTools:{title:'Elemendi andmed',dialogName:'Dialoogiakna nimi',tabName:'Saki nimi',elementId:'Elemendi ID',elementType:'Elemendi liik'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','gu',{devTools:{title:'પ્રાથમિક માહિતી',dialogName:'વિન્ડોનું નામ',tabName:'ટેબનું નામ',elementId:'પ્રાથમિક આઈડી',elementType:'પ્રાથમિક પ્રકાર'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','pl',{devTools:{title:'Informacja o elemencie',dialogName:'Nazwa okna dialogowego',tabName:'Nazwa zakładki',elementId:'ID elementu',elementType:'Typ elementu'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','cs',{devTools:{title:'Informace o prvku',dialogName:'Název dialogového okna',tabName:'Název karty',elementId:'ID prvku',elementType:'Typ prvku'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','hr',{devTools:{title:'Informacije elementa',dialogName:'Naziv prozora za dijalog',tabName:'Naziva jahača',elementId:'ID elementa',elementType:'Vrsta elementa'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','fi',{devTools:{title:'Elementin tiedot',dialogName:'Dialogi-ikkunan nimi',tabName:'Välilehden nimi',elementId:'Elementin ID',elementType:'Elementin tyyppi'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','ug',{devTools:{title:'ئېلېمېنت ئۇچۇرى',dialogName:'سۆزلەشكۈ كۆزنەك ئاتى',tabName:'Tab ئاتى',elementId:'ئېلېمېنت كىملىكى',elementType:'ئېلېمېنت تىپى'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','zh-cn',{devTools:{title:'元素信息',dialogName:'对话框窗口名称',tabName:'Tab 名称',elementId:'元素 ID',elementType:'元素类型'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','bg',{devTools:{title:'Информация за елемента',dialogName:'Име на диалоговия прозорец',tabName:'Име на таб',elementId:'ID на елемента',elementType:'Тип на елемента'}});
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang('devtools','en',{devTools:{title:'Element Information',dialogName:'Dialog window name',tabName:'Tab name',elementId:'Element ID',elementType:'Element type'}});
JavaScript
/* Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editorConfig = function( config ) { config.skin = 'kama'; config.language = 'vi'; config.entities = false; config.htmlEncodeOutput = false; //config.scayt_autoStartup = true; //config.removePlugins = 'scayt'; //config.disableNativeSpellChecker = true; config.toolbar = 'All'; config.toolbar_All = [ ['Source','-','Save','NewPage','Preview','-','Templates'], ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], ['BidiLtr', 'BidiRtl'], '/', ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Anchor'], ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'], '/', ['Styles','Format','Font','FontSize'], ['TextColor','BGColor'], ['Maximize', 'ShowBlocks'] ]; config.toolbar_Full = [ ['Source','-','Preview','ShowBlocks','Templates','Cut','Copy','Paste','PasteText','PasteFromWord','Undo','Redo','Find','Replace','SelectAll','RemoveFormat','Link','Unlink','Anchor', 'Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'], '/', ['Format','Font','FontSize','Bold','Italic','Underline','Strike','Subscript','Superscript','NumberedList','BulletedList','Outdent','Indent','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock', 'Maximize','TextColor','BGColor'] ]; config.toolbar_Basic = [ ['Source','-','Bold','Italic','Underline','Strike','Subscript','Superscript','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','NumberedList','BulletedList','TextColor','BGColor','Link','Unlink'] ]; config.toolbar_Simple = [ ['Bold','Italic','Underline','Strike','Subscript','Superscript','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','NumberedList','BulletedList','TextColor','BGColor'] ]; };
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'myDialog', function( editor ) { return { title : 'My Dialog', minWidth : 400, minHeight : 200, contents : [ { id : 'tab1', label : 'First Tab', title : 'First Tab', elements : [ { id : 'input1', type : 'text', label : 'Input 1' } ] } ] }; } );
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ // This file is not required by CKEditor and may be safely ignored. // It is just a helper file that displays a red message about browser compatibility // at the top of the samples (if incompatible browser is detected). if ( window.CKEDITOR ) { (function() { var showCompatibilityMsg = function() { var env = CKEDITOR.env; var html = '<p><strong>Your browser is not compatible with CKEditor.</strong>'; var browsers = { gecko : 'Firefox 2.0', ie : 'Internet Explorer 6.0', opera : 'Opera 9.5', webkit : 'Safari 3.0' }; var alsoBrowsers = ''; for ( var key in env ) { if ( browsers[ key ] ) { if ( env[key] ) html += ' CKEditor is compatible with ' + browsers[ key ] + ' or higher.'; else alsoBrowsers += browsers[ key ] + '+, '; } } alsoBrowsers = alsoBrowsers.replace( /\+,([^,]+), $/, '+ and $1' ); html += ' It is also compatible with ' + alsoBrowsers + '.'; html += '</p><p>With non compatible browsers, you should still be able to see and edit the contents (HTML) in a plain text field.</p>'; var alertsEl = document.getElementById( 'alerts' ); alertsEl && ( alertsEl.innerHTML = html ); }; var onload = function() { // Show a friendly compatibility message as soon as the page is loaded, // for those browsers that are not compatible with CKEditor. if ( !CKEDITOR.env.isCompatible ) showCompatibilityMsg(); }; // Register the onload listener. if ( window.addEventListener ) window.addEventListener( 'load', onload, false ); else if ( window.attachEvent ) window.attachEvent( 'onload', onload ); })(); }
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'button', { beforeInit : function( editor ) { editor.ui.addHandler( CKEDITOR.UI_BUTTON, CKEDITOR.ui.button.handler ); } }); /** * Button UI element. * @constant * @example */ CKEDITOR.UI_BUTTON = 'button'; /** * Represents a button UI element. This class should not be called directly. To * create new buttons use {@link CKEDITOR.ui.prototype.addButton} instead. * @constructor * @param {Object} definition The button definition. * @example */ CKEDITOR.ui.button = function( definition ) { // Copy all definition properties to this object. CKEDITOR.tools.extend( this, definition, // Set defaults. { title : definition.label, className : definition.className || ( definition.command && 'cke_button_' + definition.command ) || '', click : definition.click || function( editor ) { editor.execCommand( definition.command ); } }); this._ = {}; }; /** * Transforms a button definition in a {@link CKEDITOR.ui.button} instance. * @type Object * @example */ CKEDITOR.ui.button.handler = { create : function( definition ) { return new CKEDITOR.ui.button( definition ); } }; ( function() { CKEDITOR.ui.button.prototype = { /** * Renders the button. * @param {CKEDITOR.editor} editor The editor instance which this button is * to be used by. * @param {Array} output The output array to which append the HTML relative * to this button. * @example */ render : function( editor, output ) { var env = CKEDITOR.env, id = this._.id = CKEDITOR.tools.getNextId(), classes = '', command = this.command, // Get the command name. clickFn; this._.editor = editor; var instance = { id : id, button : this, editor : editor, focus : function() { var element = CKEDITOR.document.getById( id ); element.focus(); }, execute : function() { // IE 6 needs some time before execution (#7922) if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 ) CKEDITOR.tools.setTimeout( function(){ this.button.click( editor ); }, 0, this ); else this.button.click( editor ); } }; var keydownFn = CKEDITOR.tools.addFunction( function( ev ) { if ( instance.onkey ) { ev = new CKEDITOR.dom.event( ev ); return ( instance.onkey( instance, ev.getKeystroke() ) !== false ); } }); var focusFn = CKEDITOR.tools.addFunction( function( ev ) { var retVal; if ( instance.onfocus ) retVal = ( instance.onfocus( instance, new CKEDITOR.dom.event( ev ) ) !== false ); // FF2: prevent focus event been bubbled up to editor container, which caused unexpected editor focus. if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) ev.preventBubble(); return retVal; }); instance.clickFn = clickFn = CKEDITOR.tools.addFunction( instance.execute, instance ); // Indicate a mode sensitive button. if ( this.modes ) { var modeStates = {}; function updateState() { // "this" is a CKEDITOR.ui.button instance. var mode = editor.mode; if ( mode ) { // Restore saved button state. var state = this.modes[ mode ] ? modeStates[ mode ] != undefined ? modeStates[ mode ] : CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED; this.setState( editor.readOnly && !this.readOnly ? CKEDITOR.TRISTATE_DISABLED : state ); } } editor.on( 'beforeModeUnload', function() { if ( editor.mode && this._.state != CKEDITOR.TRISTATE_DISABLED ) modeStates[ editor.mode ] = this._.state; }, this ); editor.on( 'mode', updateState, this); // If this button is sensitive to readOnly state, update it accordingly. !this.readOnly && editor.on( 'readOnly', updateState, this); } else if ( command ) { // Get the command instance. command = editor.getCommand( command ); if ( command ) { command.on( 'state', function() { this.setState( command.state ); }, this); classes += 'cke_' + ( command.state == CKEDITOR.TRISTATE_ON ? 'on' : command.state == CKEDITOR.TRISTATE_DISABLED ? 'disabled' : 'off' ); } } if ( !command ) classes += 'cke_off'; if ( this.className ) classes += ' ' + this.className; output.push( '<span class="cke_button' + ( this.icon && this.icon.indexOf( '.png' ) == -1 ? ' cke_noalphafix' : '' ) + '">', '<a id="', id, '"' + ' class="', classes, '"', env.gecko && env.version >= 10900 && !env.hc ? '' : '" href="javascript:void(\''+ ( this.title || '' ).replace( "'", '' )+ '\')"', ' title="', this.title, '"' + ' tabindex="-1"' + ' hidefocus="true"' + ' role="button"' + ' aria-labelledby="' + id + '_label"' + ( this.hasArrow ? ' aria-haspopup="true"' : '' ) ); // Some browsers don't cancel key events in the keydown but in the // keypress. // TODO: Check if really needed for Gecko+Mac. if ( env.opera || ( env.gecko && env.mac ) ) { output.push( ' onkeypress="return false;"' ); } // With Firefox, we need to force the button to redraw, otherwise it // will remain in the focus state. if ( env.gecko ) { output.push( ' onblur="this.style.cssText = this.style.cssText;"' ); } output.push( ' onkeydown="return CKEDITOR.tools.callFunction(', keydownFn, ', event);"' + ' onfocus="return CKEDITOR.tools.callFunction(', focusFn,', event);" ' + ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) + // #188 '="CKEDITOR.tools.callFunction(', clickFn, ', this); return false;">' + '<span class="cke_icon"' ); if ( this.icon ) { var offset = ( this.iconOffset || 0 ) * -16; output.push( ' style="background-image:url(', CKEDITOR.getUrl( this.icon ), ');background-position:0 ' + offset + 'px;"' ); } output.push( '>&nbsp;</span>' + '<span id="', id, '_label" class="cke_label">', this.label, '</span>' ); if ( this.hasArrow ) { output.push( '<span class="cke_buttonarrow">' // BLACK DOWN-POINTING TRIANGLE + ( CKEDITOR.env.hc ? '&#9660;' : '&nbsp;' ) + '</span>' ); } output.push( '</a>', '</span>' ); if ( this.onRender ) this.onRender(); return instance; }, setState : function( state ) { if ( this._.state == state ) return false; this._.state = state; var element = CKEDITOR.document.getById( this._.id ); if ( element ) { element.setState( state ); state == CKEDITOR.TRISTATE_DISABLED ? element.setAttribute( 'aria-disabled', true ) : element.removeAttribute( 'aria-disabled' ); state == CKEDITOR.TRISTATE_ON ? element.setAttribute( 'aria-pressed', true ) : element.removeAttribute( 'aria-pressed' ); return true; } else return false; } }; })(); /** * Adds a button definition to the UI elements list. * @param {String} name The button name. * @param {Object} definition The button definition. * @example * editorInstance.ui.addButton( 'MyBold', * { * label : 'My Bold', * command : 'bold' * }); */ CKEDITOR.ui.prototype.addButton = function( name, definition ) { this.add( name, CKEDITOR.UI_BUTTON, definition ); };
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ (function() { function protectFormStyles( formElement ) { if ( !formElement || formElement.type != CKEDITOR.NODE_ELEMENT || formElement.getName() != 'form' ) return []; var hijackRecord = [], hijackNames = [ 'style', 'className' ]; for ( var i = 0 ; i < hijackNames.length ; i++ ) { var name = hijackNames[i]; var $node = formElement.$.elements.namedItem( name ); if ( $node ) { var hijackNode = new CKEDITOR.dom.element( $node ); hijackRecord.push( [ hijackNode, hijackNode.nextSibling ] ); hijackNode.remove(); } } return hijackRecord; } function restoreFormStyles( formElement, hijackRecord ) { if ( !formElement || formElement.type != CKEDITOR.NODE_ELEMENT || formElement.getName() != 'form' ) return; if ( hijackRecord.length > 0 ) { for ( var i = hijackRecord.length - 1 ; i >= 0 ; i-- ) { var node = hijackRecord[i][0]; var sibling = hijackRecord[i][1]; if ( sibling ) node.insertBefore( sibling ); else node.appendTo( formElement ); } } } function saveStyles( element, isInsideEditor ) { var data = protectFormStyles( element ); var retval = {}; var $element = element.$; if ( !isInsideEditor ) { retval[ 'class' ] = $element.className || ''; $element.className = ''; } retval.inline = $element.style.cssText || ''; if ( !isInsideEditor ) // Reset any external styles that might interfere. (#2474) $element.style.cssText = 'position: static; overflow: visible'; restoreFormStyles( data ); return retval; } function restoreStyles( element, savedStyles ) { var data = protectFormStyles( element ); var $element = element.$; if ( 'class' in savedStyles ) $element.className = savedStyles[ 'class' ]; if ( 'inline' in savedStyles ) $element.style.cssText = savedStyles.inline; restoreFormStyles( data ); } function refreshCursor( editor ) { // Refresh all editor instances on the page (#5724). var all = CKEDITOR.instances; for ( var i in all ) { var one = all[ i ]; if ( one.mode == 'wysiwyg' && !one.readOnly ) { var body = one.document.getBody(); // Refresh 'contentEditable' otherwise // DOM lifting breaks design mode. (#5560) body.setAttribute( 'contentEditable', false ); body.setAttribute( 'contentEditable', true ); } } if ( editor.focusManager.hasFocus ) { editor.toolbox.focus(); editor.focus(); } } /** * Adding an iframe shim to this element, OR removing the existing one if already applied. * Note: This will only affect IE version below 7. */ function createIframeShim( element ) { if ( !CKEDITOR.env.ie || CKEDITOR.env.version > 6 ) return null; var shim = CKEDITOR.dom.element.createFromHtml( '<iframe frameborder="0" tabindex="-1"' + ' src="javascript:' + 'void((function(){' + 'document.open();' + ( CKEDITOR.env.isCustomDomain() ? 'document.domain=\'' + this.getDocument().$.domain + '\';' : '' ) + 'document.close();' + '})())"' + ' style="display:block;position:absolute;z-index:-1;' + 'progid:DXImageTransform.Microsoft.Alpha(opacity=0);' + '"></iframe>' ); return element.append( shim, true ); } CKEDITOR.plugins.add( 'maximize', { init : function( editor ) { var lang = editor.lang; var mainDocument = CKEDITOR.document, mainWindow = mainDocument.getWindow(); // Saved selection and scroll position for the editing area. var savedSelection, savedScroll; // Saved scroll position for the outer window. var outerScroll; var shim; // Saved resize handler function. function resizeHandler() { var viewPaneSize = mainWindow.getViewPaneSize(); shim && shim.setStyles( { width : viewPaneSize.width + 'px', height : viewPaneSize.height + 'px' } ); editor.resize( viewPaneSize.width, viewPaneSize.height, null, true ); } // Retain state after mode switches. var savedState = CKEDITOR.TRISTATE_OFF; editor.addCommand( 'maximize', { // Disabled on iOS (#8307). modes : { wysiwyg : !CKEDITOR.env.iOS, source : !CKEDITOR.env.iOS }, readOnly : 1, editorFocus : false, exec : function() { var container = editor.container.getChild( 1 ); var contents = editor.getThemeSpace( 'contents' ); // Save current selection and scroll position in editing area. if ( editor.mode == 'wysiwyg' ) { var selection = editor.getSelection(); savedSelection = selection && selection.getRanges(); savedScroll = mainWindow.getScrollPosition(); } else { var $textarea = editor.textarea.$; savedSelection = !CKEDITOR.env.ie && [ $textarea.selectionStart, $textarea.selectionEnd ]; savedScroll = [ $textarea.scrollLeft, $textarea.scrollTop ]; } if ( this.state == CKEDITOR.TRISTATE_OFF ) // Go fullscreen if the state is off. { // Add event handler for resizing. mainWindow.on( 'resize', resizeHandler ); // Save the scroll bar position. outerScroll = mainWindow.getScrollPosition(); // Save and reset the styles for the entire node tree. var currentNode = editor.container; while ( ( currentNode = currentNode.getParent() ) ) { currentNode.setCustomData( 'maximize_saved_styles', saveStyles( currentNode ) ); currentNode.setStyle( 'z-index', editor.config.baseFloatZIndex - 1 ); } contents.setCustomData( 'maximize_saved_styles', saveStyles( contents, true ) ); container.setCustomData( 'maximize_saved_styles', saveStyles( container, true ) ); // Hide scroll bars. var styles = { overflow : CKEDITOR.env.webkit ? '' : 'hidden', // #6896 width : 0, height : 0 }; mainDocument.getDocumentElement().setStyles( styles ); !CKEDITOR.env.gecko && mainDocument.getDocumentElement().setStyle( 'position', 'fixed' ); !( CKEDITOR.env.gecko && CKEDITOR.env.quirks ) && mainDocument.getBody().setStyles( styles ); // Scroll to the top left (IE needs some time for it - #4923). CKEDITOR.env.ie ? setTimeout( function() { mainWindow.$.scrollTo( 0, 0 ); }, 0 ) : mainWindow.$.scrollTo( 0, 0 ); // Resize and move to top left. // Special treatment for FF Quirks (#7284) container.setStyle( 'position', CKEDITOR.env.gecko && CKEDITOR.env.quirks ? 'fixed' : 'absolute' ); container.$.offsetLeft; // SAFARI BUG: See #2066. container.setStyles( { 'z-index' : editor.config.baseFloatZIndex - 1, left : '0px', top : '0px' } ); shim = createIframeShim( container ); // IE6 select element penetration when maximized. (#4459) // Add cke_maximized class before resize handle since that will change things sizes (#5580) container.addClass( 'cke_maximized' ); resizeHandler(); // Still not top left? Fix it. (Bug #174) var offset = container.getDocumentPosition(); container.setStyles( { left : ( -1 * offset.x ) + 'px', top : ( -1 * offset.y ) + 'px' } ); // Fixing positioning editor chrome in Firefox break design mode. (#5149) CKEDITOR.env.gecko && refreshCursor( editor ); } else if ( this.state == CKEDITOR.TRISTATE_ON ) // Restore from fullscreen if the state is on. { // Remove event handler for resizing. mainWindow.removeListener( 'resize', resizeHandler ); // Restore CSS styles for the entire node tree. var editorElements = [ contents, container ]; for ( var i = 0 ; i < editorElements.length ; i++ ) { restoreStyles( editorElements[i], editorElements[i].getCustomData( 'maximize_saved_styles' ) ); editorElements[i].removeCustomData( 'maximize_saved_styles' ); } currentNode = editor.container; while ( ( currentNode = currentNode.getParent() ) ) { restoreStyles( currentNode, currentNode.getCustomData( 'maximize_saved_styles' ) ); currentNode.removeCustomData( 'maximize_saved_styles' ); } // Restore the window scroll position. CKEDITOR.env.ie ? setTimeout( function() { mainWindow.$.scrollTo( outerScroll.x, outerScroll.y ); }, 0 ) : mainWindow.$.scrollTo( outerScroll.x, outerScroll.y ); // Remove cke_maximized class. container.removeClass( 'cke_maximized' ); // Webkit requires a re-layout on editor chrome. (#6695) if ( CKEDITOR.env.webkit ) { container.setStyle( 'display', 'inline' ); setTimeout( function(){ container.setStyle( 'display', 'block' ); }, 0 ); } if ( shim ) { shim.remove(); shim = null; } // Emit a resize event, because this time the size is modified in // restoreStyles. editor.fire( 'resize' ); } this.toggleState(); // Toggle button label. var button = this.uiItems[ 0 ]; // Only try to change the button if it exists (#6166) if( button ) { var label = ( this.state == CKEDITOR.TRISTATE_OFF ) ? lang.maximize : lang.minimize; var buttonNode = editor.element.getDocument().getById( button._.id ); buttonNode.getChild( 1 ).setHtml( label ); buttonNode.setAttribute( 'title', label ); buttonNode.setAttribute( 'href', 'javascript:void("' + label + '");' ); } // Restore selection and scroll position in editing area. if ( editor.mode == 'wysiwyg' ) { if ( savedSelection ) { // Fixing positioning editor chrome in Firefox break design mode. (#5149) CKEDITOR.env.gecko && refreshCursor( editor ); editor.getSelection().selectRanges(savedSelection); var element = editor.getSelection().getStartElement(); element && element.scrollIntoView( true ); } else mainWindow.$.scrollTo( savedScroll.x, savedScroll.y ); } else { if ( savedSelection ) { $textarea.selectionStart = savedSelection[0]; $textarea.selectionEnd = savedSelection[1]; } $textarea.scrollLeft = savedScroll[0]; $textarea.scrollTop = savedScroll[1]; } savedSelection = savedScroll = null; savedState = this.state; }, canUndo : false } ); editor.ui.addButton( 'Maximize', { label : lang.maximize, command : 'maximize' } ); // Restore the command state after mode change, unless it has been changed to disabled (#6467) editor.on( 'mode', function() { var command = editor.getCommand( 'maximize' ); command.setState( command.state == CKEDITOR.TRISTATE_DISABLED ? CKEDITOR.TRISTATE_DISABLED : savedState ); }, null, null, 100 ); } } ); })();
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview Defines the {@link CKEDITOR.xml} class, which represents a * loaded XML document. */ (function() { CKEDITOR.plugins.add( 'xml', {}); /** * Represents a loaded XML document. * @constructor * @param {object|string} xmlObjectOrData A native XML (DOM document) object or * a string containing the XML definition to be loaded. * @example * var xml = <b>new CKEDITOR.xml( '<books><book title="My Book" /></books>' )</b>; */ CKEDITOR.xml = function( xmlObjectOrData ) { var baseXml = null; if ( typeof xmlObjectOrData == 'object' ) baseXml = xmlObjectOrData; else { var data = ( xmlObjectOrData || '' ).replace( /&nbsp;/g, '\xA0' ); if ( window.DOMParser ) baseXml = (new DOMParser()).parseFromString( data, 'text/xml' ); else if ( window.ActiveXObject ) { try { baseXml = new ActiveXObject( 'MSXML2.DOMDocument' ); } catch(e) { try { baseXml = new ActiveXObject( 'Microsoft.XmlDom' ); } catch(e) {} } if ( baseXml ) { baseXml.async = false; baseXml.resolveExternals = false; baseXml.validateOnParse = false; baseXml.loadXML( data ); } } } /** * The native XML (DOM document) used by the class instance. * @type object * @example */ this.baseXml = baseXml; }; CKEDITOR.xml.prototype = { /** * Get a single node from the XML document, based on a XPath query. * @param {String} xpath The XPath query to execute. * @param {Object} [contextNode] The XML DOM node to be used as the context * for the XPath query. The document root is used by default. * @returns {Object} A XML node element or null if the query has no results. * @example * // Create the XML instance. * var xml = new CKEDITOR.xml( '<list><item id="test1" /><item id="test2" /></list>' ); * // Get the first <item> node. * var itemNode = <b>xml.selectSingleNode( 'list/item' )</b>; * // Alert "item". * alert( itemNode.nodeName ); */ selectSingleNode : function( xpath, contextNode ) { var baseXml = this.baseXml; if ( contextNode || ( contextNode = baseXml ) ) { if ( CKEDITOR.env.ie || contextNode.selectSingleNode ) // IE return contextNode.selectSingleNode( xpath ); else if ( baseXml.evaluate ) // Others { var result = baseXml.evaluate( xpath, contextNode, null, 9, null); return ( result && result.singleNodeValue ) || null; } } return null; }, /** * Gets a list node from the XML document, based on a XPath query. * @param {String} xpath The XPath query to execute. * @param {Object} [contextNode] The XML DOM node to be used as the context * for the XPath query. The document root is used by default. * @returns {ArrayLike} An array containing all matched nodes. The array will * be empty if the query has no results. * @example * // Create the XML instance. * var xml = new CKEDITOR.xml( '<list><item id="test1" /><item id="test2" /></list>' ); * // Get the first <item> node. * var itemNodes = xml.selectSingleNode( 'list/item' ); * // Alert "item" twice, one for each <item>. * for ( var i = 0 ; i < itemNodes.length ; i++ ) * alert( itemNodes[i].nodeName ); */ selectNodes : function( xpath, contextNode ) { var baseXml = this.baseXml, nodes = []; if ( contextNode || ( contextNode = baseXml ) ) { if ( CKEDITOR.env.ie || contextNode.selectNodes ) // IE return contextNode.selectNodes( xpath ); else if ( baseXml.evaluate ) // Others { var result = baseXml.evaluate( xpath, contextNode, null, 5, null); if ( result ) { var node; while ( ( node = result.iterateNext() ) ) nodes.push( node ); } } } return nodes; }, /** * Gets the string representation of hte inner contents of a XML node, * based on a XPath query. * @param {String} xpath The XPath query to execute. * @param {Object} [contextNode] The XML DOM node to be used as the context * for the XPath query. The document root is used by default. * @returns {String} The textual representation of the inner contents of * the node or null if the query has no results. * @example * // Create the XML instance. * var xml = new CKEDITOR.xml( '<list><item id="test1" /><item id="test2" /></list>' ); * // Alert "<item id="test1" /><item id="test2" />". * alert( xml.getInnerXml( 'list' ) ); */ getInnerXml : function( xpath, contextNode ) { var node = this.selectSingleNode( xpath, contextNode ), xml = []; if ( node ) { node = node.firstChild; while ( node ) { if ( node.xml ) // IE xml.push( node.xml ); else if ( window.XMLSerializer ) // Others xml.push( ( new XMLSerializer() ).serializeToString( node ) ); node = node.nextSibling; } } return xml.length ? xml.join( '' ) : null; } }; })();
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'smiley', { requires : [ 'dialog' ], init : function( editor ) { editor.config.smiley_path = editor.config.smiley_path || ( this.path + 'images/' ); editor.addCommand( 'smiley', new CKEDITOR.dialogCommand( 'smiley' ) ); editor.ui.addButton( 'Smiley', { label : editor.lang.smiley.toolbar, command : 'smiley' }); CKEDITOR.dialog.add( 'smiley', this.path + 'dialogs/smiley.js' ); } } ); /** * The base path used to build the URL for the smiley images. It must end with * a slash. * @name CKEDITOR.config.smiley_path * @type String * @default <code><em>CKEDITOR.basePath</em> + 'plugins/smiley/images/'</code> * @example * config.smiley_path = 'http://www.example.com/images/smileys/'; * @example * config.smiley_path = '/images/smileys/'; */ /** * The file names for the smileys to be displayed. These files must be * contained inside the URL path defined with the * {@link CKEDITOR.config.smiley_path} setting. * @type Array * @default (see example) * @example * // This is actually the default value. * config.smiley_images = [ * 'regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif', * 'embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif', * 'devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif', * 'broken_heart.gif','kiss.gif','envelope.gif']; */ CKEDITOR.config.smiley_images = [ 'regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif', 'embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif', 'devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif', 'broken_heart.gif','kiss.gif','envelope.gif']; /** * The description to be used for each of the smileys defined in the * {@link CKEDITOR.config.smiley_images} setting. Each entry in this array list * must match its relative pair in the {@link CKEDITOR.config.smiley_images} * setting. * @type Array * @default The textual descriptions of smiley. * @example * // Default settings. * config.smiley_descriptions = * [ * 'smiley', 'sad', 'wink', 'laugh', 'frown', 'cheeky', 'blush', 'surprise', * 'indecision', 'angry', 'angel', 'cool', 'devil', 'crying', 'enlightened', 'no', * 'yes', 'heart', 'broken heart', 'kiss', 'mail' * ]; * @example * // Use textual emoticons as description. * config.smiley_descriptions = * [ * ':)', ':(', ';)', ':D', ':/', ':P', ':*)', ':-o', * ':|', '>:(', 'o:)', '8-)', '>:-)', ';(', '', '', '', * '', '', ':-*', '' * ]; */ CKEDITOR.config.smiley_descriptions = [ 'smiley', 'sad', 'wink', 'laugh', 'frown', 'cheeky', 'blush', 'surprise', 'indecision', 'angry', 'angel', 'cool', 'devil', 'crying', 'enlightened', 'no', 'yes', 'heart', 'broken heart', 'kiss', 'mail' ]; /** * The number of columns to be generated by the smilies matrix. * @name CKEDITOR.config.smiley_columns * @type Number * @default 8 * @since 3.3.2 * @example * config.smiley_columns = 6; */
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'smiley', function( editor ) { var config = editor.config, lang = editor.lang.smiley, images = config.smiley_images, columns = config.smiley_columns || 8, i; /** * Simulate "this" of a dialog for non-dialog events. * @type {CKEDITOR.dialog} */ var dialog; var onClick = function( evt ) { var target = evt.data.getTarget(), targetName = target.getName(); if ( targetName == 'a' ) target = target.getChild( 0 ); else if ( targetName != 'img' ) return; var src = target.getAttribute( 'cke_src' ), title = target.getAttribute( 'title' ); var img = editor.document.createElement( 'img', { attributes : { src : src, 'data-cke-saved-src' : src, title : title, alt : title, width : target.$.width, height : target.$.height } }); editor.insertElement( img ); dialog.hide(); evt.data.preventDefault(); }; var onKeydown = CKEDITOR.tools.addFunction( function( ev, element ) { ev = new CKEDITOR.dom.event( ev ); element = new CKEDITOR.dom.element( element ); var relative, nodeToMove; var keystroke = ev.getKeystroke(), rtl = editor.lang.dir == 'rtl'; switch ( keystroke ) { // UP-ARROW case 38 : // relative is TR if ( ( relative = element.getParent().getParent().getPrevious() ) ) { nodeToMove = relative.getChild( [element.getParent().getIndex(), 0] ); nodeToMove.focus(); } ev.preventDefault(); break; // DOWN-ARROW case 40 : // relative is TR if ( ( relative = element.getParent().getParent().getNext() ) ) { nodeToMove = relative.getChild( [element.getParent().getIndex(), 0] ); if ( nodeToMove ) nodeToMove.focus(); } ev.preventDefault(); break; // ENTER // SPACE case 32 : onClick( { data: ev } ); ev.preventDefault(); break; // RIGHT-ARROW case rtl ? 37 : 39 : // TAB case 9 : // relative is TD if ( ( relative = element.getParent().getNext() ) ) { nodeToMove = relative.getChild( 0 ); nodeToMove.focus(); ev.preventDefault(true); } // relative is TR else if ( ( relative = element.getParent().getParent().getNext() ) ) { nodeToMove = relative.getChild( [0, 0] ); if ( nodeToMove ) nodeToMove.focus(); ev.preventDefault(true); } break; // LEFT-ARROW case rtl ? 39 : 37 : // SHIFT + TAB case CKEDITOR.SHIFT + 9 : // relative is TD if ( ( relative = element.getParent().getPrevious() ) ) { nodeToMove = relative.getChild( 0 ); nodeToMove.focus(); ev.preventDefault(true); } // relative is TR else if ( ( relative = element.getParent().getParent().getPrevious() ) ) { nodeToMove = relative.getLast().getChild( 0 ); nodeToMove.focus(); ev.preventDefault(true); } break; default : // Do not stop not handled events. return; } }); // Build the HTML for the smiley images table. var labelId = CKEDITOR.tools.getNextId() + '_smiley_emtions_label'; var html = [ '<div>' + '<span id="' + labelId + '" class="cke_voice_label">' + lang.options +'</span>', '<table role="listbox" aria-labelledby="' + labelId + '" style="width:100%;height:100%" cellspacing="2" cellpadding="2"', CKEDITOR.env.ie && CKEDITOR.env.quirks ? ' style="position:absolute;"' : '', '><tbody>' ]; var size = images.length; for ( i = 0 ; i < size ; i++ ) { if ( i % columns === 0 ) html.push( '<tr>' ); var smileyLabelId = 'cke_smile_label_' + i + '_' + CKEDITOR.tools.getNextNumber(); html.push( '<td class="cke_dark_background cke_centered" style="vertical-align: middle;">' + '<a href="javascript:void(0)" role="option"', ' aria-posinset="' + ( i +1 ) + '"', ' aria-setsize="' + size + '"', ' aria-labelledby="' + smileyLabelId + '"', ' class="cke_smile cke_hand" tabindex="-1" onkeydown="CKEDITOR.tools.callFunction( ', onKeydown, ', event, this );">', '<img class="cke_hand" title="', config.smiley_descriptions[i], '"' + ' cke_src="', CKEDITOR.tools.htmlEncode( config.smiley_path + images[ i ] ), '" alt="', config.smiley_descriptions[i], '"', ' src="', CKEDITOR.tools.htmlEncode( config.smiley_path + images[ i ] ), '"', // IE BUG: Below is a workaround to an IE image loading bug to ensure the image sizes are correct. ( CKEDITOR.env.ie ? ' onload="this.setAttribute(\'width\', 2); this.removeAttribute(\'width\');" ' : '' ), '>' + '<span id="' + smileyLabelId + '" class="cke_voice_label">' +config.smiley_descriptions[ i ] + '</span>' + '</a>', '</td>' ); if ( i % columns == columns - 1 ) html.push( '</tr>' ); } if ( i < columns - 1 ) { for ( ; i < columns - 1 ; i++ ) html.push( '<td></td>' ); html.push( '</tr>' ); } html.push( '</tbody></table></div>' ); var smileySelector = { type : 'html', id : 'smileySelector', html : html.join( '' ), onLoad : function( event ) { dialog = event.sender; }, focus : function() { var self = this; // IE need a while to move the focus (#6539). setTimeout( function () { var firstSmile = self.getElement().getElementsByTag( 'a' ).getItem( 0 ); firstSmile.focus(); }, 0 ); }, onClick : onClick, style : 'width: 100%; border-collapse: separate;' }; return { title : editor.lang.smiley.title, minWidth : 270, minHeight : 120, contents : [ { id : 'tab1', label : '', title : '', expand : true, padding : 0, elements : [ smileySelector ] } ], buttons : [ CKEDITOR.dialog.cancelButton ] }; } );
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview The "sourcearea" plugin. It registers the "source" editing * mode, which displays the raw data being edited in the editor. */ CKEDITOR.plugins.add( 'sourcearea', { requires : [ 'editingblock' ], init : function( editor ) { var sourcearea = CKEDITOR.plugins.sourcearea, win = CKEDITOR.document.getWindow(); editor.on( 'editingBlockReady', function() { var textarea, onResize; editor.addMode( 'source', { load : function( holderElement, data ) { if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) holderElement.setStyle( 'position', 'relative' ); // Create the source area <textarea>. editor.textarea = textarea = new CKEDITOR.dom.element( 'textarea' ); textarea.setAttributes( { dir : 'ltr', tabIndex : CKEDITOR.env.webkit ? -1 : editor.tabIndex, 'role' : 'textbox', 'aria-label' : editor.lang.editorTitle.replace( '%1', editor.name ) }); textarea.addClass( 'cke_source' ); textarea.addClass( 'cke_enable_context_menu' ); editor.readOnly && textarea.setAttribute( 'readOnly', 'readonly' ); var styles = { // IE7 has overflow the <textarea> from wrapping table cell. width : CKEDITOR.env.ie7Compat ? '99%' : '100%', height : '100%', resize : 'none', outline : 'none', 'text-align' : 'left' }; // Having to make <textarea> fixed sized to conque the following bugs: // 1. The textarea height/width='100%' doesn't constraint to the 'td' in IE6/7. // 2. Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor // if text content within it has overflowed. (#4762) if ( CKEDITOR.env.ie ) { onResize = function() { // Holder rectange size is stretched by textarea, // so hide it just for a moment. textarea.hide(); textarea.setStyle( 'height', holderElement.$.clientHeight + 'px' ); textarea.setStyle( 'width', holderElement.$.clientWidth + 'px' ); // When we have proper holder size, show textarea again. textarea.show(); }; editor.on( 'resize', onResize ); win.on( 'resize', onResize ); setTimeout( onResize, 0 ); } // Reset the holder element and append the // <textarea> to it. holderElement.setHtml( '' ); holderElement.append( textarea ); textarea.setStyles( styles ); editor.fire( 'ariaWidget', textarea ); textarea.on( 'blur', function() { editor.focusManager.blur(); }); textarea.on( 'focus', function() { editor.focusManager.focus(); }); // The editor data "may be dirty" after this point. editor.mayBeDirty = true; // Set the <textarea> value. this.loadData( data ); var keystrokeHandler = editor.keystrokeHandler; if ( keystrokeHandler ) keystrokeHandler.attach( textarea ); setTimeout( function() { editor.mode = 'source'; editor.fire( 'mode', { previousMode : editor._.previousMode } ); }, ( CKEDITOR.env.gecko || CKEDITOR.env.webkit ) ? 100 : 0 ); }, loadData : function( data ) { textarea.setValue( data ); editor.fire( 'dataReady' ); }, getData : function() { return textarea.getValue(); }, getSnapshotData : function() { return textarea.getValue(); }, unload : function( holderElement ) { textarea.clearCustomData(); editor.textarea = textarea = null; if ( onResize ) { editor.removeListener( 'resize', onResize ); win.removeListener( 'resize', onResize ); } if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) holderElement.removeStyle( 'position' ); }, focus : function() { textarea.focus(); } }); }); editor.on( 'readOnly', function() { if ( editor.mode == 'source' ) { if ( editor.readOnly ) editor.textarea.setAttribute( 'readOnly', 'readonly' ); else editor.textarea.removeAttribute( 'readOnly' ); } }); editor.addCommand( 'source', sourcearea.commands.source ); if ( editor.ui.addButton ) { editor.ui.addButton( 'Source', { label : editor.lang.source, command : 'source' }); } editor.on( 'mode', function() { editor.getCommand( 'source' ).setState( editor.mode == 'source' ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF ); }); } }); /** * Holds the definition of commands an UI elements included with the sourcearea * plugin. * @example */ CKEDITOR.plugins.sourcearea = { commands : { source : { modes : { wysiwyg:1, source:1 }, editorFocus : false, readOnly : 1, exec : function( editor ) { if ( editor.mode == 'wysiwyg' ) editor.fire( 'saveSnapshot' ); editor.getCommand( 'source' ).setState( CKEDITOR.TRISTATE_DISABLED ); editor.setMode( editor.mode == 'source' ? 'wysiwyg' : 'source' ); }, canUndo : false } } };
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** @fileoverview The "dialogui" plugin. */ CKEDITOR.plugins.add( 'dialogui' ); (function() { var initPrivateObject = function( elementDefinition ) { this._ || ( this._ = {} ); this._['default'] = this._.initValue = elementDefinition['default'] || ''; this._.required = elementDefinition[ 'required' ] || false; var args = [ this._ ]; for ( var i = 1 ; i < arguments.length ; i++ ) args.push( arguments[i] ); args.push( true ); CKEDITOR.tools.extend.apply( CKEDITOR.tools, args ); return this._; }, textBuilder = { build : function( dialog, elementDefinition, output ) { return new CKEDITOR.ui.dialog.textInput( dialog, elementDefinition, output ); } }, commonBuilder = { build : function( dialog, elementDefinition, output ) { return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, elementDefinition, output ); } }, containerBuilder = { build : function( dialog, elementDefinition, output ) { var children = elementDefinition.children, child, childHtmlList = [], childObjList = []; for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ ) { var childHtml = []; childHtmlList.push( childHtml ); childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) ); } return new CKEDITOR.ui.dialog[ elementDefinition.type ]( dialog, childObjList, childHtmlList, output, elementDefinition ); } }, commonPrototype = { isChanged : function() { return this.getValue() != this.getInitValue(); }, reset : function( noChangeEvent ) { this.setValue( this.getInitValue(), noChangeEvent ); }, setInitValue : function() { this._.initValue = this.getValue(); }, resetInitValue : function() { this._.initValue = this._['default']; }, getInitValue : function() { return this._.initValue; } }, commonEventProcessors = CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, { onChange : function( dialog, func ) { if ( !this._.domOnChangeRegistered ) { dialog.on( 'load', function() { this.getInputElement().on( 'change', function() { // Make sure 'onchange' doesn't get fired after dialog closed. (#5719) if ( !dialog.parts.dialog.isVisible() ) return; this.fire( 'change', { value : this.getValue() } ); }, this ); }, this ); this._.domOnChangeRegistered = true; } this.on( 'change', func ); } }, true ), eventRegex = /^on([A-Z]\w+)/, cleanInnerDefinition = function( def ) { // An inner UI element should not have the parent's type, title or events. for ( var i in def ) { if ( eventRegex.test( i ) || i == 'title' || i == 'type' ) delete def[i]; } return def; }; CKEDITOR.tools.extend( CKEDITOR.ui.dialog, /** @lends CKEDITOR.ui.dialog */ { /** * Base class for all dialog elements with a textual label on the left. * @constructor * @example * @extends CKEDITOR.ui.dialog.uiElement * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>label</strong> (Required) The label string.</li> * <li><strong>labelLayout</strong> (Optional) Put 'horizontal' here if the * label element is to be layed out horizontally. Otherwise a vertical * layout will be used.</li> * <li><strong>widths</strong> (Optional) This applies only for horizontal * layouts - an 2-element array of lengths to specify the widths of the * label and the content element.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. * @param {Function} contentHtml * A function returning the HTML code string to be added inside the content * cell. */ labeledElement : function( dialog, elementDefinition, htmlList, contentHtml ) { if ( arguments.length < 4 ) return; var _ = initPrivateObject.call( this, elementDefinition ); _.labelId = CKEDITOR.tools.getNextId() + '_label'; var children = this._.children = []; /** @ignore */ var innerHTML = function() { var html = [], requiredClass = elementDefinition.required ? ' cke_required' : '' ; if ( elementDefinition.labelLayout != 'horizontal' ) html.push( '<label class="cke_dialog_ui_labeled_label' + requiredClass + '" ', ' id="'+ _.labelId + '"', ' for="' + _.inputId + '"', ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) +'>', elementDefinition.label, '</label>', '<div class="cke_dialog_ui_labeled_content"' + ( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ) + ' role="presentation">', contentHtml.call( this, dialog, elementDefinition ), '</div>' ); else { var hboxDefinition = { type : 'hbox', widths : elementDefinition.widths, padding : 0, children : [ { type : 'html', html : '<label class="cke_dialog_ui_labeled_label' + requiredClass + '"' + ' id="' + _.labelId + '"' + ' for="' + _.inputId + '"' + ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) +'>' + CKEDITOR.tools.htmlEncode( elementDefinition.label ) + '</span>' }, { type : 'html', html : '<span class="cke_dialog_ui_labeled_content"' + ( elementDefinition.controlStyle ? ' style="' + elementDefinition.controlStyle + '"' : '' ) + '>' + contentHtml.call( this, dialog, elementDefinition ) + '</span>' } ] }; CKEDITOR.dialog._.uiElementBuilders.hbox.build( dialog, hboxDefinition, html ); } return html.join( '' ); }; CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'div', null, { role : 'presentation' }, innerHTML ); }, /** * A text input with a label. This UI element class represents both the * single-line text inputs and password inputs in dialog boxes. * @constructor * @example * @extends CKEDITOR.ui.dialog.labeledElement * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>default</strong> (Optional) The default value.</li> * <li><strong>validate</strong> (Optional) The validation function. </li> * <li><strong>maxLength</strong> (Optional) The maximum length of text box * contents.</li> * <li><strong>size</strong> (Optional) The size of the text box. This is * usually overridden by the size defined by the skin, however.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ textInput : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; initPrivateObject.call( this, elementDefinition ); var domId = this._.inputId = CKEDITOR.tools.getNextId() + '_textInput', attributes = { 'class' : 'cke_dialog_ui_input_' + elementDefinition.type, id : domId, type : elementDefinition.type }, i; // Set the validator, if any. if ( elementDefinition.validate ) this.validate = elementDefinition.validate; // Set the max length and size. if ( elementDefinition.maxLength ) attributes.maxlength = elementDefinition.maxLength; if ( elementDefinition.size ) attributes.size = elementDefinition.size; if ( elementDefinition.inputStyle ) attributes.style = elementDefinition.inputStyle; // If user presses Enter in a text box, it implies clicking OK for the dialog. var me = this, keyPressedOnMe = false; dialog.on( 'load', function() { me.getInputElement().on( 'keydown', function( evt ) { if ( evt.data.getKeystroke() == 13 ) keyPressedOnMe = true; } ); // Lower the priority this 'keyup' since 'ok' will close the dialog.(#3749) me.getInputElement().on( 'keyup', function( evt ) { if ( evt.data.getKeystroke() == 13 && keyPressedOnMe ) { dialog.getButton( 'ok' ) && setTimeout( function () { dialog.getButton( 'ok' ).click(); }, 0 ); keyPressedOnMe = false; } }, null, null, 1000 ); } ); /** @ignore */ var innerHTML = function() { // IE BUG: Text input fields in IE at 100% would exceed a <td> or inline // container's width, so need to wrap it inside a <div>. var html = [ '<div class="cke_dialog_ui_input_', elementDefinition.type, '" role="presentation"' ]; if ( elementDefinition.width ) html.push( 'style="width:'+ elementDefinition.width +'" ' ); html.push( '><input ' ); attributes[ 'aria-labelledby' ] = this._.labelId; this._.required && ( attributes[ 'aria-required' ] = this._.required ); for ( var i in attributes ) html.push( i + '="' + attributes[i] + '" ' ); html.push( ' /></div>' ); return html.join( '' ); }; CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); }, /** * A text area with a label on the top or left. * @constructor * @extends CKEDITOR.ui.dialog.labeledElement * @example * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>rows</strong> (Optional) The number of rows displayed. * Defaults to 5 if not defined.</li> * <li><strong>cols</strong> (Optional) The number of cols displayed. * Defaults to 20 if not defined. Usually overridden by skins.</li> * <li><strong>default</strong> (Optional) The default value.</li> * <li><strong>validate</strong> (Optional) The validation function. </li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ textarea : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; initPrivateObject.call( this, elementDefinition ); var me = this, domId = this._.inputId = CKEDITOR.tools.getNextId() + '_textarea', attributes = {}; if ( elementDefinition.validate ) this.validate = elementDefinition.validate; // Generates the essential attributes for the textarea tag. attributes.rows = elementDefinition.rows || 5; attributes.cols = elementDefinition.cols || 20; if ( typeof elementDefinition.inputStyle != 'undefined' ) attributes.style = elementDefinition.inputStyle; /** @ignore */ var innerHTML = function() { attributes[ 'aria-labelledby' ] = this._.labelId; this._.required && ( attributes[ 'aria-required' ] = this._.required ); var html = [ '<div class="cke_dialog_ui_input_textarea" role="presentation"><textarea class="cke_dialog_ui_input_textarea" id="', domId, '" ' ]; for ( var i in attributes ) html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" ' ); html.push( '>', CKEDITOR.tools.htmlEncode( me._['default'] ), '</textarea></div>' ); return html.join( '' ); }; CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); }, /** * A single checkbox with a label on the right. * @constructor * @extends CKEDITOR.ui.dialog.uiElement * @example * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>checked</strong> (Optional) Whether the checkbox is checked * on instantiation. Defaults to false.</li> * <li><strong>validate</strong> (Optional) The validation function.</li> * <li><strong>label</strong> (Optional) The checkbox label.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ checkbox : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; var _ = initPrivateObject.call( this, elementDefinition, { 'default' : !!elementDefinition[ 'default' ] } ); if ( elementDefinition.validate ) this.validate = elementDefinition.validate; /** @ignore */ var innerHTML = function() { var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition, { id : elementDefinition.id ? elementDefinition.id + '_checkbox' : CKEDITOR.tools.getNextId() + '_checkbox' }, true ), html = []; var labelId = CKEDITOR.tools.getNextId() + '_label'; var attributes = { 'class' : 'cke_dialog_ui_checkbox_input', type : 'checkbox', 'aria-labelledby' : labelId }; cleanInnerDefinition( myDefinition ); if ( elementDefinition[ 'default' ] ) attributes.checked = 'checked'; if ( typeof myDefinition.inputStyle != 'undefined' ) myDefinition.style = myDefinition.inputStyle; _.checkbox = new CKEDITOR.ui.dialog.uiElement( dialog, myDefinition, html, 'input', null, attributes ); html.push( ' <label id="', labelId, '" for="', attributes.id, '"' + ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) + '>', CKEDITOR.tools.htmlEncode( elementDefinition.label ), '</label>' ); return html.join( '' ); }; CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'span', null, null, innerHTML ); }, /** * A group of radio buttons. * @constructor * @example * @extends CKEDITOR.ui.dialog.labeledElement * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>default</strong> (Required) The default value.</li> * <li><strong>validate</strong> (Optional) The validation function.</li> * <li><strong>items</strong> (Required) An array of options. Each option * is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value' * is missing, then the value would be assumed to be the same as the * description.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ radio : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3) return; initPrivateObject.call( this, elementDefinition ); if ( !this._['default'] ) this._['default'] = this._.initValue = elementDefinition.items[0][1]; if ( elementDefinition.validate ) this.validate = elementDefinition.valdiate; var children = [], me = this; /** @ignore */ var innerHTML = function() { var inputHtmlList = [], html = [], commonAttributes = { 'class' : 'cke_dialog_ui_radio_item', 'aria-labelledby' : this._.labelId }, commonName = elementDefinition.id ? elementDefinition.id + '_radio' : CKEDITOR.tools.getNextId() + '_radio'; for ( var i = 0 ; i < elementDefinition.items.length ; i++ ) { var item = elementDefinition.items[i], title = item[2] !== undefined ? item[2] : item[0], value = item[1] !== undefined ? item[1] : item[0], inputId = CKEDITOR.tools.getNextId() + '_radio_input', labelId = inputId + '_label', inputDefinition = CKEDITOR.tools.extend( {}, elementDefinition, { id : inputId, title : null, type : null }, true ), labelDefinition = CKEDITOR.tools.extend( {}, inputDefinition, { title : title }, true ), inputAttributes = { type : 'radio', 'class' : 'cke_dialog_ui_radio_input', name : commonName, value : value, 'aria-labelledby' : labelId }, inputHtml = []; if ( me._['default'] == value ) inputAttributes.checked = 'checked'; cleanInnerDefinition( inputDefinition ); cleanInnerDefinition( labelDefinition ); if ( typeof inputDefinition.inputStyle != 'undefined' ) inputDefinition.style = inputDefinition.inputStyle; children.push( new CKEDITOR.ui.dialog.uiElement( dialog, inputDefinition, inputHtml, 'input', null, inputAttributes ) ); inputHtml.push( ' ' ); new CKEDITOR.ui.dialog.uiElement( dialog, labelDefinition, inputHtml, 'label', null, { id : labelId, 'for' : inputAttributes.id }, item[0] ); inputHtmlList.push( inputHtml.join( '' ) ); } new CKEDITOR.ui.dialog.hbox( dialog, children, inputHtmlList, html ); return html.join( '' ); }; CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); this._.children = children; }, /** * A button with a label inside. * @constructor * @example * @extends CKEDITOR.ui.dialog.uiElement * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>label</strong> (Required) The button label.</li> * <li><strong>disabled</strong> (Optional) Set to true if you want the * button to appear in disabled state.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ button : function( dialog, elementDefinition, htmlList ) { if ( !arguments.length ) return; if ( typeof elementDefinition == 'function' ) elementDefinition = elementDefinition( dialog.getParentEditor() ); initPrivateObject.call( this, elementDefinition, { disabled : elementDefinition.disabled || false } ); // Add OnClick event to this input. CKEDITOR.event.implementOn( this ); var me = this; // Register an event handler for processing button clicks. dialog.on( 'load', function( eventInfo ) { var element = this.getElement(); (function() { element.on( 'click', function( evt ) { me.fire( 'click', { dialog : me.getDialog() } ); evt.data.preventDefault(); } ); element.on( 'keydown', function( evt ) { if ( evt.data.getKeystroke() in { 32:1 } ) { me.click(); evt.data.preventDefault(); } } ); })(); element.unselectable(); }, this ); var outerDefinition = CKEDITOR.tools.extend( {}, elementDefinition ); delete outerDefinition.style; var labelId = CKEDITOR.tools.getNextId() + '_label'; CKEDITOR.ui.dialog.uiElement.call( this, dialog, outerDefinition, htmlList, 'a', null, { style : elementDefinition.style, href : 'javascript:void(0)', title : elementDefinition.label, hidefocus : 'true', 'class' : elementDefinition['class'], role : 'button', 'aria-labelledby' : labelId }, '<span id="' + labelId + '" class="cke_dialog_ui_button">' + CKEDITOR.tools.htmlEncode( elementDefinition.label ) + '</span>' ); }, /** * A select box. * @extends CKEDITOR.ui.dialog.uiElement * @example * @constructor * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>default</strong> (Required) The default value.</li> * <li><strong>validate</strong> (Optional) The validation function.</li> * <li><strong>items</strong> (Required) An array of options. Each option * is a 1- or 2-item array of format [ 'Description', 'Value' ]. If 'Value' * is missing, then the value would be assumed to be the same as the * description.</li> * <li><strong>multiple</strong> (Optional) Set this to true if you'd like * to have a multiple-choice select box.</li> * <li><strong>size</strong> (Optional) The number of items to display in * the select box.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ select : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; var _ = initPrivateObject.call( this, elementDefinition ); if ( elementDefinition.validate ) this.validate = elementDefinition.validate; _.inputId = CKEDITOR.tools.getNextId() + '_select'; /** @ignore */ var innerHTML = function() { var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition, { id : elementDefinition.id ? elementDefinition.id + '_select' : CKEDITOR.tools.getNextId() + '_select' }, true ), html = [], innerHTML = [], attributes = { 'id' : _.inputId, 'class' : 'cke_dialog_ui_input_select', 'aria-labelledby' : this._.labelId }; // Add multiple and size attributes from element definition. if ( elementDefinition.size != undefined ) attributes.size = elementDefinition.size; if ( elementDefinition.multiple != undefined ) attributes.multiple = elementDefinition.multiple; cleanInnerDefinition( myDefinition ); for ( var i = 0, item ; i < elementDefinition.items.length && ( item = elementDefinition.items[i] ) ; i++ ) { innerHTML.push( '<option value="', CKEDITOR.tools.htmlEncode( item[1] !== undefined ? item[1] : item[0] ).replace( /"/g, '&quot;' ), '" /> ', CKEDITOR.tools.htmlEncode( item[0] ) ); } if ( typeof myDefinition.inputStyle != 'undefined' ) myDefinition.style = myDefinition.inputStyle; _.select = new CKEDITOR.ui.dialog.uiElement( dialog, myDefinition, html, 'select', null, attributes, innerHTML.join( '' ) ); return html.join( '' ); }; CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); }, /** * A file upload input. * @extends CKEDITOR.ui.dialog.labeledElement * @example * @constructor * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>validate</strong> (Optional) The validation function.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ file : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; if ( elementDefinition['default'] === undefined ) elementDefinition['default'] = ''; var _ = CKEDITOR.tools.extend( initPrivateObject.call( this, elementDefinition ), { definition : elementDefinition, buttons : [] } ); if ( elementDefinition.validate ) this.validate = elementDefinition.validate; /** @ignore */ var innerHTML = function() { _.frameId = CKEDITOR.tools.getNextId() + '_fileInput'; // Support for custom document.domain in IE. var isCustomDomain = CKEDITOR.env.isCustomDomain(); var html = [ '<iframe' + ' frameborder="0"' + ' allowtransparency="0"' + ' class="cke_dialog_ui_input_file"' + ' id="', _.frameId, '"' + ' title="', elementDefinition.label, '"' + ' src="javascript:void(' ]; html.push( isCustomDomain ? '(function(){' + 'document.open();' + 'document.domain=\'' + document.domain + '\';' + 'document.close();' + '})()' : '0' ); html.push( ')">' + '</iframe>' ); return html.join( '' ); }; // IE BUG: Parent container does not resize to contain the iframe automatically. dialog.on( 'load', function() { var iframe = CKEDITOR.document.getById( _.frameId ), contentDiv = iframe.getParent(); contentDiv.addClass( 'cke_dialog_ui_input_file' ); } ); CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); }, /** * A button for submitting the file in a file upload input. * @extends CKEDITOR.ui.dialog.button * @example * @constructor * @param {CKEDITOR.dialog} dialog * Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>for</strong> (Required) The file input's page and element Id * to associate to, in a 2-item array format: [ 'page_id', 'element_id' ]. * </li> * <li><strong>validate</strong> (Optional) The validation function.</li> * </ul> * @param {Array} htmlList * List of HTML code to output to. */ fileButton : function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; var _ = initPrivateObject.call( this, elementDefinition ), me = this; if ( elementDefinition.validate ) this.validate = elementDefinition.validate; var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition ); var onClick = myDefinition.onClick; myDefinition.className = ( myDefinition.className ? myDefinition.className + ' ' : '' ) + 'cke_dialog_ui_button'; myDefinition.onClick = function( evt ) { var target = elementDefinition[ 'for' ]; // [ pageId, elementId ] if ( !onClick || onClick.call( this, evt ) !== false ) { dialog.getContentElement( target[0], target[1] ).submit(); this.disable(); } }; dialog.on( 'load', function() { dialog.getContentElement( elementDefinition[ 'for' ][0], elementDefinition[ 'for' ][1] )._.buttons.push( me ); } ); CKEDITOR.ui.dialog.button.call( this, dialog, myDefinition, htmlList ); }, html : (function() { var myHtmlRe = /^\s*<[\w:]+\s+([^>]*)?>/, theirHtmlRe = /^(\s*<[\w:]+(?:\s+[^>]*)?)((?:.|\r|\n)+)$/, emptyTagRe = /\/$/; /** * A dialog element made from raw HTML code. * @extends CKEDITOR.ui.dialog.uiElement * @name CKEDITOR.ui.dialog.html * @param {CKEDITOR.dialog} dialog Parent dialog object. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition Element definition. * Accepted fields: * <ul> * <li><strong>html</strong> (Required) HTML code of this element.</li> * </ul> * @param {Array} htmlList List of HTML code to be added to the dialog's content area. * @example * @constructor */ return function( dialog, elementDefinition, htmlList ) { if ( arguments.length < 3 ) return; var myHtmlList = [], myHtml, theirHtml = elementDefinition.html, myMatch, theirMatch; // If the HTML input doesn't contain any tags at the beginning, add a <span> tag around it. if ( theirHtml.charAt( 0 ) != '<' ) theirHtml = '<span>' + theirHtml + '</span>'; // Look for focus function in definition. var focus = elementDefinition.focus; if ( focus ) { var oldFocus = this.focus; this.focus = function() { oldFocus.call( this ); typeof focus == 'function' && focus.call( this ); this.fire( 'focus' ); }; if ( elementDefinition.isFocusable ) { var oldIsFocusable = this.isFocusable; this.isFocusable = oldIsFocusable; } this.keyboardFocusable = true; } CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, myHtmlList, 'span', null, null, '' ); // Append the attributes created by the uiElement call to the real HTML. myHtml = myHtmlList.join( '' ); myMatch = myHtml.match( myHtmlRe ); theirMatch = theirHtml.match( theirHtmlRe ) || [ '', '', '' ]; if ( emptyTagRe.test( theirMatch[1] ) ) { theirMatch[1] = theirMatch[1].slice( 0, -1 ); theirMatch[2] = '/' + theirMatch[2]; } htmlList.push( [ theirMatch[1], ' ', myMatch[1] || '', theirMatch[2] ].join( '' ) ); }; })(), /** * Form fieldset for grouping dialog UI elements. * @constructor * @extends CKEDITOR.ui.dialog.uiElement * @param {CKEDITOR.dialog} dialog Parent dialog object. * @param {Array} childObjList * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this * container. * @param {Array} childHtmlList * Array of HTML code that correspond to the HTML output of all the * objects in childObjList. * @param {Array} htmlList * Array of HTML code that this element will output to. * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: * <ul> * <li><strong>label</strong> (Optional) The legend of the this fieldset.</li> * <li><strong>children</strong> (Required) An array of dialog field definitions which will be grouped inside this fieldset. </li> * </ul> */ fieldset : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition ) { var legendLabel = elementDefinition.label; /** @ignore */ var innerHTML = function() { var html = []; legendLabel && html.push( '<legend' + ( elementDefinition.labelStyle ? ' style="' + elementDefinition.labelStyle + '"' : '' ) + '>' + legendLabel + '</legend>' ); for ( var i = 0; i < childHtmlList.length; i++ ) html.push( childHtmlList[ i ] ); return html.join( '' ); }; this._ = { children : childObjList }; CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'fieldset', null, null, innerHTML ); } }, true ); CKEDITOR.ui.dialog.html.prototype = new CKEDITOR.ui.dialog.uiElement; CKEDITOR.ui.dialog.labeledElement.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement, /** @lends CKEDITOR.ui.dialog.labeledElement.prototype */ { /** * Sets the label text of the element. * @param {String} label The new label text. * @returns {CKEDITOR.ui.dialog.labeledElement} The current labeled element. * @example */ setLabel : function( label ) { var node = CKEDITOR.document.getById( this._.labelId ); if ( node.getChildCount() < 1 ) ( new CKEDITOR.dom.text( label, CKEDITOR.document ) ).appendTo( node ); else node.getChild( 0 ).$.nodeValue = label; return this; }, /** * Retrieves the current label text of the elment. * @returns {String} The current label text. * @example */ getLabel : function() { var node = CKEDITOR.document.getById( this._.labelId ); if ( !node || node.getChildCount() < 1 ) return ''; else return node.getChild( 0 ).getText(); }, /** * Defines the onChange event for UI element definitions. * @field * @type Object * @example */ eventProcessors : commonEventProcessors }, true ); CKEDITOR.ui.dialog.button.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement, /** @lends CKEDITOR.ui.dialog.button.prototype */ { /** * Simulates a click to the button. * @example * @returns {Object} Return value of the 'click' event. */ click : function() { if ( !this._.disabled ) return this.fire( 'click', { dialog : this._.dialog } ); this.getElement().$.blur(); return false; }, /** * Enables the button. * @example */ enable : function() { this._.disabled = false; var element = this.getElement(); element && element.removeClass( 'cke_disabled' ); }, /** * Disables the button. * @example */ disable : function() { this._.disabled = true; this.getElement().addClass( 'cke_disabled' ); }, isVisible : function() { return this.getElement().getFirst().isVisible(); }, isEnabled : function() { return !this._.disabled; }, /** * Defines the onChange event and onClick for button element definitions. * @field * @type Object * @example */ eventProcessors : CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, { /** @ignore */ onClick : function( dialog, func ) { this.on( 'click', function() { // Some browsers (Chrome, IE8, IE7 compat mode) don't move // focus to clicked button. Force this. this.getElement().focus(); func.apply( this, arguments ); }); } }, true ), /** * Handler for the element's access key up event. Simulates a click to * the button. * @example */ accessKeyUp : function() { this.click(); }, /** * Handler for the element's access key down event. Simulates a mouse * down to the button. * @example */ accessKeyDown : function() { this.focus(); }, keyboardFocusable : true }, true ); CKEDITOR.ui.dialog.textInput.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement, /** @lends CKEDITOR.ui.dialog.textInput.prototype */ { /** * Gets the text input DOM element under this UI object. * @example * @returns {CKEDITOR.dom.element} The DOM element of the text input. */ getInputElement : function() { return CKEDITOR.document.getById( this._.inputId ); }, /** * Puts focus into the text input. * @example */ focus : function() { var me = this.selectParentTab(); // GECKO BUG: setTimeout() is needed to workaround invisible selections. setTimeout( function() { var element = me.getInputElement(); element && element.$.focus(); }, 0 ); }, /** * Selects all the text in the text input. * @example */ select : function() { var me = this.selectParentTab(); // GECKO BUG: setTimeout() is needed to workaround invisible selections. setTimeout( function() { var e = me.getInputElement(); if ( e ) { e.$.focus(); e.$.select(); } }, 0 ); }, /** * Handler for the text input's access key up event. Makes a select() * call to the text input. * @example */ accessKeyUp : function() { this.select(); }, /** * Sets the value of this text input object. * @param {Object} value The new value. * @returns {CKEDITOR.ui.dialog.textInput} The current UI element. * @example * uiElement.setValue( 'Blamo' ); */ setValue : function( value ) { !value && ( value = '' ); return CKEDITOR.ui.dialog.uiElement.prototype.setValue.apply( this, arguments ); }, keyboardFocusable : true }, commonPrototype, true ); CKEDITOR.ui.dialog.textarea.prototype = new CKEDITOR.ui.dialog.textInput(); CKEDITOR.ui.dialog.select.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement, /** @lends CKEDITOR.ui.dialog.select.prototype */ { /** * Gets the DOM element of the select box. * @returns {CKEDITOR.dom.element} The &lt;select&gt; element of this UI * element. * @example */ getInputElement : function() { return this._.select.getElement(); }, /** * Adds an option to the select box. * @param {String} label Option label. * @param {String} value (Optional) Option value, if not defined it'll be * assumed to be the same as the label. * @param {Number} index (Optional) Position of the option to be inserted * to. If not defined the new option will be inserted to the end of list. * @example * @returns {CKEDITOR.ui.dialog.select} The current select UI element. */ add : function( label, value, index ) { var option = new CKEDITOR.dom.element( 'option', this.getDialog().getParentEditor().document ), selectElement = this.getInputElement().$; option.$.text = label; option.$.value = ( value === undefined || value === null ) ? label : value; if ( index === undefined || index === null ) { if ( CKEDITOR.env.ie ) selectElement.add( option.$ ); else selectElement.add( option.$, null ); } else selectElement.add( option.$, index ); return this; }, /** * Removes an option from the selection list. * @param {Number} index Index of the option to be removed. * @example * @returns {CKEDITOR.ui.dialog.select} The current select UI element. */ remove : function( index ) { var selectElement = this.getInputElement().$; selectElement.remove( index ); return this; }, /** * Clears all options out of the selection list. * @returns {CKEDITOR.ui.dialog.select} The current select UI element. */ clear : function() { var selectElement = this.getInputElement().$; while ( selectElement.length > 0 ) selectElement.remove( 0 ); return this; }, keyboardFocusable : true }, commonPrototype, true ); CKEDITOR.ui.dialog.checkbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement, /** @lends CKEDITOR.ui.dialog.checkbox.prototype */ { /** * Gets the checkbox DOM element. * @example * @returns {CKEDITOR.dom.element} The DOM element of the checkbox. */ getInputElement : function() { return this._.checkbox.getElement(); }, /** * Sets the state of the checkbox. * @example * @param {Boolean} true to tick the checkbox, false to untick it. * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element. */ setValue : function( checked, noChangeEvent ) { this.getInputElement().$.checked = checked; !noChangeEvent && this.fire( 'change', { value : checked } ); }, /** * Gets the state of the checkbox. * @example * @returns {Boolean} true means the checkbox is ticked, false means it's not ticked. */ getValue : function() { return this.getInputElement().$.checked; }, /** * Handler for the access key up event. Toggles the checkbox. * @example */ accessKeyUp : function() { this.setValue( !this.getValue() ); }, /** * Defines the onChange event for UI element definitions. * @field * @type Object * @example */ eventProcessors : { onChange : function( dialog, func ) { if ( !CKEDITOR.env.ie ) return commonEventProcessors.onChange.apply( this, arguments ); else { dialog.on( 'load', function() { var element = this._.checkbox.getElement(); element.on( 'propertychange', function( evt ) { evt = evt.data.$; if ( evt.propertyName == 'checked' ) this.fire( 'change', { value : element.$.checked } ); }, this ); }, this ); this.on( 'change', func ); } return null; } }, keyboardFocusable : true }, commonPrototype, true ); CKEDITOR.ui.dialog.radio.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement, /** @lends CKEDITOR.ui.dialog.radio.prototype */ { /** * Checks one of the radio buttons in this button group. * @example * @param {String} value The value of the button to be chcked. * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element. */ setValue : function( value, noChangeEvent ) { var children = this._.children, item; for ( var i = 0 ; ( i < children.length ) && ( item = children[i] ) ; i++ ) item.getElement().$.checked = ( item.getValue() == value ); !noChangeEvent && this.fire( 'change', { value : value } ); }, /** * Gets the value of the currently checked radio button. * @example * @returns {String} The currently checked button's value. */ getValue : function() { var children = this._.children; for ( var i = 0 ; i < children.length ; i++ ) { if ( children[i].getElement().$.checked ) return children[i].getValue(); } return null; }, /** * Handler for the access key up event. Focuses the currently * selected radio button, or the first radio button if none is * selected. * @example */ accessKeyUp : function() { var children = this._.children, i; for ( i = 0 ; i < children.length ; i++ ) { if ( children[i].getElement().$.checked ) { children[i].getElement().focus(); return; } } children[0].getElement().focus(); }, /** * Defines the onChange event for UI element definitions. * @field * @type Object * @example */ eventProcessors : { onChange : function( dialog, func ) { if ( !CKEDITOR.env.ie ) return commonEventProcessors.onChange.apply( this, arguments ); else { dialog.on( 'load', function() { var children = this._.children, me = this; for ( var i = 0 ; i < children.length ; i++ ) { var element = children[i].getElement(); element.on( 'propertychange', function( evt ) { evt = evt.data.$; if ( evt.propertyName == 'checked' && this.$.checked ) me.fire( 'change', { value : this.getAttribute( 'value' ) } ); } ); } }, this ); this.on( 'change', func ); } return null; } }, keyboardFocusable : true }, commonPrototype, true ); CKEDITOR.ui.dialog.file.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement, commonPrototype, /** @lends CKEDITOR.ui.dialog.file.prototype */ { /** * Gets the &lt;input&gt; element of this file input. * @returns {CKEDITOR.dom.element} The file input element. * @example */ getInputElement : function() { var frameDocument = CKEDITOR.document.getById( this._.frameId ).getFrameDocument(); return frameDocument.$.forms.length > 0 ? new CKEDITOR.dom.element( frameDocument.$.forms[0].elements[0] ) : this.getElement(); }, /** * Uploads the file in the file input. * @returns {CKEDITOR.ui.dialog.file} This object. * @example */ submit : function() { this.getInputElement().getParent().$.submit(); return this; }, /** * Get the action assigned to the form. * @returns {String} The value of the action. * @example */ getAction : function() { return this.getInputElement().getParent().$.action; }, /** * The events must be applied on the inner input element, and * that must be done when the iframe & form has been loaded */ registerEvents : function( definition ) { var regex = /^on([A-Z]\w+)/, match; var registerDomEvent = function( uiElement, dialog, eventName, func ) { uiElement.on( 'formLoaded', function() { uiElement.getInputElement().on( eventName, func, uiElement ); }); }; for ( var i in definition ) { if ( !( match = i.match( regex ) ) ) continue; if ( this.eventProcessors[i] ) this.eventProcessors[i].call( this, this._.dialog, definition[i] ); else registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] ); } return this; }, /** * Redraws the file input and resets the file path in the file input. * The redraw logic is necessary because non-IE browsers tend to clear * the &lt;iframe&gt; containing the file input after closing the dialog. * @example */ reset : function() { var _ = this._, frameElement = CKEDITOR.document.getById( _.frameId ), frameDocument = frameElement.getFrameDocument(), elementDefinition = _.definition, buttons = _.buttons, callNumber = this.formLoadedNumber, unloadNumber = this.formUnloadNumber, langDir = _.dialog._.editor.lang.dir, langCode = _.dialog._.editor.langCode; // The callback function for the iframe, but we must call tools.addFunction only once // so we store the function number in this.formLoadedNumber if ( !callNumber ) { callNumber = this.formLoadedNumber = CKEDITOR.tools.addFunction( function() { // Now we can apply the events to the input type=file this.fire( 'formLoaded' ) ; }, this ) ; // Remove listeners attached to the content of the iframe (the file input) unloadNumber = this.formUnloadNumber = CKEDITOR.tools.addFunction( function() { this.getInputElement().clearCustomData(); }, this ) ; this.getDialog()._.editor.on( 'destroy', function() { CKEDITOR.tools.removeFunction( callNumber ); CKEDITOR.tools.removeFunction( unloadNumber ); } ); } function generateFormField() { frameDocument.$.open(); // Support for custom document.domain in IE. if ( CKEDITOR.env.isCustomDomain() ) frameDocument.$.domain = document.domain; var size = ''; if ( elementDefinition.size ) size = elementDefinition.size - ( CKEDITOR.env.ie ? 7 : 0 ); // "Browse" button is bigger in IE. frameDocument.$.write( [ '<html dir="' + langDir + '" lang="' + langCode + '"><head><title></title></head><body style="margin: 0; overflow: hidden; background: transparent;">', '<form enctype="multipart/form-data" method="POST" dir="' + langDir + '" lang="' + langCode + '" action="', CKEDITOR.tools.htmlEncode( elementDefinition.action ), '">', '<input type="file" name="', CKEDITOR.tools.htmlEncode( elementDefinition.id || 'cke_upload' ), '" size="', CKEDITOR.tools.htmlEncode( size > 0 ? size : "" ), '" />', '</form>', '</body></html>', '<script>window.parent.CKEDITOR.tools.callFunction(' + callNumber + ');', 'window.onbeforeunload = function() {window.parent.CKEDITOR.tools.callFunction(' + unloadNumber + ')}</script>' ].join( '' ) ); frameDocument.$.close(); for ( var i = 0 ; i < buttons.length ; i++ ) buttons[i].enable(); } // #3465: Wait for the browser to finish rendering the dialog first. if ( CKEDITOR.env.gecko ) setTimeout( generateFormField, 500 ); else generateFormField(); }, getValue : function() { return this.getInputElement().$.value || ''; }, /*** * The default value of input type="file" is an empty string, but during initialization * of this UI element, the iframe still isn't ready so it can't be read from that object * Setting it manually prevents later issues about the current value ("") being different * of the initial value (undefined as it asked for .value of a div) */ setInitValue : function() { this._.initValue = ''; }, /** * Defines the onChange event for UI element definitions. * @field * @type Object * @example */ eventProcessors : { onChange : function( dialog, func ) { // If this method is called several times (I'm not sure about how this can happen but the default // onChange processor includes this protection) // In order to reapply to the new element, the property is deleted at the beggining of the registerEvents method if ( !this._.domOnChangeRegistered ) { // By listening for the formLoaded event, this handler will get reapplied when a new // form is created this.on( 'formLoaded', function() { this.getInputElement().on( 'change', function(){ this.fire( 'change', { value : this.getValue() } ); }, this ); }, this ); this._.domOnChangeRegistered = true; } this.on( 'change', func ); } }, keyboardFocusable : true }, true ); CKEDITOR.ui.dialog.fileButton.prototype = new CKEDITOR.ui.dialog.button; CKEDITOR.ui.dialog.fieldset.prototype = CKEDITOR.tools.clone( CKEDITOR.ui.dialog.hbox.prototype ); CKEDITOR.dialog.addUIElement( 'text', textBuilder ); CKEDITOR.dialog.addUIElement( 'password', textBuilder ); CKEDITOR.dialog.addUIElement( 'textarea', commonBuilder ); CKEDITOR.dialog.addUIElement( 'checkbox', commonBuilder ); CKEDITOR.dialog.addUIElement( 'radio', commonBuilder ); CKEDITOR.dialog.addUIElement( 'button', commonBuilder ); CKEDITOR.dialog.addUIElement( 'select', commonBuilder ); CKEDITOR.dialog.addUIElement( 'file', commonBuilder ); CKEDITOR.dialog.addUIElement( 'fileButton', commonBuilder ); CKEDITOR.dialog.addUIElement( 'html', commonBuilder ); CKEDITOR.dialog.addUIElement( 'fieldset', containerBuilder ); })(); /** * Fired when the value of the uiElement is changed * @name CKEDITOR.ui.dialog.uiElement#change * @event */ /** * Fired when the inner frame created by the element is ready. * Each time the button is used or the dialog is loaded a new * form might be created. * @name CKEDITOR.ui.dialog.fileButton#formLoaded * @event */
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ // Register a plugin named "sample". CKEDITOR.plugins.add( 'keystrokes', { beforeInit : function( editor ) { /** * Controls keystrokes typing in this editor instance. * @name CKEDITOR.editor.prototype.keystrokeHandler * @type CKEDITOR.keystrokeHandler * @example */ editor.keystrokeHandler = new CKEDITOR.keystrokeHandler( editor ); editor.specialKeys = {}; }, init : function( editor ) { var keystrokesConfig = editor.config.keystrokes, blockedConfig = editor.config.blockedKeystrokes; var keystrokes = editor.keystrokeHandler.keystrokes, blockedKeystrokes = editor.keystrokeHandler.blockedKeystrokes; for ( var i = 0 ; i < keystrokesConfig.length ; i++ ) keystrokes[ keystrokesConfig[i][0] ] = keystrokesConfig[i][1]; for ( i = 0 ; i < blockedConfig.length ; i++ ) blockedKeystrokes[ blockedConfig[i] ] = 1; } }); /** * Controls keystrokes typing in an editor instance. * @constructor * @param {CKEDITOR.editor} editor The editor instance. * @example */ CKEDITOR.keystrokeHandler = function( editor ) { if ( editor.keystrokeHandler ) return editor.keystrokeHandler; /** * List of keystrokes associated to commands. Each entry points to the * command to be executed. * @type Object * @example */ this.keystrokes = {}; /** * List of keystrokes that should be blocked if not defined at * {@link keystrokes}. In this way it is possible to block the default * browser behavior for those keystrokes. * @type Object * @example */ this.blockedKeystrokes = {}; this._ = { editor : editor }; return this; }; (function() { var cancel; var onKeyDown = function( event ) { // The DOM event object is passed by the "data" property. event = event.data; var keyCombination = event.getKeystroke(); var command = this.keystrokes[ keyCombination ]; var editor = this._.editor; cancel = ( editor.fire( 'key', { keyCode : keyCombination } ) === true ); if ( !cancel ) { if ( command ) { var data = { from : 'keystrokeHandler' }; cancel = ( editor.execCommand( command, data ) !== false ); } if ( !cancel ) { var handler = editor.specialKeys[ keyCombination ]; cancel = ( handler && handler( editor ) === true ); if ( !cancel ) cancel = !!this.blockedKeystrokes[ keyCombination ]; } } if ( cancel ) event.preventDefault( true ); return !cancel; }; var onKeyPress = function( event ) { if ( cancel ) { cancel = false; event.data.preventDefault( true ); } }; CKEDITOR.keystrokeHandler.prototype = { /** * Attaches this keystroke handle to a DOM object. Keystrokes typed ** over this object will get handled by this keystrokeHandler. * @param {CKEDITOR.dom.domObject} domObject The DOM object to attach * to. * @example */ attach : function( domObject ) { // For most browsers, it is enough to listen to the keydown event // only. domObject.on( 'keydown', onKeyDown, this ); // Some browsers instead, don't cancel key events in the keydown, but in the // keypress. So we must do a longer trip in those cases. if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) ) domObject.on( 'keypress', onKeyPress, this ); } }; })(); /** * A list of keystrokes to be blocked if not defined in the {@link CKEDITOR.config.keystrokes} * setting. In this way it is possible to block the default browser behavior * for those keystrokes. * @type Array * @default (see example) * @example * // This is actually the default value. * config.blockedKeystrokes = * [ * CKEDITOR.CTRL + 66 &#47;*B*&#47;, * CKEDITOR.CTRL + 73 &#47;*I*&#47;, * CKEDITOR.CTRL + 85 &#47;*U*&#47; * ]; */ CKEDITOR.config.blockedKeystrokes = [ CKEDITOR.CTRL + 66 /*B*/, CKEDITOR.CTRL + 73 /*I*/, CKEDITOR.CTRL + 85 /*U*/ ]; /** * A list associating keystrokes to editor commands. Each element in the list * is an array where the first item is the keystroke, and the second is the * name of the command to be executed. * @type Array * @default (see example) * @example * // This is actually the default value. * config.keystrokes = * [ * [ CKEDITOR.ALT + 121 &#47;*F10*&#47;, 'toolbarFocus' ], * [ CKEDITOR.ALT + 122 &#47;*F11*&#47;, 'elementsPathFocus' ], * * [ CKEDITOR.SHIFT + 121 &#47;*F10*&#47;, 'contextMenu' ], * * [ CKEDITOR.CTRL + 90 &#47;*Z*&#47;, 'undo' ], * [ CKEDITOR.CTRL + 89 &#47;*Y*&#47;, 'redo' ], * [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 &#47;*Z*&#47;, 'redo' ], * * [ CKEDITOR.CTRL + 76 &#47;*L*&#47;, 'link' ], * * [ CKEDITOR.CTRL + 66 &#47;*B*&#47;, 'bold' ], * [ CKEDITOR.CTRL + 73 &#47;*I*&#47;, 'italic' ], * [ CKEDITOR.CTRL + 85 &#47;*U*&#47;, 'underline' ], * * [ CKEDITOR.ALT + 109 &#47;*-*&#47;, 'toolbarCollapse' ] * ]; */ CKEDITOR.config.keystrokes = [ [ CKEDITOR.ALT + 121 /*F10*/, 'toolbarFocus' ], [ CKEDITOR.ALT + 122 /*F11*/, 'elementsPathFocus' ], [ CKEDITOR.SHIFT + 121 /*F10*/, 'contextMenu' ], [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 121 /*F10*/, 'contextMenu' ], [ CKEDITOR.CTRL + 90 /*Z*/, 'undo' ], [ CKEDITOR.CTRL + 89 /*Y*/, 'redo' ], [ CKEDITOR.CTRL + CKEDITOR.SHIFT + 90 /*Z*/, 'redo' ], [ CKEDITOR.CTRL + 76 /*L*/, 'link' ], [ CKEDITOR.CTRL + 66 /*B*/, 'bold' ], [ CKEDITOR.CTRL + 73 /*I*/, 'italic' ], [ CKEDITOR.CTRL + 85 /*U*/, 'underline' ], [ CKEDITOR.ALT + ( CKEDITOR.env.ie || CKEDITOR.env.webkit ? 189 : 109 ) /*-*/, 'toolbarCollapse' ], [ CKEDITOR.ALT + 48 /*0*/, 'a11yHelp' ] ]; /** * Fired when any keyboard key (or combination) is pressed into the editing area. * @name CKEDITOR.editor#key * @event * @param {Number} data.keyCode A number representing the key code (or * combination). It is the sum of the current key code and the * {@link CKEDITOR.CTRL}, {@link CKEDITOR.SHIFT} and {@link CKEDITOR.ALT} * constants, if those are pressed. */
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file Blockquote. */ (function() { function getState( editor, path ) { var firstBlock = path.block || path.blockLimit; if ( !firstBlock || firstBlock.getName() == 'body' ) return CKEDITOR.TRISTATE_OFF; // See if the first block has a blockquote parent. if ( firstBlock.getAscendant( 'blockquote', true ) ) return CKEDITOR.TRISTATE_ON; return CKEDITOR.TRISTATE_OFF; } function onSelectionChange( evt ) { var editor = evt.editor; if ( editor.readOnly ) return; var command = editor.getCommand( 'blockquote' ); command.state = getState( editor, evt.data.path ); command.fire( 'state' ); } function noBlockLeft( bqBlock ) { for ( var i = 0, length = bqBlock.getChildCount(), child ; i < length && ( child = bqBlock.getChild( i ) ) ; i++ ) { if ( child.type == CKEDITOR.NODE_ELEMENT && child.isBlockBoundary() ) return false; } return true; } var commandObject = { exec : function( editor ) { var state = editor.getCommand( 'blockquote' ).state, selection = editor.getSelection(), range = selection && selection.getRanges( true )[0]; if ( !range ) return; var bookmarks = selection.createBookmarks(); // Kludge for #1592: if the bookmark nodes are in the beginning of // blockquote, then move them to the nearest block element in the // blockquote. if ( CKEDITOR.env.ie ) { var bookmarkStart = bookmarks[0].startNode, bookmarkEnd = bookmarks[0].endNode, cursor; if ( bookmarkStart && bookmarkStart.getParent().getName() == 'blockquote' ) { cursor = bookmarkStart; while ( ( cursor = cursor.getNext() ) ) { if ( cursor.type == CKEDITOR.NODE_ELEMENT && cursor.isBlockBoundary() ) { bookmarkStart.move( cursor, true ); break; } } } if ( bookmarkEnd && bookmarkEnd.getParent().getName() == 'blockquote' ) { cursor = bookmarkEnd; while ( ( cursor = cursor.getPrevious() ) ) { if ( cursor.type == CKEDITOR.NODE_ELEMENT && cursor.isBlockBoundary() ) { bookmarkEnd.move( cursor ); break; } } } } var iterator = range.createIterator(), block; iterator.enlargeBr = editor.config.enterMode != CKEDITOR.ENTER_BR; if ( state == CKEDITOR.TRISTATE_OFF ) { var paragraphs = []; while ( ( block = iterator.getNextParagraph() ) ) paragraphs.push( block ); // If no paragraphs, create one from the current selection position. if ( paragraphs.length < 1 ) { var para = editor.document.createElement( editor.config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ), firstBookmark = bookmarks.shift(); range.insertNode( para ); para.append( new CKEDITOR.dom.text( '\ufeff', editor.document ) ); range.moveToBookmark( firstBookmark ); range.selectNodeContents( para ); range.collapse( true ); firstBookmark = range.createBookmark(); paragraphs.push( para ); bookmarks.unshift( firstBookmark ); } // Make sure all paragraphs have the same parent. var commonParent = paragraphs[0].getParent(), tmp = []; for ( var i = 0 ; i < paragraphs.length ; i++ ) { block = paragraphs[i]; commonParent = commonParent.getCommonAncestor( block.getParent() ); } // The common parent must not be the following tags: table, tbody, tr, ol, ul. var denyTags = { table : 1, tbody : 1, tr : 1, ol : 1, ul : 1 }; while ( denyTags[ commonParent.getName() ] ) commonParent = commonParent.getParent(); // Reconstruct the block list to be processed such that all resulting blocks // satisfy parentNode.equals( commonParent ). var lastBlock = null; while ( paragraphs.length > 0 ) { block = paragraphs.shift(); while ( !block.getParent().equals( commonParent ) ) block = block.getParent(); if ( !block.equals( lastBlock ) ) tmp.push( block ); lastBlock = block; } // If any of the selected blocks is a blockquote, remove it to prevent // nested blockquotes. while ( tmp.length > 0 ) { block = tmp.shift(); if ( block.getName() == 'blockquote' ) { var docFrag = new CKEDITOR.dom.documentFragment( editor.document ); while ( block.getFirst() ) { docFrag.append( block.getFirst().remove() ); paragraphs.push( docFrag.getLast() ); } docFrag.replace( block ); } else paragraphs.push( block ); } // Now we have all the blocks to be included in a new blockquote node. var bqBlock = editor.document.createElement( 'blockquote' ); bqBlock.insertBefore( paragraphs[0] ); while ( paragraphs.length > 0 ) { block = paragraphs.shift(); bqBlock.append( block ); } } else if ( state == CKEDITOR.TRISTATE_ON ) { var moveOutNodes = [], database = {}; while ( ( block = iterator.getNextParagraph() ) ) { var bqParent = null, bqChild = null; while ( block.getParent() ) { if ( block.getParent().getName() == 'blockquote' ) { bqParent = block.getParent(); bqChild = block; break; } block = block.getParent(); } // Remember the blocks that were recorded down in the moveOutNodes array // to prevent duplicates. if ( bqParent && bqChild && !bqChild.getCustomData( 'blockquote_moveout' ) ) { moveOutNodes.push( bqChild ); CKEDITOR.dom.element.setMarker( database, bqChild, 'blockquote_moveout', true ); } } CKEDITOR.dom.element.clearAllMarkers( database ); var movedNodes = [], processedBlockquoteBlocks = []; database = {}; while ( moveOutNodes.length > 0 ) { var node = moveOutNodes.shift(); bqBlock = node.getParent(); // If the node is located at the beginning or the end, just take it out // without splitting. Otherwise, split the blockquote node and move the // paragraph in between the two blockquote nodes. if ( !node.getPrevious() ) node.remove().insertBefore( bqBlock ); else if ( !node.getNext() ) node.remove().insertAfter( bqBlock ); else { node.breakParent( node.getParent() ); processedBlockquoteBlocks.push( node.getNext() ); } // Remember the blockquote node so we can clear it later (if it becomes empty). if ( !bqBlock.getCustomData( 'blockquote_processed' ) ) { processedBlockquoteBlocks.push( bqBlock ); CKEDITOR.dom.element.setMarker( database, bqBlock, 'blockquote_processed', true ); } movedNodes.push( node ); } CKEDITOR.dom.element.clearAllMarkers( database ); // Clear blockquote nodes that have become empty. for ( i = processedBlockquoteBlocks.length - 1 ; i >= 0 ; i-- ) { bqBlock = processedBlockquoteBlocks[i]; if ( noBlockLeft( bqBlock ) ) bqBlock.remove(); } if ( editor.config.enterMode == CKEDITOR.ENTER_BR ) { var firstTime = true; while ( movedNodes.length ) { node = movedNodes.shift(); if ( node.getName() == 'div' ) { docFrag = new CKEDITOR.dom.documentFragment( editor.document ); var needBeginBr = firstTime && node.getPrevious() && !( node.getPrevious().type == CKEDITOR.NODE_ELEMENT && node.getPrevious().isBlockBoundary() ); if ( needBeginBr ) docFrag.append( editor.document.createElement( 'br' ) ); var needEndBr = node.getNext() && !( node.getNext().type == CKEDITOR.NODE_ELEMENT && node.getNext().isBlockBoundary() ); while ( node.getFirst() ) node.getFirst().remove().appendTo( docFrag ); if ( needEndBr ) docFrag.append( editor.document.createElement( 'br' ) ); docFrag.replace( node ); firstTime = false; } } } } selection.selectBookmarks( bookmarks ); editor.focus(); } }; CKEDITOR.plugins.add( 'blockquote', { init : function( editor ) { editor.addCommand( 'blockquote', commandObject ); editor.ui.addButton( 'Blockquote', { label : editor.lang.blockquote, command : 'blockquote' } ); editor.on( 'selectionChange', onSelectionChange ); }, requires : [ 'domiterator' ] } ); })();
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @file Spell checker */ // Register a plugin named "wsc". CKEDITOR.plugins.add( 'wsc', { requires : [ 'dialog' ], init : function( editor ) { var commandName = 'checkspell'; var command = editor.addCommand( commandName, new CKEDITOR.dialogCommand( commandName ) ); // SpellChecker doesn't work in Opera and with custom domain command.modes = { wysiwyg : ( !CKEDITOR.env.opera && !CKEDITOR.env.air && document.domain == window.location.hostname ) }; editor.ui.addButton( 'SpellChecker', { label : editor.lang.spellCheck.toolbar, command : commandName }); CKEDITOR.dialog.add( commandName, this.path + 'dialogs/wsc.js' ); } }); CKEDITOR.config.wsc_customerId = CKEDITOR.config.wsc_customerId || '1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk' ; CKEDITOR.config.wsc_customLoaderScript = CKEDITOR.config.wsc_customLoaderScript || null;
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.dialog.add( 'checkspell', function( editor ) { var number = CKEDITOR.tools.getNextNumber(), iframeId = 'cke_frame_' + number, textareaId = 'cke_data_' + number, errorBoxId = 'cke_error_' + number, interval, protocol = document.location.protocol || 'http:', errorMsg = editor.lang.spellCheck.notAvailable; var pasteArea = '<textarea'+ ' style="display: none"' + ' id="' + textareaId + '"' + ' rows="10"' + ' cols="40">' + ' </textarea><div' + ' id="' + errorBoxId + '"' + ' style="display:none;color:red;font-size:16px;font-weight:bold;padding-top:160px;text-align:center;z-index:11;">' + '</div><iframe' + ' src=""' + ' style="width:100%;background-color:#f1f1e3;"' + ' frameborder="0"' + ' name="' + iframeId + '"' + ' id="' + iframeId + '"' + ' allowtransparency="1">' + '</iframe>'; var wscCoreUrl = editor.config.wsc_customLoaderScript || ( protocol + '//loader.webspellchecker.net/sproxy_fck/sproxy.php' + '?plugin=fck2' + '&customerid=' + editor.config.wsc_customerId + '&cmd=script&doc=wsc&schema=22' ); if ( editor.config.wsc_customLoaderScript ) errorMsg += '<p style="color:#000;font-size:11px;font-weight: normal;text-align:center;padding-top:10px">' + editor.lang.spellCheck.errorLoading.replace( /%s/g, editor.config.wsc_customLoaderScript ) + '</p>'; function burnSpelling( dialog, errorMsg ) { var i = 0; return function () { if ( typeof( window.doSpell ) == 'function' ) { //Call from window.setInteval expected at once. if ( typeof( interval ) != 'undefined' ) window.clearInterval( interval ); initAndSpell( dialog ); } else if ( i++ == 180 ) // Timeout: 180 * 250ms = 45s. window._cancelOnError( errorMsg ); }; } window._cancelOnError = function( m ) { if ( typeof( window.WSC_Error ) == 'undefined' ) { CKEDITOR.document.getById( iframeId ).setStyle( 'display', 'none' ); var errorBox = CKEDITOR.document.getById( errorBoxId ); errorBox.setStyle( 'display', 'block' ); errorBox.setHtml( m || editor.lang.spellCheck.notAvailable ); } }; function initAndSpell( dialog ) { var LangComparer = new window._SP_FCK_LangCompare(), // Language abbr standarts comparer. pluginPath = CKEDITOR.getUrl( editor.plugins.wsc.path + 'dialogs/' ), // Service paths corecting/preparing. framesetPath = pluginPath + 'tmpFrameset.html'; // global var is used in FCK specific core // change on equal var used in fckplugin.js window.gFCKPluginName = 'wsc'; LangComparer.setDefaulLangCode( editor.config.defaultLanguage ); window.doSpell({ ctrl : textareaId, lang : editor.config.wsc_lang || LangComparer.getSPLangCode(editor.langCode ), intLang: editor.config.wsc_uiLang || LangComparer.getSPLangCode(editor.langCode ), winType : iframeId, // If not defined app will run on winpopup. // Callback binding section. onCancel : function() { dialog.hide(); }, onFinish : function( dT ) { editor.focus(); dialog.getParentEditor().setData( dT.value ); dialog.hide(); }, // Some manipulations with client static pages. staticFrame : framesetPath, framesetPath : framesetPath, iframePath : pluginPath + 'ciframe.html', // Styles defining. schemaURI : pluginPath + 'wsc.css', userDictionaryName: editor.config.wsc_userDictionaryName, customDictionaryName: editor.config.wsc_customDictionaryIds && editor.config.wsc_customDictionaryIds.split(","), domainName: editor.config.wsc_domainName }); // Hide user message console (if application was loaded more then after timeout). CKEDITOR.document.getById( errorBoxId ).setStyle( 'display', 'none' ); CKEDITOR.document.getById( iframeId ).setStyle( 'display', 'block' ); } return { title : editor.config.wsc_dialogTitle || editor.lang.spellCheck.title, minWidth : 485, minHeight : 380, buttons : [ CKEDITOR.dialog.cancelButton ], onShow : function() { var contentArea = this.getContentElement( 'general', 'content' ).getElement(); contentArea.setHtml( pasteArea ); contentArea.getChild( 2 ).setStyle( 'height', this._.contentSize.height + 'px' ); if ( typeof( window.doSpell ) != 'function' ) { // Load script. CKEDITOR.document.getHead().append( CKEDITOR.document.createElement( 'script', { attributes : { type : 'text/javascript', src : wscCoreUrl } }) ); } var sData = editor.getData(); // Get the data to be checked. CKEDITOR.document.getById( textareaId ).setValue( sData ); interval = window.setInterval( burnSpelling( this, errorMsg ), 250 ); }, onHide : function() { window.ooo = undefined; window.int_framsetLoaded = undefined; window.framesetLoaded = undefined; window.is_window_opened = false; }, contents : [ { id : 'general', label : editor.config.wsc_dialogTitle || editor.lang.spellCheck.title, padding : 0, elements : [ { type : 'html', id : 'content', html : '' } ] } ] }; }); // Expand the spell-check frame when dialog resized. (#6829) CKEDITOR.dialog.on( 'resize', function( evt ) { var data = evt.data, dialog = data.dialog; if ( dialog._.name == 'checkspell' ) { var content = dialog.getContentElement( 'general', 'content' ).getElement(), iframe = content && content.getChild( 2 ); iframe && iframe.setSize( 'height', data.height ); iframe && iframe.setSize( 'width', data.width ); } });
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'contextmenu', { requires : [ 'menu' ], // Make sure the base class (CKEDITOR.menu) is loaded before it (#3318). onLoad : function() { CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( { base : CKEDITOR.menu, $ : function( editor ) { this.base.call( this, editor, { panel: { className : editor.skinClass + ' cke_contextmenu', attributes : { 'aria-label' : editor.lang.contextmenu.options } } }); }, proto : { addTarget : function( element, nativeContextMenuOnCtrl ) { // Opera doesn't support 'contextmenu' event, we have duo approaches employed here: // 1. Inherit the 'button override' hack we introduced in v2 (#4530), while this require the Opera browser // option 'Allow script to detect context menu/right click events' to be always turned on. // 2. Considering the fact that ctrl/meta key is not been occupied // for multiple range selecting (like Gecko), we use this key // combination as a fallback for triggering context-menu. (#4530) if ( CKEDITOR.env.opera && !( 'oncontextmenu' in document.body )) { var contextMenuOverrideButton; element.on( 'mousedown', function( evt ) { evt = evt.data; if ( evt.$.button != 2 ) { if ( evt.getKeystroke() == CKEDITOR.CTRL + 1 ) element.fire( 'contextmenu', evt ); return; } if ( nativeContextMenuOnCtrl && ( CKEDITOR.env.mac ? evt.$.metaKey : evt.$.ctrlKey ) ) return; var target = evt.getTarget(); if ( !contextMenuOverrideButton ) { var ownerDoc = target.getDocument(); contextMenuOverrideButton = ownerDoc.createElement( 'input' ) ; contextMenuOverrideButton.$.type = 'button' ; ownerDoc.getBody().append( contextMenuOverrideButton ) ; } contextMenuOverrideButton.setAttribute( 'style', 'position:absolute;top:' + ( evt.$.clientY - 2 ) + 'px;left:' + ( evt.$.clientX - 2 ) + 'px;width:5px;height:5px;opacity:0.01' ); } ); element.on( 'mouseup', function ( evt ) { if ( contextMenuOverrideButton ) { contextMenuOverrideButton.remove(); contextMenuOverrideButton = undefined; // Simulate 'contextmenu' event. element.fire( 'contextmenu', evt.data ); } } ); } element.on( 'contextmenu', function( event ) { var domEvent = event.data; if ( nativeContextMenuOnCtrl && // Safari on Windows always show 'ctrlKey' as true in 'contextmenu' event, // which make this property unreliable. (#4826) ( CKEDITOR.env.webkit ? holdCtrlKey : ( CKEDITOR.env.mac ? domEvent.$.metaKey : domEvent.$.ctrlKey ) ) ) return; // Cancel the browser context menu. domEvent.preventDefault(); var offsetParent = domEvent.getTarget().getDocument().getDocumentElement(), offsetX = domEvent.$.clientX, offsetY = domEvent.$.clientY; CKEDITOR.tools.setTimeout( function() { this.open( offsetParent, null, offsetX, offsetY ); // IE needs a short while to allow selection change before opening menu. (#7908) }, CKEDITOR.env.ie? 200 : 0, this ); }, this ); if ( CKEDITOR.env.opera ) { // 'contextmenu' event triggered by Windows menu key is unpreventable, // cancel the key event itself. (#6534) element.on( 'keypress' , function ( evt ) { var domEvent = evt.data; if ( domEvent.$.keyCode === 0 ) domEvent.preventDefault(); }); } if ( CKEDITOR.env.webkit ) { var holdCtrlKey, onKeyDown = function( event ) { holdCtrlKey = CKEDITOR.env.mac ? event.data.$.metaKey : event.data.$.ctrlKey ; }, resetOnKeyUp = function() { holdCtrlKey = 0; }; element.on( 'keydown', onKeyDown ); element.on( 'keyup', resetOnKeyUp ); element.on( 'contextmenu', resetOnKeyUp ); } }, open : function( offsetParent, corner, offsetX, offsetY ) { this.editor.focus(); offsetParent = offsetParent || CKEDITOR.document.getDocumentElement(); this.show( offsetParent, corner, offsetX, offsetY ); } } }); }, beforeInit : function( editor ) { editor.contextMenu = new CKEDITOR.plugins.contextMenu( editor ); editor.addCommand( 'contextMenu', { exec : function() { editor.contextMenu.open( editor.document.getBody() ); } }); } }); /** * Whether to show the browser native context menu when the <em>Ctrl</em> or * <em>Meta</em> (Mac) key is pressed on opening the context menu with the * right mouse button click or the <em>Menu</em> key. * @name CKEDITOR.config.browserContextMenuOnCtrl * @since 3.0.2 * @type Boolean * @default <code>true</code> * @example * config.browserContextMenuOnCtrl = false; */
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.add( 'basicstyles', { requires : [ 'styles', 'button' ], init : function( editor ) { // All buttons use the same code to register. So, to avoid // duplications, let's use this tool function. var addButtonCommand = function( buttonName, buttonLabel, commandName, styleDefiniton ) { var style = new CKEDITOR.style( styleDefiniton ); editor.attachStyleStateChange( style, function( state ) { !editor.readOnly && editor.getCommand( commandName ).setState( state ); }); editor.addCommand( commandName, new CKEDITOR.styleCommand( style ) ); editor.ui.addButton( buttonName, { label : buttonLabel, command : commandName }); }; var config = editor.config, lang = editor.lang; addButtonCommand( 'Bold' , lang.bold , 'bold' , config.coreStyles_bold ); addButtonCommand( 'Italic' , lang.italic , 'italic' , config.coreStyles_italic ); addButtonCommand( 'Underline' , lang.underline , 'underline' , config.coreStyles_underline ); addButtonCommand( 'Strike' , lang.strike , 'strike' , config.coreStyles_strike ); addButtonCommand( 'Subscript' , lang.subscript , 'subscript' , config.coreStyles_subscript ); addButtonCommand( 'Superscript' , lang.superscript , 'superscript' , config.coreStyles_superscript ); } }); // Basic Inline Styles. /** * The style definition that applies the <strong>bold</strong> style to the text. * @type Object * @default <code>{ element : 'strong', overrides : 'b' }</code> * @example * config.coreStyles_bold = { element : 'b', overrides : 'strong' }; * @example * config.coreStyles_bold = * { * element : 'span', * attributes : { 'class' : 'Bold' } * }; */ CKEDITOR.config.coreStyles_bold = { element : 'strong', overrides : 'b' }; /** * The style definition that applies the <em>italics</em> style to the text. * @type Object * @default <code>{ element : 'em', overrides : 'i' }</code> * @example * config.coreStyles_italic = { element : 'i', overrides : 'em' }; * @example * CKEDITOR.config.coreStyles_italic = * { * element : 'span', * attributes : { 'class' : 'Italic' } * }; */ CKEDITOR.config.coreStyles_italic = { element : 'em', overrides : 'i' }; /** * The style definition that applies the <u>underline</u> style to the text. * @type Object * @default <code>{ element : 'u' }</code> * @example * CKEDITOR.config.coreStyles_underline = * { * element : 'span', * attributes : { 'class' : 'Underline' } * }; */ CKEDITOR.config.coreStyles_underline = { element : 'u' }; /** * The style definition that applies the <strike>strike-through</strike> style to the text. * @type Object * @default <code>{ element : 'strike' }</code> * @example * CKEDITOR.config.coreStyles_strike = * { * element : 'span', * attributes : { 'class' : 'StrikeThrough' }, * overrides : 'strike' * }; */ CKEDITOR.config.coreStyles_strike = { element : 'strike' }; /** * The style definition that applies the subscript style to the text. * @type Object * @default <code>{ element : 'sub' }</code> * @example * CKEDITOR.config.coreStyles_subscript = * { * element : 'span', * attributes : { 'class' : 'Subscript' }, * overrides : 'sub' * }; */ CKEDITOR.config.coreStyles_subscript = { element : 'sub' }; /** * The style definition that applies the superscript style to the text. * @type Object * @default <code>{ element : 'sup' }</code> * @example * CKEDITOR.config.coreStyles_superscript = * { * element : 'span', * attributes : { 'class' : 'Superscript' }, * overrides : 'sup' * }; */ CKEDITOR.config.coreStyles_superscript = { element : 'sup' };
JavaScript
/* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** * @fileOverview The "div" plugin. It wraps the selected block level elements with a 'div' element with specified styles and attributes. * */ (function() { CKEDITOR.plugins.add( 'div', { requires : [ 'editingblock', 'domiterator', 'styles' ], init : function( editor ) { var lang = editor.lang.div; editor.addCommand( 'creatediv', new CKEDITOR.dialogCommand( 'creatediv' ) ); editor.addCommand( 'editdiv', new CKEDITOR.dialogCommand( 'editdiv' ) ); editor.addCommand( 'removediv', { exec : function( editor ) { var selection = editor.getSelection(), ranges = selection && selection.getRanges(), range, bookmarks = selection.createBookmarks(), walker, toRemove = []; function findDiv( node ) { var path = new CKEDITOR.dom.elementPath( node ), blockLimit = path.blockLimit, div = blockLimit.is( 'div' ) && blockLimit; if ( div && !div.data( 'cke-div-added' ) ) { toRemove.push( div ); div.data( 'cke-div-added' ); } } for ( var i = 0 ; i < ranges.length ; i++ ) { range = ranges[ i ]; if ( range.collapsed ) findDiv( selection.getStartElement() ); else { walker = new CKEDITOR.dom.walker( range ); walker.evaluator = findDiv; walker.lastForward(); } } for ( i = 0 ; i < toRemove.length ; i++ ) toRemove[ i ].remove( true ); selection.selectBookmarks( bookmarks ); } } ); editor.ui.addButton( 'CreateDiv', { label : lang.toolbar, command :'creatediv' } ); if ( editor.addMenuItems ) { editor.addMenuItems( { editdiv : { label : lang.edit, command : 'editdiv', group : 'div', order : 1 }, removediv: { label : lang.remove, command : 'removediv', group : 'div', order : 5 } } ); if ( editor.contextMenu ) { editor.contextMenu.addListener( function( element, selection ) { if ( !element || element.isReadOnly() ) return null; var elementPath = new CKEDITOR.dom.elementPath( element ), blockLimit = elementPath.blockLimit; if ( blockLimit && blockLimit.getAscendant( 'div', true ) ) { return { editdiv : CKEDITOR.TRISTATE_OFF, removediv : CKEDITOR.TRISTATE_OFF }; } return null; } ); } } CKEDITOR.dialog.add( 'creatediv', this.path + 'dialogs/div.js' ); CKEDITOR.dialog.add( 'editdiv', this.path + 'dialogs/div.js' ); } } ); })();
JavaScript