}
},
pdfBugEnabled: function() {
- return getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
+ return getBoolPref(EXT_PREFIX + '.pdfBugEnabled', false);
+ },
+ searchEnabled: function() {
+ return getBoolPref(EXT_PREFIX + '.searchEnabled', false);
+ },
+ fallback: function(url) {
+ var self = this;
+ var domWindow = this.domWindow;
+ var strings = getLocalizedStrings('chrome.properties');
+ var message = getLocalizedString(strings, 'unsupported_feature');
+
+ var win = Services.wm.getMostRecentWindow('navigator:browser');
+ var browser = win.gBrowser.getBrowserForDocument(domWindow.top.document);
+ var notificationBox = win.gBrowser.getNotificationBox(browser);
+
+ var buttons = [{
+ label: getLocalizedString(strings, 'open_with_different_viewer'),
+ accessKey: null,
+ callback: function() {
+ self.download(url);
+ }
+ }];
+ notificationBox.appendNotification(message, 'pdfjs-fallback', null,
+ notificationBox.PRIORITY_WARNING_LOW,
+ buttons);
}
};
currentScale: kUnknownScale,
currentScaleValue: null,
initialBookmark: document.location.hash.substring(1),
+ startedTextExtraction: false,
+ pageText: [],
container: null,
initialized: false,
+ fellback: false,
// called once when the document is loaded
initialize: function pdfViewInitialize() {
this.container = document.getElementById('viewerContainer');
PDFBug.init();
}
+ if (!PDFJS.isFirefoxExtension ||
+ (PDFJS.isFirefoxExtension && FirefoxCom.request('searchEnabled'))) {
+ document.querySelector('#viewSearch').classList.remove('hidden');
+ }
+
+ // Listen for warnings to trigger the fallback UI. Errors should be caught
+ // and call PDFView.error() so we don't need to listen for those.
+ PDFJS.LogManager.addLogger({
+ warn: function() {
+ PDFView.fallback();
+ }
+ });
+
var thumbsView = document.getElementById('thumbnailView');
thumbsView.addEventListener('scroll', updateThumbViewArea, true);