Merge pull request #2415 from brendandahl/gaia-activity-bar
Add close button and title bar for b2g.
This commit is contained in:
commit
d4270c7fb3
1
make.js
1
make.js
@ -522,6 +522,7 @@ target.b2g = function() {
|
|||||||
defines: defines,
|
defines: defines,
|
||||||
copy: [
|
copy: [
|
||||||
[COMMON_WEB_FILES, B2G_BUILD_CONTENT_DIR + '/web'],
|
[COMMON_WEB_FILES, B2G_BUILD_CONTENT_DIR + '/web'],
|
||||||
|
['web/viewer-b2g.css', B2G_BUILD_CONTENT_DIR + '/web'],
|
||||||
['web/locale.properties', B2G_BUILD_CONTENT_DIR + '/web'],
|
['web/locale.properties', B2G_BUILD_CONTENT_DIR + '/web'],
|
||||||
['external/webL10n/l10n.js', B2G_BUILD_CONTENT_DIR + '/web']
|
['external/webL10n/l10n.js', B2G_BUILD_CONTENT_DIR + '/web']
|
||||||
],
|
],
|
||||||
|
8
web/viewer-b2g.css
Normal file
8
web/viewer-b2g.css
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
html {
|
||||||
|
/* Font size is needed to make the activity bar the corect size. */
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#outerContainer {
|
||||||
|
position: relative;
|
||||||
|
}
|
6
web/viewer-snippet-b2g-activity-header.html
Normal file
6
web/viewer-snippet-b2g-activity-header.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<section role="region" id="activityHeader" class="skin-organic">
|
||||||
|
<header>
|
||||||
|
<button id="activityClose"><span class="icon icon-close"></span></button>
|
||||||
|
<h1 id="activityTitle"></h1>
|
||||||
|
</header>
|
||||||
|
</section>
|
@ -1,5 +1,7 @@
|
|||||||
<!-- This snippet is used in b2g, see Makefile -->
|
<!-- This snippet is used in b2g, see Makefile -->
|
||||||
<link rel="resource" type="application/l10n" href="locale.properties"/>
|
<link rel="resource" type="application/l10n" href="locale.properties"/>
|
||||||
|
<link rel="stylesheet" href="/shared/style/headers.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="viewer-b2g.css" type="text/css" />
|
||||||
<script type="text/javascript" src="l10n.js"></script>
|
<script type="text/javascript" src="l10n.js"></script>
|
||||||
<script type="text/javascript" src="../build/pdf.js"></script>
|
<script type="text/javascript" src="../build/pdf.js"></script>
|
||||||
<script type="text/javascript" src="/shared/js/async_storage.js"></script>
|
<script type="text/javascript" src="/shared/js/async_storage.js"></script>
|
||||||
|
@ -78,6 +78,9 @@ limitations under the License.
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<!--#if B2G-->
|
||||||
|
<!--#include viewer-snippet-b2g-activity-header.html-->
|
||||||
|
<!--#endif-->
|
||||||
<div id="outerContainer">
|
<div id="outerContainer">
|
||||||
|
|
||||||
<div id="sidebarContainer">
|
<div id="sidebarContainer">
|
||||||
|
@ -912,14 +912,21 @@ var PDFView = {
|
|||||||
setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {
|
setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
try {
|
try {
|
||||||
document.title = decodeURIComponent(getFileName(url)) || url;
|
this.setTitle(decodeURIComponent(getFileName(url)) || url);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// decodeURIComponent may throw URIError,
|
// decodeURIComponent may throw URIError,
|
||||||
// fall back to using the unprocessed url in that case
|
// fall back to using the unprocessed url in that case
|
||||||
document.title = url;
|
this.setTitle(url);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setTitle: function pdfViewSetTitle(title) {
|
||||||
|
document.title = title;
|
||||||
|
//#if B2G
|
||||||
|
// document.getElementById('activityTitle').textContent = title;
|
||||||
|
//#endif
|
||||||
|
},
|
||||||
|
|
||||||
open: function pdfViewOpen(url, scale, password) {
|
open: function pdfViewOpen(url, scale, password) {
|
||||||
var parameters = {password: password};
|
var parameters = {password: password};
|
||||||
if (typeof url === 'string') { // URL
|
if (typeof url === 'string') { // URL
|
||||||
@ -1291,7 +1298,7 @@ var PDFView = {
|
|||||||
pdfTitle = info['Title'];
|
pdfTitle = info['Title'];
|
||||||
|
|
||||||
if (pdfTitle)
|
if (pdfTitle)
|
||||||
document.title = pdfTitle + ' - ' + document.title;
|
self.setTitle(pdfTitle + ' - ' + document.title);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -3242,17 +3249,10 @@ window.addEventListener('afterprint', function afterPrint(evt) {
|
|||||||
//#if B2G
|
//#if B2G
|
||||||
//window.navigator.mozSetMessageHandler('activity', function(activity) {
|
//window.navigator.mozSetMessageHandler('activity', function(activity) {
|
||||||
// var url = activity.source.data.url;
|
// var url = activity.source.data.url;
|
||||||
// // Temporarily get the data here since the cross domain xhr is broken in
|
// PDFView.open(url);
|
||||||
// // the worker currently, see bug 761227.
|
// var cancelButton = document.getElementById('activityClose');
|
||||||
// var params = {
|
// cancelButton.addEventListener('click', function() {
|
||||||
// url: url,
|
// activity.postResult('close');
|
||||||
// error: function(e) {
|
|
||||||
// PDFView.error(mozL10n.get('loading_error', null,
|
|
||||||
// 'An error occurred while loading the PDF.'), e);
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// PDFJS.getPdf(params, function successCallback(data) {
|
|
||||||
// PDFView.open(data, 0);
|
|
||||||
// });
|
// });
|
||||||
//});
|
//});
|
||||||
//#endif
|
//#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user