-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup.js
54 lines (37 loc) · 1.36 KB
/
popup.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var background = chrome.extension.getBackgroundPage();
document.addEventListener('DOMContentLoaded', function() {
Array.prototype.forEach.call(document.getElementsByTagName('*'), function (el) {
if (el.hasAttribute('data-i18n') ){
el.innerHTML = chrome.i18n.getMessage(el.getAttribute('data-i18n'));
}
});
$('#date').text(background.lastSent);
$('#nbEvol').text(background.nbEvol);
if(background.changesToSee){
$('#changes').show();
}
//Adding click events for buttons
$('#viewChanges').click(function() {
chrome.tabs.create({ url: "https://amiunique.org/timeline/"+background.uuid+"#"+background.nbEvol });
chrome.runtime.sendMessage({
from: 'popup',
subject: 'changesToSee',
changesToSee: false
});
$('#changes').hide();
});
$('#discardChanges').click(function() {
chrome.runtime.sendMessage({
from: 'popup',
subject: 'changesToSee',
changesToSee: false
});
$('#changes').hide();
});
$('#viewFP').click(function() {
chrome.tabs.create({ url: "https://amiunique.org/timeline/"+background.uuid+"#fp" });
});
$('#viewTimeline').click(function() {
chrome.tabs.create({ url: "https://amiunique.org/timeline/"+background.uuid });
});
});