Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <body>
    <!-- FIRST LINE for the CSS files -->
    <link href="https://fonts.googleapis.com/css?family=Kanit|Orbitron" rel="stylesheet">
<!--     <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> -->
    <link href="RandomQuoteMachine.css" rel="stylesheet" type="text/css">
    <div class="container-fluid">
        <div class="row">
            <div class="col-xs-8 col-xs-offset-2">
                <div class="well center-block">
                    <h1 id="quotes"></h1>
                    <h2 id="character-movie"></h2>
                    <div class="footer">
                        <button id="newQuote" class="btn btn-primary btn-responsive">NEW QUOTE</button>
                        <!--<button id="newImage" class="btn btn-primary btn-responsive">NEW IMAGE</button>-->
                        <button id="tweetQuote" class="btn btn-primary btn-responsive">TWEET QUOTE</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--or just add the JS directly to the HTML file, that's ok, right?-->
    <script>
        window.onload = function () {
            getQuotes();
        };
        // Get random quote
        document.getElementById("newQuote").onclick = getQuotes;
        //  Get new image
        // document.getElementById("newImage").onclick = getImage;
        // Tweet the quote
        document.getElementById("tweetQuote").onclick = tweetQuote;

        function fetchQuotes(callback) {
            // arnold json gist
            const endpoint =
                'https://gist.githubusercontent.com/spences10/ceee092f6fed36559036c94682b7a5f7/raw/7a27570759834ee454ee380ca42ebd47dc55e932/arnold_quotes.json'
                // fetch gist
            fetch(endpoint)
                .then(blob => blob.json())
                .then(data => callback(data));
        }
        // callback for quotes promise
        function getQuotes() {
            clearBox();
            fetchQuotes(function (quotes) {
                // get random quote from JSON 
                const quoteID = getRandomInt(1, 100);
                // get json data
                var quoteStr = quotes[quoteID].quote
                var characterMovieStr = quotes[quoteID].character + ' - ' + quotes[quoteID].movie
                var para = document.createElement("p");
                var node = document.createTextNode(quoteStr);
                var element = document.getElementById("quotes");
                para.appendChild(node);
                element.appendChild(para);
                para = document.createElement("p");
                node = document.createTextNode(characterMovieStr);
                element = document.getElementById("character-movie");
                para.appendChild(node);
                element.appendChild(para);
            })
        }

        function getRandomInt(min, max) {
            return Math.floor(Math.random() * (max - min + 1)) + min;
        }

        // function getImage() {
        //     display_random_image();
        // }

        function tweetQuote() {
            var quoteStr = document.getElementById("quotes").innerText + ' - ' +
                document.getElementById("character-movie").innerText + ' %23arniequotes';
            window.open("https://twitter.com/home?status=" + quoteStr);
        }

        function clearBox() {
            document.getElementById("quotes").innerHTML = "";
            document.getElementById("character-movie").innerHTML = "";
        }
    </script>
    <!-- LAST LINE for the JavaScript file -->
</body>
              
            
!

CSS

              
                /*.container {
    color: #000000;
    left: 50%;
    margin: auto;
    overflow: hidden;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 640px;
}*/

div.row {
    margin: 100px 0;
}

.footer {
    display: flex;
    justify-content: space-between;
    /* ^^ this!! for the longest time!!! couldnt even!*/
    padding: 0 1px 1px;
    position: relative;
}

h1 {
    font-family: Orbitron, monospace;
}

h2 {
    font-family: Kanit, monospace;
}

#newQuote {
    white-space: normal;
}
#newImage {
    white-space: normal;
}
#tweetQuote {
    white-space: normal;
}
              
            
!

JS

              
                // JavaScript is in the HTML file
              
            
!
999px

Console