JavaScript

No description

fork
loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6440492337504822","path":"main.js","file":{"path":"main.js","content":{"asEncoding":{"base64":"CgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gLgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAoKCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCgovL01hZGxpYnM7IGNsaWNrIHJ1biBhbmQgZmlsbCBpbiB0aGUgcHJvbXB0cy4gRW50ZXIgY2FuY2VsIHRvIGNsb3NlIGFsbCBwcm9tcHQgd2luZG93cy4KdmFyIG1hZGxpYiA9ICJUaGUgZGF5IHdhcyB7YWRqZWN0aXZlfSBhbmQgSSB3YW50ZWQgdG8ge3ZlcmIgKHdpdGhvdXQgaW5nIGVuZGluZyl9IGJ1dCBJIGNvdWxkIG5vdCB7c2FtZSB2ZXJifSBiZWNhdXNlIHtwZXJzb259IHdhcyBtYWQgYXQgbWUgZm9yIHt2ZXJiIGVuZGluZyB3aXRoIC1pbmd9LiBTbywgbm93IEkgYW0gaW4ge3BsYWNlfS4gQWxsIEkgaGF2ZSBpcyBhIHtudW1iZXIgNDAtMTUwfSBwb3VuZCB7c2luZ3VsYXIgdmVnZXRhYmxlfSwgYSB7Tm91biBzdGFydGluZyB3aXRoIGEgY29uc29uYW50fSBhbmQgYSByYWJpZCB7YW5pbWFsfS4gVGhpcyBtYWtlcyBtZSBmZWVsIGV4ZXRyZW1lbHkge2Vtb3Rpb259IGJ1dCBJIHdpbGwgYmUge2FkdmVyYn0ge3ZlcmIgZW5kaW5nIHdpdGggLWluZ30gYWZ0ZXIgSSBnZXQgbXkge3BsdXJhbCBOb3VufS4gIjsKCnZhciBtYWRsaWJfcGF0dGVybiA9IC97KC4rPyl9L2c7CgpibGFua3MgPSBtYWRsaWIubWF0Y2gobWFkbGliX3BhdHRlcm4pOwpmb3IodmFyIGkgaW4gYmxhbmtzKXsKICB2YXIgd29yZCA9IHdpbmRvdy5wcm9tcHQoIkdpdmUgbWUgYSAiK2JsYW5rc1tpXSk7CiAgCiAgaWYgKCJjYW5jZWwiPT13b3JkKXticmVha30KICAKICBtYWRsaWIgPSBtYWRsaWIucmVwbGFjZShibGFua3NbaV0sIHdvcmQpOwp9CmNvbnNvbGUubG9nKG1hZGxpYik7CgoKCgo="},"asBuffer":null},"loaded":true}}
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

                                                 // .
                                                  
                                                  
                                                  
                                                  
                                                  


                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  

//Madlibs; click run and fill in the prompts. Enter cancel to close all prompt windows.
var madlib = "The day was {adjective} and I wanted to {verb (without ing ending)} but I could not {same verb} because {person} was mad at me for {verb ending with -ing}. So, now I am in {place}. All I have is a {number 40-150} pound {singular vegetable}, a {Noun starting with a consonant} and a rabid {animal}. This makes me feel exetremely {emotion} but I will be {adverb} {verb ending with -ing} after I get my {plural Noun}. ";

var madlib_pattern = /{(.+?)}/g;

blanks = madlib.match(madlib_pattern);
for(var i in blanks){
  var word = window.prompt("Give me a "+blanks[i]);
  
  if ("cancel"==word){break}
  
  madlib = madlib.replace(blanks[i], word);
}
console.log(madlib);




Native Browser JavaScript