var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
{
  let window = _____WB$wombat$assign$function_____("window");
  let self = _____WB$wombat$assign$function_____("self");
  let document = _____WB$wombat$assign$function_____("document");
  let location = _____WB$wombat$assign$function_____("location");
  let top = _____WB$wombat$assign$function_____("top");
  let parent = _____WB$wombat$assign$function_____("parent");
  let frames = _____WB$wombat$assign$function_____("frames");
  let opener = _____WB$wombat$assign$function_____("opener");

/*
 * catalog-search.js
 * https://github.com/mgrabovsky/lainchan/blob/catalog-search/js/catalog-search.js
 *
 * Released under the MIT license
 * Copyright (c) 2015 Matěj Grabovský <matej.grabovsky@gmail.com>
 *
 * Usage:
 *   $config['additional_javascript'][] = 'js/jquery.min.js';
 *   $config['additional_javascript'][] = 'js/catalog-search.js';
 */

(function() {

var catalogSearch = function() {
	var $controls = $('.controls'),
		$threads = $('.threads .thread'),
		$searchLabel = $('<label for="catalog_search">Search: </label>'),
		$searchBox = $('<input id="catalog_search" type="text" placeholder="Search" />');
		function searchToggle() {
			var button = $('#catalog_search_button');

			if (!button.data('expanded')) {
				button.data('expanded', '1');
				button.text('Close');
				$('.catalog_search').append(' <input id="search_field" style="border: inset 1px;">');
				$('#search_field').focus();
			} else {
				button.removeData('expanded');
				button.text('Search');
				$('.catalog_search').children().last().remove();
				$('div[id="Grid"]>.mix').each(function () { $(this).css('display', 'inline-block'); });
			}
		}

	$controls.append($searchLabel)
			.append($searchBox);

	$searchBox.keyup(function() {
		var $found = searchThreads($threads, this.value);
		$threads.hide();
		$found.show();
	});

	var m = location.hash.match(/[#&]s=([^&]+)/);
	if(m) {
		$searchBox.val(decodeURIComponent(m[1])).keyup();
	}
};

// Filter threads by their content, given a regex. Can be extended to load data
// remotely and filter by multiple fields
var searchThreads = function($threads, query) {
	var re = new RegExp(query, 'mi');
	return $threads.filter(function() {
		return re.test($('.replies', this).text());
	});
};

// Only load in the catalog
if (active_page == 'catalog') {
	onready(catalogSearch);
}

}());


}
/*
     FILE ARCHIVED ON 17:31:30 Sep 15, 2023 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 03:52:59 Mar 03, 2024.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
*/
/*
playback timings (ms):
  exclusion.robots: 0.076
  exclusion.robots.policy: 0.063
  cdx.remote: 0.228
  esindex: 0.015
  LoadShardBlock: 111.532 (6)
  PetaboxLoader3.datanode: 204.947 (8)
  load_resource: 1233.731 (2)
  PetaboxLoader3.resolve: 1128.631 (2)
*/