cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <html lang="en">
<head>
    <meta charset="utf-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <!-- Bootstrap says:  The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    
    <title>Random Quote Generator</title>
    <!-- Bootstrap -->
    <link href=
    "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
    rel="stylesheet">
    <link href="css/main.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link href='https://fonts.googleapis.com/css?family=Cardo:400,400italic'
    rel='stylesheet' type='text/css'>
</head>

<body>
    <div class="container-fluid">
        <!-- responsive amount of space above the quote panel-->


        <div class="row visible-vs-block vs-spacer-row">
        </div>

        <div class="row visible-sm-block sm-spacer-row">
        </div>

        <div class="row visible-md-block md-spacer-row">
        </div>

        <div class="row visible-lg active lg-spacer-row">
        </div>
        <!-- The row contains 3 divs.  On either side a blank columnn increases with screen size, center column holds the quote panel and buttons -->
        <div class="row">
            <div class="col-xs-12 col-sm-1 col-md-2 col-lg-3 col-xl-4">
            </div>

            <div class=
            "col-xs-12 col-sm-10 col-md-8 col-lg-6 col-xl-4 center-block">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">Waywardpoints
                        Quote-o-Matic</h3>
                    </div>

                    <div class="panel-body">
                        <div class="row main-message" id="quote-content">
                            Quotesondesign.com did not respond. Try again.
                        </div>

                        <div class="row attribution" id=
                        "doineedquotetitlehere">
                            <p id="quote-title">Quote source not reachable.</p>
                        </div>

                        <div class="row"><!-- row of buttons-->
                            <div class="col-xs-6" id="tweeter">
                            </div>
                            <div class="col-xs-6">
                                <button class="btn btn-default right-side" id=
                                "get-another-quote-button" name="new-quote"
                                type="button">New Quote</button>
                            </div>
                        </div>
                        <!-- row of buttons ends here-->
                    </div>
                </div>
            </div>
            <!-- center-block ends here-->

            <div class="col-xs-12 col-sm-1 col-md-2 col-lg-3 col-xl-4">
            </div>
        </div>
    </div>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src=
    "https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
    </script> 
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src=
    "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js">
    </script> 
    <script src="js/quote-generator.js">
    </script>
</body>
</html>
            
          
!
            
              body {
    font-family: 'Cardo',serif;
}

.center-item {
    padding: 50px 10% 25%;
}

.btn {
    height: 28px;
    width: 95px;
    padding: 0px;
}

.right-side {
    float: right;
}

.center-block {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.vs-spacer-row {
    min-height: 15px;
}

.sm-spacer-row {
    height: 100px;
}

.md-spacer-row {
    height: 200px;
}

.lg-spacer-row {
    min-height: 250px;
}

.main-message {
    font-size: 1.5em;
    padding: 5% 10%;
}

.attribution {
    font-weight: 300;
    font-size: smaller;
    padding: 10px 2px;
    text-align: right;
}

.panel-heading {
    text-align: center;
}

            
          
!
            
              $(document).ready(function() //delay everything until page has loaded.
{
    //	automagically makes the Twitter Button
    ! function(d, s, id)
    {
        var js, fjs = d.getElementsByTagName(s)[0],
            p = /^http:/.test(d.location) ? 'http' : 'https';
        if (!d.getElementById(id))
        {
            js = d.createElement(s);
            js.id = id;
            js.src = p + '://platform.twitter.com/widgets.js';
            fjs.parentNode.insertBefore(js, fjs);
        }
    }(document, 'script', 'twitter-wjs');
    //function provided by quotesondesign.com 
    $('#get-another-quote-button').on('click', function(e)
    {
        $('body').css("background-color", '#' + Math.floor(Math
            .random() * 16777215).toString(16)); //change background color
        e.preventDefault(); // no idea what that does, looks important
        $.ajax(
        {
            url: 'https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1',
            success: function(data)
            { //assigns values *after* the quote json is downloaded.
                var post = data.shift(); // The data is an array of posts. Grab the first one.
                $('#quote-title').text(post.title); // is actually the author of the quote
                $('#quote-content').html(post.content);
                //Delete any existing tweeter button
                $('#tweeter').empty();
                // Make a new twitter share button specific to the quote https://dev.twitter.com/web/tweet-button/javascript-create
                //I tried to change the text property only, but twitter made some sort of security error.
                twttr.widgets.createShareButton(
                    'http://waywardpoints.com/random-quote-generator/',
                    document.getElementById('tweeter'),
                    {
                        text: $('#quote-content > p').text(),
                        size: "large" //28px x 75px
                    });
                // If the Source is available, use it. Otherwise hide it.  Not using this right now.  Left here in case I should
                if (typeof post.custom_meta !==
                    'undefined' && typeof post.custom_meta.Source !== 'undefined')
                {
                    $('#quote-source').html(
                        'Source:' + post.custom_meta.Source);
                }
                else
                {
                    $('#quote-source').text('');
                }
            },
            cache: false
        });
    });
    //Load initial quote -- Thanks http://stackoverflow.com/questions/2060019/how-to-trigger-click-on-page-load
    setTimeout(function()
    {
        $('#get-another-quote-button').trigger('click');
    }, 10);
}); //end document ready function
            
          
!
999px
Loading ..................

Console