Bug 1335016 - Add tooltip to identity popup expander button. r=florian,MarcoZ

MozReview-Commit-ID: 7ulEwzyYFsW

--HG--
extra : rebase_source : 3b3aa1bdd1882c1f959961a9cd04f274be845981
This commit is contained in:
Johann Hofmann 2017-03-01 15:23:46 +01:00
Родитель a5dcfe58dc
Коммит 793b540f87
2 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -6855,6 +6855,10 @@ var gIdentityHandler = {
delete this._permissionReloadHint;
return this._permissionReloadHint = document.getElementById("identity-popup-permission-reload-hint");
},
get _popupExpander() {
delete this._popupExpander;
return this._popupExpander = document.getElementById("identity-popup-security-expander");
},
get _permissionAnchors() {
delete this._permissionAnchors;
let permissionAnchors = {};
@ -6876,10 +6880,18 @@ var gIdentityHandler = {
toggleSubView(name, anchor) {
let view = this._identityPopupMultiView;
let id = `identity-popup-${name}View`;
let subView = document.getElementById(id);
// Listen for the subview showing or hiding to change
// the tooltip on the expander button.
subView.addEventListener("ViewShowing", this);
subView.addEventListener("ViewHiding", this);
if (view.showingSubView) {
view.showMainView();
} else {
view.showSubView(`identity-popup-${name}View`, anchor);
view.showSubView(id, anchor);
}
// If an element is focused that's not the anchor, clear the focus.
@ -7188,6 +7200,9 @@ var gIdentityHandler = {
this._identityPopupInsecureLoginFormsLearnMore
.setAttribute("href", baseURL + "insecure-password");
// The expander switches its tooltip when toggled, change it to the default.
this._popupExpander.tooltipText = gNavigatorBundle.getString("identity.showDetails.tooltip");
// Determine connection security information.
let connection = "not-secure";
if (this._isSecureInternalUI) {
@ -7397,6 +7412,16 @@ var gIdentityHandler = {
},
handleEvent(event) {
// If the subview is shown or hidden, change the tooltip on the expander button.
if (event.type == "ViewShowing") {
this._popupExpander.tooltipText = gNavigatorBundle.getString("identity.hideDetails.tooltip");
return;
}
if (event.type == "ViewHiding") {
this._popupExpander.tooltipText = gNavigatorBundle.getString("identity.showDetails.tooltip");
return;
}
let elem = document.activeElement;
let position = elem.compareDocumentPosition(this._identityPopup);

Просмотреть файл

@ -443,6 +443,8 @@ identity.identified.verified_by_you=You have added a security exception for this
identity.identified.state_and_country=%S, %S
identity.icon.tooltip=Show site information
identity.showDetails.tooltip=Show connection details
identity.hideDetails.tooltip=Hide connection details
trackingProtection.intro.title=How Tracking Protection works
# LOCALIZATION NOTE (trackingProtection.intro.description2):