: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
InfiniteScroll.prototype.loadMore = function () {
var params = $.extend({}, {page: 1}, this.lastParams);
this.trigger('query:append', params);
InfiniteScroll.prototype.showLoadingMore = function (_, data) {
return data.pagination && data.pagination.more;
InfiniteScroll.prototype.createLoadingMore = function () {
'class="pumselect2-results__option pumselect2-results__option--load-more"' +
'role="treeitem" aria-disabled="true"></li>'
var message = this.options.get('translations').get('loadingMore');
$option.html(message(this.lastParams));
S2.define('pumselect2/dropdown/attachBody',[
function AttachBody (decorated, $element, options) {
this.$dropdownParent = options.get('dropdownParent') || $(document.body);
decorated.call(this, $element, options);
AttachBody.prototype.bind = function (decorated, container, $container) {
var setupResultsEvents = false;
decorated.call(this, container, $container);
container.on('open', function () {
self._attachPositioningHandler(container);
if (!setupResultsEvents) {
setupResultsEvents = true;
container.on('results:all', function () {
self._positionDropdown();
container.on('results:append', function () {
self._positionDropdown();
container.on('close', function () {
self._detachPositioningHandler(container);
this.$dropdownContainer.on('mousedown', function (evt) {
AttachBody.prototype.destroy = function (decorated) {
this.$dropdownContainer.remove();
AttachBody.prototype.position = function (decorated, $dropdown, $container) {
// Clone all of the container classes
$dropdown.attr('class', $container.attr('class'));
$dropdown.removeClass('pumselect2');
$dropdown.addClass('pumselect2-container--open');
this.$container = $container;
AttachBody.prototype.render = function (decorated) {
var $container = $('<span></span>');
var $dropdown = decorated.call(this);
$container.append($dropdown);
this.$dropdownContainer = $container;
AttachBody.prototype._hideDropdown = function (decorated) {
this.$dropdownContainer.detach();
AttachBody.prototype._attachPositioningHandler =
function (decorated, container) {
var scrollEvent = 'scroll.pumselect2.' + container.id;
var resizeEvent = 'resize.pumselect2.' + container.id;
var orientationEvent = 'orientationchange.pumselect2.' + container.id;
var $watchers = this.$container.parents().filter(Utils.hasScroll);
$watchers.each(function () {
$(this).data('pumselect2-scroll-position', {
$watchers.on(scrollEvent, function (ev) {
var position = $(this).data('pumselect2-scroll-position');
$(this).scrollTop(position.y);
$(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
self._positionDropdown();
AttachBody.prototype._detachPositioningHandler =
function (decorated, container) {
var scrollEvent = 'scroll.pumselect2.' + container.id;
var resizeEvent = 'resize.pumselect2.' + container.id;
var orientationEvent = 'orientationchange.pumselect2.' + container.id;
var $watchers = this.$container.parents().filter(Utils.hasScroll);
$watchers.off(scrollEvent);
$(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
AttachBody.prototype._positionDropdown = function () {
var isCurrentlyAbove = this.$dropdown.hasClass('pumselect2-dropdown--above');
var isCurrentlyBelow = this.$dropdown.hasClass('pumselect2-dropdown--below');
var offset = this.$container.offset();
offset.bottom = offset.top + this.$container.outerHeight(false);
height: this.$container.outerHeight(false)
container.top = offset.top;
container.bottom = offset.top + container.height;
height: this.$dropdown.outerHeight(false)
top: $window.scrollTop(),
bottom: $window.scrollTop() + $window.height()
var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
// Determine what the parent element is to use for calciulating the offset
var $offsetParent = this.$dropdownParent;
// For statically positoned elements, we need to get the element
// that is determining the offset
if ($offsetParent.css('position') === 'static') {
$offsetParent = $offsetParent.offsetParent();
var parentOffset = $offsetParent.offset();
css.top -= parentOffset.top;
css.left -= parentOffset.left;
if (!isCurrentlyAbove && !isCurrentlyBelow) {
if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
} else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
if (newDirection == 'above' ||
(isCurrentlyAbove && newDirection !== 'below')) {
css.top = container.top - dropdown.height;
if (newDirection != null) {
.removeClass('pumselect2-dropdown--below pumselect2-dropdown--above')
.addClass('pumselect2-dropdown--' + newDirection);
.removeClass('pumselect2-container--below pumselect2-container--above')
.addClass('pumselect2-container--' + newDirection);
this.$dropdownContainer.css(css);
AttachBody.prototype._resizeDropdown = function () {
width: this.$container.outerWidth(false) + 'px'
if (this.options.get('dropdownAutoWidth')) {
css.minWidth = css.width;
AttachBody.prototype._showDropdown = function (decorated) {
this.$dropdownContainer.appendTo(this.$dropdownParent);
this._positionDropdown();
S2.define('pumselect2/dropdown/minimumResultsForSearch',[
function countResults (data) {
for (var d = 0; d < data.length; d++) {
count += countResults(item.children);
function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
this.minimumResultsForSearch = options.get('minimumResultsForSearch');
if (this.minimumResultsForSearch < 0) {
this.minimumResultsForSearch = Infinity;
decorated.call(this, $element, options, dataAdapter);
MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
if (countResults(params.data.results) < this.minimumResultsForSearch) {
return decorated.call(this, params);
return MinimumResultsForSearch;
S2.define('pumselect2/dropdown/selectOnClose',[
function SelectOnClose () { }
SelectOnClose.prototype.bind = function (decorated, container, $container) {
decorated.call(this, container, $container);
container.on('close', function () {
self._handleSelectOnClose();
SelectOnClose.prototype._handleSelectOnClose = function () {
var $highlightedResults = this.getHighlightedResults();
// Only select highlighted results
if ($highlightedResults.length < 1) {
var data = $highlightedResults.data('data');
// Don't re-select already selected resulte
(data.element != null && data.element.selected) ||
(data.element == null && data.selected)
S2.define('pumselect2/dropdown/closeOnSelect',[
function CloseOnSelect () { }
CloseOnSelect.prototype.bind = function (decorated, container, $container) {
decorated.call(this, container, $container);
container.on('select', function (evt) {
self._selectTriggered(evt);
container.on('unselect', function (evt) {
self._selectTriggered(evt);
CloseOnSelect.prototype._selectTriggered = function (_, evt) {
var originalEvent = evt.originalEvent;
// Don't close if the control key is being held
if (originalEvent && originalEvent.ctrlKey) {
this.trigger('close', {});
S2.define('pumselect2/i18n/en',[],function () {
errorLoading: function () {
return 'The results could not be loaded.';
inputTooLong: function (args) {
var overChars = args.input.length - args.maximum;
var message = 'Please delete ' + overChars + ' character';
inputTooShort: function (args) {
var remainingChars = args.minimum - args.input.length;
var message = 'Please enter ' + remainingChars + ' or more characters';
loadingMore: function () {
return 'Loading more results…';
maximumSelected: function (args) {
var message = 'You can only select ' + args.maximum + ' item';
return 'No results found';
S2.define('pumselect2/defaults',[
'./selection/placeholder',
'./selection/allowClear',
'./selection/eventRelay',
'./data/minimumInputLength',
'./data/maximumInputLength',
'./data/maximumSelectionLength',
'./dropdown/hidePlaceholder',
'./dropdown/infiniteScroll',
'./dropdown/minimumResultsForSearch',
'./dropdown/selectOnClose',
'./dropdown/closeOnSelect',
SingleSelection, MultipleSelection, Placeholder, AllowClear,
SelectionSearch, EventRelay,
Utils, Translation, DIACRITICS,
SelectData, ArrayData, AjaxData, Tags, Tokenizer,
MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
Defaults.prototype.apply = function (options) {
options = $.extend(true, {}, this.defaults, options);
if (options.dataAdapter == null) {
if (options.ajax != null) {
options.dataAdapter = AjaxData;
} else if (options.data != null) {
options.dataAdapter = ArrayData;
options.dataAdapter = SelectData;
if (options.minimumInputLength > 0) {
options.dataAdapter = Utils.Decorate(
if (options.maximumInputLength > 0) {
options.dataAdapter = Utils.Decorate(
if (options.maximumSelectionLength > 0) {