|
|
@ -96,6 +96,8 @@ var PDFFindBar = (function PDFFindBarClosure() { |
|
|
|
this.caseSensitive.addEventListener('click', function() { |
|
|
|
this.caseSensitive.addEventListener('click', function() { |
|
|
|
self.dispatchEvent('casesensitivitychange'); |
|
|
|
self.dispatchEvent('casesensitivitychange'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.eventBus.on('resize', this._adjustWidth.bind(this)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
PDFFindBar.prototype = { |
|
|
|
PDFFindBar.prototype = { |
|
|
@ -155,6 +157,7 @@ var PDFFindBar = (function PDFFindBarClosure() { |
|
|
|
this.findMsg.textContent = findMsg; |
|
|
|
this.findMsg.textContent = findMsg; |
|
|
|
|
|
|
|
|
|
|
|
this.updateResultsCount(matchCount); |
|
|
|
this.updateResultsCount(matchCount); |
|
|
|
|
|
|
|
this._adjustWidth(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
updateResultsCount: function(matchCount) { |
|
|
|
updateResultsCount: function(matchCount) { |
|
|
@ -183,6 +186,8 @@ var PDFFindBar = (function PDFFindBarClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
this.findField.select(); |
|
|
|
this.findField.select(); |
|
|
|
this.findField.focus(); |
|
|
|
this.findField.focus(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this._adjustWidth(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
close: function PDFFindBar_close() { |
|
|
|
close: function PDFFindBar_close() { |
|
|
@ -201,7 +206,32 @@ var PDFFindBar = (function PDFFindBarClosure() { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.open(); |
|
|
|
this.open(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @private |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
_adjustWidth: function PDFFindBar_adjustWidth() { |
|
|
|
|
|
|
|
if (!this.opened) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The find bar has an absolute position and thus the browser extends
|
|
|
|
|
|
|
|
// its width to the maximum possible width once the find bar does not fit
|
|
|
|
|
|
|
|
// entirely within the window anymore (and its elements are automatically
|
|
|
|
|
|
|
|
// wrapped). Here we detect and fix that.
|
|
|
|
|
|
|
|
this.bar.classList.remove('wrapContainers'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var findbarHeight = this.bar.clientHeight; |
|
|
|
|
|
|
|
var inputContainerHeight = this.bar.firstElementChild.clientHeight; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (findbarHeight > inputContainerHeight) { |
|
|
|
|
|
|
|
// The findbar is taller than the input container, which means that
|
|
|
|
|
|
|
|
// the browser wrapped some of the elements. For a consistent look,
|
|
|
|
|
|
|
|
// wrap all of them to adjust the width of the find bar.
|
|
|
|
|
|
|
|
this.bar.classList.add('wrapContainers'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
return PDFFindBar; |
|
|
|
return PDFFindBar; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|