本帖最后由 反调的华丽 于 2009-7-11 15:51 编辑
《礼物》作者发布的“《礼物》与网站深度整合插件”
我安装了下、一切正常、可是令我不爽的是,feed页好友生日提醒跑到上面来了。
于是就分析下官方的代码,一分析才发现,原来官方有更简便的方法,就是在feed页加入一条代码:- <script language="javascript" type="text/javascript" src="http://gift.nohyes.cn/recommend.php"></script>
复制代码 于是我也尝试把自己的网站加入此代码、发现加入此代码后跟官方的一样,原来不需要像作者说的那样修改space_feed页那么多处。“我的网站地址:www.90cu.com/home 测试账号demo 123123”
可是接下来问题来了。
虽说好友生日提醒后的礼物图标显示正常,但点击礼物图标却不能正常打开礼物应用,打开的是礼物应用的空白界面:如下图: 虽说显示正常,但点击礼物图标却打开的是:
经过跟官方的对比,我发现,是我的网站里的礼物图标的URL有问题,才导致不能正常进入《礼物》应用送礼物。
发现这个网站也是通过加入了一段代码实现的送礼物提醒和生日送礼物,不过这个网站调用的代码是:
- <script language="javascript" type="text/javascript" src="http://gift.nohyes.cn/nohyes.php"></script>
复制代码
我把自己网站的代码换成这段代码、还是不行、问题依旧。
于是我分别分析了官方UCH和“《礼物》官网”分别调用的两个php文件,
官方调用的php文件源码是:-
- var BASE64={
- enKey: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
- deKey: new Array(
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
- -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
- ),
- encode: function(src){
- var str=new Array();
- var ch1, ch2, ch3;
- var pos=0;
- while(pos+3<=src.length){
- ch1=src.charCodeAt(pos++);
- ch2=src.charCodeAt(pos++);
- ch3=src.charCodeAt(pos++);
- str.push(this.enKey.charAt(ch1>>2), this.enKey.charAt(((ch1<<4)+(ch2>>4))&0x3f));
- str.push(this.enKey.charAt(((ch2<<2)+(ch3>>6))&0x3f), this.enKey.charAt(ch3&0x3f));
- }
- if(pos<src.length){
- ch1=src.charCodeAt(pos++);
- str.push(this.enKey.charAt(ch1>>2));
- if(pos<src.length){
- ch2=src.charCodeAt(pos);
- str.push(this.enKey.charAt(((ch1<<4)+(ch2>>4))&0x3f));
- str.push(this.enKey.charAt(ch2<<2&0x3f), '=');
- }else{
- str.push(this.enKey.charAt(ch1<<4&0x3f), '==');
- }
- }
- return str.join('');
- }
- };
- function giftRecClose()
- {
- Cookie.set("gift_rec_close", 1, 24);
- $('giftRec').style.display = 'none';
- return false;
- }
- var pNode = $('sidebar');
- var cNodes = pNode.childNodes;
- var checkFirstDiv = false;
- var taskDefined = false;
- var recommend = document.createElement('div');
- recommend.id = 'giftRec';
- recommend.innerHTML = '<div class="ye_l_t"><div class="ye_r_b"><div class="ye_l_b"><div class="task_notice" style="width:230px;"><a href="#" onclick="javascript:giftRecClose();return false;" class="float_cancel" title="\u5ffd\u7565">\u5ffd\u7565</a><div class="task_notice_body"><a href="userapp.php?id=1027468&my_suffix=aW5kZXgucGhwP2RvPXNlbmQmZnJvbT1yZWNvbW1lbmRfdSZnaWZ0aWQ9MTE5"><img style="margin-top:15px;" id="recgiftimg" src="http://124.238.249.203/gift/gifts/119.gif" alt="" class="icon" /></a><h3>\u63a8\u8350\u793c\u7269</h3><p id="recgiftname">\u84dd\u5b9d\u77f3\u6212\u6307</p><p>\u9b45\u529b +10 \u4eb2\u5bc6\u5ea6 +6</p><p><a id="recgifthref" href="userapp.php?id=1027468&my_suffix=aW5kZXgucGhwP2RvPXNlbmQmZnJvbT1yZWNvbW1lbmRfdSZnaWZ0aWQ9MTE5">\u5c31\u9001\u5b83\u4e86</a> | <a href="userapp.php?id=1027468&my_suffix=aW5kZXgucGhwP2RvPXNlbmQmZnJvbT1yZWNvbW1lbmRfdQ%3D%3D">\u67e5\u770b\u6240\u6709</a></p></div></div></div></div></div>';
- recommend.className = 'ye_r_t';
- for(var i=0;i<cNodes.length;i++)
- {
- if(cNodes.nodeName && cNodes.nodeName == 'DIV')
- {
- var nodeDiv = cNodes;
- if(checkFirstDiv == false)
- {
- var firstDivNodes = nodeDiv.getElementsByTagName('div');
- for(var j=0;j<firstDivNodes.length;j++)
- {
- if(firstDivNodes[j].className == 'task_notice')
- {
- taskDefined = true;
- }
- }
- }
- if((taskDefined == false && checkFirstDiv == false) || (taskDefined == true && checkFirstDiv == true))
- {
- if(nodeDiv.className != 'searchfirend' && isUndefined(markNode))
- {
-
- var markNode = nodeDiv;
-
- } else {
- var h3Nodes = nodeDiv.getElementsByTagName('h3');
- if(!isUndefined(h3Nodes[0]) && h3Nodes[0].innerHTML == '\u597d\u53cb\u751f\u65e5\u63d0\u9192') {
- var birthNode = nodeDiv;
- } else if(isUndefined(markNode)) {
- var markNode = nodeDiv;
- }
- }
- }
- checkFirstDiv = true;
- }
- }
-
- if(!isUndefined(birthNode))
- {
- var liBirthNode = birthNode.getElementsByTagName('li');
- for(var k=0;k<liBirthNode.length;k++)
- {
- var birthLi = liBirthNode[k];
- birthLi.style.cssText="overflow:hidden;width:85px;";
- var birthHref = birthLi.getElementsByTagName('a')[0];
- birthHref.style.cssText="white-space:nowrap;overflow:hidden;width:65px;float:left;";
- var birthUid = birthHref.href.replace(/^[^\d]*(\d+)[^\d]*$/, "$1");
- var newBirthHref = document.createElement('a');
- newBirthHref.href = 'userapp.php?id=1027468&my_suffix='+escape(BASE64.encode('index.php?do=send&from=home_u&uchId='+birthUid+'&gifttype=birth'));
- newBirthHref.innerHTML ='<img title="\u9001TA\u793c\u7269" style="vertical-align:middle;float:right;" src="http://appicon.manyou.com/icons/1027468"/>';
- birthLi.appendChild(newBirthHref);
- }
- }
- if(!isUndefined(markNode) && !Cookie.get("gift_rec_close"))
- {
- pNode.insertBefore(recommend,markNode);
- }
复制代码 “《礼物》官网”调用的php文件源码是:-
- var BASE64={
- enKey: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
- deKey: new Array(
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
- -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
- ),
- encode: function(src){
- var str=new Array();
- var ch1, ch2, ch3;
- var pos=0;
- while(pos+3<=src.length){
- ch1=src.charCodeAt(pos++);
- ch2=src.charCodeAt(pos++);
- ch3=src.charCodeAt(pos++);
- str.push(this.enKey.charAt(ch1>>2), this.enKey.charAt(((ch1<<4)+(ch2>>4))&0x3f));
- str.push(this.enKey.charAt(((ch2<<2)+(ch3>>6))&0x3f), this.enKey.charAt(ch3&0x3f));
- }
- if(pos<src.length){
- ch1=src.charCodeAt(pos++);
- str.push(this.enKey.charAt(ch1>>2));
- if(pos<src.length){
- ch2=src.charCodeAt(pos);
- str.push(this.enKey.charAt(((ch1<<4)+(ch2>>4))&0x3f));
- str.push(this.enKey.charAt(ch2<<2&0x3f), '=');
- }else{
- str.push(this.enKey.charAt(ch1<<4&0x3f), '==');
- }
- }
- return str.join('');
- }
- };
- function giftRecClose()
- {
- Cookie.set("gift_rec_close", 1, 24);
- $('giftRec').style.display = 'none';
- return false;
- }
- var pNode = $('sidebar');
- var cNodes = pNode.childNodes;
- var checkFirstDiv = false;
- var taskDefined = false;
- var recommend = document.createElement('div');
- recommend.id = 'giftRec';
- recommend.innerHTML = '<div class="ye_l_t"><div class="ye_r_b"><div class="ye_l_b"><div class="task_notice" style="width:230px;"><a href="#" onclick="javascript:giftRecClose();return false;" class="float_cancel" title="\u5ffd\u7565">\u5ffd\u7565</a><div class="task_notice_body"><a href="userapp.php?id=1027468&my_suffix=aW5kZXgucGhwP2RvPXNlbmQmZnJvbT1yZWNvbW1lbmRfdSZnaWZ0aWQ9NTg%3D"><img style="margin-top:15px;" id="recgiftimg" src="http://124.238.249.203/gift/gifts/58.gif" alt="" class="icon" /></a><h3>\u63a8\u8350\u793c\u7269</h3><p id="recgiftname">\u56de\u529b\u8fd0\u52a8\u978b</p><p>\u9b45\u529b +10 \u4eb2\u5bc6\u5ea6 +5</p><p><a id="recgifthref" href="userapp.php?id=1027468&my_suffix=aW5kZXgucGhwP2RvPXNlbmQmZnJvbT1yZWNvbW1lbmRfdSZnaWZ0aWQ9NTg%3D">\u5c31\u9001\u5b83\u4e86</a> | <a href="userapp.php?id=1027468&my_suffix=aW5kZXgucGhwP2RvPXNlbmQmZnJvbT1yZWNvbW1lbmRfdQ%3D%3D">\u67e5\u770b\u6240\u6709</a></p></div></div></div></div></div>';
- recommend.className = 'ye_r_t';
- for(var i=0;i<cNodes.length;i++)
- {
- if(cNodes.nodeName && cNodes.nodeName == 'DIV')
- {
- var nodeDiv = cNodes;
- if(checkFirstDiv == false)
- {
- var firstDivNodes = nodeDiv.getElementsByTagName('div');
- for(var j=0;j<firstDivNodes.length;j++)
- {
- if(firstDivNodes[j].className == 'task_notice')
- {
- taskDefined = true;
- }
- }
- }
- if((taskDefined == false && checkFirstDiv == false) || (taskDefined == true && checkFirstDiv == true))
- {
- if(nodeDiv.className != 'searchfirend' && isUndefined(markNode))
- {
-
- var markNode = nodeDiv;
-
- } else {
- var h3Nodes = nodeDiv.getElementsByTagName('h3');
- if(!isUndefined(h3Nodes[0]) && h3Nodes[0].innerHTML == '\u597d\u53cb\u751f\u65e5\u63d0\u9192') {
- var birthNode = nodeDiv;
- } else if(isUndefined(markNode)) {
- var markNode = nodeDiv;
- }
- }
- }
- checkFirstDiv = true;
- }
- }
-
- if(!isUndefined(birthNode))
- {
- var liBirthNode = birthNode.getElementsByTagName('li');
- for(var k=0;k<liBirthNode.length;k++)
- {
- var birthLi = liBirthNode[k];
- birthLi.style.cssText="overflow:hidden;width:135px;";
- var birthHref = birthLi.getElementsByTagName('a')[0];
- birthHref.style.cssText="white-space:nowrap;overflow:hidden;width:65px;float:left;";
- var birthUid = birthHref.href.replace(/^[^\d]*(\d+)[^\d]*$/, "$1");
- var newBirthHref = document.createElement('a');
- newBirthHref.href = 'userapp.php?id=1027468&my_suffix='+escape(BASE64.encode('index.php?do=send&from=home&uchId='+birthUid+'&gifttype=birth'));
- newBirthHref.innerHTML ='<img title="\u9001TA\u793c\u7269" style="vertical-align:middle;float:right;" src="http://appicon.manyou.com/icons/1027468"/>';
- birthLi.appendChild(newBirthHref);
- }
- }
- if(!isUndefined(markNode) && !Cookie.get("gift_rec_close"))
- {
- pNode.insertBefore(recommend,markNode);
- }
复制代码 比较了一下,关于“生日礼物”图标的代码处不一样的地方只有:
官方UCH调用的:-
- newBirthHref.href = 'userapp.php?id=1027468&my_suffix='+escape(BASE64.encode('index.php?do=send&from=home_u&uchId='+birthUid+'&gifttype=birth'));
复制代码 《礼物》官方网站调用的:-
- newBirthHref.href = 'userapp.php?id=1027468&my_suffix='+escape(BASE64.encode('index.php?do=send&from=home&uchId='+birthUid+'&gifttype=birth'));
复制代码 只有这里不一样、
无论我怎么分析、还是没有半点头绪,而《礼物》的作者也没联系上。
希望大家集思广益。共同探讨。 |