includes/clientside/tinymce/plugins/advlink/js/advlink.js
changeset 395 fa4c5ecb7c9a
parent 335 67bd3121a12e
child 459 31c23016ab62
equal deleted inserted replaced
394:fbfdcea634a7 395:fa4c5ecb7c9a
   112 
   112 
   113 	window.focus();
   113 	window.focus();
   114 }
   114 }
   115 
   115 
   116 function checkPrefix(n) {
   116 function checkPrefix(n) {
   117 	if (Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email')))
   117 	if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email')))
   118 		n.value = 'mailto:' + n.value;
   118 		n.value = 'mailto:' + n.value;
   119 
   119 
   120 	if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external')))
   120 	if (/^\s*www./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external')))
   121 		n.value = 'http://' + n.value;
   121 		n.value = 'http://' + n.value;
   122 }
   122 }
   356 		elm.setAttribute(attrib.toLowerCase(), value);
   356 		elm.setAttribute(attrib.toLowerCase(), value);
   357 
   357 
   358 		if (attrib == "style")
   358 		if (attrib == "style")
   359 			attrib = "style.cssText";
   359 			attrib = "style.cssText";
   360 
   360 
   361 		if (attrib.substring(0, 2) == 'on')
   361 //		if (attrib.substring(0, 2) == 'on')
   362 			value = 'return true;' + value;
   362 //			value = 'return true;' + value;
   363 
   363 
   364 		if (attrib == "class")
   364 		if (attrib == "class")
   365 			attrib = "className";
   365 			attrib = "className";
   366 
   366 
   367 		eval('elm.' + attrib + "=value;");
   367 		elm[attrib] = value;
   368 	} else
   368 	} else
   369 		elm.removeAttribute(attrib);
   369 		elm.removeAttribute(attrib);
   370 }
   370 }
   371 
   371 
   372 function getAnchorListHTML(id, target) {
   372 function getAnchorListHTML(id, target) {
   394 
   394 
   395 	elm = inst.selection.getNode();
   395 	elm = inst.selection.getNode();
   396 	checkPrefix(document.forms[0].href);
   396 	checkPrefix(document.forms[0].href);
   397 
   397 
   398 	elm = inst.dom.getParent(elm, "A");
   398 	elm = inst.dom.getParent(elm, "A");
       
   399 
       
   400 	// Remove element if there is no href
       
   401 	if (!document.forms[0].href.value) {
       
   402 		tinyMCEPopup.execCommand("mceBeginUndoLevel");
       
   403 		i = inst.selection.getBookmark();
       
   404 		inst.dom.remove(elm, 1);
       
   405 		inst.selection.moveToBookmark(i);
       
   406 		tinyMCEPopup.execCommand("mceEndUndoLevel");
       
   407 		tinyMCEPopup.close();
       
   408 		return;
       
   409 	}
       
   410 
   399 	tinyMCEPopup.execCommand("mceBeginUndoLevel");
   411 	tinyMCEPopup.execCommand("mceBeginUndoLevel");
   400 
   412 
   401 	// Create new anchor elements
   413 	// Create new anchor elements
   402 	if (elm == null) {
   414 	if (elm == null) {
   403 		tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#");
   415 		tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#");