-Поиск по дневнику

Поиск сообщений в cereber

 -Подписка по e-mail

 

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 08.02.2011
Записей:
Комментариев:
Написано: 371


Greasemonkey scripts for pubmed

Вторник, 08 Февраля 2011 г. 08:59 + в цитатник
Оригинал сообщения

greasemonkeyDr Shock asked for this.  I use five Greasemonkey scripts.


*) Pubmed redirect. First of all I redirect all pubmed pages (ncbi.nlm.nih.gov) to the pubmed page (ncbi.nlm.nih.gov.proxy.library.uu.nl) of my university

*) Automatically open UBU link. If the pubmed page consists of a direct (UBU) link this script automatically opens the link to the pages of for instance a journal.

*) Resize window. For some reason I do not know a library page opens in a small windows. This scripts makes sure that the window resizes to the full screen.

*) Automatically open PDF.  If the pubmed page consists of links to pdfs then this script automatically opens the pdf.

*) Redirect Springerlink. This is a redirect script for Springer pages.


You can find the scripts below. Any questions? Let me know.


 Pubmed redirect 


// ==UserScript==

// @name           Redirect Pubmed

// @namespace      Redirect Pubmed

// @description    Redirect Pubmed

// @include        http://*ncbi.nlm.nih.gov*/*

// ==/UserScript==


//alert(document.location.href);

var str =  document.location.href; // get the hyperlink of the current page and store it in the variable str

var matchpos = str.search(/proxy.library.uu.nl/); // see if proxy.library.uu.nl occurs in the variable str 

var rep =   ncbi.nlm.nih.gov.proxy.library.uu.nl;  // store new hyperlink in variable rep

if (matchpos ==-1){ // if str does not contain proxy.library.uu.nl then substitute links

str = str.replace(/ncbi.nlm.nih.gov/g, rep); // substitute ncbi.nlm.nih.gov with variable rep

document.location.href= str;

}





 Automatically open UBU Link -

// ==UserScript==

// @name           Automatically open UBU Link

// @namespace      NLM.NIH.GOV.PROXY.LIBRARY.UU.NL

// @include        http://*ncbi.nlm.nih.gov.proxy.library.uu.nl*

// ==/UserScript==


// an UBU link is characterized by one of the following links: sfx.library.uu.nl, pubmedcentral.nih.gov/articlerender or ncbi.nlm.nih.gov.proxy.library.uu.nl/entrez/utils/fref.fcgi?PrId


 


var links = document.getElementsByTagName(a); // get all hyperlinks and store them in variable links

for(var i = 0; i < links.length; i++) { // loop through the hyperlinks in variable links


var url = links[i].href; // store array variable in url

var matchpos = url.search(/sfx.library.uu.nl/) // see if sfx.library.uu.nl occurs in the variable url

if (matchpos !=-1){ // if url contains sfx.library.uu.nl open url in new tab

GM_openInTab(url);


}

var matchpos1 = url.search(/pubmedcentral.nih.gov\/articlerender/); // see if pubmedcentral.nih.gov/articlerender occurs in the variable url

if (matchpos1 !=-1){ // if url contains pubmedcentral.nih.gov/articlerender open url in new tab

document.location = url;


}

var matchpos2 = url.search(/ncbi.nlm.nih.gov.proxy.library.uu.nl\/entrez\/utils\/fref.fcgi\?PrId/); // see if ncbi.nlm.nih.gov.proxy.library.uu.nl/entrez/utils/fref.fcgi?PrId occurs in the variable url

if (matchpos2 !=-1){ // if url contains ncbi.nlm.nih.gov.proxy.library.uu.nl/entrez/utils/fref.fcgi?PrId open url in new tab

GM_openInTab(url);


}


}




 Resize window  -


// ==UserScript==

// @name           Library

// @namespace      Sfx.library.uu.nl

// @include        http://sfx.library.uu.nl.proxy.library.uu.nl*

// ==/UserScript==


self.resizeTo(screen.availWidth,screen.availHeight);





Automatically open PDF -


// ==UserScript==

// @name           Automatically open PDF

// @namespace      Pubmedcentral

// @include        http://www.pubmedcentral.nih.gov.proxy.library.uu.nl/articlerender.fcgi?tool=pubmed&pubmedid=*

// ==/UserScript==


// if a hyperlink on a http://www.pubmedcentral.nih.gov.proxy.library.uu....gi?tool=pubmed&pubmedid=* page contains blobtype=pdf then it refers to a pdf. So this scripts looks for such hyperlinks and opens them if it occurs.


var found = 0;

var links = document.getElementsByTagName(a); // get all hyperlinks and store them in variable links

for(var i = 0; i < links.length; i++) { // loop through the hyperlinks in variable links


var url = links[i].href;

var matchpos = url.search(/blobtype\=pdf/);  // see if blobtype=pdf occurs in the variable url


if (matchpos !=-1 && found==0){  // if url contains blobtype=pdf open url in new window

window.location = url;

//alert(url);

found = 1; // to prevent opening more than one window the variable found is set to 1


}


}





Redirect Springerlink 


// ==UserScript==

// @name           Redirect Springerlink

// @namespace      Pubmedcentral

// @include        http://www.springerlink.com/*

// ==/UserScript==


var str =  document.location.href;

var matchpos = str.search(/proxy.library.uu.nl/);

var rep =   www.springerlink.com.proxy.library.uu.nl;

if (matchpos ==-1){

str = str.replace(/www.springerlink.com/g, rep);

document.location.href= str;

}






Related Articles at MedBlog.nl:




Я сейчас нахожусь: home
Мой настрой: good
Я слушаю: nirvana

LIci WP