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 close icon to breakage note tooltip #3034

Open
wants to merge 1 commit 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
7 changes: 6 additions & 1 deletion src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,12 @@ function createBreakageNote(domain, i18n_message_key) {
// return the tooltip we want (the breakage note, not Allow)
$slider_allow.tooltipster('destroy').tooltipster({
autoClose: false,
content: chrome.i18n.getMessage(i18n_message_key),
content: $(`<div>
<a href="" id="dismiss-tooltip" role="button" aria-label="i18n_report_close">
<img src="../icons/close.svg" alt="">
</a>
<div>${chrome.i18n.getMessage(i18n_message_key)}</div>
</div>`),
functionReady: function (tooltip) {
// close on tooltip click/tap
$(tooltip.elementTooltip()).on('click', function (e) {
Expand Down
9 changes: 9 additions & 0 deletions src/lib/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ function setTextDirection() {
['#fittslaw', '.overlay-close'].forEach((selector) => {
toggle_css_value(selector, "float", "right", "left");
});
// Workaround for tooltipster dynamically inserted after localization
let css = document.createElement("style");
css.textContent = `
#dismiss-tooltip {
float: left;
right: unset;
left: -5px;
}`;
document.body.appendChild(css);

// options page
} else if (document.location.pathname == "/skin/options.html") {
Expand Down
18 changes: 18 additions & 0 deletions src/skin/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,24 @@ a.overlay-close:hover {
cursor: pointer;
}

#dismiss-tooltip {
float: right;
margin: 5px;
position: relative;
top: -5px;
right: -5px;
}

#dismiss-tooltip img {
height: 18px;
filter: invert(100%) sepia(0%) saturate(7489%) hue-rotate(126deg) brightness(106%) contrast(100%);
}

#dismiss-tooltip:hover img, #dismiss-tooltip:focus img {
/* Calculated with https://codepen.io/sosuke/pen/Pjoqqp to match #fff */
filter: invert(93%) sepia(8%) saturate(30%) hue-rotate(203deg) brightness(99%) contrast(94%);
}

#firstparty-protections-container, #youtube-message-container {
border-bottom: 1px solid #d3d3d3;
margin: 10px 0;
Expand Down