[GC] - Enhanced Relic Log View

See additional details related to your relic log, included view filter options.

// ==UserScript==
// @name         [GC] - Enhanced Relic Log View
// @namespace    https://greasyfork.org/en/users/1225524-kaitlin
// @version      3.1
// @license      MIT
// @description  See additional details related to your relic log, included view filter options.
// @author       Cupkait
// @match        https://www.grundos.cafe/space/warehouse/*
// @match        https://www.grundos.cafe/search/items/*
// @match        https://www.grundos.cafe/space/warehouse/relics/#details
// @match        https://www.grundos.cafe/safetydeposit/*&category=999*
// @grant        none
// @icon        https://i.imgur.com/4Hm2e6z.png
// ==/UserScript==

if (window.location.href.includes('/warehouse/relics/')) {
    var pageContent = document.getElementById('page_content');
    var relicCountElement = document.querySelector("#page_content > main > div.center > p:nth-child(2)");

    var relicCount = relicCountElement.innerText.replace(/[^\d/]/g, '');
    var [countLogged, relicTotal] = relicCount.split('/').map(value => parseInt(value.trim(), 10));

    var countNeeded = relicTotal - countLogged;
    var relicPercent = ((countLogged / relicTotal) * 100).toFixed(1);

    relicCountElement.innerHTML += `<br>Your collection is <strong>${relicPercent}%</strong> complete.<br> You are missing <strong>${countNeeded}</strong> relics.<br> Click <a href="https://www.grundos.cafe/safetydeposit/?query=&category=999&sort=count">here</a> to check for them in your SDB.`;

    var dropdown = document.createElement('select');
    dropdown.id = 'orderDropdown';
    dropdown.style.marginLeft = '10px';
    dropdown.style.marginBottom = '10px';

    var createOption = (value, text, disabled = false, selected = false) => {
        var option = document.createElement('option');
        option.value = value;
        option.text = text;
        option.disabled = disabled;
        option.selected = selected;
        return option;
    };

    dropdown.add(createOption('choose_view', 'Choose View', true, true));

    var options = ['Show Needed', 'Show Logged', 'Show All'];
    options.forEach(optionText => {
        dropdown.add(createOption(optionText.toLowerCase().replace(' ', '_'), optionText));
    });

    var selectedOption = localStorage.getItem('selectedOption');
    if (selectedOption) {
        dropdown.value = selectedOption;
    }

    relicCountElement.parentNode.insertBefore(dropdown, relicCountElement.nextSibling);
    var flexColumns = document.querySelectorAll('.flex-column');
    var notLoggedSet = new Set();

    dropdown.addEventListener('change', function () {
        applySelectedOption();
        localStorage.setItem('selectedOption', dropdown.value);
    });

    flexColumns.forEach(flexColumn => {
        var imagesWithOpacity = flexColumn.querySelectorAll('img[style*="opacity"]');
        var id = imagesWithOpacity.length > 0 ? 'notlogged' : 'reliclogged';
        flexColumn.setAttribute('id', id);

        if (id === 'notlogged') {
            const relicName = flexColumn.querySelector('strong').innerText;
            notLoggedSet.add(relicName);
        }
    });

    var notLoggedArray = Array.from(notLoggedSet);
    var notLoggedJSON = JSON.stringify(notLoggedArray);
if (!window.location.href.includes('/?user=')) {
    localStorage.setItem('notLoggedRelic', notLoggedJSON);
  console.log("Logged list updated.")
}

    function toggleVisibility(elements, displayValue) {
        elements.forEach(element => {
            element.style.display = displayValue;
        });
    }

    function applySelectedOption() {
        var relicLoggedDivs = document.querySelectorAll('#reliclogged');
        var notLoggedDivs = document.querySelectorAll('#notlogged');

        if (dropdown.value === 'show_all') {
            toggleVisibility(relicLoggedDivs, '');
            toggleVisibility(notLoggedDivs, '');
        } else if (dropdown.value === 'show_needed') {
            toggleVisibility(relicLoggedDivs, 'none');
            toggleVisibility(notLoggedDivs, '');
        } else if (dropdown.value === 'show_logged') {
            toggleVisibility(notLoggedDivs, 'none');
            toggleVisibility(relicLoggedDivs, '');
        }
    }

    applySelectedOption();
}

