-
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.
feat(Ad): Add user setting to grab phone or not
Closes #316
- Loading branch information
Showing
9 changed files
with
145 additions
and
62 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
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
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 |
---|---|---|
@@ -1,14 +1,29 @@ | ||
import {getState} from './state/get-state'; | ||
import {setState, StateKeys} from './state/set-state'; | ||
|
||
/** | ||
* Popup script entry point. | ||
*/ | ||
async function popup(): Promise<void> { | ||
const link = document.getElementById('export'); | ||
let isAttached = false; | ||
|
||
link.addEventListener('click', async () => { | ||
async function attach(): Promise<void> { | ||
if (isAttached) { | ||
return; | ||
} | ||
|
||
isAttached = true; | ||
|
||
const state = await getState(); | ||
|
||
const exportButton = document.getElementById('export'); | ||
exportButton.addEventListener('click', async () => { | ||
await setState(StateKeys.isTriggered, true); | ||
}); | ||
|
||
const phoneCheckbox = document.getElementById( | ||
'phoneCheckbox', | ||
) as HTMLInputElement; | ||
phoneCheckbox.checked = state.isPhoneChecked; | ||
phoneCheckbox.addEventListener('change', async () => { | ||
await setState(StateKeys.isPhoneChecked, phoneCheckbox.checked); | ||
}); | ||
} | ||
|
||
window.addEventListener('load', popup); | ||
window.addEventListener('load', attach); |
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
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 |
---|---|---|
@@ -1,13 +1,37 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta content="width=device-width, initial-scale=1.0" name="viewport"> | ||
<link href="./styles.css" rel="stylesheet"> | ||
<title>leboncoin-pdf-ext</title> | ||
</head> | ||
<body> | ||
<button id="export">exporter</button> | ||
<script src="../scripts/popup.js"></script> | ||
</body> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta | ||
content="width=device-width, initial-scale=1.0" | ||
name="viewport" | ||
/> | ||
<link | ||
href="./styles.css" | ||
rel="stylesheet" | ||
/> | ||
<title>leboncoin-pdf-ext</title> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<button | ||
id="export" | ||
class="button" | ||
> | ||
exporter | ||
</button> | ||
|
||
<div class="checkbox"> | ||
<input | ||
type="checkbox" | ||
id="phoneCheckbox" | ||
name="phoneCheckbox" | ||
value="checked" | ||
/> | ||
<label for="phoneCheckbox">Prendre téléphone</label> | ||
</div> | ||
</div> | ||
|
||
<script src="../scripts/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 |
---|---|---|
@@ -1,3 +1,30 @@ | ||
html { | ||
user-select: none; | ||
user-select: none; | ||
} | ||
|
||
.container { | ||
width: 200px; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.button { | ||
width: calc(100% - 8px); | ||
} | ||
|
||
.checkbox { | ||
width: 100%; | ||
height: auto; | ||
margin-top: 4px; | ||
|
||
display: flex; | ||
justify-content: flex-start; | ||
align-items: center; | ||
} | ||
|
||
.checkbox input { | ||
width: 15px; | ||
height: 15px; | ||
} |