AVE.CMS v3.28
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1 lines
16 KiB

This file contains unexpected Bidirectional Unicode characters!

This file contains unexpected Bidirectional Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

CKEDITOR.dialog.add("link",function(e){function r(e){return e.replace(/'/g,"\\$&")}function i(e){var i,s=t,o,u;i=[n,"("];for(var a=0;a<s.length;a++)o=s[a].toLowerCase(),u=e[o],0<a&&i.push(","),i.push("'",u?r(encodeURIComponent(e[o])):"","'");i.push(")");return i.join("")}function s(e){for(var t,n=e.length,r=[],i=0;i<n;i++)t=e.charCodeAt(i),r.push(t);return"String.fromCharCode("+r.join(",")+")"}function o(e){return(e=e.getAttribute("class"))?e.replace(/\s*(?:cke_anchor_empty|cke_anchor)(?:\s*$)?/g,""):""}var t,n;var u=CKEDITOR.plugins.link,a=function(){var t=this.getDialog(),n=t.getContentElement("target","popupFeatures"),t=t.getContentElement("target","linkTargetName"),r=this.getValue();if(n&&t)switch(n=n.getElement(),n.hide(),t.setValue(""),r){case"frame":t.setLabel(e.lang.link.targetFrameName);t.getElement().show();break;case"popup":n.show();t.setLabel(e.lang.link.targetPopupName);t.getElement().show();break;default:t.setValue(r),t.getElement().hide()}},f=/^javascript:/,l=/^mailto:([^?]+)(?:\?(.+))?$/,c=/subject=([^;?:@&=$,\/]*)/,h=/body=([^;?:@&=$,\/]*)/,p=/^#(.*)$/,d=/^((?:http|https|ftp|news):\/\/)?(.*)$/,v=/^(_(?:self|top|parent|blank))$/,m=/^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,g=/^javascript:([^(]+)\(([^)]+)\)$/,y=/\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/,b=/(?:^|,)([^=]+)=(\d+|yes|no)/gi,w=function(e,r){var i=r&&(r.data("cke-saved-href")||r.getAttribute("href"))||"",s,u,a={};i.match(f)&&("encode"==N?i=i.replace(m,function(e,t,n){return"mailto:"+String.fromCharCode.apply(String,t.split(","))+(n&&n.replace(/\\'/g,"'"))}):N&&i.replace(g,function(e,r,i){if(r==n){a.type="email";for(var e=a.email={},r=/(^')|('$)/g,i=i.match(/[^,\s]+/g),s=i.length,o,u,f=0;f<s;f++)o=decodeURIComponent,u=i[f].replace(r,"").replace(/\\'/g,"'"),u=o(u),o=t[f].toLowerCase(),e[o]=u;e.address=[e.name,e.domain].join("@")}}));if(!a.type)if(s=i.match(p))a.type="anchor",a.anchor={},a.anchor.name=a.anchor.id=s[1];else if(s=i.match(l)){u=i.match(c);i=i.match(h);a.type="email";var w=a.email={};w.address=s[1];u&&(w.subject=decodeURIComponent(u[1]));i&&(w.body=decodeURIComponent(i[1]))}else i&&(u=i.match(d))?(a.type="url",a.url={},a.url.protocol=u[1],a.url.url=u[2]):a.type="url";if(r){s=r.getAttribute("target");a.target={};a.adv={};if(s)s.match(v)?a.target.type=a.target.name=s:(a.target.type="frame",a.target.name=s);else if(s=(s=r.data("cke-pa-onclick")||r.getAttribute("onclick"))&&s.match(y)){a.target.type="popup";for(a.target.name=s[1];i=b.exec(s[2]);)("yes"==i[2]||"1"==i[2])&&!(i[1]in{height:1,width:1,top:1,left:1})?a.target[i[1]]=!0:isFinite(i[2])&&(a.target[i[1]]=i[2])}s=function(e,t){var n=r.getAttribute(t);null!==n&&(a.adv[e]=n||"")};s("advId","id");s("advLangDir","dir");s("advAccessKey","accessKey");a.adv.advName=r.data("cke-saved-name")||r.getAttribute("name")||"";s("advLangCode","lang");s("advTabIndex","tabindex");s("advTitle","title");s("advContentType","type");CKEDITOR.plugins.link.synAnchorSelector?a.adv.advCSSClasses=o(r):s("advCSSClasses","class");s("advCharset","charset");s("advStyles","style");s("advRel","rel")}s=a.anchors=[];var E;if(CKEDITOR.plugins.link.emptyAnchorFix){w=e.document.getElementsByTag("a");i=0;for(u=w.count();i<u;i++)if(E=w.getItem(i),E.data("cke-saved-name")||E.hasAttribute("name"))s.push({name:E.data("cke-saved-name")||E.getAttribute("name"),id:E.getAttribute("id")})}else{w=new CKEDITOR.dom.nodeList(e.document.$.anchors);i=0;for(u=w.count();i<u;i++)E=w.getItem(i),s[i]={name:E.getAttribute("name"),id:E.getAttribute("id")}}if(CKEDITOR.plugins.link.fakeAnchor){w=e.document.getElementsByTag("img");i=0;for(u=w.count();i<u;i++)(E=CKEDITOR.plugins.link.tryRestoreFakeAnchor(e,w.getItem(i)))&&s.push({name:E.getAttribute("name"),id:E.getAttribute("id")})}this._.selectedElement=r;return a},E=function(e){e.target&&this.setValue(e.target[this.id]||"")},S=function(e){e.adv&&this.setValue(e.adv[this.id]||"")},x=function(e){e.target||(e.target={});e.target[this.id]=this.getValue()||""},T=function(e){e.adv||(e.adv={});e.adv[this.id]=this.getValue()||""},N=e.config.emailProtection||"";N&&"encode"!=N&&(n=t=void 0,N.replace(/^([^(]+)\(([^)]+)\)$/,function(e,r,i){n=r;t=[];i.replace(/[^,\s]+/g,function(e){t.push(e)})}));var C=e.lang.common,k=e.lang.link;return{title:k.title,minWidth:400,minHeight:230,contents:[{id:"info",label:k.info,title:k.info,elements:[{id:"linkType",type:"select",label:k.type,"default":"url",items:[[k.toUrl,"url"],[k.toAnchor,"anchor"],[k.toEmail,"email"]],onChange:function(){var t=this.getDialog(),n=["urlOptions","anchorOptions","emailOptions"],r=this.getValue(),i=t.definition.getContents("upload"),i=i&&i.hidden;if(r=="url"){e.config.linkShowTargetTab&&t.showPage("target");i||t.showPage("upload")}else{t.hidePage("target");i||t.hidePage("upload")}for(i=0;i<n.length;i++){var s=t.getContentElement("info",n[i]);if(s){s=s.getElement().getParent().getParent();n[i]==r+"Options"?s.show():s.hide()}}t.layout()},setup:function(e){e.type&&this.setValue(e.type)},commit:function(e){e.type=this.getValue()}},{type:"vbox",id:"urlOptions",children:[{type:"hbox",widths:["25%","75%"],children:[{id:"protocol",type:"select",label:C.protocol,"default":"",items:[["http://","http://"],["https://","https://"],["ftp://","ftp://"],["news://","news://"],[k.other,""]],setup:function(e){e.url&&this.setValue(e.url.protocol||"")},commit:function(e){if(!e.url)e.url={};e.url.protocol=this.getValue()}},{type:"text",id:"url",label:C.url,required:!0,onLoad:function(){this.allowOnChange=true},onKeyUp:function(){this.allowOnChange=false;var e=this.getDialog().getContentElement("info","protocol"),t=this.getValue(),n=/^((javascript:)|[#\/\.\?])/i,r=/^(http|https|ftp|news):\/\/(?=.)/i.exec(t);if(r){this.setValue(t.substr(r[0].length));e.setValue(r[0].toLowerCase())}else n.test(t)&&e.setValue("");this.allowOnChange=true},onChange:function(){if(this.allowOnChange)this.onKeyUp()},validate:function(){var e=this.getDialog();if(e.getContentElement("info","linkType")&&e.getValueOf("info","linkType")!="url")return true;if(/javascript\:/.test(this.getValue())){alert(C.invalidValue);return false}return this.getDialog().fakeObj?true:CKEDITOR.dialog.validate.notEmpty(k.noUrl).apply(this)},setup:function(e){this.allowOnChange=false;e.url&&this.setValue(e.url.url);this.allowOnChange=true},commit:function(e){this.onChange();if(!e.url)e.url={};e.url.url=this.getValue();this.allowOnChange=false}}],setup:function(){this.getDialog().getContentElement("info","linkType")||this.getElement().show()}},{type:"button",id:"browse",hidden:"true",filebrowser:{action:"Browse",target:"info:url",url:e.config.filebrowserImageBrowseUrl},label:C.browseServer},{type:"button",id:"browse",hidden:"true",filebrowser:{action:"Browse",target:"info:url",url:e.config.filebrowserLinkBrowseUrl},label:C.browseDocuments}]},{type:"vbox",id:"anchorOptions",width:260,align:"center",padding:0,children:[{type:"fieldset",id:"selectAnchorText",label:k.selectAnchor,setup:function(e){e.anchors.length>0?this.getElement().show():this.getElement().hide()},children:[{type:"hbox",id:"selectAnchor",children:[{type:"select",id:"anchorName","default":"",label:k.anchorName,style:"width: 100%;",items:[[""]],setup:function(e){this.clear();this.add("");for(var t=0;t<e.anchors.length;t++)e.anchors[t].name&&this.add(e.anchors[t].name);e.anchor&&this.setValue(e.anchor.name);(e=this.getDialog().getContentElement("info","linkType"))&&e.getValue()=="email"&&this.focus()},commit:function(e){if(!e.anchor)e.anchor={};e.anchor.name=this.getValue()}},{type:"select",id:"anchorId","default":"",label:k.anchorId,style:"width: 100%;",items:[[""]],setup:function(e){this.clear();this.add("");for(var t=0;t<e.anchors.length;t++)e.anchors[t].id&&this.add(e.anchors[t].id);e.anchor&&this.setValue(e.anchor.id)},commit:function(e){if(!e.anchor)e.anchor={};e.anchor.id=this.getValue()}}],setup:function(e){e.anchors.length>0?this.getElement().show():this.getElement().hide()}}]},{type:"html",id:"noAnchors",style:"text-align: center;",html:'<div role="note" tabIndex="-1">'+CKEDITOR.tools.htmlEncode(k.noAnchors)+"</div>",focus:!0,setup:function(e){e.anchors.length<1?this.getElement().show():this.getElement().hide()}}],setup:function(){this.getDialog().getContentElement("info","linkType")||this.getElement().hide()}},{type:"vbox",id:"emailOptions",padding:1,children:[{type:"text",id:"emailAddress",label:k.emailAddress,required:!0,validate:function(){var e=this.getDialog();return!e.getContentElement("info","linkType")||e.getValueOf("info","linkType")!="email"?true:CKEDITOR.dialog.validate.notEmpty(k.noEmail).apply(this)},setup:function(e){e.email&&this.setValue(e.email.address);(e=this.getDialog().getContentElement("info","linkType"))&&e.getValue()=="email"&&this.select()},commit:function(e){if(!e.email)e.email={};e.email.address=this.getValue()}},{type:"text",id:"emailSubject",label:k.emailSubject,setup:function(e){e.email&&this.setValue(e.email.subject)},commit:function(e){if(!e.email)e.email={};e.email.subject=this.getValue()}},{type:"textarea",id:"emailBody",label:k.emailBody,rows:3,"default":"",setup:function(e){e.email&&this.setValue(e.email.body)},commit:function(e){if(!e.email)e.email={};e.email.body=this.getValue()}}],setup:function(){this.getDialog().getContentElement("info","linkType")||this.getElement().hide()}}]},{id:"target",label:k.target,title:k.target,elements:[{type:"hbox",widths:["50%","50%"],children:[{type:"select",id:"linkTargetType",label:C.target,"default":"notSet",style:"width : 100%;",items:[[C.notSet,"notSet"],[k.targetFrame,"frame"],[k.targetPopup,"popup"],[C.targetNew,"_blank"],[C.targetTop,"_top"],[C.targetSelf,"_self"],[C.targetParent,"_parent"]],onChange:a,setup:function(e){e.target&&this.setValue(e.target.type||"notSet");a.call(this)},commit:function(e){if(!e.target)e.target={};e.target.type=this.getValue()}},{type:"text",id:"linkTargetName",label:k.targetFrameName,"default":"",setup:function(e){e.target&&this.setValue(e.target.name)},commit:function(e){if(!e.target)e.target={};e.target.name=this.getValue().replace(/\W/gi,"")}}]},{type:"vbox",width:"100%",align:"center",padding:2,id:"popupFeatures",children:[{type:"fieldset",label:k.popupFeatures,children:[{type:"hbox",children:[{type:"checkbox",id:"resizable",label:k.popupResizable,setup:E,commit:x},{type:"checkbox",id:"status",label:k.popupStatusBar,setup:E,commit:x}]},{type:"hbox",children:[{type:"checkbox",id:"location",label:k.popupLocationBar,setup:E,commit:x},{type:"checkbox",id:"toolbar",label:k.popupToolbar,setup:E,commit:x}]},{type:"hbox",children:[{type:"checkbox",id:"menubar",label:k.popupMenuBar,setup:E,commit:x},{type:"checkbox",id:"fullscreen",label:k.popupFullScreen,setup:E,commit:x}]},{type:"hbox",children:[{type:"checkbox",id:"scrollbars",label:k.popupScrollBars,setup:E,commit:x},{type:"checkbox",id:"dependent",label:k.popupDependent,setup:E,commit:x}]},{type:"hbox",children:[{type:"text",widths:["50%","50%"],labelLayout:"horizontal",label:C.width,id:"width",setup:E,commit:x},{type:"text",labelLayout:"horizontal",widths:["50%","50%"],label:k.popupLeft,id:"left",setup:E,commit:x}]},{type:"hbox",children:[{type:"text",labelLayout:"horizontal",widths:["50%","50%"],label:C.height,id:"height",setup:E,commit:x},{type:"text",labelLayout:"horizontal",label:k.popupTop,widths:["50%","50%"],id:"top",setup:E,commit:x}]}]}]}]},{id:"upload",label:k.upload,title:k.upload,hidden:!0,filebrowser:"uploadButton",elements:[{type:"file",id:"upload",label:C.upload,style:"height:40px",size:29},{type:"fileButton",id:"uploadButton",label:C.uploadSubmit,filebrowser:"info:url","for":["upload","upload"]}]},{id:"advanced",label:k.advanced,title:k.advanced,elements:[{type:"vbox",padding:1,children:[{type:"hbox",widths:["45%","35%","20%"],children:[{type:"text",id:"advId",label:k.id,setup:S,commit:T},{type:"select",id:"advLangDir",label:k.langDir,"default":"",style:"width:110px",items:[[C.notSet,""],[k.langDirLTR,"ltr"],[k.langDirRTL,"rtl"]],setup:S,commit:T},{type:"text",id:"advAccessKey",width:"80px",label:k.acccessKey,maxLength:1,setup:S,commit:T}]},{type:"hbox",widths:["45%","35%","20%"],children:[{type:"text",label:k.name,id:"advName",setup:S,commit:T},{type:"text",label:k.langCode,id:"advLangCode",width:"110px","default":"",setup:S,commit:T},{type:"text",label:k.tabIndex,id:"advTabIndex",width:"80px",maxLength:5,setup:S,commit:T}]}]},{type:"vbox",padding:1,children:[{type:"hbox",widths:["45%","55%"],children:[{type:"text",label:k.advisoryTitle,"default":"",id:"advTitle",setup:S,commit:T},{type:"text",label:k.advisoryContentType,"default":"",id:"advContentType",setup:S,commit:T}]},{type:"hbox",widths:["45%","55%"],children:[{type:"text",label:k.cssClasses,"default":"",id:"advCSSClasses",setup:S,commit:T},{type:"text",label:k.charset,"default":"",id:"advCharset",setup:S,commit:T}]},{type:"hbox",widths:["45%","55%"],children:[{type:"text",label:k.rel,"default":"",id:"advRel",setup:S,commit:T},{type:"text",label:k.styles,"default":"",id:"advStyles",validate:CKEDITOR.dialog.validate.inlineStyle(e.lang.common.invalidInlineStyle),setup:S,commit:T}]}]}]}],onShow:function(){var e=this.getParentEditor(),t=e.getSelection(),n=null;(n=u.getSelectedLink(e))&&n.hasAttribute("href")?t.selectElement(n):n=null;this.setupContent(w.apply(this,[e,n]))},onOk:function(){var e={},t=[],n={},o=this.getParentEditor();this.commitContent(n);switch(n.type||"url"){case"url":var u=n.url&&n.url.protocol!=void 0?n.url.protocol:"http://",a=n.url&&CKEDITOR.tools.trim(n.url.url)||"";e["data-cke-saved-href"]=a.indexOf("/")===0?a:u+a;break;case"anchor":u=n.anchor&&n.anchor.id;e["data-cke-saved-href"]="#"+(n.anchor&&n.anchor.name||u||"");break;case"email":var f=n.email,u=f.address;switch(N){case"":case"encode":var a=encodeURIComponent(f.subject||""),l=encodeURIComponent(f.body||""),f=[];a&&f.push("subject="+a);l&&f.push("body="+l);f=f.length?"?"+f.join("&"):"";if(N=="encode"){u=["javascript:void(location.href='mailto:'+",s(u)];f&&u.push("+'",r(f),"'");u.push(")")}else u=["mailto:",u,f];break;default:u=u.split("@",2);f.name=u[0];f.domain=u[1];u=["javascript:",i(f)]}e["data-cke-saved-href"]=u.join("")}if(n.target)if(n.target.type=="popup"){for(var u=["window.open(this.href, '",n.target.name||"","', '"],c=["resizable","status","location","toolbar","menubar","fullscreen","scrollbars","dependent"],a=c.length,f=function(e){n.target[e]&&c.push(e+"="+n.target[e])},l=0;l<a;l++)c[l]=c[l]+(n.target[c[l]]?"=yes":"=no");f("width");f("left");f("height");f("top");u.push(c.join(","),"'); return false;");e["data-cke-pa-onclick"]=u.join("");t.push("target")}else{n.target.type!="notSet"&&n.target.name?e.target=n.target.name:t.push("target");t.push("data-cke-pa-onclick","onclick")}if(n.adv){u=function(r,i){var s=n.adv[r];s?e[i]=s:t.push(i)};u("advId","id");u("advLangDir","dir");u("advAccessKey","accessKey");n.adv.advName?e.name=e["data-cke-saved-name"]=n.adv.advName:t=t.concat(["data-cke-saved-name","name"]);u("advLangCode","lang");u("advTabIndex","tabindex");u("advTitle","title");u("advContentType","type");u("advCSSClasses","class");u("advCharset","charset");u("advStyles","style");u("advRel","rel")}u=o.getSelection();e.href=e["data-cke-saved-href"];if(this._.selectedElement){o=this._.selectedElement;a=o.data("cke-saved-href");f=o.getHtml();o.setAttributes(e);o.removeAttributes(t);n.adv&&n.adv.advName&&CKEDITOR.plugins.link.synAnchorSelector&&o.addClass(o.getChildCount()?"cke_anchor":"cke_anchor_empty");if(a==f||n.type=="email"&&f.indexOf("@")!=-1)o.setHtml(n.type=="email"?n.email.address:e["data-cke-saved-href"]);u.selectElement(o);delete this._.selectedElement}else{u=u.getRanges(1)[0];if(u.collapsed){o=new CKEDITOR.dom.text(n.type=="email"?n.email.address:e["data-cke-saved-href"],o.document);u.insertNode(o);u.selectNodeContents(o)}o=new CKEDITOR.style({element:"a",attributes:e});o.type=CKEDITOR.STYLE_INLINE;o.applyToRange(u);u.select()}},onLoad:function(){e.config.linkShowAdvancedTab||this.hidePage("advanced");e.config.linkShowTargetTab||this.hidePage("target")},onFocus:function(){var e=this.getContentElement("info","linkType");if(e&&e.getValue()=="url"){e=this.getContentElement("info","url");e.select()}}}})