Skip to content

Commit

Permalink
uploaded 5.0.1
Browse files Browse the repository at this point in the history
fixed bug where searches would try to load 'undefined.wikipedia.org'
  • Loading branch information
corbindavenport committed Mar 30, 2014
1 parent c22a18c commit 8962db0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Wikipedia Search is free to use in any browser extension, but I would like a lin
__Wikipedia is a trademark of the Wikimedia Foundation.__

---------------------------------------------------------
__New in Wikipedia Serch 5.0.1:__
* Fixed bug where searches would try to load 'undefined.wikipedia.org'

__New in Wikipedia Serch 5.0:__
* Search from the Chrome Omnibar by selecting it, typing 'wiki', pressing space, and start typing (Based on [OmniWiki](https://github.com/hamczu/OmniWiki))
* Removal of the old search button
Expand Down
6 changes: 3 additions & 3 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ chrome.runtime.onInstalled.addListener(function(details){

function onSearch(info, tab) {
chrome.tabs.detectLanguage(null, function(lang) {
var language = localStorage["launguage"];
var language = localStorage["language"];
var taburl = "http://" + language + ".wikipedia.org/w/index.php?title=Special:Search&search=" + info.selectionText.replace(/\s/g, "+");
chrome.tabs.create({ url: taburl, selected: false });
});
Expand Down Expand Up @@ -87,7 +87,7 @@ chrome.omnibox.onInputCancelled.addListener(function() {


function suggests(query, callback) {
var language = localStorage["launguage"];
var language = localStorage["language"];
var req = new XMLHttpRequest();

req.open("GET", "http://" + language + ".wikipedia.org/w/api.php?action=opensearch&namespace=0&suggest=&search=" + query, true);
Expand All @@ -109,6 +109,6 @@ function suggests(query, callback) {
}

chrome.omnibox.onInputEntered.addListener(function(text) {
var language = localStorage["launguage"];
var language = localStorage["language"];
chrome.tabs.update(null, {url: "http://" + language + ".wikipedia.org/w/index.php?search=" + text});
})();
16 changes: 8 additions & 8 deletions language.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ You should have received a copy of the GNU General Public License along with thi
function save_options() {
var select = document.getElementById("language");
var language = select.children[select.selectedIndex].value;
localStorage["launguage"] = language;
localStorage["language"] = language;
}
function restore_options() {
var launguage = localStorage["launguage"];
if (!launguage) {
var favorite = localStorage["language"];
if (!favorite) {
return;
}
var select = document.getElementById("language");
for (var i = 0; i < select.children.length; i++) {
var child = select.children[i];
if (child.value == launguage) {
if (child.value == favorite) {
child.selected = "true";
break;
}
Expand All @@ -29,19 +29,19 @@ window.onload = function(){
document.querySelector('input[value="Save"]').onclick=save_options;
}
window.addEventListener('load',function(){
var launguage = localStorage["launguage"];
if (!launguage) {
var favorite = localStorage["language"];
if (!favorite) {
return;
}
var select = document.getElementById("language");
for (var i = 0; i < select.children.length; i++) {
var child = select.children[i];
if (child.value == launguage) {
if (child.value == favorite) {
child.selected = "true";
break;
}
}
});
function startSearch(event) {
document.getElementById("searchform").submit();
document.getElementById("searchform").submit();
}
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Wikipedia Search",
"version": "5.0",
"version": "5.0.1",
"description": "Search Wikipedia in every language from the search bar.",
"options_page": "options.html",
"omnibox": {
Expand Down
2 changes: 1 addition & 1 deletion welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</head>
<body>
<section id="wrapper" class="wrapper enabled">
<h1>Welcome to Wikipedia Search 5!</h1>
<h1>Welcome to Wikipedia Search 5.0.1!</h1>
<article>
<h2>New ways to search</h2>
<p>You may notice that the old W button is missing. <b>That's because you can now search straight from the search bar!</b></p>
Expand Down

0 comments on commit 8962db0

Please sign in to comment.