зеркало из https://github.com/mozilla/gecko-dev.git
Bug 778582 - Part 1. r=lucasr
This commit is contained in:
Родитель
2de3c5a082
Коммит
bb89d6f0cc
|
@ -10,15 +10,7 @@
|
|||
</head>
|
||||
|
||||
<body onload="AboutReader.init();" onunload="AboutReader.uninit();">
|
||||
<div id="reader-header" class="header">
|
||||
<div id="reader-domain" class="domain"></div>
|
||||
<h1 id="reader-title"></h1>
|
||||
<div id="reader-credits" class="credits"></div>
|
||||
</div>
|
||||
|
||||
<div id="reader-content" class="content">
|
||||
</div>
|
||||
|
||||
<iframe id="frame" src="about:readercontent"></iframe>
|
||||
<ul id="reader-toolbar" class="toolbar toolbar-hidden">
|
||||
<li><a id="share-button" class="button share-button" href="#"></a></li>
|
||||
<ul class="dropdown">
|
||||
|
|
|
@ -39,20 +39,19 @@ let AboutReader = {
|
|||
this._article = null;
|
||||
|
||||
dump("Feching toolbar, header and content notes from about:reader");
|
||||
this._headerElement = document.getElementById("reader-header");
|
||||
this._domainElement = document.getElementById("reader-domain");
|
||||
this._titleElement = document.getElementById("reader-title");
|
||||
this._creditsElement = document.getElementById("reader-credits");
|
||||
this._contentElement = document.getElementById("reader-content");
|
||||
this._frame = document.getElementById("frame");
|
||||
this._headerElement = this._frame.contentDocument.getElementById("reader-header");
|
||||
this._domainElement = this._frame.contentDocument.getElementById("reader-domain");
|
||||
this._creditsElement = this._frame.contentDocument.getElementById("reader-credits");
|
||||
this._contentElement = this._frame.contentDocument.getElementById("reader-content");
|
||||
this._toolbarElement = document.getElementById("reader-toolbar");
|
||||
|
||||
this._toolbarEnabled = false;
|
||||
|
||||
this._scrollOffset = window.pageYOffset;
|
||||
|
||||
let body = document.body;
|
||||
body.addEventListener("touchstart", this, false);
|
||||
body.addEventListener("click", this, false);
|
||||
this._frame.contentDocument.addEventListener("touchstart", this, false);
|
||||
this._frame.contentDocument.addEventListener("click", this, false);
|
||||
window.addEventListener("scroll", this, false);
|
||||
window.addEventListener("popstate", this, false);
|
||||
window.addEventListener("resize", this, false);
|
||||
|
@ -140,9 +139,8 @@ let AboutReader = {
|
|||
|
||||
Services.obs.removeObserver(this, "Reader:FaviconReturn", false);
|
||||
|
||||
let body = document.body;
|
||||
body.removeEventListener("touchstart", this, false);
|
||||
body.removeEventListener("click", this, false);
|
||||
this._frame.contentDocument.removeEventListener("touchstart", this, false);
|
||||
this._frame.contentDocument.removeEventListener("click", this, false);
|
||||
window.removeEventListener("scroll", this, false);
|
||||
window.removeEventListener("popstate", this, false);
|
||||
window.removeEventListener("resize", this, false);
|
||||
|
@ -230,8 +228,9 @@ let AboutReader = {
|
|||
return;
|
||||
|
||||
this._marginSize = Math.max(5, Math.min(25, newMarginSize));
|
||||
document.body.style.marginLeft = this._marginSize + "%";
|
||||
document.body.style.marginRight = this._marginSize + "%";
|
||||
let bodyStyle = this._frame.contentDocument.body.style;
|
||||
bodyStyle.marginLeft = this._marginSize + "%";
|
||||
bodyStyle.marginRight = this._marginSize + "%";
|
||||
|
||||
this._updateImageMargins();
|
||||
|
||||
|
@ -249,7 +248,7 @@ let AboutReader = {
|
|||
if (this._fontSize === newFontSize)
|
||||
return;
|
||||
|
||||
let bodyClasses = document.body.classList;
|
||||
let bodyClasses = this._frame.contentDocument.body.classList;
|
||||
|
||||
if (this._fontSize > 0)
|
||||
bodyClasses.remove("font-size" + this._fontSize);
|
||||
|
@ -265,12 +264,16 @@ let AboutReader = {
|
|||
return;
|
||||
|
||||
let bodyClasses = document.body.classList;
|
||||
let frameClasses = this._frame.contentDocument.body.classList;
|
||||
|
||||
if (this._colorScheme)
|
||||
if (this._colorScheme) {
|
||||
bodyClasses.remove(this._colorScheme);
|
||||
frameClasses.remove(this._colorScheme);
|
||||
}
|
||||
|
||||
this._colorScheme = newColorScheme;
|
||||
bodyClasses.add(this._colorScheme);
|
||||
frameClasses.add(this._colorScheme);
|
||||
|
||||
Services.prefs.setCharPref("reader.color_scheme", this._colorScheme);
|
||||
},
|
||||
|
@ -408,7 +411,7 @@ let AboutReader = {
|
|||
|
||||
this._creditsElement.innerHTML = article.byline;
|
||||
|
||||
this._titleElement.innerHTML = article.title;
|
||||
this._frame.contentDocument.getElementById("reader-title").innerHTML = article.title;
|
||||
document.title = article.title;
|
||||
|
||||
this._headerElement.style.display = "block";
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- make links load outside of frame -->
|
||||
<base target="_parent" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="reader-header" class="header">
|
||||
<div id="reader-domain" class="domain"></div>
|
||||
<h1 id="reader-title"></h1>
|
||||
<div id="reader-credits" class="credits"></div>
|
||||
</div>
|
||||
<div id="reader-content" class="content"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
|
||||
chrome.jar:
|
||||
% content browser %content/
|
||||
% content browser %content/ contentaccessible=yes
|
||||
|
||||
* content/about.xhtml (content/about.xhtml)
|
||||
content/config.xhtml (content/config.xhtml)
|
||||
|
@ -15,6 +15,7 @@ chrome.jar:
|
|||
content/aboutDownloads.xhtml (content/aboutDownloads.xhtml)
|
||||
content/aboutDownloads.js (content/aboutDownloads.js)
|
||||
content/aboutReader.html (content/aboutReader.html)
|
||||
content/aboutReaderContent.html (content/aboutReaderContent.html)
|
||||
content/aboutReader.js (content/aboutReader.js)
|
||||
content/Readability.js (content/Readability.js)
|
||||
content/JSDOMParser.js (content/JSDOMParser.js)
|
||||
|
|
|
@ -62,6 +62,11 @@ let modules = {
|
|||
reader: {
|
||||
uri: "chrome://browser/content/aboutReader.html",
|
||||
privileged: true
|
||||
},
|
||||
readercontent: {
|
||||
uri: "chrome://browser/content/aboutReaderContent.html",
|
||||
privileged: false,
|
||||
hide: true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ contract @mozilla.org/network/protocol/about;1?what=home {322ba47e-7047-4f71-aeb
|
|||
contract @mozilla.org/network/protocol/about;1?what=apps {322ba47e-7047-4f71-aebf-cb7d69325cd9}
|
||||
contract @mozilla.org/network/protocol/about;1?what=downloads {322ba47e-7047-4f71-aebf-cb7d69325cd9}
|
||||
contract @mozilla.org/network/protocol/about;1?what=reader {322ba47e-7047-4f71-aebf-cb7d69325cd9}
|
||||
contract @mozilla.org/network/protocol/about;1?what=readercontent {322ba47e-7047-4f71-aebf-cb7d69325cd9}
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
contract @mozilla.org/network/protocol/about;1?what=blocked {322ba47e-7047-4f71-aebf-cb7d69325cd9}
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче