Change how the tools are enabled.

This commit is contained in:
Brendan Dahl 2012-02-15 13:13:07 -08:00
parent 0175f53637
commit f54486d8c8
2 changed files with 12 additions and 9 deletions

View File

@ -374,8 +374,8 @@ var PDFBug = (function PDFBugClosure() {
tool.init(); tool.init();
else else
panel.textContent = tool.name + ' is disabled. To enable add ' + panel.textContent = tool.name + ' is disabled. To enable add ' +
' PDFBug_' + tool.id + '=true to the url query ' + ' "' + tool.id + '" to the pdfBug parameter ' +
'parameters and refresh.'; 'and refresh (seperate multiple by commas).';
buttons.push(panelButton); buttons.push(panelButton);
} }
this.selectPanel(0); this.selectPanel(0);

View File

@ -1122,16 +1122,19 @@ window.addEventListener('load', function webViewerLoad(evt) {
if ('disableTextLayer' in params) if ('disableTextLayer' in params)
PDFJS.disableTextLayer = (params['disableTextLayer'] === 'true'); PDFJS.disableTextLayer = (params['disableTextLayer'] === 'true');
if ('PDFBug' in params) if ('pdfBug' in params) {
PDFJS.pdfBug = (params['PDFBug'] === 'true'); PDFJS.pdfBug = true;
var pdfBug = params['pdfBug'];
if (PDFJS.pdfBug) { var all = false, enabled = [];
if (pdfBug === 'all')
all = true;
else
enabled = pdfBug.split(',');
var debugTools = PDFBug.tools; var debugTools = PDFBug.tools;
for (var i = 0; i < debugTools.length; ++i) { for (var i = 0; i < debugTools.length; ++i) {
var tool = debugTools[i]; var tool = debugTools[i];
var key = 'PDFBug_' + tool.id; if (all || enabled.indexOf(tool.id) !== -1)
if (key in params) tool.enabled = true;
tool.enabled = (params[key] === 'true');
} }
PDFBug.init(); PDFBug.init();
} }