|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
|
<html>
|
|
|
<head>
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
|
<title></title>
|
|
|
</head>
|
|
|
<body>
|
|
|
<table>
|
|
|
<tr>
|
|
|
<td><label for="text"> 文本内容</label></td>
|
|
|
<td><input class="txt" id="text" type="text" disabled="true"/></td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td><label for="href"> 链接类型</var></label></td>
|
|
|
<td>
|
|
|
<select class="form-control observe" id="action" name="action" value="">
|
|
|
|
|
|
<option value="">请选择跳转列表</option>
|
|
|
|
|
|
<option value="go.brand">品牌列表页</option>
|
|
|
|
|
|
<option value="go.productDetail">商品详情页</option>
|
|
|
|
|
|
<option value="go.coupon">优惠券页</option>
|
|
|
|
|
|
<option value="go.fav">收藏列表页</option>
|
|
|
|
|
|
<option value="go.mine">我的页面</option>
|
|
|
|
|
|
<option value="go.list">列表或搜索页</option>
|
|
|
|
|
|
<option value="go.attention">关注页</option>
|
|
|
|
|
|
<option value="go.plus">plus页</option>
|
|
|
|
|
|
<option value="go.star">star页</option>
|
|
|
|
|
|
<option value="go.new">新品到着页</option>
|
|
|
|
|
|
<option value="go.sale">折扣页</option>
|
|
|
|
|
|
<option value="go.share">分享</option>
|
|
|
|
|
|
<option value="go.h5">h5网页</option>
|
|
|
|
|
|
<option value="go.weblogin">h5网页调用本地登录</option>
|
|
|
|
|
|
<option value="go.gender">男女首页</option>
|
|
|
|
|
|
<option value="go.activity">app活动页</option>
|
|
|
|
|
|
<option value="go.home">频道首页</option>
|
|
|
|
|
|
<option value="go.yohood">YOHOOD</option>
|
|
|
|
|
|
<option value="go.top100">热销排行</option>
|
|
|
|
|
|
<option value="go.activitytemplate">活动模板</option>
|
|
|
|
|
|
<option value="go.globalpurchase">全球购</option>
|
|
|
|
|
|
<option value="go.subchannel">二级频道</option>
|
|
|
|
|
|
<option value="go.showgoods">去晒单</option>
|
|
|
|
|
|
<option value="go.limitpurchase">尖货频道</option>
|
|
|
|
|
|
<option value="go.vippro">会员商品</option>
|
|
|
|
|
|
<option value="go.shortsize">断码页</option>
|
|
|
|
|
|
<option value="go.discountmarket">折扣专区</option>
|
|
|
|
|
|
<option value="go.discountmarketpro">折扣专区详情页</option>
|
|
|
|
|
|
<option value="go.signin">签到页</option>
|
|
|
|
|
|
<option value="go.playvideo">视频播放</option>
|
|
|
|
|
|
<option value="go.shop">店铺</option>
|
|
|
|
|
|
<option value="go.outletactivity">奥莱活动详情页</option>
|
|
|
|
|
|
<option value="go.newoutlet">奥莱频道页</option>
|
|
|
|
|
|
<option value="go.category">选择一级品类</option>
|
|
|
|
|
|
<option value="go.comm.postdetail">社区帖子详情页</option>
|
|
|
|
|
|
<option value="go.comm.forum">社区版块首页</option>
|
|
|
|
|
|
<option value="go.comm.h5">社区H5</option>
|
|
|
|
|
|
<option value="go.comm.productDetail">社区商品详情页</option>
|
|
|
|
|
|
<option value="go.videolive">直播详情页</option>
|
|
|
|
|
|
<option value="go.videoreplay">重播详情页</option>
|
|
|
|
|
|
<option value="go.newyohood">new YOHOOD</option>
|
|
|
|
|
|
<option value="go.myInstalment">分期</option>
|
|
|
|
|
|
<option value="go.blkbrandcategory">BLK品牌品类页</option>
|
|
|
|
|
|
<option value="go.findgoodgoods">发现好货</option>
|
|
|
|
|
|
<option value="go.poollist">商品列表页</option>
|
|
|
|
|
|
<option value="go.gallay">xx馆落地页</option>
|
|
|
|
|
|
<option value="go.shopactivity">店铺活动页</option>
|
|
|
|
|
|
<option value="go.newarrivalsingleshop">新品到着单品</option>
|
|
|
|
|
|
<option value="go.blkhome">有货BLK首页</option>
|
|
|
|
|
|
<option value="go.family">有货 !family</option>
|
|
|
|
|
|
<option value="go.vipInfo">会员中心页</option>
|
|
|
|
|
|
<option value="go.vipexclusivepro">会员专享列表</option>
|
|
|
|
|
|
<option value="go.minealliance">联盟</option>
|
|
|
|
|
|
<option value="go.miniapp">跳转到小程序</option>
|
|
|
|
|
|
<option value="go.collagehome">拼团首页</option>
|
|
|
|
|
|
<option value="go.switchchannel">频道切换</option>
|
|
|
|
|
|
<option value="go.mineredpackage">我的红包</option>
|
|
|
|
|
|
<option value="go.ufo">UFO落地页</option>
|
|
|
|
|
|
<option value="go.bargainlist">砍价商品列表</option>
|
|
|
|
|
|
<option value="go.searchlist">搜索结果页</option>
|
|
|
|
|
|
<option value="go.guangchannel">社区</option>
|
|
|
|
|
|
</select>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td><label for="href"> 链接地址</var></label></td>
|
|
|
<td><input class="txt" id="href" type="text" /></td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td><label for="title"> 标题</label></td>
|
|
|
<td><input class="txt" id="title" type="text"/></td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td colspan="2">
|
|
|
<label for="target">新窗口打开</label>
|
|
|
<input id="target" type="checkbox"/>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td colspan="2" id="msg"></td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
<!--页面中一定要引入internal.js为了能直接使用当前打开dialog的实例变量-->
|
|
|
<!--internal.js默认是放到dialogs目录下的-->
|
|
|
<script type="text/javascript" src="../../third-party/jquery-1.10.2.min.js"></script>
|
|
|
<script type="text/javascript" src="../internal.js"></script>
|
|
|
<script>
|
|
|
$(function () {
|
|
|
var lang = editor.getLang('link');
|
|
|
var action = $("#action");
|
|
|
var range = editor.selection.getRange(),
|
|
|
link = range.collapsed ? editor.queryCommandValue( "link" ) : editor.selection.getStart(),
|
|
|
url,
|
|
|
trueUrl,
|
|
|
text = $G('text'),
|
|
|
rangeLink = domUtils.findParentByTagName(range.getCommonAncestor(),'a',true),
|
|
|
orgText;
|
|
|
link = domUtils.findParentByTagName( link, "a", true );
|
|
|
if(link){
|
|
|
url = utils.html(link.getAttribute( '_href' ) || link.getAttribute( 'href', 2 ));
|
|
|
|
|
|
if(rangeLink === link && !link.getElementsByTagName('img').length){
|
|
|
text.removeAttribute('disabled');
|
|
|
orgText = text.value = link[browser.ie ? 'innerText':'textContent'];
|
|
|
}else{
|
|
|
text.setAttribute('disabled','true');
|
|
|
text.value = lang.validLink;
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
if(range.collapsed){
|
|
|
text.removeAttribute('disabled');
|
|
|
text.value = '';
|
|
|
}else{
|
|
|
text.setAttribute('disabled','true');
|
|
|
text.value = lang.validLink;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
console.log("url", url, "action", action);
|
|
|
// url = url+'?openby:yohobuy=' + JSON.stringify({action: action, params: {url: url}});
|
|
|
|
|
|
// yoholink
|
|
|
if (url) {
|
|
|
var urlPart = url.split('?openby:yohobuy=');
|
|
|
if (urlPart.length == 2) {
|
|
|
try {
|
|
|
action.val(JSON.parse(urlPart[1]).action);
|
|
|
trueUrl = urlPart[0];
|
|
|
} catch (err) {
|
|
|
console.log("yoho link err", err);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
$G("title").value = url ? link.title : "";
|
|
|
$G("href").value = url && trueUrl ? trueUrl : '';
|
|
|
$G("target").checked = url && link.target == "_blank" ? true : false;
|
|
|
$focus($G("href"));
|
|
|
|
|
|
function handleDialogOk(){
|
|
|
var href =$G('href').value.replace(/^\s+|\s+$/g, '');
|
|
|
if(href){
|
|
|
if(!hrefStartWith(href,["http","/","ftp://",'#'])) {
|
|
|
href = "http://" + href;
|
|
|
}
|
|
|
var obj = {
|
|
|
'href' : href,
|
|
|
'target' : $G("target").checked ? "_blank" : '_self',
|
|
|
'title' : $G("title").value.replace(/^\s+|\s+$/g, ''),
|
|
|
'_href':href
|
|
|
};
|
|
|
//修改链接内容的情况太特殊了,所以先做到这里了
|
|
|
//todo:情况多的时候,做到command里
|
|
|
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;
|
|
|
}
|
|
|
|
|
|
obj._href = obj.href = href+'?openby:yohobuy=' + JSON.stringify({action: action.val(), params: {url: href}});
|
|
|
|
|
|
editor.execCommand('link',utils.clearEmptyAttrs(obj) );
|
|
|
dialog.close();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
dialog.onok = handleDialogOk;
|
|
|
|
|
|
|
|
|
function hrefStartWith(href,arr){
|
|
|
href = href.replace(/^\s+|\s+$/g, '');
|
|
|
for(var i=0,ai;ai=arr[i++];){
|
|
|
if(href.indexOf(ai)==0){
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
})
|
|
|
|
|
|
|
|
|
</script>
|
|
|
</body>
|
|
|
</html> |
|
|
\ No newline at end of file |
...
|
...
|
|