-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent_script.js
More file actions
55 lines (46 loc) · 1.84 KB
/
content_script.js
File metadata and controls
55 lines (46 loc) · 1.84 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
let port = chrome.runtime.connect()
// Connect to background script and send a message
port.postMessage({message: 'hello from content script'})
port.onMessage.addListener((message) => {
console.log('Content script received: ', message)
switch (message.action) {
case 'toggle':
toggleAnchor(document, message.tabId)
break;
}
})
function toggleAnchor (tabId) {
document.getElementById('viq-anchor').classList.toggle('in')
}
(function addAnchor () {
let anchor = document.getElementById('viq-anchor')
if (anchor) {
return
}
let viqAnchorDiv = document.createElement('iframe')
viqAnchorDiv.addEventListener('transitionend', () => { console.log('I have finished animating')}, false);
viqAnchorDiv.id = 'viq-anchor'
// viqAnchorDiv.src = 'chrome-extension://kfpainkapdpnibpgdkacklmofembhmlm/dist/index.html#/EntityView'
// viqAnchorDiv.src = 'https://www.ventureiq.nl'
// viqAnchorDiv.classList.add('viqInvisible')
// viqAnchorDiv.classList.add('viq-invisible')
// viqAnchorDiv.margin =
// viqAnchorDiv.innerHTML = tabId
viqAnchorDiv.onclick = ((e) => {
console.log(e);
port.postMessage({'action': 'help'})
})
viqAnchorDiv.setAttribute('seamless', 'seamless')
viqAnchorDiv.style = 'background-color: cornflowerblue; min-width: 400px; height: 600px; font-family: "sans-serif"; text-align:center; font-size: 10em; line-height: 1em; border:0;z-index:99999;position: fixed;right: -620px;top: 20px;'
viqAnchorDiv.classList.add('slide')
document.body.appendChild(viqAnchorDiv)
}())
// chrome.runtime.onConnect.addListener(function(port) {
// port.onMessage.addListener(function(msg) {
// port.postMessage({counter: msg.counter+1});
// });
// });
// chrome.extension.onRequest.addListener(
// function(request, sender, sendResponse) {
// sendResponse({counter: request.counter+1});
// })