diff --git a/css/main.css b/css/main.css index a9e558f..26c657a 100644 --- a/css/main.css +++ b/css/main.css @@ -14,13 +14,66 @@ body { } #name { - font-size: 16pt; + font-size: 18pt; +} + +#type { + font-size: 14pt; } #flavortext { font-size: 12pt; } +.type-filter { + position: relative; + float: left; + overflow: hidden; + width: auto; + padding: 0 10px 0 0; + margin-right: 9px; + background: rgba(245, 245, 245, 1); + border: 1px solid rgba(30,36,43,0.1); + border-radius: .278rem; + font-size: 11px; +} + +select { + width: 130%; + height: 130%; + padding: .8em 1em;; + color: rgba(30,36,43, 1); + border: 0; + border-radius: .278rem; + box-shadow: none; + background: rgba(245, 245, 245, 1); + background-image: none; + font-size: 15px; + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; +} + +select:focus { + outline: none; +} + +select:hover +{ + background: rgba(250, 250, 250, 1); +} + +.type-filter:after +{ + content: "\f0d7"; + font-family: FontAwesome; + font-size: 15px; + position: absolute; + top: 14px; + right: 16px; + color: rgba(30,36,43, 1); +} + .button { vertical-align: middle; cursor: pointer; @@ -40,6 +93,10 @@ body { background-color: #ffce1f; } +.button:focus { + outline: none; +} + .footer { position: relative; width: 100%; diff --git a/index.html b/index.html index c1b0c14..d535fbc 100644 --- a/index.html +++ b/index.html @@ -8,7 +8,7 @@ - + - + +

+

