function init(){window.addEventListener("keydown",onKeyDown,!1),$("#addButton").click(addFilters),$("#cancelButton").click(closeDialog.bind(null,!1)),$("#close").click(closeDialog.bind(null,!1)),chrome.tabs.sendMessage(tabId,{reqtype:"clickhide-init",width:Math.max(document.body.offsetWidth,document.body.scrollWidth),height:document.body.offsetHeight},function(e){document.getElementById("filters").value=e.filters.join("\n")}),document.getElementById("filters").focus()}function onKeyDown(e){27==e.keyCode?(e.preventDefault(),closeDialog()):13!=e.keyCode||e.shiftKey||e.ctrlKey||(e.preventDefault(),addFilters())}function addFilters(){var e=document.getElementById("filters").value.split(/[\r\n]+/).map(function(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")}).filter(function(e){return""!=e});chrome.runtime.sendMessage({reqtype:"add-filters",filters:e}),closeDialog(!0)}function closeDialog(e){window.close()}var tabId=parseInt(location.href.match(/block.html\?tabId=(\d+)/)[1]);$(init);