(function (Scratch) { 'use strict'; // I LOVE MICE const mouseFacts = [ "Mice have a very high reproductive rate; a female mouse can give birth to up to 10 litters per year.", "Mice can squeeze through holes as small as a pencil eraser.", "Mice have excellent hearing and can detect ultrasonic sounds.", "Mice whiskers are highly sensitive and help them navigate in the dark.", "A mouse's teeth never stop growing, so they constantly gnaw to keep them short.", "Mice are nocturnal and do most of their foraging at night.", "Mice have a strong sense of smell which they use to find food and mates.", "A mouse can jump up to 18 inches high.", "Mice communicate using ultrasonic squeaks that humans cannot hear.", "Mice are very social animals and live in groups called colonies.", "Some species of mice are known to be able to swim.", "Mice can remember paths and mazes for long periods.", "A mouse’s heart beats extremely fast, up to 600 times per minute.", "Mice are prey animals and are very alert to sounds and movement.", "Laboratory mice have contributed enormously to scientific research.", "Mice have a short lifespan, typically 1–3 years in the wild.", "White mice are often used in experiments, but wild mice are usually brown or grey.", "Mice are capable of grooming themselves meticulously to stay clean.", "Mice can survive on very little water, getting most of it from food.", "Mice can recognize other mice by scent and vocalizations.", "A group of mice is called a mischief.", "Mice can climb, swim, and jump, making them very agile.", "Mice are omnivorous and will eat grains, fruits, seeds, and even insects.", "Mice can run at speeds of up to 8 miles per hour.", "Mice have very strong incisors relative to their size.", "Mice are often used in genetic studies because they share many genes with humans.", "Mice have keen spatial memory, helping them find food and avoid predators.", "Pet mice can become very tame and enjoy human interaction.", "Mice have been domesticated for centuries and appear in many cultures as pets or symbols.", "Mice have very sensitive paws which they use to detect textures and temperature.", "Mice use urine markings to communicate territory boundaries.", "Mice can survive falls from high places due to their light weight.", "Mice are prey for many animals, including cats, snakes, and birds of prey." ]; let mouseBreeds = [ 'House Mouse', 'Fancy Mouse', 'Deer Mouse', 'Field Mouse', 'White Lab Mouse', 'Black Lab Mouse', 'African Pygmy Mouse', 'Steppe Mouse', 'Harvest Mouse', 'Wood Mouse', 'Spiny Mouse', 'Long-tailed Mouse', 'Chinese Hamster Mouse', 'Golden Mouse', 'European Mouse' ]; class MOUSE { getInfo() { return { id: 'ginxilovemice', name: 'MICE', color1: '#A9A9A9', // Dark Gray color2: '#808080', // Gray color3: '#505050', blocks: [ { opcode: 'randommousefact', blockType: Scratch.BlockType.REPORTER, text: 'random mouse fact from [FORMAT]', disableMonitor: true, arguments: { FORMAT: { type: Scratch.ArgumentType.STRING, menu: 'FORMAT_MENU' } } }, { opcode: 'micescool', blockType: Scratch.BlockType.BOOLEAN, text: 'are mice cool?', disableMonitor: true, }, { opcode: 'mouseinfo', blockType: Scratch.BlockType.REPORTER, text: 'get info of breed [BREED]', disableMonitor: true, arguments: { BREED: { type: Scratch.ArgumentType.STRING, menu: 'BREED_MENU' } } } ], menus: { FORMAT_MENU: { acceptReporters: true, items: ['source 1 (mouseapi.fake)', 'source 2 (local. faster!)'] }, BREED_MENU: { acceptReporters: true, items: mouseBreeds } } }; } randommousefact(args) { // Placeholder: real APIs for mice facts are rare, using local facts for now return mouseFacts[Math.floor(Math.random() * mouseFacts.length)]; } micescool() { return true; } mouseinfo(args) { if (!mouseBreeds.includes(args.BREED)) { return "Breed not found in list."; } let breed = args.BREED; // Add "mouse" to search query for clarity on Wikipedia let searchQuery = breed + " mouse"; return fetch("https://en.wikipedia.org/w/api.php?action=query&prop=extracts&exlimit=1&titles=" + encodeURIComponent(searchQuery) + "&explaintext=1&exsectionformat=plain&format=json&origin=*") .then((response) => response.json()) .then((data) => { const pageId = Object.keys(data.query.pages)[0]; if (pageId === "-1") return "this is broken lmao."; let extract = data.query.pages[pageId].extract; extract = extract.replace(/\s{2,}/g, ' '); return extract.split('.').slice(0, 2).join('.') + '. (Source: Wikipedia)'; }) .catch(() => 'Something went wrong.'); } } Scratch.extensions.register(new MOUSE()); })(Scratch);