- +     
- + \ No newline at end of file diff --git a/js/flavortext.js b/js/flavortext.js index d294879..a16902d 100644 --- a/js/flavortext.js +++ b/js/flavortext.js @@ -1,6 +1,4 @@ - grabFlavorText(); - - function grabFlavorText() { + function GrabRandomFlavorText() { // Get JSON file from server $.getJSON('https://destinyflavortext.net/data/flavortext.json', function(data) { // Grab random entry from list @@ -9,18 +7,790 @@ // Take the chosen entry and add it to the corresponding HTML elements. var myObj = entry; document.getElementById("name").innerHTML = myObj.name; + document.getElementById("type").innerHTML = myObj.type; document.getElementById("flavortext").innerHTML = myObj.flavor; }) } + // Loads a new random piece of flavor text. function Refresh() { - grabFlavorText(); + GrabRandomFlavorText(); } + // Variables with info on the website, used for @About function. var aboutTitle = "About DestinyFlavorText.net"; var aboutText = "Destiny Flavor Text, is a simple website that will give you a random piece of flavortext from Destiny on request. It is being developed by Hennamann from The Antioxidants If you would like to contribute to DestinyFlavorText.net's development, help contribute to the source code over on Github: https\://github.com/antioxidants/destinyflavortext."; + // Changes the flavor text, into a small description for the website. function About() { document.getElementById("name").innerHTML = aboutTitle; + document.getElementById("type").innerHTML = ""; document.getElementById("flavortext").innerHTML = aboutText; -}; \ No newline at end of file + } + + // Opens the list page + function goToLists() { + window.location = "https://destinflavortext.net/lists.html"; + } + + // Returns the user to the home page + function GoHome() { + window.location = "https://destinyflavortext.net" + } + + // Changes the list depending on the chosen filter. + function SubmitFilterChoice() { + document.getElementById("filter_type").value!="all"||(GrabFlavorText()) + document.getElementById("filter_type").value!="autos"||(GrabAutos()) + document.getElementById("filter_type").value!="fusions"||(GrabFusions()) + document.getElementById("filter_type").value!="hand_cannons"||(GrabHandCannons()) + document.getElementById("filter_type").value!="lmgs"||(GrabLmgs()) + document.getElementById("filter_type").value!="pulses"||(GrabPulses()) + document.getElementById("filter_type").value!="rockets"||(GrabRockets()) + document.getElementById("filter_type").value!="scouts"||(GrabScouts()) + document.getElementById("filter_type").value!="shotguns"||(GrabShotguns()) + document.getElementById("filter_type").value!="sidearms"||(GrabSidearms()) + document.getElementById("filter_type").value!="snipers"||(GrabSnipers()) + document.getElementById("filter_type").value!="swords"||(GrabSwords()) + document.getElementById("filter_type").value!="artifacts"||(GrabArtifacts()) + document.getElementById("filter_type").value!="hunter_artifacts"||(GrabHunterArtifacts()) + document.getElementById("filter_type").value!="hunter_helmets"||(GrabHunterHelmets()) + document.getElementById("filter_type").value!="hunter_chest_armor"||(GrabHunterChestArmor()) + document.getElementById("filter_type").value!="hunter_cloaks"||(GrabCloaks()) + document.getElementById("filter_type").value!="hunter_gauntlets"||(GrabHunterGauntlets()) + document.getElementById("filter_type").value!="hunter_helmets"||(GrabHunterHelmets()) + document.getElementById("filter_type").value!="hunter_leg_armor"||(GrabHunterLegArmor()) + document.getElementById("filter_type").value!="titan_artifacts"||(GrabHunterArtifacts()) + document.getElementById("filter_type").value!="titan_helmets"||(GrabTitanHelmets()) + document.getElementById("filter_type").value!="titan_chest_armor"||(GrabTitanChestArmor()) + document.getElementById("filter_type").value!="titan_marks"||(GrabMarks()) + document.getElementById("filter_type").value!="titan_gauntlets"||(GrabTitanGauntlets()) + document.getElementById("filter_type").value!="titan_helmets"||(GrabTitanHelmets()) + document.getElementById("filter_type").value!="titan_leg_armor"||(GrabTitanLegArmor()) + document.getElementById("filter_type").value!="warlock_artifacts"||(GrabWarlockArtifacts()) + document.getElementById("filter_type").value!="warlock_helmets"||(GrabWarlockHelmets()) + document.getElementById("filter_type").value!="warlock_chest_armor"||(GrabWarlockChestArmor()) + document.getElementById("filter_type").value!="warlock_bonds"||(GrabBonds()) + document.getElementById("filter_type").value!="warlock_gauntlets"||(GrabWarlockGauntlets()) + document.getElementById("filter_type").value!="warlock_helmets"||(GrabWarlockHelmets()) + document.getElementById("filter_type").value!="warlock_leg_armor"||(GrabWarlockLegArmor()) + document.getElementById("filter_type").value!="ghosts"||(GrabGhosts()) + document.getElementById("filter_type").value!="ships"||(GrabShips()) + document.getElementById("filter_type").value!="sparrows"||(GrabSparrows()) + } + + // Grabs all the flavortext and displays it as a list. + function GrabFlavorText() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/flavortext.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + type = $(document.createElement('p')), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'type'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + type.text(data[i].type); + flavor.text(data[i].flavor); + + container.append(name, type, flavor); + } + }) + }; + + // Grabs all flavor text from auto rifles and displays it as a list. + function GrabAutos() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/weapons/autos.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from fusion rifles and displays it as a list. + function GrabFusions() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/weapons/fusions.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from hand cannons and displays it as a list. + function GrabHandCannons() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/weapons/hand%20cannons.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from machine guns and displays it as a list. + function GrabLmgs() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/weapons/lmgs.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from pulse rifles and displays it as a list. + function GrabPulses() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/weapons/pulses.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from rocket launchers and displays it as a list. + function GrabRockets() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/weapons/rockets.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from scout rifles and displays it as a list. + function GrabScouts() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/weapons/scouts.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from shotguns and displays it as a list. + function GrabShotguns() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/weapons/shotguns.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from sidearms and displays it as a list. + function GrabSidearms() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/weapons/sidearms.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from sniper rifles and displays it as a list. + function GrabSnipers() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/weapons/snipers.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + // Grabs all flavor text from swords and displays it as a list. + function GrabSwords() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/weapons/swords.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from artifacts and displays it as a list. + function GrabArtifacts() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/artifacts.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from hunter artifacts and displays it as a list. + function GrabHunterArtifacts() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/hunter_artifact.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from hunter chest armor and displays it as a list. + function GrabHunterChestArmor() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/hunter_chest_armor.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from cloaks and displays it as a list. + function GrabCloaks() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/hunter_cloaks.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from hunter gauntlets and displays it as a list. + function GrabHunterGauntlets() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/hunter_gauntlets.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from hunter helmets and displays it as a list. + function GrabHunterHelmets() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/hunter_helmets.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from hunter leg armor and displays it as a list. + function GrabHunterLegArmor() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/hunter_leg_armor.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from titan artifacts and displays it as a list. + function GrabTitanArtifacts() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/titan_artifacts.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from titan chest armor and displays it as a list. + function GrabTitanChestArmor() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/titan_chest_armor.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from marks and displays it as a list. + function GrabMarks() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/titan_marks.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from titan gauntlets and displays it as a list. + function GrabTitanGauntlets() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/titan_gauntlets.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from titan helmets and displays it as a list. + function GrabTitanHelmets() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/titan_helmets.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from titan leg armor and displays it as a list. + function GrabTitanLegArmor() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/titan_leg_armor.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from warlock artifacts and displays it as a list. + function GrabWarlockArtifacts() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/warlock_artifact.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from warlock chest armor and displays it as a list. + function GrabWarlockChestArmor() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/warlock_chest_armor.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from bonds and displays it as a list. + function GrabBonds() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/warlock_bonds.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from warlock gauntlets and displays it as a list. + function GrabWarlockGauntlets() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/warlock_gauntlets.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from warlock helmets and displays it as a list. + function GrabWarlockHelmets() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/warlock_helmets.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from warlock leg armor and displays it as a list. + function GrabWarlockLegArmor() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/armor/warlock_leg_armor.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from ghost shells and displays it as a list. + function GrabGhosts() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/misc/ghosts.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from ships and displays it as a list. + function GrabShips() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/misc/ships.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; + + // Grabs all flavor text from sparrows and displays it as a list. + function GrabSparrows() { + $("#item_list").html(""); + $.getJSON('https://destinyflavortext.net/data/misc/sparrows.json', function(data) { + var container = $('#item_list'); + + for(var i = 0, k = data.length; i < k; i++){ + var name = $(document.createElement('p'), + flavor = $(document.createElement('p'))); + + name.attr('id', 'name'); + flavor.attr('id', 'flavortext'); + + name.text(data[i].name); + flavor.text(data[i].flavor); + + container.append(name, flavor); + } + }) + }; \ No newline at end of file diff --git a/js/flavortext.min.js b/js/flavortext.min.js new file mode 100644 index 0000000..67fe3e2 --- /dev/null +++ b/js/flavortext.min.js @@ -0,0 +1 @@ +function GrabRandomFlavorText(){$.getJSON("https://destinyflavortext.net/data/flavortext.json",function(t){var e=t[Math.floor(Math.random()*t.length)],a=e;document.getElementById("name").innerHTML=a.name,document.getElementById("type").innerHTML=a.type,document.getElementById("flavortext").innerHTML=a.flavor})}function Refresh(){GrabRandomFlavorText()}function About(){document.getElementById("name").innerHTML=aboutTitle,document.getElementById("type").innerHTML="",document.getElementById("flavortext").innerHTML=aboutText}function goToLists(){window.location="https://destinflavortext.net/lists.html"}function GoHome(){window.location="https://destinyflavortext.net"}function SubmitFilterChoice(){"all"!=document.getElementById("filter_type").value||GrabFlavorText(),"autos"!=document.getElementById("filter_type").value||GrabAutos(),"fusions"!=document.getElementById("filter_type").value||GrabFusions(),"hand_cannons"!=document.getElementById("filter_type").value||GrabHandCannons(),"lmgs"!=document.getElementById("filter_type").value||GrabLmgs(),"pulses"!=document.getElementById("filter_type").value||GrabPulses(),"rockets"!=document.getElementById("filter_type").value||GrabRockets(),"scouts"!=document.getElementById("filter_type").value||GrabScouts(),"shotguns"!=document.getElementById("filter_type").value||GrabShotguns(),"sidearms"!=document.getElementById("filter_type").value||GrabSidearms(),"snipers"!=document.getElementById("filter_type").value||GrabSnipers(),"swords"!=document.getElementById("filter_type").value||GrabSwords(),"artifacts"!=document.getElementById("filter_type").value||GrabArtifacts(),"hunter_artifacts"!=document.getElementById("filter_type").value||GrabHunterArtifacts(),"hunter_helmets"!=document.getElementById("filter_type").value||GrabHunterHelmets(),"hunter_chest_armor"!=document.getElementById("filter_type").value||GrabHunterChestArmor(),"hunter_cloaks"!=document.getElementById("filter_type").value||GrabCloaks(),"hunter_gauntlets"!=document.getElementById("filter_type").value||GrabHunterGauntlets(),"hunter_helmets"!=document.getElementById("filter_type").value||GrabHunterHelmets(),"hunter_leg_armor"!=document.getElementById("filter_type").value||GrabHunterLegArmor(),"titan_artifacts"!=document.getElementById("filter_type").value||GrabHunterArtifacts(),"titan_helmets"!=document.getElementById("filter_type").value||GrabTitanHelmets(),"titan_chest_armor"!=document.getElementById("filter_type").value||GrabTitanChestArmor(),"titan_marks"!=document.getElementById("filter_type").value||GrabMarks(),"titan_gauntlets"!=document.getElementById("filter_type").value||GrabTitanGauntlets(),"titan_helmets"!=document.getElementById("filter_type").value||GrabTitanHelmets(),"titan_leg_armor"!=document.getElementById("filter_type").value||GrabTitanLegArmor(),"warlock_artifacts"!=document.getElementById("filter_type").value||GrabWarlockArtifacts(),"warlock_helmets"!=document.getElementById("filter_type").value||GrabWarlockHelmets(),"warlock_chest_armor"!=document.getElementById("filter_type").value||GrabWarlockChestArmor(),"warlock_bonds"!=document.getElementById("filter_type").value||GrabBonds(),"warlock_gauntlets"!=document.getElementById("filter_type").value||GrabWarlockGauntlets(),"warlock_helmets"!=document.getElementById("filter_type").value||GrabWarlockHelmets(),"warlock_leg_armor"!=document.getElementById("filter_type").value||GrabWarlockLegArmor(),"ghosts"!=document.getElementById("filter_type").value||GrabGhosts(),"ships"!=document.getElementById("filter_type").value||GrabShips(),"sparrows"!=document.getElementById("filter_type").value||GrabSparrows()}function GrabFlavorText(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/flavortext.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),type=$(document.createElement("p")),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","type"),flavor.attr("id","flavortext"),n.text(t[a].name),type.text(t[a].type),flavor.text(t[a].flavor),e.append(n,type,flavor)}})}function GrabAutos(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/weapons/autos.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabFusions(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/weapons/fusions.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabHandCannons(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/weapons/hand%20cannons.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabLmgs(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/weapons/lmgs.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabPulses(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/weapons/pulses.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabRockets(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/weapons/rockets.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabScouts(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/weapons/scouts.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabShotguns(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/weapons/shotguns.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabSidearms(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/weapons/sidearms.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabSnipers(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/weapons/snipers.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabSwords(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/weapons/swords.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabArtifacts(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/artifacts.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabHunterArtifacts(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/hunter_artifact.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabHunterChestArmor(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/hunter_chest_armor.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabCloaks(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/hunter_cloaks.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabHunterGauntlets(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/hunter_gauntlets.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabHunterHelmets(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/hunter_helmets.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabHunterLegArmor(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/hunter_leg_armor.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabTitanArtifacts(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/titan_artifacts.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabTitanChestArmor(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/titan_chest_armor.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabMarks(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/titan_marks.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabTitanGauntlets(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/titan_gauntlets.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabTitanHelmets(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/titan_helmets.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabTitanLegArmor(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/titan_leg_armor.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabWarlockArtifacts(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/warlock_artifact.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabWarlockChestArmor(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/warlock_chest_armor.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabBonds(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/warlock_bonds.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabWarlockGauntlets(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/warlock_gauntlets.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabWarlockHelmets(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/warlock_helmets.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabWarlockLegArmor(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/armor/warlock_leg_armor.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabGhosts(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/misc/ghosts.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabShips(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/misc/ships.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}function GrabSparrows(){$("#item_list").html(""),$.getJSON("https://destinyflavortext.net/data/misc/sparrows.json",function(t){for(var e=$("#item_list"),a=0,r=t.length;r>a;a++){var n=$(document.createElement("p"),flavor=$(document.createElement("p")));n.attr("id","name"),flavor.attr("id","flavortext"),n.text(t[a].name),flavor.text(t[a].flavor),e.append(n,flavor)}})}var aboutTitle="About DestinyFlavorText.net",aboutText='Destiny Flavor Text, is a simple website that will give you a random piece of flavortext from Destiny on request. It is being developed by Hennamann from The Antioxidants If you would like to contribute to DestinyFlavorText.net\'s development, help contribute to the source code over on Github: https://github.com/antioxidants/destinyflavortext.'; \ No newline at end of file diff --git a/lists.html b/lists.html new file mode 100644 index 0000000..7a8c622 --- /dev/null +++ b/lists.html @@ -0,0 +1,67 @@ + + + + Destiny Flavor Text + + + + + + + + + + + + +
+
+    +
+
+ + + \ No newline at end of file