前言:
zblog每次更新插件或主题的时候,就会覆盖修改过的代码,非常难受。所以我将修改过后的代码记录在这,方便自己有时候更新时过来查看。
源代码:
文件位置:localhost/zb_users/plugin/ly_ueditor_plus/ueditor-plus/dialogs/link/link.html
行:126
function handleDialogOk() {
var href = $G('href').value.replace(/^\s+|\s+$/g, '');
if (href) {
if (!hrefStartWith(href, allowLinkProtocols)) {
href = "http://" + href;
}
var obj = {
'href': href,
'target': $G("target").checked ? "_blank" : '_self',
'rel': $G("rel").checked ? "nofollow" : '',
'title': $G("title").value.replace(/^\s+|\s+$/g, ''),
'_href': href
};
if (orgText && text.value != orgText) {
link[browser.ie ? 'innerText' : 'textContent'] = obj.textValue = text.value;
range.selectNode(link).select()
}
if (range.collapsed) {
obj.textValue = text.value;
}
editor.execCommand('link', utils.clearEmptyAttrs(obj));
dialog.close();
}
}修改过后代码:
function handleDialogOk() {
var href = $G('href').value.replace(/^\s+|\s+$/g, '');
if (href) {
if (!hrefStartWith(href, allowLinkProtocols)) {
href = "http://" + href;
}
var obj = {
'href': href,
'target': $G("target").checked ? "_blank" : '_self',
'rel': $G("rel").checked ? "nofollow" : '',
'title': $G("title").value.replace(/^\s+|\s+$/g, ''),
'_href': $G("rel").checked ? "https://52lc.top/jump.php?url=" + btoa(href) : href
};
if (orgText && text.value != orgText) {
link[browser.ie ? 'innerText' : 'textContent'] = obj.textValue = text.value;
range.selectNode(link).select()
}
if (range.collapsed) {
obj.textValue = text.value;
}
editor.execCommand('link', utils.clearEmptyAttrs(obj));
dialog.close();
}
}主要就是实现在编辑器内给添加nofollow的链接,加上链接中转效果。











发布评论