Skip to content

Commit

Permalink
Add options to apply styles without "!important" flag
Browse files Browse the repository at this point in the history
(used the old way by default)
(#127)
  • Loading branch information
Infocatcher committed Dec 16, 2013
1 parent dd6f105 commit 3e3b612
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
22 changes: 13 additions & 9 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,8 @@ var windowsObserver = {
for(var window in this.windows)
this.updateWindowTitle(window.gBrowser, undefined, true);
}
else if(pName == "stylesHighPriority" || pName == "stylesHighPriority.tree")
this.reloadStyles();
else if(pName == "debug")
_dbg = pVal;
else if(pName == "debug.verbose")
Expand Down Expand Up @@ -3188,19 +3190,21 @@ var windowsObserver = {
' + prefix + 'text-decoration-style: dashed;';
}
}
var important = prefs.get("stylesHighPriority") ? " !important" : "";
var importantTree = prefs.get("stylesHighPriority.tree") ? " !important" : "";
var cssStr = '\
/* Private Tab: main styles */\n\
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");\n\
@-moz-document url("' + document.documentURI + '") {\n\
.tabbrowser-tab[' + this.privateAttr + '],\n\
.menuitem-iconic[' + this.privateAttr + '] {\n\
text-decoration: underline !important;\n\
' + prefix + 'text-decoration-color: -moz-nativehyperlinktext !important;\n\
' + prefix + 'text-decoration-style: dashed !important;\n\
text-decoration: underline' + important + ';\n\
' + prefix + 'text-decoration-color: -moz-nativehyperlinktext' + important + ';\n\
' + prefix + 'text-decoration-style: dashed' + important + ';\n\
}\n\
.tabbrowser-tab[' + this.privateAttr + '][pinned] .tab-icon-image,\n\
.tabbrowser-tab[' + this.privateAttr + '][pinned] .tab-throbber {\n\
border-bottom: 1px dashed -moz-nativehyperlinktext !important;\n\
border-bottom: 1px dashed -moz-nativehyperlinktext' + important + ';\n\
}\n\
#' + this.tabTipId + ' {\n\
color: ' + ttColor + ';' + ttAddStyles + '\n\
Expand Down Expand Up @@ -3251,18 +3255,18 @@ var windowsObserver = {
cssStr += '\n\
@-moz-document url("' + document.documentURI + '") {\n\
.bookmark-item[scheme="private"] {\n\
text-decoration: underline !important;\n\
' + prefix + 'text-decoration-color: -moz-nativehyperlinktext !important;\n\
' + prefix + 'text-decoration-style: dashed !important;\n\
text-decoration: underline' + important + ';\n\
' + prefix + 'text-decoration-color: -moz-nativehyperlinktext' + important + ';\n\
' + prefix + 'text-decoration-style: dashed' + important + ';\n\
}\n\
}\n\
@-moz-document url("chrome://browser/content/bookmarks/bookmarksPanel.xul"),\n\
url("chrome://browser/content/places/places.xul"),\n\
url("chrome://communicator/content/bookmarks/bm-panel.xul"),\n\
url("chrome://communicator/content/bookmarks/bookmarksManager.xul") {\n\
treechildren::-moz-tree-cell-text(private) {\n\
border-bottom: 1px dashed -moz-nativehyperlinktext !important;\n\
margin-bottom: 1px !important;\n\
border-bottom: 1px dashed -moz-nativehyperlinktext' + importantTree + ';\n\
margin-bottom: 1px' + importantTree + ';\n\
}\n\
}';
}
Expand Down
2 changes: 2 additions & 0 deletions defaults/preferences/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pref("extensions.privateTab.showItemInTaskBarJumpList", true); // Works only if
pref("extensions.privateTab.usePrivateWindowStyle", true);
// true - apply private window style to private tabs (and show tab private state)
// false - show window private state
pref("extensions.privateTab.stylesHighPriority", true); // Set "!important" flag to force override third-party styles
pref("extensions.privateTab.stylesHighPriority.tree", true); // The same as above for private:///#... bookmarks inside XUL <tree>

pref("extensions.privateTab.debug", false);
pref("extensions.privateTab.debug.verbose", false);

0 comments on commit 3e3b612

Please sign in to comment.