-
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
0 parents
commit c4b7ff9
Showing
12 changed files
with
188 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
chrome.runtime.onMessage.addListener( | ||
function(request, sender, sendResponse) | ||
{ | ||
if (request.localstorage == "chz_subject") | ||
{ | ||
chrome.storage.sync.get( | ||
['chz_subject'], | ||
function(result) | ||
{ | ||
sendResponse({chz_subject: result.chz_subject}); | ||
} | ||
); | ||
} | ||
else if (request.localstorage == "chz_message") | ||
{ | ||
chrome.storage.sync.get( | ||
['chz_message'], | ||
function(result) | ||
{ | ||
sendResponse({chz_message: result.chz_message}); | ||
} | ||
); | ||
} | ||
else | ||
{ | ||
sendResponse({}); | ||
} | ||
} | ||
); |
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,15 @@ | ||
chrome.storage.sync.get( | ||
[ | ||
'chz_bbs_subject', | ||
'chz_bbs_message' | ||
], | ||
function(result) | ||
{ | ||
let dom_subject = document.getElementsByName("subject")[0]; | ||
let dom_message = document.getElementsByName("message")[0]; | ||
|
||
console.log(result.chz_bbs_subject); | ||
if(result.chz_bbs_subject != undefined && dom_subject.value.length == 0) dom_subject.value = result.chz_bbs_subject; | ||
if(result.chz_bbs_message != undefined && dom_message.value.length == 0) dom_message.value = result.chz_bbs_message; | ||
} | ||
); |
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,28 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "Chapatiz Textarea", | ||
"description": "Cette extension permet de pré-remplir les messages sur les forums de Chapatiz (chapatiz.com/bbs).", | ||
"version": "3.2", | ||
"icons": { | ||
"128": "128.png", | ||
"64": "64.png", | ||
"48": "48.png", | ||
"32": "32.png", | ||
"16": "16.png" | ||
}, | ||
"browser_action": { | ||
"default_popup": "popup.html", | ||
"default_icon": "128.png" | ||
}, | ||
"permissions": ["storage"], | ||
"background": { | ||
"scripts": ["background.js"], | ||
"persistent": false | ||
}, | ||
"content_scripts": [ | ||
{ | ||
"matches": ["https://www.chapatiz.com/bbs/posting.php*"], | ||
"js": ["inject.js"] | ||
} | ||
] | ||
} |
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,57 @@ | ||
:root | ||
{ | ||
--primary: #0BACAA; | ||
--secondary: #67E2ED; | ||
--light: #FFFFFF; | ||
--dark: #000000; | ||
/* | ||
--primary: #0BACAA; | ||
--secondary: #67E2ED; | ||
--light: #FFFFFF; | ||
--dark: #0D1E20; | ||
*/ | ||
} | ||
body | ||
{ | ||
background-color: var(--secondary); | ||
} | ||
|
||
.form input, | ||
.form button, | ||
.form textarea | ||
{ | ||
display: block; | ||
width: 300px; | ||
padding: 6px; | ||
margin: 5px; | ||
} | ||
.input | ||
{ | ||
border: 1px solid var(--primary); | ||
color: var(--primary); | ||
background-color: var(--light); | ||
font-family: courier; | ||
} | ||
.btn | ||
{ | ||
background-color: var(--primary); | ||
color: var(--light); | ||
font-family: sans-serif; | ||
|
||
transition: background-color 0.5s, color 0.5s; | ||
} | ||
.btn:hover | ||
{ | ||
background-color: var(--light); | ||
color: var(--primary); | ||
} | ||
.btn:active | ||
{ | ||
background-color: var(--secondary); | ||
color: var(--dark); | ||
} | ||
.bg-128-50 | ||
{ | ||
background: url('128_50.png') no-repeat right bottom; | ||
background-color: var(--light); | ||
} |
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,15 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<link href="popup.css" rel="stylesheet" type="text/css" /> | ||
</head> | ||
<body> | ||
<div class="form"> | ||
<input type="text" id="subject" class="input" placeholder="sujet"/> | ||
<textarea id="message" class="input bg-128-50" placeholder="message" rows = 10></textarea> | ||
|
||
<button id="save" class="input btn">sauvegarder</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,44 @@ | ||
var state = document.getElementById('state'); | ||
var subject = document.getElementById('subject'); | ||
var message = document.getElementById('message'); | ||
var save = document.getElementById('save'); | ||
|
||
function set_local_storage() | ||
{ | ||
chrome.storage.sync.set( | ||
{ | ||
'chz_bbs_subject': subject.value, | ||
'chz_bbs_message' : message.value | ||
}, | ||
function() | ||
{ | ||
save.innerHTML = "sauvegardé ^.^" | ||
|
||
setTimeout( | ||
function() | ||
{ | ||
save.innerHTML = "sauvegarder" | ||
}, | ||
1000 | ||
); | ||
} | ||
); | ||
} | ||
|
||
function get_local_storage() | ||
{ | ||
chrome.storage.sync.get( | ||
[ | ||
'chz_bbs_subject', | ||
'chz_bbs_message' | ||
], | ||
function(result) | ||
{ | ||
if(result.chz_bbs_subject != undefined) subject.value = result.chz_bbs_subject; | ||
if(result.chz_bbs_message != undefined) message.value = result.chz_bbs_message; | ||
} | ||
); | ||
} | ||
|
||
get_local_storage(); | ||
save.addEventListener('click', set_local_storage); |