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 line
16 KiB

7 years ago
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=