Wikipedia Viewer
How do I make an wikipedia viewer?
What is a wikipedia viewer? How do you make a wikipedia viewer? This script and codes were developed by Victor Hall on 13 September 2022, Tuesday.
Wikipedia Viewer - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Wikipedia Viewer</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="row"> </div><!-- /.col-lg-6 -->
</br> <div class="col-xs-12"> <div class="input-group"> <input id="text" type="text" class="form-control" placeholder="Enter Wiki Search...."> <span class="input-group-btn"> <button id="button" class="btn btn-default" type="button">Go!</button> </span> </div><!-- /input-group --> </div><!-- /.col-lg-6 -->
</div>
<div id="list"></div> <script src='http://cdnjs.cloudflare.com/ajax/libs/react/0.13.0/react.min.js'></script>
<script src='https://npmcdn.com/[email protected]/dist/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Wikipedia Viewer - Script Codes CSS Codes
div{ text-align: center;
}
ul{ list-style: none;
}
a{ color: white;
}
body{ background-color: #262626;
}
Wikipedia Viewer - Script Codes JS Codes
$( "#button" ).click(function() { var searchTerm = document.getElementById("text").value;
search(searchTerm);
});
function search(searchTerm){
var response = [];
var lengthOfList;
//this list will be added into the componenent
//var list; $.ajax({ // request type ( GET or POST ) type: "GET", // the URL to which the request is sent url: "https://en.wikipedia.org/w/api.php?", // data to be sent to the server data: { action:'query', format:'json', list: 'search', srsearch: searchTerm, srwhat: 'text', srprop: 'timestamp', continue: ''}, // The type of data that you're expecting back from the server dataType: 'jsonp', crossDomain : true, // Function to be called if the request succeeds success: function( jsondata ){ for (var i = 0; i < jsondata.query.search.length; i++){ //pushes each result into the array named list response.push(jsondata.query.search[i].title); } lengthOfList = jsondata.query.search.length; createList(lengthOfList, response); }
});
}
function createList(lengthOfList, response){ //clears content from search result list $("div#list").empty(); var list = document.createElement("ul"); for(var a = 0; a < lengthOfList; a++){ var anchor = document.createElement("a"); anchor.href = "https://en.wikipedia.org/wiki/" + response[a]; anchor.innerText = response[a]; var elem = document.createElement("li"); elem.appendChild(anchor); list.appendChild(elem); } //http://stackoverflow.com/questions/21192763/how-to-dynamically-add-list-items-in-jquery //renders the component when the ajax call is returned var div = document.getElementById("list"); div.appendChild(list);
}
Developer | Victor Hall |
Username | vhall_io |
Uploaded | September 13, 2022 |
Rating | 3 |
Size | 2,665 Kb |
Views | 30,360 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Sum All Primes | 1,628 Kb |
Culinary Arts Institute | 6,040 Kb |
Search and Replace | 1,893 Kb |
Culinary Arts Institute at MCCC | 6,079 Kb |
Tribute Page | 3,131 Kb |
FCC Test | 1,652 Kb |
A Pen by Victor Hall | 2,047 Kb |
DNA pairing | 1,854 Kb |
Everything be true | 1,626 Kb |
Random Quote Machine Complete | 4,076 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Pomodoro Timer | Sdas13 | 2,900 Kb |
JQuery AJAX reddit Exercise | Btholt | 1,777 Kb |
Table Exercise | Fresco | 9,585 Kb |
CSS3 Selectables with information rollover | Jasonmayes | 9,565 Kb |
SVG Text Masking | JMChristensen | 2,141 Kb |
JS Countdown Timer | Ayoungh | 2,435 Kb |
A Pen by Matt Popovich | Mpopv | 3,349 Kb |
CSS Org Chart | Appirio-ux | 3,882 Kb |
CSS3 Snow Animation | NickyCDK | 1,695 Kb |
Expert Help | SinceSidSlid | 4,064 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!