Skip to content

Commit

Permalink
RT formed on archive pages
Browse files Browse the repository at this point in the history
  • Loading branch information
abhidas17695 committed Sep 6, 2017
1 parent 900f4ab commit c78dcfc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ chrome.runtime.onMessage.addListener(function(message,sender,sendResponse){
console.log(RTurl);
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
var tab=tabs[0];
var url=tabs[0].url;
var url=RTurl;
if(url.includes('web.archive.org') || url.includes('web-beta.archive.org')){
//chrome.tabs.sendMessage(tab.id, {message:'nomodal'});
alert("Structure as radial tree not available on archive.org pages");
Expand All @@ -152,10 +152,10 @@ chrome.runtime.onMessage.addListener(function(message,sender,sendResponse){
});
}



});



}else if(message.message=='sendurl'){
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
var url=tabs[0].url;
Expand Down
7 changes: 6 additions & 1 deletion scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ function remove_port(url){

function remove_wbm(url){
var pos=url.indexOf('/http');
var new_url=url.substring(pos+1);
if(pos!=-1){
var new_url=url.substring(pos+1);
}else{
var pos=url.indexOf('/www');
var new_url=url.substring(pos+1);
}
new_url=remove_port(new_url);
return new_url;
}
Expand Down
7 changes: 4 additions & 3 deletions scripts/sequences.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ IAglobvar=0;
//console.log('sequences');
chrome.runtime.sendMessage({message:'sendurlforrt'});
chrome.runtime.onMessage.addListener(function(message,sender,sendResponse){
if(message.RTurl){
if(message.RTurl!=""){
var url=message.RTurl;
console.log('THE URL is '+url);
if(url.includes('https')){
url=url.replace('https://','');
}else{
url=url.replace('http://','');
}

var pos=url.indexOf('/');
url=url.substring(0,pos);
console.log('THE URL is '+url);
if(pos!=-1) url=url.substring(0,pos);

var xhr = new XMLHttpRequest();
xhr.open("GET","https://web.archive.org/cdx/search/cdx?url="+url+"/&fl=timestamp,original&matchType=prefix&filter=statuscode:200&filter=mimetype:text/html&output=json", true);

Expand Down

0 comments on commit c78dcfc

Please sign in to comment.