Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add delete domain button and function #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,34 @@ onCookieChanged();
cookie.path;
chrome.cookies.remove({"url": url, "name": cookie.name});
}

function removeDomainCookies() {
var domain = document.getElementById('url')
chrome.cookies.getAll({url: domain.value}, function(cookies) {
cookies.forEach(function(cookie) {
removeCookie(cookie)
})
displayCookies()
})
}

function updateBanner(){
document.getElementById("banner").style.display="none";
}

document.addEventListener('DOMContentLoaded', function() {
var clear_Cookies = document.getElementById("clear_cookies");
var delete_Domain_Cookies = document.getElementById("delete_domain_cookies")
var set_Cookies = document.getElementById("set_cookies");
var display_Cookies = document.getElementById("display_cookies");
var url = document.getElementById("url");
// onClick's logic below:
clear_Cookies.addEventListener('click', function() {
clearAllCookies();
});
delete_Domain_Cookies.addEventListener('click', function() {
removeDomainCookies()
})
set_Cookies.addEventListener('click',function(){
setCookies();
});
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ <h2 class="title text-center text-capitalize">Cookie Manager</h2>
<input type="text" class="form-control" id="value" required="required">
</div>
<button type = "button" class="btn btnBelow btn-danger" id="clear_cookies">Clear All Cookies</button>
<button type="button" class="btn btnBelow btn-danger" id="delete_domain_cookies">Delete Domain Cookies</button>
<button type="button" class="btn btnBelow btn-primary" id="display_cookies">Display Cookies</button>
<button type="button" class="btn btnBelow btn-success" id="set_cookies">Set Cookies</button>
</form>
Expand Down