Wiki Search
How do I make an wiki search?
What is a wiki search? How do you make a wiki search? This script and codes were developed by Paulo Sérgio on 19 November 2022, Saturday.
Wiki Search - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Wiki Search</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="maincontainer" ng-app="myapp"> <div class="container-fluid" ng-controller="WikiController"> <div class="row"> <div class="jumbotron"> <h1 class="title text-center">Wiki Search</h1> <div class="row"> <div class="col-xs-1 col-xs-offset-3"> <div class="input-group"> <button ng-click="getContent(true)" class="btn btn-info">Random Search</button> </div> </div> <div class="col-xs-5"> <div class="input-group"> <span class="input-group-btn"> <button class="btn btn-primary" ng-click="getContent()" type="button">Go!</button> </span> <input type="text" class="form-control" ng-model="search" placeholder="Type here!"></input> </div> </div> </div> <!-- end row --> </div> <!-- end jumbotron --> </div> <!-- end row --> <div class="row example-animate-container"> <div class="col-md-4 animate-repeat" ng-if="!random" ng-repeat="result in wikiresult"> <div class="panel panel-default element"> <div class="panel-heading">{{result.title}}</div> <div class="panel-body"> <p ng-bind-html="toHtml(result.snippet)"></p> </div> </div> </div> <!-- end col-md-4 --> <div class="container" ng-if="random"> <div class="panel panel-default element"> <div class="panel-heading">{{wikiresult.title}}</div> <div class="panel-body"> <p ng-bind-html="toHtml(wikiresult.extract)"></p> </div> </div> </div> </div> </div>
</div> <script src='https://code.jquery.com/jquery-2.2.4.min.js'></script>
<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.min.js'></script>
<script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular-sanitize.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0/angular-animate.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Wiki Search - Script Codes CSS Codes
.element { opacity: 0.25;
}
Wiki Search - Script Codes JS Codes
var app = angular.module('myapp', ['ngSanitize' , 'ngAnimate']);
app.controller('WikiController' , ['$scope' , '$sce', '$timeout', function($scope , $sce , $timeout){ $scope.wikiresult = []; //data has be changed $scope.$watch('wikiresult' , function(){ //console.log('wikiresult has changed'); //animate the html $timeout(function(){ console.log("on timeout"); var element = $(".element"); element.each( function(index , el) { //console.log("on each"); //console.dir(el); $(el).stop().animate({ opacity: 1, 'background-color': '#354147 !important' } , 1000); }); } , 1000); }) $scope.getContent = function(hasRandom){ //console.log("on click" + hasRandom); if(!hasRandom) $scope.getWiki($scope.search , false); else $scope.getWiki(null,true); } $scope.toHtml = function(html){ //var html = $scope.html; return $sce.trustAsHtml(html); } $scope.getWiki = function(content , random){ var url , wikipediaPage = content; url = ""; if(content) url = 'https://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch=' + wikipediaPage; else url = 'https://en.wikipedia.org/w/api.php?action=query&list=random&generator=random&prop=extracts&exchars=1500&format=json'; if(random) $scope.random = true; else $scope.random = false; $.ajax({ url: url, dataType: 'jsonp' }).done(function(data) { //console.log(data); //var query = data.query; //$scope.wikiresult = data.query.search; $scope.$apply(function () { if(!$scope.random) { //console.log("dont has random"); $scope.wikiresult = data.query.search; } else { var result = data.query.pages; var keys = Object.keys(result); //console.log(keys); $scope.wikiresult = data.query.pages[keys[0]]; } //console.dir($scope.wikiresult); }); }); }
}]);
Developer | Paulo Sérgio |
Username | paulo101977 |
Uploaded | November 19, 2022 |
Rating | 3 |
Size | 3,062 Kb |
Views | 12,144 |
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 |
Quote Api | 3,963 Kb |
Tributo a Renato Russo | 5,611 Kb |
Game of Life | 6,047 Kb |
Twitch.tv API Query | 3,631 Kb |
WeatherMap | 13,360 Kb |
Input Range Multiple CSS Jquery Javascript Scss Sass | 2,880 Kb |
Tic Tac Toe Game | 6,111 Kb |
Donut Singapoure Oi | 5,490 Kb |
Pomodoro Clock | 3,306 Kb |
Calculator | 3,239 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 |
Fading Navigation Bar | J-w-v | 2,805 Kb |
Vue Transition | Chenming142 | 4,561 Kb |
CSS Donut Charts | Seanstopnik | 2,908 Kb |
Impress JS Algorhytmic Generator | Jeffscottward | 7,906 Kb |
Old calculator | Gnarfugh | 2,815 Kb |
Twinkling Stars | Ripley6811 | 2,750 Kb |
A Pen by tugce | Ecgutcnkr | 4,197 Kb |
Large canvas mousemove experiment | Jibbon | 2,885 Kb |
A Pen by Manoz | Manoz | 2,424 Kb |
Polygon Dodecahedron in CSS | Vennsoh | 7,606 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!