Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion option-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function loadHandlers() {
$("#overlay_queries").unbind().click(TMNHideQueries);

$("#validate-feed").unbind().click(function() {
var feeds = $("#trackmenot-seed").val();
var feeds = $("#trackmenot-seed").val().split('|');
var param = {
"feeds": feeds
};
Expand Down
9 changes: 6 additions & 3 deletions trackmenot.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ TRACKMENOT.TMNSearch = function() {
);

function trim(s) {
return s.replace(/\n/g, '');
return s.replace(/\n/g, '').replace(/^\s+|\s+$/g,'');
}

function cerr(msg, e) {
Expand Down Expand Up @@ -362,7 +362,9 @@ TRACKMENOT.TMNSearch = function() {


function randomQuery() {
var typeoffeeds = Object.keys(TMNQueries);
var typeoffeeds = Object.keys(TMNQueries);
//filter out empty feeds
typeoffeeds = typeoffeeds.filter(function(feed_type){return TMNQueries[feed_type].length;});
var qtype = randomElt(typeoffeeds);
var queries = [];
if (qtype !== 'zeitgeist' && qtype !== 'extracted') {
Expand Down Expand Up @@ -414,7 +416,7 @@ TRACKMENOT.TMNSearch = function() {
var queryToAdd = phrases.join(" ");
if (queryToAdd.length < 4)
return;
TMNQueries.extracted = [].concat(TMNQueries.extracted);
TMNQueries.extracted = TMNQueries.extracted || [];
while (TMNQueries.extracted.length > 200) {
var rand = roll(0, TMNQueries.extracted.length - 1);
TMNQueries.extracted.splice(rand, 1);
Expand Down Expand Up @@ -525,6 +527,7 @@ TRACKMENOT.TMNSearch = function() {
addQuery(queryToAdd, feedObject.words);
}
cout(feedObject.name + " : " + feedObject.words);
if (feedObject.words.length == 0) return 0;
TMNQueries.rss.push(feedObject);

return 1;
Expand Down