Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
Added support for reddit, changed name and icon of extension, made ch…
Browse files Browse the repository at this point in the history
…anges to tab opening, so it opens a new tab everytime.
  • Loading branch information
normano committed Nov 3, 2012
1 parent a4c9236 commit ea54edd
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 125 deletions.
24 changes: 12 additions & 12 deletions README
@@ -1,13 +1,13 @@
HackerNews News recommender for Google Chrome

Uses the naive bayes classifier for classification of posts you found interesting and not interesting. It attempts to predict what you like based of your past interactions. If you'd like to learn more visit http://normansoven.com/blog/?p=651

How to use:
If you currently have the extension installed, remove it.
1. On the extensions page, check developer mode if you haven't already.
2. Click Load unpacked extension and go to the folder that contains the source code.
Done, simple as pie!.

When ever you make changes to your version of the extension, while on the extensions page,click reload under the extension.

ExContent Recommender for Google Chrome
The ExContent Recommender uses a variant of the naive bayes classifier for classification of interesting and not interesting posts. It highlights the ones that were highlighted as interesting. In other words, it attempts to predict what you like based on articles you clicked. If you'd like to learn more visit http://normansoven.com/blog/?p=651
How to use:
If you currently have the extension installed, remove it.
1. On the extensions page, check developer mode if you haven't already.
2. Click Load unpacked extension and go to the folder that contains the source code.
Done, simple as pie!.
Whenever you make changes to your version of the extension, while on the extensions page click reload under the extension.
Hope this helps!
39 changes: 34 additions & 5 deletions dataExtractor.js
Expand Up @@ -7,20 +7,43 @@ function initializeRequest(response)
{
extOnline = response.status; // Do I?
var titlesEle = {};
var websites = {
'newsAtYC': {'regExp': new RegExp("news.ycombinator.com", "i")},
'reddit': { 'regExp': new RegExp("reddit.com", "i")}
};

// Check if extension is online
if(extOnline == "yes")
{
// Setting up listeners
$(document).ready(pageReady); // We are ready
$(window).delegate(".title a", 'click', titleClick);// Add a listener to listen for clicks on the elements
$(window).delegate(".title>a", 'click', titleClick);// Add a listener to listen for clicks on the elements

// Reddit
if(window.document.documentURI.match(websites.reddit.regExp))
{
$(window).delegate(".nextprev>a", 'click', trainClick);// Reddit specific listener
}
$(window).bind('beforeunload', pageUnload); // On unload, tell extension to remove our articles



function pageReady(event)
{
var docURI = window.document.documentURI;
///// Data Extraction
// Extract titles from page, except the more link
titlesEle = $('.title a').slice(0, -1);
// Extract titles from page
// newsYC specific
if(docURI.match(websites.newsAtYC.regExp))
{
// except the more link
titlesEle = $('.title>a').slice(0, -1);
}
else if(docURI.match(websites.reddit.regExp))
{
titlesEle = $('.sitetable .title>a')
}

var articleData = []; // Array of objects is better

// Extract titles
Expand Down Expand Up @@ -55,7 +78,7 @@ function initializeRequest(response)
// If we clicked the more button to process dataset
if( element.text() === "More" )
{
chrome.extension.sendMessage({request: "train"});
trainClick();
return; // Nothing more needs to be done.
}

Expand All @@ -65,14 +88,20 @@ function initializeRequest(response)
chrome.extension.sendMessage({request: "label", dataPoint: {title: textNormalized, link:link, label: 1}});

event.preventDefault(); // Yeah....
window.open(link, '_newtab');
window.open(link, '_blank');
}

function pageUnload(event)
{
// Remove the stored tab's data
chrome.extension.sendMessage({request: "removeTabData"});
}

/* Send message to extension to train on data set*/
function trainClick()
{
chrome.extension.sendMessage({request: "train"});
}
}
}

Expand Down
Binary file modified icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified iconOff.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added iconfull.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ea54edd

Please sign in to comment.