-
+ 7DD658DC5C080C8AC353A0D6DFB229F8F681FD731321339169BFDA0578DC113BCCB7A230469087D6AEDE5EA8F20C284BEF3D0D88DEC14EE06A7FD1F4F39A6F52
mp-wp/wp-includes/js/tinymce/themes/advanced/js/link.js
(0 . 0)(1 . 155)
128952 tinyMCEPopup.requireLangPack();
128953
128954 var LinkDialog = {
128955 preInit : function() {
128956 var url;
128957
128958 if (url = tinyMCEPopup.getParam("external_link_list_url"))
128959 document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
128960 },
128961
128962 init : function() {
128963 var f = document.forms[0], ed = tinyMCEPopup.editor;
128964
128965 // Setup browse button
128966 document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link');
128967 if (isVisible('hrefbrowser'))
128968 document.getElementById('href').style.width = '180px';
128969
128970 this.fillClassList('class_list');
128971 this.fillFileList('link_list', 'tinyMCELinkList');
128972 this.fillTargetList('target_list');
128973
128974 if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) {
128975 f.href.value = ed.dom.getAttrib(e, 'href');
128976 f.linktitle.value = ed.dom.getAttrib(e, 'title');
128977 f.insert.value = ed.getLang('update');
128978 selectByValue(f, 'link_list', f.href.value);
128979 selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target'));
128980 selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class'));
128981 }
128982 },
128983
128984 update : function() {
128985 var f = document.forms[0], ed = tinyMCEPopup.editor, e, b;
128986
128987 tinyMCEPopup.restoreSelection();
128988 e = ed.dom.getParent(ed.selection.getNode(), 'A');
128989
128990 // Remove element if there is no href
128991 if (!f.href.value) {
128992 if (e) {
128993 tinyMCEPopup.execCommand("mceBeginUndoLevel");
128994 b = ed.selection.getBookmark();
128995 ed.dom.remove(e, 1);
128996 ed.selection.moveToBookmark(b);
128997 tinyMCEPopup.execCommand("mceEndUndoLevel");
128998 tinyMCEPopup.close();
128999 return;
129000 }
129001 }
129002
129003 tinyMCEPopup.execCommand("mceBeginUndoLevel");
129004
129005 // Create new anchor elements
129006 if (e == null) {
129007 tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
129008
129009 tinymce.each(ed.dom.select("a"), function(n) {
129010 if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
129011 e = n;
129012
129013 ed.dom.setAttribs(e, {
129014 href : f.href.value,
129015 title : f.linktitle.value,
129016 target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
129017 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
129018 });
129019 }
129020 });
129021 } else {
129022 ed.dom.setAttribs(e, {
129023 href : f.href.value,
129024 title : f.linktitle.value,
129025 target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
129026 'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
129027 });
129028 }
129029
129030 // Don't move caret if selection was image
129031 if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {
129032 ed.focus();
129033 ed.selection.select(e);
129034 ed.selection.collapse(0);
129035 tinyMCEPopup.storeSelection();
129036 }
129037
129038 tinyMCEPopup.execCommand("mceEndUndoLevel");
129039 tinyMCEPopup.close();
129040 },
129041
129042 checkPrefix : function(n) {
129043 if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))
129044 n.value = 'mailto:' + n.value;
129045
129046 if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
129047 n.value = 'http://' + n.value;
129048 },
129049
129050 fillFileList : function(id, l) {
129051 var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
129052
129053 l = window[l];
129054
129055 if (l && l.length > 0) {
129056 lst.options[lst.options.length] = new Option('', '');
129057
129058 tinymce.each(l, function(o) {
129059 lst.options[lst.options.length] = new Option(o[0], o[1]);
129060 });
129061 } else
129062 dom.remove(dom.getParent(id, 'tr'));
129063 },
129064
129065 fillClassList : function(id) {
129066 var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
129067
129068 if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
129069 cl = [];
129070
129071 tinymce.each(v.split(';'), function(v) {
129072 var p = v.split('=');
129073
129074 cl.push({'title' : p[0], 'class' : p[1]});
129075 });
129076 } else
129077 cl = tinyMCEPopup.editor.dom.getClasses();
129078
129079 if (cl.length > 0) {
129080 lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
129081
129082 tinymce.each(cl, function(o) {
129083 lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
129084 });
129085 } else
129086 dom.remove(dom.getParent(id, 'tr'));
129087 },
129088
129089 fillTargetList : function(id) {
129090 var dom = tinyMCEPopup.dom, lst = dom.get(id), v;
129091
129092 lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
129093 lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self');
129094 lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank');
129095
129096 if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) {
129097 tinymce.each(v.split(','), function(v) {
129098 v = v.split('=');
129099 lst.options[lst.options.length] = new Option(v[0], v[1]);
129100 });
129101 }
129102 }
129103 };
129104
129105 LinkDialog.preInit();
129106 tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog);