博客园cnblogs chrome右键插件 开发
background.html
<script src="cnblogsright.js"></script>
cnblogsright.js
var tweettext = chrome.contextMenus.create({"title": "转载到博客园","contexts":["selection"], "onclick": posttwtext});
function posttwtext(info, tab) {
var posturl="http://www.cnblogs.com/meetrice/admin/EditPosts.aspx?opt=1&url="+info.pageUrl;
chrome.windows.create({"url":posturl.replace("SELTEXT", info.selectionText), "type":"popup", "height":300,"width":600});
}
var tweetlink = chrome.contextMenus.create({"title": "提交到网摘","contexts":["link"], "onclick": posttwlink});
function posttwlink(info, tab) {
http://wz.cnblogs.com/create?t=标题&u=网址&c=描述&i=0
var posturl="http://wz.cnblogs.com/create?t=SELTEXT&u="+info.pageUrl+"&c=&i=0";
chrome.windows.create({"url":posturl.replace("SELTEXT",info.selectionText), "type":"popup", "height":387,"width":470});
}
var tweetpage = chrome.contextMenus.create({"title": "提交到网摘","contexts":["page"], "onclick": posttwpage});
function posttwpage(info, tab) {
var posturl="http://wz.cnblogs.com/create?t=SELTEXT&u="+info.pageUrl+"&c=&i=0";
chrome.windows.create({"url":posturl.replace("SELTEXT", info.pageUrl), "type":"popup", "height":387,"width":470});
}
manifest.json
{
"update_url":"http://clients2.google.com/service/update2/crx",
"name": "转载到博客园",
"version": "0.11",
"description": "Easily upload Conente to Cnblogs through a right-click menu.",
"background_page": "background.html",
"permissions": [
"contextMenus","tabs"
],
"icons": {
"16": "icon.png"
},
"minimum_chrome_version": "6"
}
icon.png