From 153445a5a3366eefbeafb2311d0b2d63b761b92e Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Fri, 23 Dec 2016 11:42:48 +0700 Subject: [PATCH] Merged some changes from wrapperband --- manifest.json | 2 +- option-script.js | 4 ++-- package.json | 2 +- trackmenot.js | 31 ++++++++++++++++++------------- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/manifest.json b/manifest.json index c6517f1..9c6e393 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "TrackMeNot", "description": "TMN WebExtension portage", - "version": "0.10.10", + "version": "0.10.11", "background": { "scripts": [ "trackmenot.js" diff --git a/option-script.js b/option-script.js index 1788e06..34864a0 100644 --- a/option-script.js +++ b/option-script.js @@ -122,7 +122,7 @@ function TMNClearLogs() { function TMNShowLog() { let logs = tmn._getLogs(); - let htmlStr = ''; + let htmlStr = '
'; htmlStr += ''; htmlStr += ''; htmlStr += ''; @@ -167,7 +167,7 @@ function TMNShowEngines(engines) { function TMNShowQueries() { let sources = tmn._getAllQueries(); let htmlStr = 'Userlist | DHS | RSS | Popular | Extracted'; - htmlStr += '
EngineMode
'; + htmlStr += '
'; let default_options = tmn._getOptions(); if ( sources.userlist ) { diff --git a/package.json b/package.json index 4025335..eb9d61d 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "fullName" : "TrackMeNot", "license": "GPL 2.0", "author": "Daniel Howe, Helen Nissenbaum, Vincent Toubiana", - "version": "0.10.10", + "version": "0.10.11", "homepage": "http://www.cs.nyu.edu/trackmenot/", "icon":"data/images/skin/tmn.png", "main": "trackmenot", diff --git a/trackmenot.js b/trackmenot.js index 9fc26c9..ea93bac 100644 --- a/trackmenot.js +++ b/trackmenot.js @@ -533,17 +533,19 @@ TRACKMENOT.TMNSearch = function() { // Parse the HTML into phrases let l = html.split(/((<\?tr>)|(
)|(<\/?p>))/i); for (let i = 0; i < l.length; i++) { - if (!l[i] || l[i] == 'undefined') continue; - l[i] = l[i].replace(/(<([^>]+)>)/ig, ' '); - //if (/([a-z]+ [a-z]+)/i.test(l[i])) { - //let reg = /([a-z]{4,} [a-z]{4,} [a-z]{4,} ([a-z]{4,} ?) {0,3})/i; - let matches = l[i].split(' ');//reg.exec(l[i]); - if (!matches || matches.length < 2) + if (!l[i] || l[i] == 'undefined') continue; - let newQuery = trim(matches[1]); - // if ( phrases.length >0 ) newQuery.unshift(" "); - if (newQuery && phrases.indexOf(newQuery) < 0) - phrases.push(newQuery); + l[i] = l[i].replace(/(<([^>]+)>)/ig, ' '); + if (/([a-z]+ [a-z]+)/i.test(l[i])) { + let reg = /([a-z]{4,} [a-z]{4,} [a-z]{4,} ([a-z]{4,} ?) {0,3})/i; + let matches = l[i].split(' ');//reg.exec(l[i]); + if (!matches || matches.length < 2) + continue; + let newQuery = trim(matches[1]); + // if ( phrases.length >0 ) newQuery.unshift(" "); + if (newQuery && phrases.indexOf(newQuery) < 0) + phrases.push(newQuery); + } } const queryToAdd = phrases.join(' '); @@ -951,7 +953,8 @@ TRACKMENOT.TMNSearch = function() { } function scheduleNextSearch(delay) { - if (!enabled) return; + if (!enabled) + return; if (delay > 0) { if (!isBursting()) { // randomize to approach target frequency let offset = delay * (Math.random() / 2); @@ -960,8 +963,10 @@ TRACKMENOT.TMNSearch = function() { delay += delay * (Math.random() - 0.5); } } - if (isBursting()) engine = burstEngine; - else engine = chooseEngine(searchEngines.split(',')); + if (isBursting()) + engine = burstEngine; + else + engine = chooseEngine(searchEngines.split(',')); debug('NextSearchScheduled on: ' + engine); tmn_errTimeout = window.setTimeout(rescheduleOnError, delay * 3); tmn_searchTimer = window.setTimeout(doSearch, delay);