Skip to content

Commit

Permalink
add minification + source maps
Browse files Browse the repository at this point in the history
  • Loading branch information
remusao committed Jun 20, 2019
1 parent 5185b39 commit 8262aec
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
background.bundle.js
background.bundle.js.map
content-script.bundle.js
content-script.bundle.js.map
1 change: 0 additions & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,6 @@ function getCompanyName(hostname, partialHostName) {

return {
company_name: 'Unknown',
tracker_host: 'Unknown',
tracker_id: 'Unknown',
tracker_host: hostname
};
Expand Down
215 changes: 215 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"dexie": "^2.0.4"
},
"devDependencies": {
"@ampproject/rollup-plugin-closure-compiler": "^0.9.0",
"concurrently": "^4.1.0",
"rollup": "^1.15.6",
"rollup-plugin-commonjs": "^10.0.0",
Expand Down
4 changes: 4 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
import json from 'rollup-plugin-json';
import compiler from '@ampproject/rollup-plugin-closure-compiler';

const plugins = [
json(),
resolve({
preferBuiltins: false,
}),
commonjs(),
compiler(),
];

export default [
Expand All @@ -17,6 +19,7 @@ export default [
file: 'background.bundle.js',
format: 'iife',
name: 'localSheriff',
sourcemap: true,
},
plugins,
},
Expand All @@ -26,6 +29,7 @@ export default [
file: 'content-script.bundle.js',
format: 'iife',
name: 'localSheriff',
sourcemap: true,
},
plugins,
},
Expand Down
9 changes: 4 additions & 5 deletions scripts/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
We need to capture data being entered in the input fields and check it was shared with trackers.
*/

import { chrome, browser } from '../globals';

// Check cases like: https://www.swm.de/privatkunden/mein-swm/zaehlerstand#/
// Other issues where it's autocompleted. Only partial results are shown.
// Check what all information needs to be saved.
Expand All @@ -23,7 +25,7 @@ function loadListeners(evt){
document.forms[i].addEventListener("blur", function( event ) {
// We should generally avoid saving passwords. // May be not save it but just check and notify it to the user.
if (event.srcElement.type !== 'password') {

const value = event.srcElement.value.slice(0,20);
const additionalInfo = {
type: 'inputFields',
Expand Down Expand Up @@ -57,9 +59,6 @@ function loadListeners(evt){

// If there is a neat way to detect dom load finished, that would be preferrered.
// Let's check if this is a private tab. If yes then do not load content-script here.
if(typeof('chrome') === 'undefined') {
var chrome = browser;
}
if (!chrome.extension.inIncognitoContext) {
window.setTimeout(loadListeners, 2500);
}
}

0 comments on commit 8262aec

Please sign in to comment.