以下方法和360doc如出一轍可以參考
快速收藏文章有好多種,這里說(shuō)的是右鍵快速收藏。
注意:僅對IE有效(有能力的朋友可以按思路做Firefox的擴展,360doc可以參考),且當同一IE進(jìn)程只打開(kāi)一個(gè)網(wǎng)頁(yè)時(shí)。
主要分三個(gè)步驟:
- 制作注冊表文章以在鼠標右鍵注冊菜單
- 制作接收數據JS并提交到收藏頁(yè)
- 收藏頁(yè)取得相關(guān)信息,正式收藏
注冊表文件很簡(jiǎn)單:
你只需要按自己需要修改一下就可以了,例:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt]
這樣當點(diǎn)擊右鍵時(shí),IE會(huì )自動(dòng)向
http://localhost/mouse.html頁(yè)提交
卸載:
Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\收藏文件]
接收數據JS:實(shí)際上這就是頁(yè)面http://localhost/mouse.html的內容
<script language="javascript">
if (external.menuArguments) {
var parentwin = external.menuArguments;
var url = parentwin.location.href;
var title = parentwin.document.title;
if(title.length>50) title=title.substring(0,50);
var intro = parentwin.document.selection.type!=‘None‘?parentwin.document.selection.createRange().text:‘‘
if(intro.length>100) intro=intro.substring(0,100);
if (parentwin.event.srcElement.tagName == "A") {
url = parentwin.event.srcElement.getAttribute("HREF");
title = parentwin.event.srcElement.innerText;
}
/*if(isLogin) void(window.open(‘http://‘ + getPageUrl+‘?name=‘+escape(title)+‘&address=‘+escape(url)+‘&intro=‘+escape(intro),‘_blank‘))
else
void(window.open(‘http://‘+loginPageUrl+‘?msg=使用收藏夾功能,請先登陸‘,‘_blank‘))*/
} else {
history.go(-1);
}
///測試
alert(title);
alert(url);
alert(escape(intro));///測試加密
</script>
根據以上測試代碼可以修改成自己需要的東西,
注冊表文件形式的右鍵菜單還有一個(gè)妙用就是快速發(fā)貼,每次要登錄后臺再點(diǎn)發(fā)表新文章累死了吧,
把注冊表的提交路徑改成發(fā)表新文章的就可以了……
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請
點(diǎn)擊舉報。