A wiki viewer

Developer
Size
2,637 Kb
Views
8,096

How do I make an a wiki viewer?

What is a a wiki viewer? How do you make a a wiki viewer? This script and codes were developed by Daniel on 23 October 2022, Sunday.

A wiki viewer Previews

A wiki viewer - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>a wiki viewer</title> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <div class="row"> <div class="col-md-12"> <div id="content" class="text-center">
<h3><a href="https://en.wikipedia.org/wiki/Special:Random" target="_blank">Click here for random artical</a></h3>
<p>or searching by input the keyword down below</p> <input type="text" id="inputKey" required placeholder="search key..."> <button id="search">search</button> <button id="clear">clear</button> <div id="searchResult"></div> </div> </div> </div> </div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

A wiki viewer - Script Codes CSS Codes

body { background-color: LemonChiffon; color: black;
}
#content { padding: 150px 20px 50px 20px;
}
a, a:visited, a:hover, a:active { color: inherit; text-decoration: none !important;
}

A wiki viewer - Script Codes JS Codes

$(document).ready(function() { //load DOC ready $("#search").click(function() { //click search button $("#searchResult").empty(); //make sure field is clean getWiki(); //call the function to get data from wiki // console.log(getWiki()); }); $("#clear").click(function (){ //click button to clear input value and data $("input").val(" "); $("#searchResult").empty(); }); });
var getWiki = function () { var key = ""; key = $("#inputKey").val(); //get input value and assign to key $.ajax({ //ajax to call value to server url:"https://en.wikipedia.org//w/api.php?action=query&format=json&list=search&continue=&srlimit=10&srwhat=text&srsearch="+key, //wiki API dataType: 'jsonp', success: function(val) { var title = []; var content = []; var regTarget = /\s/g; //regexp: space in the string global var urlTarget; for(var i=0; i<val.query.search.length; i++){ title[i] = val.query.search[i].title; content[i] = val.query.search[i].snippet; urlTarget = title[i].replace(regTarget,"_"); //repace space to '_' // console.log(d); $("#searchResult").append("<a target='_blank' href='https://en.wikipedia.org/wiki/"+urlTarget+"'>"+"<h3>"+title[i]+"</h3></a>" +"<b>"+content[i]+"</b>"); //append data into page } //console.log(val); }, error: function() { //if ajax response fail $("#searchResult").html(" there are some errors, please try again!"); } }); };
//https://en.wikipedia.org/wiki/List_of_numbered_roads_in_Niagara_Region
A wiki viewer - Script Codes
A wiki viewer - Script Codes
Home Page Home
Developer Daniel
Username twdaniel
Uploaded October 23, 2022
Rating 3
Size 2,637 Kb
Views 8,096
Do you need developer help for A wiki viewer?

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!

Daniel (twdaniel) Script Codes
Name
Tribute
ShowTLW
Portfolio
PracticeQuote
A Pen by daniel
Test getlocation
RandomQuoteMachine
Create amazing art & images with AI!

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!