﻿
@@ -1 +1,1664 @@
-%EF%BB%BF
+$(document).ready(function() %7B%0A  $('#searchBtn').on('click', getSnippets);%0A  %0A  $(document).keypress(function(e) %7B%0A    if(e.which == 13) %7B%0A       getSnippets();%0A    %7D%0A%7D);%0A%7D);%0A%0A$(document).keypress(function(e) %7B%0A    if(e.which == 13) %7B%0A       $('#searchBtn').on('click', getSnippets);%0A    %7D%0A%7D);%0A    %0A    %0A    function getSnippets() %7B%0A    %0Avar input =  $(%22#input%22).val();%0A$('#results').text(%22Searching for %22 + input + %22...%22);    %0A%0A    %0A$.ajax(%7B%0A            url:  %0A  'http://en.wikipedia.org/w/api.php?action=query&format=json&list=search&srsearch=' + input +'&callback=?',%0A            type: 'GET',%0A            contentType: %22application/json; charset=utf-8%22,%0A            dataType: 'json',%0A            error: function(xhr, status, error) %7B%0A                $('#results').text(%22Error occured while loading data, sorry!%22);%0A            %7D,%0A            success: function(json) %7B%0A              %0Avar str = %22%22;              %0Afor(var i=0; i%3Cjson.query.search.length;i++)%7B%0A  var snippet; %0A  if(json.query.search%5Bi%5D.snippet.slice(-1) === %22.%22)%7B%0A    snippet = json.query.search%5Bi%5D.snippet + %22..%22;%0A  %7Delse%7B%0A    snippet = json.query.search%5Bi%5D.snippet + %22...%22%0A  %7D%0A  %0A  str += %22%3Ca href=%5C%22https://en.wikipedia.org/wiki/%22 + json.query.search%5Bi%5D.title + %22%5C%22 target=%5C%22_blank%5C%22%3E%3Cdiv class=%5C%22snippets%5C%22%3E%22 + %22%3Ch2%3E%22 + json.query.search%5Bi%5D.title + %22%3C/h2%3E%22 + %22%3Cp%3E%22 + snippet + %22%3C/p%3E%22 + %22%3C/div%3E%3C/a%3E%22;%0A%7D;%0A%0A$('#results').html(str);                          %0A              %0Aif($('#results').text() === %22%22)%7B%0A  $('#results').text(%22Sorry, couldn't find such entry. Check for spelling mistakes or search for something else.%22);%0A%7D              %0A%0A            %7D,//end of success function%0A  %0A %7D);    %0A  %0A  %7D;%0A

Update wiki_viewer_script.js