Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: fcacee57bb
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 74 lines (66 sloc) 2.372 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
<!-- -
Jeter Filter - Background Page

Four functions currently:

1) Display badge in address bar alerting user that Number Two may be on page.
2) Log URI with FluidInfo.
3) Log event with Google Analytics.
4) Get extension's stored values.
5) Log local statistics.
-->
<!DOCTYPE html>
<html>
  <head>
<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
   <script type="text/javascript" src="js/analytics.js"></script>
   <script type="text/javascript" src="js/jsFluidDB.js"></script>
    <script>
      var fluidDBUsername = "jeterfilter";
      var fluidDBPassword = "fucktheyankees";
      
      function onRequest(request, sender, sendResponse) {
if (request.method == "loadFilter") {
console.log("Retrieving user's filter settings...");
console.log(localStorage.selectedFilter);
sendResponse({filter: localStorage.selectedFilter});
} else if (request.method == "saveStats") {
console.log("Storing stats...");
console.log ("Adding " + request.jeters + " Jeters to stats.");
localStorage.jeters = parseInt(localStorage.jeters) + parseInt(request.jeters);
localStorage.pages = parseInt(localStorage.pages) + 1;
sendResponse({});
} else {
// Show icon
console.log("Putting badge on address bar.");
chrome.pageAction.show(sender.tab.id);

// Log event with Google Analytics
console.log("Logging URI with Number Two: " + sender.tab.url);
_gaq.push(['_trackEvent', 'Filter', sender.tab.url]);

// Log Event with FluidInfo

console.log("Publishing URI to FluidInfo: " + sender.tab.url);
fluidDB.post({
url: 'about/' + encodeURIComponent(sender.tab.url),
async: false,
username: fluidDBUsername,
password: fluidDBPassword,
success: function(json) {
console.log('URI Logged: ' + encodeURIComponent(sender.tab.url));
console.log(json);
}
});
fluidDB.put({
url: 'about/' + encodeURIComponent(sender.tab.url) + '/jeterfilter/contains-jeter',
payload: Math.round(((new Date()).getTime()-Date.UTC(1970,0,1))/1000),
primitive: true,
async: false,
username: fluidDBUsername,
password: fluidDBPassword,
success: function(json) {
console.log('URI tagged as containing Jeter.');
}
});

sendResponse({});
}
      }
      chrome.extension.onRequest.addListener(onRequest);
    </script>
  </head>
</html>
Something went wrong with that request. Please try again.