-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.html
More file actions
32 lines (32 loc) · 1.11 KB
/
popup.html
File metadata and controls
32 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<script type='text/javascript'>
var e=encodeURIComponent;
chrome.tabs.getSelected(null, function(tab) {
chrome.tabs.sendRequest(tab.id, {action: "getSelected"}, function(response) {
var r='http://www.douban.com/recommend/?url='+e(tab.url)+'&title='+e(tab.title)+'&sel='+e(response.data)+'&v=1';
console.log(r);
var xhr = new XMLHttpRequest();
xhr.open("GET",r,true);
xhr.onreadystatechange = function() {
if (xhr.readyState==4)
{
if (xhr.status==200)
{
document.write(xhr.responseText);
if (response.data)
{
var ta=document.getElementById('status_textarea');
ta.value = " //"+response.data;
}
document.body.style.width="500px";
document.body.style.height="300px";
}
else
{
document.write("error: "+xhr.status);
}
}
};
xhr.send();
});
});
</script>