1
1
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
-
3
-
},{}],2:[function(require,module,exports){
4
2
/*!
5
3
* Chameleon
6
4
*
@@ -20,7 +18,8 @@ var ALL_URLS = { urls: ['http://*/*', 'https://*/*'] },
20
18
ENABLED = true;
21
19
22
20
var tabData = require('../lib/tabdata'),
23
-
sendMessage = require('../lib/utils').sendMessage;
21
+
sendMessage = require('../lib/content_script_utils').sendMessage,
22
+
utils = require('../lib/utils');
24
23
25
24
// TODO https://developer.chrome.com/extensions/webRequest#life_cycle_footnote
26
25
// The following headers are currently not provided to the onBeforeSendHeaders event.
@@ -103,7 +102,7 @@ function updateBadge(tab_id) {
103
102
text = '';
104
103
105
104
if (data) {
106
-
text = _.size(data.counts).toString();
105
+
text = utils.getAccessCount(data.counts).toString();
107
106
}
108
107
109
108
chrome.browserAction.setBadgeText({
@@ -228,7 +227,52 @@ chrome.webNavigation.onCommitted.addListener(onNavigation);
228
227
// TODO switch to chrome.alarms?
229
228
setInterval(tabData.clean, 300000);
230
229
231
-
},{"../lib/tabdata":3,"../lib/utils":4}],3:[function(require,module,exports){
230
+
},{"../lib/content_script_utils":2,"../lib/tabdata":3,"../lib/utils":4}],2:[function(require,module,exports){
231
+
/*!
232
+
* Chameleon
233
+
*
234
+
* Copyright 2014 ghostwords.
235
+
*
236
+
* This Source Code Form is subject to the terms of the Mozilla Public
237
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
238
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
239
+
*
240
+
*/
241
+
242
+
/*
243
+
* This module needs to work both inside content scripts and the rest of the
244
+
* extension, like the browser popup.
245
+
*
246
+
* Content scripts have certain limitations in Chrome:
247
+
* https://developer.chrome.com/extensions/content_scripts
248
+
*/
249
+
250
+
// acceptable signatures:
251
+
// name
252
+
// name, message
253
+
// name, callback
254
+
// name, message, callback
255
+
module.exports.sendMessage = function (name, message, callback) {
256
+
var args = [{ name: name }];
257
+
258
+
if (Object.prototype.toString.call(message) == '[object Function]') {
259
+
// name, callback
260
+
args.push(message);
261
+
} else {
262
+
if (message) {
263
+
// name, message, [callback]
264
+
args[0].message = message;
265
+
}
266
+
if (callback) {
267
+
// name, [message], callback
268
+
args.push(callback);
269
+
}
270
+
}
271
+
272
+
chrome.runtime.sendMessage.apply(chrome.runtime, args);
273
+
};
274
+
275
+
},{}],3:[function(require,module,exports){
232
276
/*!
233
277
* Chameleon
234
278
*
@@ -246,7 +290,8 @@ var data = {};
246
290
247
291
var tabData = {
248
292
record: function (tab_id, access) {
249
-
var key = access.obj + '.' + access.prop;
293
+
var key = access.obj + '.' + access.prop,
294
+
script_url = access.scriptUrl || '<unknown>';
250
295
251
296
if (!data.hasOwnProperty(tab_id)) {
252
297
data[tab_id] = {
@@ -255,15 +300,22 @@ var tabData = {
255
300
};
256
301
}
257
302
303
+
var datum = data[tab_id];
304
+
305
+
// font enumeration
258
306
if (access.prop == 'style.fontFamily') {
259
-
data[tab_id].fontEnumeration = true;
307
+
datum.fontEnumeration = true;
260
308
}
261
309
262
-
if (!data[tab_id].counts.hasOwnProperty(key)) {
263
-
data[tab_id].counts[key] = 0;
310
+
// javascript property access counts indexed by script URL
311
+
if (!datum.counts.hasOwnProperty(script_url)) {
312
+
datum.counts[script_url] = {};
264
313
}
265
-
266
-
data[tab_id].counts[key]++;
314
+
var counts = datum.counts[script_url];
315
+
if (!counts.hasOwnProperty(key)) {
316
+
counts[key] = 0;
317
+
}
318
+
counts[key]++;
267
319
},
268
320
269
321
get: function (tab_id) {
@@ -300,33 +352,19 @@ module.exports = tabData;
300
352
*
301
353
*/
302
354
303
-
/*
304
-
* This module needs to work both inside content scripts and the browser popup.
305
-
*/
355
+
// used by the badge and the popup
356
+
module.exports.getAccessCount = function (counts) {
357
+
// count unique keys across all counts objects
358
+
var props = {};
306
359
307
-
// acceptable signatures:
308
-
// name
309
-
// name, message
310
-
// name, callback
311
-
// name, message, callback
312
-
module.exports.sendMessage = function (name, message, callback) {
313
-
var args = [{ name: name }];
314
-
315
-
if (Object.prototype.toString.call(message) == '[object Function]') {
316
-
// name, callback
317
-
args.push(message);
318
-
} else {
319
-
if (message) {
320
-
// name, message, [callback]
321
-
args[0].message = message;
322
-
}
323
-
if (callback) {
324
-
// name, [message], callback
325
-
args.push(callback);
360
+
// no need for hasOwnProperty loop checks in this context
361
+
for (var url in counts) { // jshint ignore:line
362
+
for (var prop in counts[url]) { // jshint ignore:line
363
+
props[prop] = true;
326
364
}
327
365
}
328
366
329
-
chrome.runtime.sendMessage.apply(chrome.runtime, args);
367
+
return Object.keys(props).length;
330
368
};
331
369
332
-
},{}]},{},[2])
370
+
},{}]},{},[1])
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3