Miscellaneous improvements for the document properties dialog
This commit is contained in:
parent
5a6862decc
commit
c952b6fb85
@ -63,12 +63,12 @@ hand_tool_disable.title=Disable hand tool
|
|||||||
hand_tool_disable_label=Disable hand tool
|
hand_tool_disable_label=Disable hand tool
|
||||||
|
|
||||||
# Document properties dialog box
|
# Document properties dialog box
|
||||||
document_properties.title=Document Properties
|
document_properties.title=Document Properties…
|
||||||
document_properties_label=Document Properties
|
document_properties_label=Document Properties…
|
||||||
document_properties_file_name=File name:
|
document_properties_file_name=File name:
|
||||||
document_properties_file_size=File size:
|
document_properties_file_size=File size:
|
||||||
document_properties_kb={{size_kb}} KB
|
document_properties_kb={{size_kb}} KB ({{size_b}} bytes)
|
||||||
document_properties_mb={{size_mb}} MB
|
document_properties_mb={{size_mb}} MB ({{size_b}} bytes)
|
||||||
document_properties_title=Title:
|
document_properties_title=Title:
|
||||||
document_properties_author=Author:
|
document_properties_author=Author:
|
||||||
document_properties_subject=Subject:
|
document_properties_subject=Subject:
|
||||||
|
@ -63,12 +63,12 @@ hand_tool_disable.title=Handcursor uitschakelen
|
|||||||
hand_tool_disable_label=Handcursor uitschakelen
|
hand_tool_disable_label=Handcursor uitschakelen
|
||||||
|
|
||||||
# Document properties dialog box
|
# Document properties dialog box
|
||||||
document_properties.title=Documenteigenschappen
|
document_properties.title=Documenteigenschappen…
|
||||||
document_properties_label=Documenteigenschappen
|
document_properties_label=Documenteigenschappen…
|
||||||
document_properties_file_name=Bestandsnaam:
|
document_properties_file_name=Bestandsnaam:
|
||||||
document_properties_file_size=Bestandsgrootte:
|
document_properties_file_size=Bestandsgrootte:
|
||||||
document_properties_kb={{size_kb}} KB
|
document_properties_kb={{size_kb}} KB ({{size_b}} bytes)
|
||||||
document_properties_mb={{size_mb}} MB
|
document_properties_mb={{size_mb}} MB ({{size_b}} bytes)
|
||||||
document_properties_title=Titel:
|
document_properties_title=Titel:
|
||||||
document_properties_author=Auteur:
|
document_properties_author=Auteur:
|
||||||
document_properties_subject=Onderwerp:
|
document_properties_subject=Onderwerp:
|
||||||
|
@ -14,12 +14,13 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* globals PDFView, mozL10n */
|
/* globals PDFView, mozL10n, getPDFFileNameFromURL */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var DocumentProperties = {
|
var DocumentProperties = {
|
||||||
overlayContainer: null,
|
overlayContainer: null,
|
||||||
|
fileName: '',
|
||||||
fileSize: '',
|
fileSize: '',
|
||||||
visible: false,
|
visible: false,
|
||||||
|
|
||||||
@ -58,11 +59,22 @@ var DocumentProperties = {
|
|||||||
if (options.closeButton) {
|
if (options.closeButton) {
|
||||||
options.closeButton.addEventListener('click', this.hide.bind(this));
|
options.closeButton.addEventListener('click', this.hide.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bind the event listener for the Esc key (to close the dialog).
|
||||||
|
window.addEventListener('keydown',
|
||||||
|
function (e) {
|
||||||
|
if (e.keyCode === 27) { // Esc key
|
||||||
|
this.hide();
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
getProperties: function documentPropertiesGetProperties() {
|
getProperties: function documentPropertiesGetProperties() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
// Get the file name.
|
||||||
|
this.fileName = getPDFFileNameFromURL(PDFView.url);
|
||||||
|
|
||||||
// Get the file size.
|
// Get the file size.
|
||||||
PDFView.pdfDocument.dataLoaded().then(function(data) {
|
PDFView.pdfDocument.dataLoaded().then(function(data) {
|
||||||
self.setFileSize(data.length);
|
self.setFileSize(data.length);
|
||||||
@ -71,7 +83,7 @@ var DocumentProperties = {
|
|||||||
// Get the other document properties.
|
// Get the other document properties.
|
||||||
PDFView.pdfDocument.getMetadata().then(function(data) {
|
PDFView.pdfDocument.getMetadata().then(function(data) {
|
||||||
var fields = [
|
var fields = [
|
||||||
{ field: self.fileNameField, content: PDFView.url },
|
{ field: self.fileNameField, content: self.fileName },
|
||||||
{ field: self.fileSizeField, content: self.fileSize },
|
{ field: self.fileSizeField, content: self.fileSize },
|
||||||
{ field: self.titleField, content: data.info.Title },
|
{ field: self.titleField, content: data.info.Title },
|
||||||
{ field: self.authorField, content: data.info.Author },
|
{ field: self.authorField, content: data.info.Author },
|
||||||
@ -99,14 +111,17 @@ var DocumentProperties = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
setFileSize: function documentPropertiesSetFileSize(fileSize) {
|
setFileSize: function documentPropertiesSetFileSize(fileSize) {
|
||||||
var kb = Math.round(fileSize / 1024);
|
var kb = fileSize / 1024;
|
||||||
if (kb < 1024) {
|
if (kb < 1024) {
|
||||||
this.fileSize = mozL10n.get('document_properties_kb',
|
this.fileSize = mozL10n.get('document_properties_kb', {
|
||||||
{size_kb: kb}, '{{size_kb}} KB');
|
size_kb: (+kb.toPrecision(3)).toLocaleString(),
|
||||||
|
size_b: fileSize.toLocaleString()
|
||||||
|
}, '{{size_kb}} KB ({{size_b}} bytes)');
|
||||||
} else {
|
} else {
|
||||||
var mb = Math.round((kb / 1024) * 100) / 100;
|
this.fileSize = mozL10n.get('document_properties_mb', {
|
||||||
this.fileSize = mozL10n.get('document_properties_mb',
|
size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(),
|
||||||
{size_mb: mb}, '{{size_mb}} MB');
|
size_b: fileSize.toLocaleString()
|
||||||
|
}, '{{size_mb}} MB ({{size_b}} bytes)');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ var PasswordPrompt = {
|
|||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
this.overlayContainer.addEventListener('keydown',
|
window.addEventListener('keydown',
|
||||||
function (e) {
|
function (e) {
|
||||||
if (e.keyCode === 27) { // Esc key
|
if (e.keyCode === 27) { // Esc key
|
||||||
this.hide();
|
this.hide();
|
||||||
|
@ -1486,6 +1486,16 @@ html[dir='rtl'] #documentPropertiesContainer .row > * {
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#documentPropertiesContainer .row span {
|
||||||
|
width: 125px;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
#documentPropertiesContainer .row p {
|
||||||
|
max-width: 225px;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
#documentPropertiesContainer .buttonRow {
|
#documentPropertiesContainer .buttonRow {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -175,8 +175,8 @@ limitations under the License.
|
|||||||
|
|
||||||
<div class="horizontalToolbarSeparator"></div>
|
<div class="horizontalToolbarSeparator"></div>
|
||||||
|
|
||||||
<button id="documentProperties" class="secondaryToolbarButton documentProperties" title="Document Properties" tabindex="28" data-l10n-id="document_properties">
|
<button id="documentProperties" class="secondaryToolbarButton documentProperties" title="Document Properties…" tabindex="28" data-l10n-id="document_properties">
|
||||||
<span data-l10n-id="document_properties_label">Document Properties</span>
|
<span data-l10n-id="document_properties_label">Document Properties…</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- secondaryToolbar -->
|
</div> <!-- secondaryToolbar -->
|
||||||
|
Loading…
Reference in New Issue
Block a user