2Random Wordlist

Generates a random 2 word wordlist

目前為 2021-01-24 提交的版本,檢視 最新版本

// ==UserScript==
// @name         2Random Wordlist
// @namespace    https://gf.qytechs.cn/en/users/668074
// @version      2.0
// @description  Generates a random 2 word wordlist
// @author       Two, 𝔥𝔦𝔤𝔥
// @match        https://sketchful.io/
// @grant        none
// ==/UserScript==
/* global $ */

(function () {
      'use strict';
      var $ = window.$;//OR
      var newHTML = document.getElementById("gameSettings")
      //HTML by 𝔥𝔦𝔤𝔥 :)
      newHTML.insertAdjacentHTML("afterbegin", `<style>

	/* Google Font */
	@import url('https://fonts.googleapis.com/css2?family=Londrina+Shadow&display=swap');

	/* Custom Game Menu Container*/
	#gravatar {
		overflow: hidden;
	}

	/* Textarea */
	textarea {
		resize: none;
		height: 90px;
		background: #FFF;
		color: black;
		border: 3px solid #E1E1E1;
		margin-left: 5px;
		margin-right: 5px;
		border-radius: 5px;
		padding-left: 5px;
		line-height: 20px;
	}

	/* Input Fields */
	.lengtho,
	.nw {
		background: #FFF;
		color: black;
		border: 2px solid #E1E1E1;
		border-radius: 5px;
		padding-left: 5px;
	}

	#lengtho,
	#nw {
		padding-bottom: 10px;
	}

	/* Dashed Bottom Border*/
	.borderbottom {
		position: absolute;
		bottom: -2px;
		height: 2px;
		border-bottom: 2px dashed #E1E1E1;
		left: 0;
		width: calc(100% + 53px);
		transition: 0.2s;
	}

	/* Button Bar Container*/
	#copy {
		padding-bottom: 10px;
	}

	/* Arrow Button Container*/
	#circle {
		right: 27px;
		filter: brightness(150%) grayscale(0%);
		transition: 0.8s;
		position: absolute;
		height: 39px;
		width: 55px;
		border-radius: 20px;
		right: 10px;
		z-index: 10;
		transform: rotate(0deg);
	}

	/* Word Combiner Container*/
	#square {
		float: left;
		display: none;
		height: 0;
		width: 0;
		opacity: 0;
		display: block;
		height: auto;
		width: 100%;
		margin-top: -300px;
		text-align: center;
		transition: 0.8s;
	}

	/* Playerlist */
	#gameSettings {
		position: relative;
	}

	/* Text Placement In Textarea Boxes*/
	.rList,
	.result {
		padding-top: 3px;
	}

	/* Title Text */
	.text-styling {
		font-size: 46px;
		color: #B1B1B1;
		font-family: 'Londrina Shadow', cursive;
		width: 260px;
		margin: 0;
		padding: 0;
		margin-left: calc(50% - 130px);
		margin-bottom: 10px;
		transition: 0.2s;
		height: 60px;
	}

	/* Hover, Focus & Active Effects */
	/*Input & Textarea*/
	input.lengtho, input.nw {
		transition: 0.2s;
	}

	input.lengtho:hover, input.nw:hover {
		border: 2px solid #EFEFEF;
	}

	input.lengtho:focus, input.nw:focus {
		border: 2px solid #BFDEFF;
	}

	textarea.rList, textarea.result {
		transition: 0.2s;
	}

	textarea.rList:hover, textarea.result:hover {
		border: 3px solid #EFEFEF;
	}

	textarea.rList:focus, textarea.result:focus {
		border: 3px solid #BFDEFF;
	}

	/* Title */
	.text-styling:hover {
		color: #BFDEFF;
	}

	.text-styling:active {
		color: #B1B1B1;
	}

	/* Word Combiner Container*/
	#square:hover {
		margin-top: 0px;
	}

	#square:hover, #circle:hover + #square {
		display: initial;
		position: relative;
		filter: invert(0%) !important;
		opacity: 1;
		width: 100%;
		height: auto;
		text-align: center;
		padding-bottom: 20px;
		margin-bottom: 20px;
		margin-top: 0px;
	}

	/* Arrow Button */
	#circle:hover {
		filter: invert(70%);
		transform: rotate(90deg);
	}

	/* Bottom Dashed Border */
	.borderbottom:hover {
		border-bottom: 2px dashed #BFDEFF;
	}

</style>

	<div id="gravatar">
		<img src="https://www.pinclipart.com/picdir/big/78-787768_right-double-arrow-icon-clipart.png"
			id="circle">
		<div id="square">
			<div id="title"><div class='text-styling'>Word Combiner</div></div>
			<div id="lengtho">
				<a>Length of list</a>
			</div>
			<div id="nw">
				<a>No. of words</a>
			</div>
			<div id="copy">
			</div>
			<div class="borderbottom"> </div>
		</div>
	</div>` )


      $("#square,#circle").hover(
            function () {
                  this.parentElement.firstElementChild.style.filter = 'brightness(200%) grayscale(100%)';
                  this.parentElement.firstElementChild.style.transform = "rotate(90deg)"
            }, function () {
                  this.parentElement.firstElementChild.style.filter = 'brightness(150%) grayscale(0%)';
                  this.parentElement.firstElementChild.style.transform = "rotate(0deg)"
            }
      );



      const playersList = document.querySelector('#gamePlayersList');
      const gameSettings = document.querySelector(".columnRight");
      const canvas = document.querySelector("#canvas");
      const gameParent = document.querySelector(".gameParent");
      var canvasHeight;
      //thanks Bell
      new ResizeObserver(() => {
            if (!canvas.getBoundingClientRect().height) {
                  canvasHeight = gameSettings.getBoundingClientRect().height;
            } else {
                  canvasHeight = canvas.getBoundingClientRect().height;
            }
            playersList.style.maxHeight = `${canvasHeight}px`;
      }).observe(gameParent);
      function playerList() {
            document.getElementById("gamePlayersList").style.maxHeight = "100%"
      }
      document.getElementById("gamePlayersList").style.maxHeight = "100%"
      /*     let divG = document.createElement('div');
           divG.setAttribute("style", "background-color:rgba(0,0,0,.1); max-height: inherit;")
           document.getElementsByClassName("gameContainer")[0].appendChild(divG)
           divG.appendChild(document.getElementById("gamePlayersList"))*/
      let space = document.createElement('span')
      space.innerHTML = `&nbsp;&nbsp;&nbsp;`
      let def = document.createElement('button');
      def.innerHTML = "Default Wordlist"
      def.setAttribute("class", "btn btn-sm btn-secondary")
      def.onclick = function () {
            document.getElementsByClassName("rList")[0].value = `alligator, alpaca, angler fish, ant, anteater, antelope, armadillo, eagle, owl, bat, dragon, beaver, bee, beetle, Bigfoot, bird, bison, boar, bull, bulldog, butterfly, camel, cat, caterpillar, catfish, centipede, chameleon, cheetah, chicken, chihuahua, clown fish, cockroach, cow, crab, crocodile, crow, deer, dinosaur, dog, dolphin, donkey, dragonfly, duck, eagle, eel, elephant, firefly, flamingo, fly, fox, frog, gazelle, gecko, anteater, tortoise, giraffe, goat, hamster, goldfish, goose, grasshopper, shark, hamster, hedgehog, hippo, horse, hummingbird, hyena, jaguar, jellyfish, kangaroo, whale, crab, King Kong, penguin, vulture, kitten, koala, Kraken, lamb, leopard, lion, lizard, llama, lynx, meerkat, mole, monkey, moose, mosquito, moth, chicken, zebra, mouse, narwhal, octopus, orca, ostrich, otter, owl, panda, panther, parrot, peacock, pelican, penguin, pig, pigeon, piranha, platypus, polar bear, pony, poodle, porcupine, fish, puma, puppy, rabbit, raccoon, ram, rat, rattlesnake, panda, reindeer, rhinoceros, rooster, scorpion, sea lion, seagull, seal, shark, sheep, shiba, skunk, sloth, snail, snake, turtle, spider, monkey, spinosaurus, squid, squirrel, stingray, stork, sun, swan, swordfish, tadpole, tiger, beetle, fish, tortoise, toucan, triceratops, turkey, turtle, t-rex, unicorn, vulture, walrus, warthog, wasp, scorpion, snake, whale, shark, wolf, woodpecker, worm, yeti, zebra, apple, avocado, bacon, bagel, baguette, beans, potato, banana, sauce, beer, beet, bell pepper, biscuit, blackberry, blueberry, bread, broccoli, brownie, bubblegum, burrito, butter, cabbage, cake, necklace, carrot, cauliflower, celery, cereal, cheese, cheeseburger, cheesecake, cherry, burger, chicken nugget, chili, chocolate, bunny, cake, egg, milk, coffee, cookie, corn, dog, cat, cotton candy, stick, cranberry, croissant, cucumber, cupcake, curry, donut, egg, drink, burger, french fries, toast, frog, garlic, grape, grapefruit, gravy, grilled cheese, chicken, guacamole, gummy bear, gummy, ham, hamburger, brown, honey, hot chocolate, hot dog, hot sauce, ice cream, ice cube, tea, jalapeno, jam, jawbreaker, jelly, kebab, ketchup, kiwi, lasagna, lemon, lemonade, lettuce, lime, licorice, lollipop, cheese, macaroni, maple syrup, margarine, martini, mashed potatoes, mayonnaise, meatball, meatloaf, melon, milk, milkshake, brain, mushroom, mustard, nacho, noodle, olive, omelet, onion, ring, orange juice, oyster, pancake, papaya, peach, pear, peas, pepper, pepperoni, pickle, pie, pineapple, pizza, plum, pomegranate, popcorn, potato, chips, cracker, pretzel, prune, pudding, pumpkin, radish, raisin, sauce, raspberry, ravioli, relish, rice, salsa, salt, sandwich, sausage, shrimp, smoothie, soda, soup, spaghetti, sprout, steak, strawberry, waffle, sugar, sushi, taco, tea, toast, tomato, turnip, watermelon, whipped cream, whiskey, wine, yogurt, angry, barn, blood, blush, boxing glove, brick, bruise, bullseye, butcher, candy cane, lantern, China, clown, seaweed, snake, crowbar, devil, bus, fruit, dynamite, error, explosion, fire, fire alarm, fire extinguisher, fire hydrant, fire truck, flare, flare gun, finger, can, heart, hell, stamp, jello, ladybug, laser, lava, lava lamp, lighthouse, lips, lipstick, lobster, battery, leaf, mars, meat, nosebleed, picnic blanket, pimple, pokeball, poppy, button, red, sea, ribbon, roadblock, rose, ruby, santa, scar, shotgun, starfish, stoned, stop sign, sunburn, Superman, target, tongue, traffic cone, vein, light, sign, wax, Angry Birds, Cola, Deadpool, Elmo, Flash, Iron Man, KFC, Knuckles, Lightning Mcqueen, Mario, Mr Krabs, Red Riding Hood, Rudolf, Spiderman, Youtube, acorn, almond, bark, barrel, glove, basket, bear, belt, bench, bongo, bookshelf, boomerang, box, branch, bronze, broom, brown, brunette, cabin, canoe, caramel, cello, fountain, chocolate pudding, cinnamon, coconut, cola, cork, crust, dig, dirt, wood, drum, earthquake, fall, fence, flute, football, freckles, guitar, hay, hazelnut, hockey, cart, lasso, leather, log, wand, mine, mud, paper bag, peanut, peanut butter, pine cone, pirate, plank, poop, rope, seed, sewer, slug, soil, sombrero, soy sauce, ribs, stew, stool, table, tan, tea bag, teddy bear, tobacco, stump, trench, twig, ukulele, violin, volcano, Bigfoot, Chewbacca, Great Wall, Oreo, Shaggy, coyote, ballerina, ballet, belly, brain, bubble gum, cheek, cherry blossom, eggplant, elbow, eraser, eyelid, hand, lavender, perfume, piggy bank, pink, pinky, purple, heart, gold, salmon, skin, toe, tutu, Barney, bird, Cupid, Kirby, pony, Patrick, Peppa Pig, Piglet, Pink Panther, Porky Pig, Princess Bubblegum, Spyro, Toadette, Waluigi, Mario, Wario, aquarium, birdbath, blizzard, blowhole, blue, whale, blueberry, bluetooth, dam, jacket, diamond, diver, drool, fisherman, net, flood, frozen, genie, geyser, glacier, glass, ice, ice age, fishing, sculpture, icicle, igloo, ink, jeans, jet ski, surfer, lake, lightning, ocean, dart, policeman, pond, puddle, raindrop, river, saliva, sapphire, stone, sky, snorkel, spit, submarine, sweat, swimming pool, taser, tear, toothpaste, tsunami, water, balloon, bottle, cannon, gun, jet pack, park, show, slide, volleyball, waterfall, wave, whirlpool, Avatar, BMW, Blastoise, Cinderella, Cookie Monster, Discord, Donald Duck, Dory, Dropbox, Earth, Elsa, Facebook, Greece, Gumball, Herobrine, king, Stitch, Meeseeks, Sonic, Microsoft, Neptune, platypus, Playstation, Sans, Skype, Smurf, Sonic, Squidward, Twitter, Vault Boy, acid, algae, alien, backyard, bacteria, booger, bush, cactus, tree, clover, cocoon, soap, dollar, download, emerald, sign, flower, football, forest, battery, truck, garden, gnome, grass, green, green bean, green tea, greenhouse, grenade, health bar, insect, jungle, lawn, leaf, leprechaun, lily pad, mint, mold, moss, ninja turtle, nuclear waste, palm tree, park, pine tree, pistachio, plankton, plant, poison ivy, potion, radar, rainforest, rake, recycling, road, salad, seaweed, slime, soldier, spinach, spring, swamp, tank, tennis ball, tree, valley, vine, vomit, willow, bottle, x-ray, zombie, Android, Bulbasaur, Creeper, Frankenstein, Godzilla, Green Arrow, beret, card, Green Lantern, Grinch, Hulk, Joker, Kermit, Link, Loch Ness Monster, Luigi, Master Chief, Mike Wazowski, Pepe, Peter Pan, Pickle Rick, Shrek, Statue of Liberty, mask, Yoda, Yoshi, beach, bell, blonde, bulldozer, champagne, chick, coin, crane, crown, dandelion, desert, dune, earwax, emoji, eye, sand, fries, chain, egg, goose, halo, hard hat, highlighter, hive, honeycomb, hourglass, lightbulb, mango, medal, pasta, pencil, pollen, potato, pyramid, quicksand, boots, raincoat, duck, castle, sandbox, school bus, eggs, star, sponge, star, starfruit, sunflower, sunshine, tape measure, taxi, nail, treasure, trophy, tumbleweed, vanilla, ring, wheat, yellow, yolk, bee, Pikachu, Flappy Bird, Johnny Bravo, Lamborghini, Lego, Mcdonalds, Minion, Pac-Man, Spongebob, Simpson, Tweety, Wario, Winnie The Pooh, Wolverine, amber, apricot, baboon, tarantula, basketball, burger, campfire, corn, cheese, clownfish, copper, ember, flame, flamethrower, punch, life buoy, magma, cheese, prisoner, pie, wave, spider, squash, sun, sunrise, potato, syrup, torch, orange, Charizard, Charmander, Donald Trump, nachos, Garfield, Grand Canyon, pumpkin, Nemo, Puss in Boots, rock star, lion, Tails, big, small, happy, sad, cry, tear, cute, short, queen, prince, princess, king, Barack Obama, Daffy Duck, golden`
            doWork();
      }
      document.getElementById("copy").appendChild(space.cloneNode(true))
      document.getElementById("copy").appendChild(space.cloneNode(true))
      document.getElementById("copy").appendChild(space.cloneNode(true))
      document.getElementById("copy").appendChild(def)
      let copy1 = document.createElement('button');
      copy1.innerHTML = "Copy"
      copy1.id = "copybtn"
      copy1.setAttribute("class", "btn btn-sm btn-secondary")
      copy1.onclick = function () {
            copy();
      }
      let clr = document.createElement('button');
      clr.innerHTML = "Clear"
      clr.setAttribute("class", "btn btn-sm btn-secondary")
      clr.onclick = function () {
            document.getElementsByClassName("result")[0].value = ""
            document.getElementsByClassName("rList")[0].value = ""
            document.getElementById("copybtn").style.backgroundColor = ""
      }
      document.getElementById("copy").appendChild(space.cloneNode(true))
      document.getElementById("copy").appendChild(clr)
      document.getElementById("copy").appendChild(space.cloneNode(true))
      document.getElementById("copy").appendChild(copy1)
      let check1 = document.createElement('input');
      check1.setAttribute("class", "check")
      check1.setAttribute("type", "checkbox")
      check1.onchange = function () {

            doWork();
      }
      document.getElementById("copy").appendChild(space.cloneNode(true))
      document.getElementById("copy").appendChild(check1)
      document.getElementById("copy").append(" Remove Duplicates?")
      let nw1 = document.createElement("input")
      nw1.setAttribute("placeholder", "Default: 2")
      nw1.setAttribute("class", "nw")
      nw1.setAttribute("type", "number")
      nw1.onchange = function () {
            doWork()
      }
      document.getElementById("nw").appendChild(nw1)
      let lengtho1 = document.createElement("input")
      lengtho1.setAttribute("placeholder", "Default: 1000")
      lengtho1.setAttribute("class", "lengtho")
      lengtho1.setAttribute("type", "number")

      lengtho1.onchange = function () {
            doWork()
      }
      document.getElementById("lengtho").appendChild(lengtho1)




      let result1 = document.createElement("textarea")
      result1.setAttribute("placeholder", "Result will show up here")
      result1.setAttribute("class", "result")
      result1.setAttribute("readonly", "")
      result1.setAttribute("rows", "2")

      let rlist1 = document.createElement("textarea")
      rlist1.setAttribute("placeholder", "List of words to be randomized.")
      rlist1.setAttribute("class", "rList")
      rlist1.setAttribute("rows", "2")
      rlist1.onchange = function () {
            doWork()
      }
      document.getElementById("square").appendChild(rlist1)
      document.getElementById("square").appendChild(result1)





      function doWork() {
            var tries = 0
            var lengtho = document.getElementsByClassName("lengtho")[0].value || 1000
            var l = document.getElementsByClassName("rList")[0].value
            if (!l) return;

            document.getElementsByClassName("result")[0].value = "Loading..."
            l = shorten(l, 20000)
            l = l.split(",")
            l = l.map(f => f.replace(" ", ""))
            if (l.length == 1) {
                  document.getElementsByClassName("result")[0].value = l[0] + " " + l[0]
                  if (document.getElementsByClassName("result")[0].value.trim()) {
                        document.getElementById("copybtn").style.backgroundColor = "green"
                  } else {
                        document.getElementById("copybtn").style.backgroundColor = ""
                  }
                  return;
            }
            function getRandomWords(no_words) {
                  var now = document.getElementsByClassName("nw")[0].value || 2
                  var temparr = []
                  for (var e = 0; e < now; e++) {
                        temparr.push(no_words[Math.floor(Math.random() * no_words.length)])
                  }
                  return temparr.join(" ")
            }

            function shorten(str, maxLen, separator = ', ') {
                  if (str.length <= maxLen) return str;
                  return str.substr(0, str.lastIndexOf(separator, maxLen));
            }
            getWord()
            var wordarr = []
            function arraysEqual(_arr1, _arr2) {

                  if (!Array.isArray(_arr1) || !Array.isArray(_arr2) || _arr1.length !== _arr2.length)
                        return false;

                  var arr1 = _arr1.concat().sort();
                  var arr2 = _arr2.concat().sort();

                  for (var i = 0; i < arr1.length; i++) {

                        if (arr1[i] !== arr2[i])
                              return false;

                  }

                  return true;

            }
            function onlyUnique(value, index, self) {
                  return self.indexOf(value) === index;
            }
            function getWord() {
                  var wordd = getRandomWords(l)
                  if (!wordarr) wordarr = []
                  if (document.getElementsByClassName("check")[0].checked) {

                        wordarr.push(wordd)

                  } else {
                        wordarr.push(wordd)
                  }
            }

            for (var i = 0; i < lengtho; i++) {
                  getWord()
            }
            if (document.getElementsByClassName("check")[0].checked) {

                  wordarr = wordarr.filter(onlyUnique)
            }
            var res = document.getElementsByClassName("result")[0]
            res.value = wordarr.toString()
            if (res.value.trim()) {
                  document.getElementById("copybtn").style.backgroundColor = "green"
            } else {
                  document.getElementById("copybtn").style.backgroundColor = ""
            }
      }
      function copy() {
            var result = document.getElementsByClassName('result')[0]
            result.select();
            document.execCommand('copy');

      }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址