-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This version includes a new options page to allow users to choose to remove additional things
- Loading branch information
Showing
6 changed files
with
117 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
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,4 +1,4 @@ | ||
Gmail-Print-Page-Cleaner | ||
======================== | ||
|
||
Removes some things from the Gmail print email page, mainly removing the Gmail logo at the top. | ||
Will remove user chosen elements from Gmails print view. |
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 +1,33 @@ | ||
$("div.bodycontainer table tbody img[alt='Gmail']").parent().hide(); | ||
//Check if it a print page | ||
if(document.title.startsWith('Gmail')) { | ||
//Get user options | ||
var hideGmailLogo = true; | ||
var hideEmail = false; | ||
var hideSubject = false; | ||
var hideContactDetails = false; | ||
chrome.storage.sync.get(['hideGmailLogo', 'hideEmail', 'hideSubject', 'hideContactDetails'], function(items) { | ||
if(typeof items.hideGmailLogo !== 'undefined') hideGmailLogo = items.hideGmailLogo; | ||
if(typeof items.hideEmail !== 'undefined') hideEmail = items.hideEmail; | ||
if(typeof items.hideSubject !== 'undefined') hideSubject = items.hideSubject; | ||
if(typeof items.hideContactDetails !== 'undefined') hideContactDetails = items.hideContactDetails; | ||
hide(); | ||
}) | ||
|
||
function hide() { | ||
if(hideGmailLogo) { | ||
$("div.bodycontainer table tbody img[alt='Gmail']").parent().hide(); | ||
} | ||
if(hideEmail) { | ||
$("body > div > table").siblings("hr").hide(); | ||
$("body > div > table").hide(); | ||
} | ||
if(hideSubject) { | ||
$("body > div > div > table:nth-child(1)").next().hide(); | ||
$("body > div > div > table:nth-child(1)").hide(); | ||
} | ||
if(hideContactDetails) { | ||
$("table.message > tbody > tr:nth-child(1)").hide(); | ||
$("table.message > tbody > tr:nth-child(2)").hide(); | ||
} | ||
} | ||
} |
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,36 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>My Test Extension Options</title> | ||
<style> | ||
body: { padding: 10px; } | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<label> | ||
<input type="checkbox" id="hideGmailLogo"> | ||
Hide Gmail logo? | ||
</label> | ||
<br/> | ||
<label> | ||
<input type="checkbox" id="hideEmail"> | ||
Hide your email address? | ||
</label> | ||
<br/> | ||
<label> | ||
<input type="checkbox" id="hideSubject"> | ||
Hide the subject? | ||
</label> | ||
<br/> | ||
<label> | ||
<input type="checkbox" id="hideContactDetails"> | ||
Hide the senders details? <i>(This is an experimental settings and can sometimes make email conversations hard to follow)</i> | ||
</label> | ||
<br/> | ||
<div id="status"></div> | ||
<button id="save">Save</button> | ||
|
||
<script src="options.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,40 @@ | ||
// Saves options to chrome.storage.sync. | ||
function save_options() { | ||
var hideGmailLogo = document.getElementById('hideGmailLogo').checked; | ||
var hideEmail = document.getElementById('hideEmail').checked; | ||
var hideSubject = document.getElementById('hideSubject').checked; | ||
var hideContactDetails = document.getElementById('hideContactDetails').checked; | ||
alert("Here"); | ||
chrome.storage.sync.set({ | ||
hideGmailLogo: hideGmailLogo, | ||
hideEmail: hideEmail, | ||
hideSubject: hideSubject, | ||
hideContactDetails: hideContactDetails | ||
}, function() { | ||
// Update status to let user know options were saved. | ||
var status = document.getElementById('status'); | ||
status.textContent = 'Options saved.'; | ||
setTimeout(function() { | ||
status.textContent = 'Saved'; | ||
}, 750); | ||
}); | ||
} | ||
|
||
// Restores select box and checkbox state using the preferences | ||
// stored in chrome.storage. | ||
function restore_options() { | ||
alert(); | ||
chrome.storage.sync.get({ | ||
hideGmailLogo: true, | ||
hideEmail: false, | ||
hideSubject: false, | ||
hideContactDetails: false | ||
}, function(items) { | ||
document.getElementById('hideGmailLogo').checked = items.hideGmailLogo; | ||
document.getElementById('hideEmail').checked = items.hideEmail; | ||
document.getElementById('hideSubject').checked = items.hideSubject; | ||
document.getElementById('hideContactDetails').checked = items.hideContactDetails; | ||
}); | ||
} | ||
document.addEventListener('DOMContentLoaded', restore_options); | ||
document.getElementById('save').addEventListener('click',save_options); |