我是一名心理学学生,我经常阅读论文。大学图书馆提供对数据库的访问,但我需要使用图书馆搜索引擎并每次登录。非常烦人。我找到了避免跳页的方法。Chrome扩展程序:点击编辑当前网址,然后重定向到编辑的网址
这里是方法:
我加上“ezp.lib.unimelb.edu.au”后,我发现在谷歌学术纸目标数据库地址的末端,那么它会重定向到库登录页面。
例如,本文的地址是:
http://www.sciencedirect.com/science/article/pii/S0006899315008550
我修改它:
http://www.sciencedirect.com.ezp.lib.unimelb.edu.au /科学/条/ PII/S000689315008550
我想创建一个Chrome扩展程序以完成点击(太懒)这项工作。我尝试了几个小时,但它不起作用。
这里是我做了什么:
我有一个文件夹中的三个文件:
第一个文件:manifest.json的
{
"manifest_version": 2,
"name": "Damn! Take me to the library!",
"description": "This extension automatically adds the 'ezp.lib.unimelb.edu.au' to the browser's address, allowing you to visit the databases bought by the library quickly",
"version": "1.0",
"browser_action": {
"default_icon": "unimelb.png",
"default_title": "Damn! Take me to the library!"
},
"background":{
"scripts":["popup.js"]
},
"permissions": [
"activeTab",
"tabs"
]
}
二文件:popup.js
function getCurrentTabUrlthenChangeIt(callback) {
var queryInfo = {
active: true,
currentWindow: true
};
chrome.tabs.query(queryInfo, function(tabs) {
var tab = tabs[0];
var url = tab.url;
callback(url);
var newurl = url.replace('/',"ezp.lib.unimelb.edu.au/");
window.location.replace(newurl);
});
}
第三档:unimelb.png
当我打开这个文件夹到浏览器,这是行不通的。
这是我第一次使用JS,任何人有任何建议?
谢谢!
我觉得我在如何让popup.js在点击上运行以及在编辑网址时遇到了一些问题。 – Saturn