-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.js
36 lines (26 loc) · 893 Bytes
/
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
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function click(e) {
if(e.currentTarget.getAttribute("id")==="checkbox"){
chrome.tabs.executeScript(null,
{file:"reddit.js"});
}
else if(e.currentTarget.getAttribute("id")==="generateHtml"){
chrome.tabs.executeScript(null,
{file:"generate.js"});
}
else if(e.currentTarget.getAttribute("id")==="generateReddit"){
chrome.tabs.executeScript(null,
{file:"to-markdown.js"});
chrome.tabs.executeScript(null,
{file:"generateMarkdown.js"});
}
window.close();
}
document.addEventListener('DOMContentLoaded', function () {
var divs = document.querySelectorAll('a');
for (var i = 0; i < divs.length; i++) {
divs[i].addEventListener('click', click);
}
});