Skip to content
This repository has been archived by the owner on Jun 21, 2021. It is now read-only.

Commit

Permalink
Removed lscache, was causing bugs. Rely on browser cache for get
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvipanda committed Oct 26, 2011
1 parent 813e24c commit a287ab4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 156 deletions.
7 changes: 4 additions & 3 deletions background.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.5.2.min.js"> </script>
<script src="lscache.js"> </script>
<script src="background.js"> </script>
<script type="text/javascript" src="jquery-1.5.2.min.js"> </script>
<script type="text/javascript" src="background.js"> </script>
<title>yenWikipedia alternate wikipedia language suggestor</title>
</head>
</html>
18 changes: 6 additions & 12 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,21 @@ function objectifyLinks(data, callback) {
object = {};
$(data).find("ll").each(function() {
object[$(this).attr("lang")] = $(this).text();
callback(object);
});
callback(object);
}

function getLocalName(title, callback) {
var lang = localStorage['language'];
if (!lang) {
lang = 'ta';
}
if (lscache.get(title)) {
object = lscache.get(title);
doFoundCallback(object, lang, callback);
} else {
var url = "http://en.wikipedia.org/w/api.php?action=query&titles=" + title + "&prop=langlinks&lllimit=500&format=xml";
$.get(url, dataType="xml", function(data) {
objectifyLinks(data, function(object) {
lscache.set(title, object, expiryTime);
doFoundCallback(object, lang, callback);
});
var url = "http://en.wikipedia.org/w/api.php?action=query&titles=" + title + "&prop=langlinks&lllimit=500&format=xml";
$.get(url, dataType="xml", function(data) {
objectifyLinks(data, function(object) {
doFoundCallback(object, lang, callback);
});
}
});
}

function onRequest(request, sender, callback) {
Expand Down
1 change: 0 additions & 1 deletion injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ function initEvents() {
}
$(searchBody).bind('DOMSubtreeModified', function() {
throttledDoReplace();
console.log("heya");
});

// Initial call, to handle first load
Expand Down
140 changes: 0 additions & 140 deletions lscache.js

This file was deleted.

0 comments on commit a287ab4

Please sign in to comment.