forked from GouravKaushal/Phony-Bulletin-Revealer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.js
31 lines (29 loc) · 878 Bytes
/
content.js
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
chrome.runtime.onMessage.addListener(gotMessage);
var dict=new Object();
function gotMessage(message, sender, sendResponse) {
if(message.txt === "hello") {
var mesg=window.getSelection().toString()
/*$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
url:"http://127.0.0.1:5000/script",
data: {message: mesg},
dataType:'json',
success: function(response) {
console.log(response)
},
error: function(xhr,status,error) {
console.error(response)
}
});*/
if(mesg in dict)
{
alert("The Probability of the selected news ' " + mesg + " ' is " + Math.round(dict[mesg] * 100 ) +" %")
}
else
{
dict[mesg]=Math.random();
alert("The Probability of the selected news ' " + mesg + "' is " + Math.round(dict[mesg] * 100) +" %")
}
}
}