forked from proginosko/LeechBlockNG
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1868d2f
commit 6ef9655
Showing
6 changed files
with
105 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* LeechBlock popup CSS style */ | ||
|
||
body { | ||
background-color: #fff; | ||
color: #000; | ||
text-align: center; | ||
} | ||
|
||
#button-container { | ||
display: inline-block; | ||
} | ||
|
||
button { | ||
display: inline; | ||
width: 100%; | ||
margin: 2px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
|
||
<html lang="us"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>LeechBlock</title> | ||
<link href="jquery-ui/jquery-ui.min.css" rel="stylesheet"> | ||
<link href="popup.css" rel="stylesheet"> | ||
<link href="icons/leechblock16.ico" rel="icon" type="image/x-icon"> | ||
<link href="icons/leechblock16.ico" rel="shortcut icon" type="image/x-icon"> | ||
</head> | ||
|
||
<body> | ||
<p><img src="images/leechblock_logo_small.png" alt="LeechBlock logo" title="LeechBlock"><p> | ||
<div id="button-container" class="ui-widget"> | ||
<button id="options" type="button">Options</button> | ||
<button id="lockdown" type="button">Lockdown</button> | ||
</div> | ||
<script src="popup.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
// Open options page | ||
// | ||
function openOptions() { | ||
browser.runtime.openOptionsPage(); | ||
window.close(); | ||
} | ||
|
||
// Open lockdown page | ||
// | ||
function openLockdown() { | ||
openExtensionPage("lockdown.html"); | ||
} | ||
|
||
// Open extension page (either create new tab or activate existing tab) | ||
// | ||
function openExtensionPage(url) { | ||
let fullURL = browser.extension.getURL(url); | ||
|
||
browser.tabs.query({ url: fullURL }).then(onGot, onError); | ||
|
||
function onGot(tabs) { | ||
if (tabs.length > 0) { | ||
browser.tabs.update(tabs[0].id, { active: true }); | ||
} else { | ||
browser.tabs.create({ url: fullURL }); | ||
} | ||
window.close(); | ||
} | ||
|
||
function onError(error) { | ||
browser.tabs.create({ url: fullURL }); | ||
window.close(); | ||
} | ||
} | ||
|
||
document.querySelector("#options").addEventListener("click", openOptions); | ||
document.querySelector("#lockdown").addEventListener("click", openLockdown); |