This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(() => { | |
console.log('ready!'); | |
$("i#tweet-icon").on("click", () => { | |
let quote = $.trim($("#quote").text()); | |
window.open(`https://twitter.com/intent/tweet?text=${quote}`); | |
}); | |
});// end of document.ready |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(() => { | |
let endpoint = 'https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?'; | |
let getRandomQuote = () => { | |
$.getJSON(`${endpoint}`, (data) => { | |
$("#quote").html(`<i class="fas fa-quote-left"></i> ${data.quoteText} <i class="fas fa-quote-right"></i>`); | |
//Checking if the quote does not have an author | |
if (data.quoteAuthor !== "") { | |
$("#quote-author").html(`${data.quoteAuthor} at <a href="${data.quoteLink}" target="_blank" class="card-link">forismatic</a>`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(() => { | |
//Create a tweet function | |
function tweetQuote() { | |
window.open(`https://twitter.com/intent/tweet?text=${data.quoteText}`); | |
} | |
$("#tweet-icon").on("click", tweetQuote); | |
};//end of getRandomQuote | |
$("#quote-button").on("click", getRandomQuote); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(() => { | |
console.log('ready!'); | |
$("i#tweet-icon").on("click", () => { | |
let quote = $.trim($("#quote").text()); | |
window.open(`https://twitter.com/intent/tweet?text=${quote}`); | |
}); | |
let endpoint = 'https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(()=> { | |
console.log("ready"); | |
let quotesArray = ["quote1", "quote2", "quote3", "quote4", "quote5", "quote6", "quote7", "quote8", "quote9", "quote10"]; | |
function randomQuote() { | |
let randQuote = Math.floor(Math.random() * quotesArray.length); | |
return $("p#quote").text(quotesArray[randQuote]); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<!-- Required meta tags --> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<!-- Bootstrap CSS --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" | |
crossorigin="anonymous"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<!-- Required meta tags --> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<!-- Bootstrap CSS --> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(() => { | |
$("#random").click(() => { | |
return window.open("https://en.wikipedia.org/wiki/Special:Random"); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(() => { | |
$("#random").click(() => { | |
return window.open("https://en.wikipedia.org/wiki/Special:Random"); | |
}); | |
let endpoint = | |
"https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch="; | |
function thisWholeThing() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (data.query === undefined) { | |
$("#results").append( | |
`<div class="list-group"> | |
<div class="list-group-item list-group-item-action flex-column align-items-start"> | |
<div class="d-flex w-100 justify-content-between"> | |
<h5 class="mb-1">Suggestions:</h5> | |
</div> | |
<li class="mb-1">Make sure all words are spelled correctly.</li> | |
<li class="mb-1">Try different keywords.</li> | |
<li class="mb-1">Try more general keywords.</li> |