Add close button and title bar for b2g.
This commit is contained in:
parent
9bf318019e
commit
df0d9be4a5
1
make.js
1
make.js
@ -522,6 +522,7 @@ target.b2g = function() {
|
||||
defines: defines,
|
||||
copy: [
|
||||
[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'],
|
||||
['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 -->
|
||||
<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="../build/pdf.js"></script>
|
||||
<script type="text/javascript" src="/shared/js/async_storage.js"></script>
|
||||
|
@ -78,6 +78,9 @@ limitations under the License.
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!--#if B2G-->
|
||||
<!--#include viewer-snippet-b2g-activity-header.html-->
|
||||
<!--#endif-->
|
||||
<div id="outerContainer">
|
||||
|
||||
<div id="sidebarContainer">
|
||||
|
@ -912,14 +912,21 @@ var PDFView = {
|
||||
setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {
|
||||
this.url = url;
|
||||
try {
|
||||
document.title = decodeURIComponent(getFileName(url)) || url;
|
||||
this.setTitle(decodeURIComponent(getFileName(url)) || url);
|
||||
} catch (e) {
|
||||
// decodeURIComponent may throw URIError,
|
||||
// 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) {
|
||||
var parameters = {password: password};
|
||||
if (typeof url === 'string') { // URL
|
||||
@ -1291,7 +1298,7 @@ var PDFView = {
|
||||
pdfTitle = info['Title'];
|
||||
|
||||
if (pdfTitle)
|
||||
document.title = pdfTitle + ' - ' + document.title;
|
||||
self.setTitle(pdfTitle + ' - ' + document.title);
|
||||
});
|
||||
},
|
||||
|
||||
@ -3242,17 +3249,10 @@ window.addEventListener('afterprint', function afterPrint(evt) {
|
||||
//#if B2G
|
||||
//window.navigator.mozSetMessageHandler('activity', function(activity) {
|
||||
// var url = activity.source.data.url;
|
||||
// // Temporarily get the data here since the cross domain xhr is broken in
|
||||
// // the worker currently, see bug 761227.
|
||||
// var params = {
|
||||
// url: url,
|
||||
// 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);
|
||||
// PDFView.open(url);
|
||||
// var cancelButton = document.getElementById('activityClose');
|
||||
// cancelButton.addEventListener('click', function() {
|
||||
// activity.postResult('close');
|
||||
// });
|
||||
//});
|
||||
//#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user