if (window.location.href.includes('/safetydeposit/') && window.location.href.includes('&category=999')) {
    var notLoggedJSON = localStorage.getItem('notLoggedRelic');
    var notLoggedArray = JSON.parse(notLoggedJSON) || [];

    var items = document.querySelectorAll('.flex-column.small-gap.break');

    items.forEach(item => {
        var itemName = item.querySelector('strong').innerText;

        if (notLoggedArray.includes(itemName)) {
            item.style.backgroundColor = 'yellow';
        }
    });
}

if (window.location.href === 'https://www.grundos.cafe/space/warehouse/') {
    var relics = document.querySelectorAll('.relic');

    var notLoggedJSON = localStorage.getItem('notLoggedRelic');
    var notLoggedArray = JSON.parse(notLoggedJSON) || [];

    relics.forEach(relic => {
        var relicName = relic.textContent.trim();

        if (notLoggedArray.includes(relicName)) {
            relic.style.backgroundColor = 'yellow';
        }
    });
}




const relicArray = [
  {"name": "Air Faerie Crown", "origin": `<ul><li>Possible reward when completing any Faerie Quest.</li><li>Possible prize item from <a href='/games/html5/faeriecloudracers/'>Faerie Cloud Racers</a>.</li></ul>`},
  {"name": "Air Faerie Token", "origin": `<ul><li>Possible reward when completing an Air Faerie Quest.</li><li>Possible prize item from <a href='/games/html5/faeriecloudracers/'>Faerie Cloud Racers</a>.</li></ul>`},
  {"name": "Ancient Lupe Wand", "origin": `<ul><li>Possible prize from scratching <a href='search/items/?item_name=Faeries%20Fortune%20Scratchcard'>Faeries Fortune Scratchcard</a>, <a href='/search/items/?item_name=Peak%20O%20Plenty%20Scratchcard'>Peak O Plenty Scratchcard</a>, or <a href='/search/items/?item_name=Icetravaganza%20Scratchcard'>Icetravaganza Scratchcard</a>.</li></ul>`},
  {"name": "Aquatic Gem", "origin": `<ul><li>Possible prize item from <a href='/games/html5/sutekstomb/'>Sutek's Tomb</a>.</li></ul>`},
  {"name": "Army Math Tools", "origin": `<ul><li>Possible reward for completing History NeoSchool Course.</li></ul>`},
  {"name": "Attack Cape", "origin": `<ul><li>Originally available as a prize in the 2023 Haunted House prize shop.</li></ul>`},
  {"name": "Attack Fork", "origin": `<ul><li>Possible reward when completing a <a href='/halloween/braintree/'>Brain Tree Quest</a>.</li></ul>`},
  {"name": "Bag of Occult Jelly", "origin": `<ul><li>Possible reward when collecting from the <a href='/jelly/greenjelly/'>Green Jelly</a>.</li></ul>`},
  {"name": "Battle Plunger", "origin": `<ul><li>Possible reward from <a href='/water/fishing/'>Underwater Fishing</a>.</li></ul>`},
  {"name": "Battle Quill", "origin": `<ul><li>Guaranteed reward for receiving an A or higher in Early Neopian History, Grammar and Language, Simple Spelling, Art, Geography, or Spanish NeoSchool Course.</li></ul>`},
  {"name": "Bit of Evil Clown", "origin": `<ul><li>Possible prize item from <a href='/games/html5/carnivalofterror/'>Carnival of Terror</a>.</li></ul>`},
  {"name": "Blizzard Ring", "origin": `<ul><li>Possible prize from scratching <a href='search/items/?item_name=Faeries%20Fortune%20Scratchcard'>Faeries Fortune Scratchcard</a>, <a href='/search/items/?item_name=Peak%20O%20Plenty%20Scratchcard'>Peak O Plenty Scratchcard</a>, or <a href='/search/items/?item_name=Icetravaganza%20Scratchcard'>Icetravaganza Scratchcard</a>.</li></ul>`},
  {"name": "Blood Grub", "origin": `<ul><li>Possible prize from scratching a <a href='search/items/?item_name=Pustravaganza%20Scratchcard'>Pustravaganza Scratchcard</a> or <a href='/search/items/?item_name=Rotting%20Riches%20Scratchcard'>Rotting Riches Scratchcard</a>.</li></ul>`},
  {"name": "Brain Tree Branch", "origin": `<ul><li>Possible reward when completing a <a href='/halloween/braintree/'>Brain Tree Quest</a>.</li></ul>`},
  {"name": "Brain Tree Knife", "origin": `<ul><li>Possible reward when completing a <a href='/halloween/braintree/'>Brain Tree Quest</a>.</li><li>Possible reward when turning in a <a href='/games/treasurehunt/?type=spooky'>Spooky Treasure Map</a>.</li></ul>`},
  {"name": "Brain Tree Mace", "origin": `<ul><li>Possible reward when completing a <a href='/halloween/braintree/'>Brain Tree Quest</a>.</li></ul>`},
  {"name": "Brain Tree Root", "origin": `<ul><li>Possible reward when completing a <a href='/halloween/braintree/'>Brain Tree Quest</a>.</li><li>Possible reward when turning in a <a href='/games/treasurehunt/?type=spooky'>Spooky Treasure Map</a>.</li></ul>`},
  {"name": "Brain Tree Splinters", "origin": `<ul><li>Possible reward when completing a <a href='/halloween/braintree/'>Brain Tree Quest</a>.</li></ul>`},
  {"name": "Cabbage of Mystery", "origin": `<ul><li>Possible reward from <a href='/guilds'>Guild Gardens</a> with an inventory above 1,000.</li></ul>`},
  {"name": "Candy Club", "origin": `<ul><li>Previously awarded during the annual Celebration Calendar.</li></ul>`},
  {"name": "Castle Defenders Shield", "origin": `<ul><li>Possible reward for completing all 10 missions in <a href='/games/invasionofmeridell/'>Invasion of Meridell</a>.</li></ul>`},
  {"name": "Castle Defenders Sword", "origin": `<ul><li>Possible reward for completing all 10 missions in <a href='/games/invasionofmeridell/'>Invasion of Meridell</a>.</li></ul>`},
  {"name": "Caustic Potion", "origin": `<ul><li>Guaranteed reward when completing level 17 <a href='/faerieland/darkfaerie/'>Jhudora's Quest</a>.</li></ul>`},
  {"name": "Charles' Torch", "origin": `<ul><li>Originally available as a prize in 2023 Haunted House prize shop.</li></ul>`},
  {"name": "Cobrall Wand", "origin": `<ul><li>Possible reward when winning a round of <a href='/games/sakhmet_solitaire/'>Sakhmet Solitaire</a>.</li></ul>`},
  {"name": "Dark Faerie Dagger", "origin": `<ul><li>Possible prize item from <a href='/games/html5/faeriebubbles'>Faerie Bubbles</a>.</li></ul>`},
  {"name": "Dark Faerie Token", "origin": `<ul><li>Possible reward when completing a Dark Faerie Quest.</li><li>Possible prize item from <a href='/games/html5/faeriecloudracers/'>Faerie Cloud Racers</a>.</li></ul>`},
  {"name": "Donnys Mallet", "origin": `<ul><li>Originally awarded following the 2022 Snowball Fight.</li></ul>`},
  {"name": "Earth Faerie Dagger", "origin": `<ul><li>Possible prize item from <a href='/games/html5/faeriebubbles'>Faerie Bubbles</a>.</li></ul>`},
  {"name": "Earth Faerie Token", "origin": `<ul><li>Possible reward when completing an Earth Faerie Quest.</li><li>Possible prize item from <a href='/games/html5/faeriecloudracers/'>Faerie Cloud Racers</a>.</li></ul>`},
  {"name": "Earth Stone Gem", "origin": `<ul><li>Possible prize item from <a href='/games/html5/sutekstomb/'>Sutek's Tomb</a>.</li></ul>`},
  {"name": "Elephante Lamp", "origin": `<ul><li>Possible reward when visiting <a href='/desert/shrine/'>Coltzan's Shrine</a>.</li></ul>`},
  {"name": "Eraser of the Dark Faerie", "origin": `<ul><li>Guaranteed reward for receiving an A or higher in Potion Brewing Basics NeoSchool Course.</li></ul>`},
  {"name": "Exploding Space Bugs", "origin": `<ul><li>Possible reward for defeating an <a href='/dome/1p/select/?arena=5'>Space Arena</a> challenger.</li></ul>`},
  {"name": "Faerie Eraser", "origin": `<ul><li>Guaranteed reward for receiving an A or higher in Faerie Studies NeoSchool Course.</li></ul>`},
  {"name": "Fat Red Pen", "origin": `<ul><li>Possible reward for completing History NeoSchool Course.</li></ul>`},
  {"name": "Fire Faerie Token", "origin": `<ul><li>Possible reward when completing a Fire Faerie Quest.</li><li>Possible prize item from <a href='/games/html5/faeriecloudracers/'>Faerie Cloud Racers</a>.</li></ul>`},
  {"name": "Fire Stone Gem", "origin": `<ul><li>Possible prize item from <a href='/games/html5/sutekstomb/'>Sutek's Tomb</a>.</li></ul>`},
  {"name": "Frostbite Dart", "origin": `<ul><li>Sold for 3,000 points in the 2023 Snowball Fight Prize Shop.</li></ul>`},
  {"name": "Fumpu Leaf Medallion", "origin": `<ul><li>Possible reward when playing <a href='/island/tombola/'>Tombola</a>.</li></ul>`},
  {"name": "Genie Orb",  "origin": `<ul><li>Possible prize from scratching <a href='search/items/?item_name=Faeries%20Fortune%20Scratchcard'>Faeries Fortune Scratchcard</a>, <a href='/search/items/?item_name=Peak%20O%20Plenty%20Scratchcard'>Peak O Plenty Scratchcard</a>, or <a href='/search/items/?item_name=Icetravaganza%20Scratchcard'>Icetravaganza Scratchcard</a>.</li></ul>`},
  {"name": "Ghost Lupe Sword", "origin": `<ul><li>Possible reward for defeating an <a href='/dome/1p/select/?arena=4'>Island Arena</a> challenger.</li></ul>`},
  {"name": "Garin's Sword", "origin": `<ul><li>Possible prize item from <a href='/games/html5/attackoftherevenge/'>Attack of the Revenge</a>.</li></ul>`},
  {"name": "Golden Aisha Wand", "origin": `<ul><li>Possible prize when you wish for the word 'relic' at the <a href='/wishing/'>Wishing Well</a> and have your wish granted.</li></ul>`},
  {"name": "Golden Meepit Statue", "origin": `<ul><li>Possible prize item from <a href='/games/html5/meepitjuicebreak/'>Meepit Juice Break</a>.</li><li>Possible reward from <a href='/water/fishing/'>Underwater Fishing</a>.</li></ul>`},
  {"name": "Golden Pirate Amulet", "origin": `<ul><li>Possible reward when looking for <a href='/pirates/buriedtreasure/'>Buried Treasure</a>.</li></ul>`},
  {"name": "Good Snowball", "origin": `<ul><li>Possible reward when visiting <a href='/island/mystichut/'>Island Music</a>.</li><li>Possible reward when stealing from the <a href='/winter/snowager/'>Snowager</a>.</li></ul>`},
  {"name": "Grarrg Tooth", "origin": `<ul><li>Possible prize for landing on the Grarrl space at the <a href='/prehistoric/wheel'>Wheel of Monotony</a>.</li></ul>`},
  {"name": "Great Snowball", "origin": `<ul><li>Sold for 3,000 points in the 2023 Snowball Fight Prize Shop.</li></ul>`},
  {"name": "Halloween Aisha Bucket", "origin": `<ul><li>Possible reward for completing History NeoSchool Course.</li></ul>`},
  {"name": "Happy Anniversary Negg", "origin": `<ul><li>Possible reward when feeding a <strong>Very Sad</strong> kad at the <a href='/games/kadoatery/'>Kadoatery</a>.</li></ul>`},
  {"name": "Happy Negg Eraser", "origin": `<ul><li>Guaranteed reward for receiving an A or higher in Basic Mathematics or Fishing NeoSchool Course.</li></ul>`},
  {"name": "Hawk Bracelet",  "origin": `<ul><li>Possible prize from scratching <a href='search/items/?item_name=Faeries%20Fortune%20Scratchcard'>Faeries Fortune Scratchcard</a>, <a href='/search/items/?item_name=Peak%20O%20Plenty%20Scratchcard'>Peak O Plenty Scratchcard</a>, or <a href='/search/items/?item_name=Icetravaganza%20Scratchcard'>Icetravaganza Scratchcard</a>.</li></ul>`},
  {"name": "Hawk Wand",  "origin": `<ul><li>Possible prize from scratching <a href='search/items/?item_name=Faeries%20Fortune%20Scratchcard'>Faeries Fortune Scratchcard</a>, <a href='/search/items/?item_name=Peak%20O%20Plenty%20Scratchcard'>Peak O Plenty Scratchcard</a>, or <a href='/search/items/?item_name=Icetravaganza%20Scratchcard'>Icetravaganza Scratchcard</a>.</li></ul>`},
  {"name": "Iced Wand",  "origin": `<ul><li>Possible prize from scratching <a href='search/items/?item_name=Faeries%20Fortune%20Scratchcard'>Faeries Fortune Scratchcard</a>, <a href='/search/items/?item_name=Peak%20O%20Plenty%20Scratchcard'>Peak O Plenty Scratchcard</a>, or <a href='/search/items/?item_name=Icetravaganza%20Scratchcard'>Icetravaganza Scratchcard</a>.</li></ul>`},
  {"name": "Iceray Bracelet",  "origin": `<ul><li>Possible prize from scratching <a href='search/items/?item_name=Faeries%20Fortune%20Scratchcard'>Faeries Fortune Scratchcard</a>, <a href='/search/items/?item_name=Peak%20O%20Plenty%20Scratchcard'>Peak O Plenty Scratchcard</a>, or <a href='/search/items/?item_name=Icetravaganza%20Scratchcard'>Icetravaganza Scratchcard</a>.</li></ul>`},
  {"name": "Irregulation Chainmail", "origin": `<ul><li>Possible prize item from <a href='/games/html5/castleescape'>Escape from Meridell Castle</a>.</li></ul>`},
  {"name": "Jar of Spiders", "origin": `<ul><li>Possible prize item from <a href='/games/html5/webofvernax'>Web of Vernax</a>.</li></ul>`},
  {"name": "King Kelpbeards Blessing", "origin": `<ul><li>Possible reward when turning in a <a href='/games/treasurehunt/?type=underwater'>Underwater Treasure Map</a>.</li><li>Possible reward from <a href='/water/fishing/'>Underwater Fishing</a>.</li></ul>`},
  {"name": "Lava Rock", "origin": `<ul><li>Possible prize item from <a href='/games/html5/destructomatch'>Destruct-O-Match</a>.</li></ul>`},
  {"name": "Legendary von Roo Ring", "origin": `<ul><li>Possible prize for landing on the Gift space at the <a href='/halloween/wheel'>Wheel of Misfortune</a>.</li></ul>`},
  {"name": "Light Faerie Dagger", "origin": `<ul><li>Possible prize item from <a href='/games/html5/faeriebubbles'>Faerie Bubbles</a>.</li></ul>`},
  {"name": "Light Faerie Token", "origin": `<ul><li>Possible reward when completing an Light Faerie Quest.</li><li>Possible prize item from <a href='/games/html5/faeriecloudracers/'>Faerie Cloud Racers</a>.</li></ul>`},
  {"name": "Magic Branch", "origin": `<ul><li>Possible reward when completing a <a href='/halloween/braintree/'>Brain Tree Quest</a>.</li></ul>`},
  {"name": "Magnus Club", "origin": `<ul><li>Possible reward for defeating an <a href='/dome/1p/select/?arena=7'>Tyrannian Arena</a> challenger.</li></ul>`},
  {"name": "Malice Potion", "origin": `<ul><li>Guaranteed reward when completing level 20 <a href='/faerieland/darkfaerie/'>Jhudora's Quest</a>.</li></ul>`},
  {"name": "Melting Mirror", "origin": `<ul><li>Possible prize from scratching a <a href='search/items/?item_name=Pustravaganza%20Scratchcard'>Pustravaganza Scratchcard</a> or <a href='/search/items/?item_name=Rotting%20Riches%20Scratchcard'>Rotting Riches Scratchcard</a>.</li></ul>`},
  {"name": "Mystic Guitar", "origin": `<ul><li>Possible reward when visiting <a href='/island/mystichut/'>Island Music</a>.</li></ul>`},
  {"name": "Mystic Jelly Bean Necklace", "origin": `<ul><li>Possible prize item from <a href='/games/html5/jellyblobs'>Jelly Blobs of Doom</a>.</li></ul>`},
  {"name": "Mystical Fish Lobber", "origin": `<ul><li>Possible reward from <a href='/water/fishing/'>Underwater Fishing</a>.</li></ul>`},
  {"name": "Nimmo Finger", "origin": `<ul><li>Possible prize from scratching a <a href='search/items/?item_name=Pustravaganza%20Scratchcard'>Pustravaganza Scratchcard</a> or <a href='/search/items/?item_name=Rotting%20Riches%20Scratchcard'>Rotting Riches Scratchcard</a>.</li></ul>`},
  {"name": "Neutron Wand", "origin": `<ul><li>Possible reward when turning in a <a href='/games/treasurehunt/?type=space'>Space Map</a>.</li></ul>`},
  {"name": "Patched Magic Hat", "origin": `<ul><li>Possible reward when completing an <a href='/halloween/witchtower/'>Edna's Quest</a>.</li><li>Possible reward when turning in a <a href='/games/treasurehunt/?type=spooky'>Spooky Treasure Map</a>.</li></ul>`},
  {"name": "Pear of Disintegration", "origin": `<ul><li>Possible reward from <a href='/gulids/'>Guild Gardens</a> with an inventory above 1,000.</li></ul>`},
  {"name": "Petpet Bone", "origin": `<ul><li>Possible reward when waking <a href='/medieval/turmaculus/'>Turmaculus</a>.</li></ul>`},
  {"name": "Platinum Dubloon", "origin": `<ul><li>Possible prize item from <a href='/games/html5/dubloondisaster'>Dubloon Disaster</a>.</li></ul>`},
  {"name": "Poké Ball", "origin": `<ul><li>Randomly awarded through an extremely rare site-wide random event.</li></ul>`},
  {"name": "Power Negg Eraser", "origin": `<ul><li>Guaranteed reward for receiving an A or higher in Neopian Driver's Ed or Physical Education NeoSchool Course.</li></ul>`},
  {"name": "Pumpkin Stick", "origin": `<ul><li>Possible prize from scratching a <a href='search/items/?item_name=Pustravaganza%20Scratchcard'>Pustravaganza Scratchcard</a> or <a href='/search/items/?item_name=Rotting%20Riches%20Scratchcard'>Rotting Riches Scratchcard</a>.<li>Possible prize item from <a href='/games/html5/carnivakofterror'>Carnival of Terror</a>.</li></ul>`},
  {"name": "Radish Bow", "origin": `<ul><li>Possible prize item from <a href='/games/html5/bullseye'>Ultimate Bullseye</a>.</li></ul>`},
  {"name": "Rainbow Cybunny Wand", "origin": `<ul><li>Possible prize when you wish for the word 'relic' at the <a href='/wishing/'>Wishing Well</a> and have your wish granted.</li></ul>`},
  {"name": "Rainbow Kacheek Pendant", "origin": `<ul><li>Possible reward for completing History NeoSchool Course.</li></ul>`},
  {"name": "Rainbow Negg Eraser", "origin": `<ul><li>Guaranteed reward for receiving an A or higher in Science or Computer Science NeoSchool Course.</li></ul>`},
  {"name": "Rainbow Pteri Feather", "origin": `<ul><li>Possible reward when playing <a href='/island/tombola/'>Tombola</a>.</li><li>Randomly dropped when receiving the 'golden pteri' site-wide random event.</li></ul>`},
  {"name": "Reinvented Wheel", "origin": `<ul><li>Randomly available to purchase for 14 credits from the <a href='/games/emporium/'>Puzzle Emporium</a>.</li></ul>`},
  {"name": "Ring of the Lost", "origin": `<ul><li>Possible prize from scratching <a href='/search/items/?item_name=Bagguss%20Bonanza%20Scratchcard'>Bagguss Bonanza Scratchcard</a> or <a href='/search/items/?item_name=Sandtravaganza%20Scratchcard'>Sandtravaganza Scratchcard</a>.</li></ul>`},
  {"name": "Robo Sloth Fist of Power", "origin": `<ul><li>Guaranteed reward for receiving an A or higher in Back to Business NeoSchool Course.</li></ul>`},
  {"name": "Royal Wedding Ring", "origin": `<ul><li>Possible prize from scratching <a href='/search/items/?item_name=Bagguss%20Bonanza%20Scratchcard'>Bagguss Bonanza Scratchcard</a> or <a href='/search/items/?item_name=Sandtravaganza%20Scratchcard'>Sandtravaganza Scratchcard</a>.</li></ul>`},
  {"name": "Rusty Garden Pitchfork", "origin": `<ul><li>Possible item you can find during <a href='/medieval/pickyourown/index/'>Pick Your Own</a>.</li></ul>`},
  {"name": "Rutabaga Lance", "origin": `<ul><li>Possible reward when guessing correctly at <a href='/medieval/potatocounter/'>Potato Counter</a>.</li></ul>`},
  {"name": "Scarab Amulet", "origin": `<ul><li>Possible reward when winning a round of <a href='/games/sakhmet_solitaire/'>Sakhmet Solitaire</a>.</li></ul>`},
  {"name": "Scroll of Ultimate Knowledge", "origin": `<ul><li>Possible reward for completing History NeoSchool Course.</li></ul>`},
  {"name": "Snow Beast Horn", "origin": `<ul><li>Possible reward for defeating an <a href='/dome/1p/select/?arena=3'>Ice Arena</a> challenger.</li></ul>`},
  {"name": "Snowflake Pendant", "origin": `<ul><li>Possible prize item from <a href='/games/html5/icecreammachine'>Ice Cream Machine</a>.</li></ul>`},
  {"name": "Snowager Pendant", "origin": `<ul><li>Possible reward when stealing from the <a href='/winter/snowager/'>Snowager</a>.</li></ul>`},
  {"name": "Snowglobe Staff",  "origin": `<ul><li>Possible prize from scratching <a href='search/items/?item_name=Faeries%20Fortune%20Scratchcard'>Faeries Fortune Scratchcard</a>, <a href='/search/items/?item_name=Peak%20O%20Plenty%20Scratchcard'>Peak O Plenty Scratchcard</a>, or <a href='/search/items/?item_name=Icetravaganza%20Scratchcard'>Icetravaganza Scratchcard</a>.</li></ul>`},
  {"name": "Snowager Sleep Ray", "origin": `<ul><li>Sold for 3,000 points in the 2023 Snowball Fight Prize Shop.</li></ul>`},
  {"name": "Soul Stone", "origin": `<ul><li>Possible reward for completing a <a href='/island/kitchen/'>Kitchen Quest</a>.</li></ul>`},
  {"name": "Space Amulet", "origin": `<ul><li>Possible reward when turning in a <a href='/games/treasurehunt/?type=space'>Space Map</a>.</li></ul>`},
  {"name": "Space Faeries Shield", "origin": `<ul><li>Possible reward when turning in a <a href='/games/treasurehunt/?type=space'>Space Map</a>.</li></ul>`},
  {"name": "Space Faerie Token", "origin": `<ul><li>Possible reward when completing a Space Faerie Quest.</li><li>Possible prize item from <a href='/games/html5/faeriecloudracers/'>Faerie Cloud Racers</a>.</li></ul>`},
  {"name": "Spider Grundo Sword", "origin": `<ul><li>Possible reward for defeating a <a href='/dome/1p/select/?arena=2'>Stone Dome</a> challenger.</li></ul>`},
  {"name": "Spirited Fiddle", "origin": `<ul><li>Possible reward when turning in a <a href='/games/treasurehunt/?type=spooky'>Spooky Treasure Map</a>.<li>Possible prize item from <a href='/games/html5/korbatslab'>Korbat's Lab</a>.</li></ul>`},
  {"name": "Spooky Slime", "origin": `<ul><li>Possible reward for completing an <a href='/halloween/esophagor/'>Esophagor Quest</a>.</li><li>Randomly dropped when a slorg is thrown at you.</li></ul>`},
  {"name": "Staff of Brain", "origin": `<ul><li>Possible reward when completing a <a href='/halloween/braintree/'>Brain Tree Quest</a>.</li></ul>`},
  {"name": "Squash Club", "origin": `<ul><li>Possible reward when guessing correctly at <a href='/medieval/potatocounter/'>Potato Counter</a>.</li></ul>`},
  {"name": "Starry Scorchio Wand", "origin": `<ul><li>Possible prize when you wish for the word 'relic' at the <a href='/wishing/'>Wishing Well</a> and have your wish granted.</li></ul>`},
  {"name": "Superior Battle Plunger", "origin": `<ul><li>Possible item you can find when jumping into the <a href='/halloween/toilet/'>Spooky Toilet</a>.</li></ul>`},
  {"name": "Trident of Chiazilla", "origin": `<ul><li>Possible reward for defeating a <a href='/dome/1p/select/?arena=6'>Water Arena</a> challenger.</li></ul>`},
  {"name": "Trusty Hand Cannon", "origin": `<ul><li>Possible prize item from <a href='/games/html5/attackoftherevenge'>Attack of the Revenge</a>.</li></ul>`},
  {"name": "Tyrannian Amulet", "origin": `<ul><li>Possible prize item from <a href='/games/html5/volcanorun'>Volcano Run</a>.</li></ul>`},
  {"name": "Ultra Fire Gem", "origin": `<ul><li>Possible prize item from <a href='/games/html5/sutekstomb/'>Sutek's Tomb</a>.</li></ul>`},
  {"name": "Wand of the Snow Faerie", "origin": `<ul><li>Possible reward for completing a <a href='/winter/snowfaerie/'>Snow Faerie Quest</a>.</li></ul>`},
  {"name": "Water Faerie Dagger", "origin": `<ul><li>Possible prize item from <a href='/games/html5/faeriebubbles'>Faerie Bubbles</a>.</li></ul>`},
  {"name": "Water Faerie Token", "origin": `<ul><li>Possible reward when completing a Water Faerie Quest.</li><li>Possible prize item from <a href='/games/html5/faeriecloudracers/'>Faerie Cloud Racers</a>.</li><li>Possible reward when turning in a <a href='/games/treasurehunt/?type=underwater'>Underwater Treasure Map</a>.</li></ul>`},
  {"name": "Wind Up Rat", "origin": `<ul><li>Guaranteed reward when completing level 32 <a href='/faerieland/darkfaerie/'>Jhudora's Quest</a>.</li></ul>`},
  {"name": "Witches Orb", "origin": `<ul><li>Possible reward when completing an <a href='/halloween/witchtower/'>Edna's Quest</a>.</li></ul>`},
  {"name": "Wooden Compass", "origin": `<ul><li>Guaranteed reward when turning in a <a href='/games/treasurehunt/?type=original'>Original Treasure Map</a>.</li></ul>`},
  {"name": "Zucchini Bat", "origin": `<ul><li>Possible reward when guessing correctly at <a href='/medieval/potatocounter/'>Potato Counter</a>.</li></ul>`},
    {"name": "Official Prissy Miss Hair Brush", "origin": `<ul><li>Possible prize item from <a href='/games/html5/usukifrenzy/'>Usuki Frenzy</a>.</li></ul>`},
  {"name": "Boom Sticks", "origin": `<ul><li>Possible prize item from <a href='/games/html5/tntstaffsmasher/'>TNT Staff Smasher</a>.</li></ul>`},
  {"name": "Grundo Gavel", "origin": `<ul><li>Possible prize item from <a href='/games/html5/staffsmasher/'>GC Staff Smasher</a>.</li></ul>`}
]

