NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name poe.trade Item Highlighter // @namespace com.atemus // @include http://poe.trade/search/* // @version 2 // @grant none // ==/UserScript== var items = []; var selectedItems = []; var loader = document.getElementsByClassName('loader')[0]; function initialize() { items = document.getElementsByClassName('item'); selectedItems = []; showHideCheckbox.checked = false; var sortables = document.getElementsByClassName('sortable'); for (i = 0; i < sortables.length; i++) { sortables[i].onclick = waitForNewItemsAndReinitialize; } for (i = 0; i < items.length; i++) { addOnClickToItem(items[i]); } } function waitForNewItemsAndReinitialize() { var interval = setInterval(function() { if (!loader.hasChildNodes()) { clearInterval(interval); initialize(); } } , 100); } function addOnClickToItem(item) { var iconTableCell = item.getElementsByClassName('icon-td')[0]; iconTableCell.style.cursor = "pointer"; iconTableCell.onclick = function() { var itemIndex = selectedItems.indexOf(item); if (itemIndex == -1) { iconTableCell.style.boxShadow = "-7px 0px #94a314"; selectedItems.push(item); } else { iconTableCell.style.boxShadow = ""; selectedItems.splice(itemIndex, 1); if (showHideCheckbox.checked) hideNonhighlightedItems(); } }; } function hideNonhighlightedItems() { for (i = 0; i < items.length; i++) { if (selectedItems.indexOf(items[i]) == -1) items[i].style.display = "none"; } } function showNonhighlightedItems() { for (i = 0; i < items.length; i++) { items[i].style.display = "block"; } } var checkboxDiv = document.createElement('div'); checkboxDiv.style.position = "fixed"; checkboxDiv.style.bottom = "0px"; checkboxDiv.style.right = "0px"; checkboxDiv.style.backgroundColor = "#222222"; checkboxDiv.innerHTML = "Show only highlighted items"; checkboxDiv.style.padding = "10px"; var showHideCheckbox = document.createElement('input'); showHideCheckbox.type = 'checkbox'; showHideCheckbox.style.margin = "0 0 0 10px"; showHideCheckbox.onclick = function() { if (showHideCheckbox.checked) hideNonhighlightedItems(); else showNonhighlightedItems(); }; checkboxDiv.appendChild(showHideCheckbox); document.body.appendChild(checkboxDiv); window.onload = function() { initialize(); };