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();
else
panel.textContent = tool.name + ' is disabled. To enable add ' +
' PDFBug_' + tool.id + '=true to the url query ' +
'parameters and refresh.';
' "' + tool.id + '" to the pdfBug parameter ' +
'and refresh (seperate multiple by commas).';
buttons.push(panelButton);
}
this.selectPanel(0);

View File

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