if (window.location.href.includes('/items/')) {


const itemCard = document.querySelector('.item-search-container');
const itemName = itemCard.querySelector('.nomargin').innerText.trim();
const relicOrigin = relicArray.find(item => item.name === itemName)?.origin || null;




if (relicOrigin !== null) {
 var originDetails = document.createElement('div');
 originDetails.style.backgroundColor = 'beige';
 originDetails.style.padding = '30px';
 originDetails.style.border = '3px solid purple';
 originDetails.innerHTML = `<span style="font-weight: bold; color: purple; font-size: 16px;">Where is this relic from?</span><span style="text-align:left;">${relicOrigin}</span>`;

 var parentElement = document.querySelector(".item-search-container");
 parentElement.insertAdjacentElement('afterend', originDetails);
}
}

if (window.location.href.includes('#details')) {
  console.log("test")


function createDivs() {
    const centerDiv = document.querySelector('#page_content');
    const container = document.createElement('div');
    container.style.display = 'flex';
    container.style.flexWrap = 'wrap';
    container.style.width = '595px';
    centerDiv.innerHTML = null;
    centerDiv.appendChild(container);

    relicArray.forEach(relic => {
        const div = document.createElement('div');
        div.style.width = '575px';
        div.style.margin = '5px';
        div.style.padding = '10px';
        div.style.border = '1px solid black'


        const header = document.createElement('h3');
        header.textContent = relic.name;
        const body = document.createElement('p');
        body.innerHTML = relic.origin;

        div.appendChild(header);
        div.appendChild(body);

        container.appendChild(div);
    });
}

createDivs();
}