@26325001/

random wine description generator

HTML, CSS, JS

No description

fork
loading
Files
  • index.html
  • jquery-1.11.1.min.js
  • style.css
  • tracery.js
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE html>
<html>
  <head>
    <link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet">
    <title>Random Wine Description Generator</title>
    <script src="tracery.js"></script>
    <script src="jquery-1.11.1.min.js"></script>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- import the webpage's stylesheet -->
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    
    <!-- top where it says "RWDG"-->
    <ul>
      <li><a href="index.html"><h1>rwdg</h1></a></li>
    </ul>
      
      
    <h4>[random wine description here]</h4>
    <button onclick="generate()">Generate</button>
    <script>

    var grammarObj = {
      "origin" : [
        "This wine is as good as #taste#.",
        "#brand.capitalize# is happpy to have three stars on Uber!",
        "Lucky You! This is really good stuff!",
        "This wine sucks.",
        "#brand.capitalize# tastes like #taste# with a hint of #ingredient#.",
        "This #compliment# wine is like #taste#.",
        "This wine is as good as #brand#.",
        "For this price, #brand# is the best!",
        "With its #compliment# aroma, #brand# will make your day!"
      ],
      "brand" :[
        "Wine D'or ®",//® keep that handy.
        "so and so wine",
        "the wine with a bull on the cover",
        "Wine au Poulet ®",//chicken wine in french
        "La Mauvaise Wine ®",//the bad wine in french
        "La Wine Vivante ®"  //the living wine in french
      ],
      "compliment" :[
        "real",
        "authentic",
        "legitimate",
        "awesome",
        "nice",
        "refreshing"
      ],
      "taste" :[
        "cement",
        "sugar",
        "plastic",
        "molasses"
      ],
      "ingredient" : [
        "nothing in particular",
        "shoe sole",
        "marble",
        "makeup",
        "maple"
      ]
    }
    var grammar = tracery.createGrammar(grammarObj)
    function generate(){
      var t = grammar.flatten("#origin#");
      $('h4').text(t);
    }
    
    </script>
  </body>
</html>
result
console