Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <link href="https://fonts.googleapis.com/css?family=Dosis|Open+Sans+Condensed:300" rel="stylesheet">
<div class = "container">
  <div class = "quoteBox">
  <h1>Random Quran Ayat Generator</h1>
  <div id = "content" class = "container">
    <div id="arabicVerseText" class = "largeSize"></div>
    <div id="verseText" class = "mediumSize"></div>
    <div id="surahAndAyah" class = "mediumSize"></div>
  </div>
  <input id = "shuffle" type="button" value = "New Ayat">
  <input id = "tweet" type = "button" value = "Tweet">
  </div>
</div>

              
            
!

CSS

              
                html{
	width: 100%;
  height: 100%;
	background: #1192d3 url(http://3.bp.blogspot.com/-slMS7NVyLFE/Vji0yb_l42I/AAAAAAAAhDc/jBWU_DJexRg/s1600/islamic-architecture-art-by-mshtag21-on-deviantart.jpg) no-repeat bottom right;
  background-size: cover;
}


h1{
  text-align : center;
  font-family: 'Dosis', sans-serif;
  font-size : 250%;
}

.container{
  text-align : center;
  border-radius : 3px;
  position : relative;
  margin : auto auto auto auto;
  width : 550px;
  display : table;
  background-color : #fff;
}

.quoteBox{
  border-radius : 3px;
  position : relative;
  margin : 8px auto auto auto;
  padding : 40px 50px;
  display : table;
  background-color : #fff;
}

#arabicVerseText{
  font-size: 200%;
}

#content{
  font-family: 'Open Sans Condensed', sans-serif;
}

input[type=button]{
  cursor : pointer;
}

.condensedSanSerif{
  font-family: 'Open Sans Condensed', sans-serif;
}

.largeSize{
  font-size : 200%;
}

.mediumSize{
  font-size : 150%;
}

.smallSize{
  font-size: 130%;
}
              
            
!

JS

              
                var arText;
var enText;
var surah;
var ayahNumber;
var surahAndAyah;

$(document).ready(function(){
  getQuote();
  $("#shuffle").on("click", getQuote);
  $("#tweet").click(function(){
    var tweetLink = 'https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text='+'"' + enText + '" QS' + surahAndAyah;
    window.open(tweetLink);
  });
});


function getQuote() {
  var ayah = Math.floor(Math.random() * 6236) + 1 
  var url = "https://api.alquran.cloud/ayah/"+ayah+"/en.asad";
  var urlArabic = "https://api.alquran.cloud/ayah/"+ayah;
  arText;
  enText;
  surah;
  ayahNumber;
  surahAndAyah;
  
  $.getJSON( urlArabic, function(data) {
    arText = data.data.text;
    document.getElementById("arabicVerseText").innerHTML = arText;
    console.log(arText);
  });
            
  $.getJSON( url, function(data) {
    console.log(data);
    enText = data.data.text;
    surah = data.data.surah.englishName;
    ayahNumber = data.data.surah.numberOfAyahs;
    surahAndAyah = surah + " : "+ ayahNumber 
    document.getElementById("verseText").innerHTML = enText;
    document.getElementById("surahAndAyah").innerHTML = surahAndAyah;
    console.log(enText);
    console.log(surah);
    console.log(ayahNumber);
    console.log( "success" );
  })
    .done(function() {
      console.log("second success");
    })
    .fail(function(jqXHR, textStatus, errorThrown) { alert('getJSON request failed! ' + textStatus); })
    .always(function() {
      console.log( "complete" );
    });
}
              
            
!
999px

Console