assets/js/main.js
// Using NET Bible Web Service API to generate quotes
Using NET Bible Web Service API to generate quotes
Using NET Bible Web Service API to generate quotes
function callQuote() {
    var url = "https://labs.bible.org/api/?passage=random&type=json&callback=?";
    var quote = "";
    var path = "";
    $.getJSON(url, function(data) {
      quote = data[0].text;
      path = "- " + data[0].bookname + " " + data[0].chapter + " : " + data[0].verse;
      quote = quote.slice(0, quote.length -87);
      quote = quote.replace(/\W+\d+/giu, "");
      $("#quote").text(quote);
      $("#path").text(path);
      $("#tweet").on("click", function() {
        var url = "https://twitter.com/intent/tweet?&text=";
        window.open(url + encodeURIComponent(quote + " " + path));
      });
    });
  }
function callQuote ( ) { var url = "https://labs.bible.org/api/?passage=random&type=json&callback=?" ; var quote = "" ; var path = "" ; $ . getJSON ( url , function ( data ) { quote = data [ 0 ] . text ; path = "- " + data [ 0 ] . bookname + " " + data [ 0 ] . chapter + " : " + data [ 0 ] . verse ; quote = quote . slice ( 0 , quote . length - 87 ) ; quote = quote . replace ( / \W+\d+ / giu , "" ) ; $ ( "#quote" ) . text ( quote ) ; $ ( "#path" ) . text ( path ) ; $ ( "#tweet" ) . on ( "click" , function ( ) { var url = "https://twitter.com/intent/tweet?&text=" ; window . open ( url + encodeURIComponent ( quote + " " + path ) ) ; } ) ; } ) ; }
Using NET Bible Web Service API to generate quotes
Using NET Bible Web Service API to generate quotes
// API // "containers" variables // AJAX Call // Getting verses text content. // Getting Book, Chapter and verses references. // Using .slice to remove incovenient tags at the end of the quote // Remove unicode character among the verses. // Inject data from api to html // Tweet Quote