Merge pull request #1396 from gigaherz/title-mods
Assign the filename to the page title instead of the full URL
This commit is contained in:
commit
9998af0af8
@ -15,6 +15,15 @@ var kMaxScale = 4.0;
|
|||||||
var kImageDirectory = './images/';
|
var kImageDirectory = './images/';
|
||||||
var kSettingsMemory = 20;
|
var kSettingsMemory = 20;
|
||||||
|
|
||||||
|
function getFileName(url) {
|
||||||
|
var anchor = url.indexOf('#');
|
||||||
|
var query = url.indexOf('?');
|
||||||
|
var end = Math.min(
|
||||||
|
anchor > 0 ? anchor : url.length,
|
||||||
|
query > 0 ? query : url.length);
|
||||||
|
return url.substring(url.lastIndexOf('/', end) + 1, end);
|
||||||
|
}
|
||||||
|
|
||||||
var Cache = function cacheCache(size) {
|
var Cache = function cacheCache(size) {
|
||||||
var data = [];
|
var data = [];
|
||||||
this.push = function cachePush(view) {
|
this.push = function cachePush(view) {
|
||||||
@ -300,7 +309,9 @@ var PDFView = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
open: function pdfViewOpen(url, scale) {
|
open: function pdfViewOpen(url, scale) {
|
||||||
document.title = this.url = url;
|
this.url = url;
|
||||||
|
|
||||||
|
document.title = decodeURIComponent(getFileName(url)) || url;
|
||||||
|
|
||||||
if (!PDFView.loadingBar) {
|
if (!PDFView.loadingBar) {
|
||||||
PDFView.loadingBar = new ProgressBar('#loadingBar', {});
|
PDFView.loadingBar = new ProgressBar('#loadingBar', {});
|
||||||
|
Loading…
Reference in New Issue
Block a user