小书签一键获取淘宝天猫搭配套餐和优惠券的无线连接

» 折腾不止 » 小书签一键获取淘宝天猫搭配套餐和优惠券的无线连接

代码

javascript: (function() {
	function qr(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
		var r = window.location.search.substr(1).match(reg);
		if (r != null) return r[2];
		return null;
	}
	var site = window.location.href.match(/^http(s)?:\/\/[^?]*/);
	var collocationId = qr("collocationId");//tc
	var sellerId = qr("sellerId");
	var userId = qr("userId");
	var activity_id = qr("activity_id");//yhq
	var seller_id = qr("seller_id");//yhq
	var id = qr("id");
	if (collocationId != null ) {
		var pureUrl = 'http://h5.m.taobao.com/cm/collocation.html?id=' + collocationId + '&userId=' + sellerId;
	} else if (id != null && userId != null) {
		var pureUrl = 'http://h5.m.taobao.com/cm/collocation.html?id=' + id + '&userId=' + userId;
	}else if (id != null) {
		var pureUrl = site[0] + "?id=" + id;
	} else if (activity_id != null && seller_id != null) {
		var pureUrl = 'https://market.m.taobao.com/apps/aliyx/coupon/detail.html?activity_id='+ activity_id + '&seller_id=' + seller_id;
	} else {
		alert('本脚本仅限于淘宝详情页/套餐页/优惠券页面使用');
	}
	var reload = prompt("优化版链接:", pureUrl);
	if (reload != null) {
		window.location.href = pureUrl;
	}
})();

压缩版本

javascript:(function(){function a(a){a=new RegExp("(^|&)"+a+"=([^&]*)(&|$)","i");a=window.location.search.substr(1).match(a);return null!=a?a[2]:null}var g=window.location.href.match(/^http(s)?:\/\/[^?]*/),d=a("collocationId"),h=a("sellerId"),e=a("userId"),f=a("activity_id"),k=a("seller_id"),c=a("id");if(null!=d)var b="http://h5.m.taobao.com/cm/collocation.html?id="+d+"&userId="+h;else null!=c&&null!=e?b="http://h5.m.taobao.com/cm/collocation.html?id="+c+"&userId="+e:null!=c?b=g[0]+"?id="+c:null!=f?b="https://market.m.taobao.com/apps/aliyx/coupon/detail.html?activity_id="+f+"&seller_id="+k:alert("\u672c\u811a\u672c\u4ec5\u9650\u4e8e\u6dd8\u5b9d\u8be6\u60c5\u9875/\u5957\u9910\u9875/\u4f18\u60e0\u5238\u9875\u9762\u4f7f\u7528");null!=prompt("\u4f18\u5316\u7248\u94fe\u63a5\uff1a",b)&&(window.location.href=b)})();

如何使用

收藏任意一个网页到浏览器书签栏,然后将网址修改为上面的压缩版本代码,需要用的时候点击按钮即可。

使用演示

小书签一键获取淘宝天猫搭配套餐和优惠券的无线连接-极客公园

-- 完 --

-- 完 --

发表评论

电子邮件地址不会被公开。 必填项已用*标注

2 Replies to “小书签一键获取淘宝天猫搭配套餐和优惠券的无线连接”