Wikipedia Search Engine
How do I make an wikipedia search engine?
A Wikipedia search engine that brings up the first 10 articles that meet the search criteria, including an excerpt from the article. A link list that allows the user to go directly to an article in the search results. An additional button allows the user to open a random Wikipedia page in a separate tab.. What is a wikipedia search engine? How do you make a wikipedia search engine? This script and codes were developed by Tom Brodhead on 19 January 2023, Thursday.
Wikipedia Search Engine - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Wikipedia Search Engine</title> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Wikipedia Viewer</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <div class="jumbotron" style="background-color:blue;"> <div class="row centerBlock"> <p id="wikirandom"><button onClick="randomWikipediaPage()">Open random Wikipedia page in separate tab</button></p> <form id="wikisearch" action="javascript:getWikipediaEntries()">Search Wikipedia: <input type="text" name="searchTerm"></form> <p id="wikilinks" style="display:none"></p> </div> </div>
</div> <script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Wikipedia Search Engine - Script Codes CSS Codes
html { overflow-y:scroll }
body { margin-top:60px; text-align:center; background-color:blue }
#wikilinks, #wikisearch { background-color:Gainsboro; display:inline-block; padding:.25em .5em .25em .5em}
#wikilinks > p, #wikisearch { font-size:16px}
#wikirandom { font-size:18px}
hr { border-color:black }
Wikipedia Search Engine - Script Codes JS Codes
var getElementById,getWikipediaEntries,randomWikipediaPage;getElementById=function(a){return document.getElementById(a)};getWikipediaEntries=function(){var a,e,b;a=document.querySelector('#wikisearch input[name="searchTerm"]');b=a.value.trim().replace(/\s+/g,"%20");e=b.replace(/%20/g," ");getElementById("wikilinks").innerHTML="<br>Fetching results...";getElementById("wikilinks").style.display="block";getElementById("wikilinks").style.padding="0em 1em 1em 1em";getElementById("wikilinks").style.marginTop="0em";""!==b&&$.ajax({type:"GET",url:"https://en.wikipedia.org/w/api.php?action=query&generator=search&gsrnamespace=0&gsrsearch="+b+"&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&format=json&callback=?",dataType:"json",success:function(c){var d,a,b,f;d=[];void 0!==c.query?(a=Object.keys(c.query.pages).length,0!==a&&(d.push('<p style="font-size=20px"><strong>Displaying results for: '+e+"</strong><hr></p>"),Object.keys(c.query.pages).forEach(function(a){void 0!==c.query.pages[a].title&&void 0!==c.query.pages[a].extract&&(b=c.query.pages[a].title,f=c.query.pages[a].extract,d.push('<p class="result"><a href="https://en.wikipedia.org/?curid='+a+'" target="_blank">'+b+"</a><br>"+f+"<hr></p>"))})),getElementById("wikilinks").innerHTML="<br>"+d.join(""),getElementById("wikilinks").style.display="inline-block"):(d.push('<br><p style="font-size=20px"><strong>No results for: '+e+"</strong></p>"),getElementById("wikilinks").innerHTML="<br>"+d.join(""),getElementById("wikilinks").style.display="block",getElementById("wikilinks").style.padding="0em 1em 1em 1em",getElementById("wikilinks").style.marginTop="0em")},error:function(){console.log("Error retrieving JSON");getElementById("wikilinks").style.display="none"}});a.value=""};randomWikipediaPage=function(){window.open("https://en.wikipedia.org/wiki/Special:Random")};
Developer | Tom Brodhead |
Username | TomCodeCamp |
Uploaded | January 19, 2023 |
Rating | 3 |
Size | 3,121 Kb |
Views | 6,072 |
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 |
Calculator | 3,739 Kb |
A Pen by Tom Brodhead | 1,247 Kb |
Tribute Page | 2,658 Kb |
Local Weather | 3,152 Kb |
Tic Tac Toe | 5,662 Kb |
Random Quote Generator | 2,295 Kb |
Pomodoro Clock | 4,577 Kb |
Twitch TV Streamers | 3,211 Kb |
Portfolio | 3,942 Kb |
Simon | 5,807 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 |
STIKHOI | Denmch | 7,122 Kb |
A Pen by Anoop | Anoopjohn | 330,760 Kb |
Wikipedia viewer | Chpecson | 2,865 Kb |
Force Counter | Kenlauguico | 2,732 Kb |
JS Beispiel getElementsByClassName 3 | HSZG-Frontend-Kurs | 1,988 Kb |
Welcome | Nakome | 6,076 Kb |
Isometric css island | Xaddict | 2,950 Kb |
CSS3 Diamond | Rendro | 1,960 Kb |
Toggle menu | Seyedi | 2,279 Kb |
Coming Soon | MariamMassadeh | 1,680 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!