Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function request(url, tagname) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", url, true);
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4 && xhr.status == 200) {
- if (xhr.responseText == null) console.log('null_rq');
- var doc = document.implementation.createHTMLDocument("tmp");
- doc.documentElement.innerHTML = xhr.responseText;
- console.log(doc.getElementById(tagname).innerText);
- }
- }
- xhr.send();
- return xhr.responseText;
- }
- chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
- console.log(sender.tab.url);
- if (message.key == "info") {
- console.log('Recideved "' + message.key + '" in background');
- var i, recieved_data = JSON.stringify(message.data);
- //alert('RECIEVED:' + recieved_data);
- //save_result(recieved_data);
- var curr_page;
- var curr_url, mathnet_main_url = "http://mi.mathnet.ru/intf";
- var url2 = "http://www.mathnet.ru/php/archive.phtml?wshow=paper&jrnid=intf&paperid=";
- var url3 = "&option_lang=rus";
- var tagname = "citPaperAMSBIBID";
- for (i = 1; i < 5; i++) {
- curr_url = url2 + i + url3;
- curr_page = request(curr_url, tagname);
- if (curr_page == null) console.log('null');
- //alert(curr_page);
- }
- }
- if (message.key == "rq") {
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement