Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump mixin-deep from 1.3.1 to 1.3.2 #6

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
700b5c3
Inicio de plugin
LeonardoVaquel Mar 15, 2019
3e838e1
Fixed to try compile the plugin
LeonardoVaquel Mar 15, 2019
79302d7
Change images and icon
LeonardoVaquel Mar 18, 2019
5fbae3e
add scan function
Mar 19, 2019
97a7cd5
add popup and scan function
Apr 15, 2019
1689d53
Added default placeholder for dropdown menu and bugs report reference
LeonardoVaquel Apr 15, 2019
67506ca
Added styles for dropdown menu and info section
LeonardoVaquel Apr 15, 2019
4865bab
Added plugin icon
LeonardoVaquel Apr 15, 2019
ef2de36
first version of publi electoral plugin
May 22, 2019
add9e67
fix mozilla warnings
May 23, 2019
28004c4
change ads backend URL, add new political accounts
Jun 11, 2019
42b22f9
Changed everything that refer to PubliElectoral
LeonardoVaquel Jun 11, 2019
e23c2b0
Changed app name in package-lock.json
LeonardoVaquel Jun 11, 2019
6925828
Changed gecko id
LeonardoVaquel Jun 12, 2019
104379d
Added commentaries
LeonardoVaquel Jun 12, 2019
42cd246
Added plugin image for documentation
LeonardoVaquel Jun 12, 2019
9ca743b
Updated README with documentation
LeonardoVaquel Jun 12, 2019
c713906
Changed gecko id
LeonardoVaquel Jun 13, 2019
6762bec
Deleted plugin image of icons folder
LeonardoVaquel Jun 13, 2019
85f4ecf
Added Documentation folder with the images directory
LeonardoVaquel Jun 13, 2019
4405e81
Moved spanish version README to Documentation/es directory
LeonardoVaquel Jun 13, 2019
a6807f7
Translate Documentation to English
LeonardoVaquel Jun 13, 2019
5de80f2
Fix image route in spanish version README
LeonardoVaquel Jun 13, 2019
b52dda3
Changed extension-bolierplate link
LeonardoVaquel Jun 13, 2019
926cb20
Changed extension-boilerplate link in spanish version README
LeonardoVaquel Jun 13, 2019
643fa00
Fixed the word firefox in English README
LeonardoVaquel Jun 24, 2019
dce25d5
Merge pull request #1 from Cambalab/feature/#19-white-base-para-liber…
LeonardoVaquel Jun 24, 2019
b85a62a
Fixed repository url in the clone instruction
LeonardoVaquel Jun 25, 2019
6b89d35
Fixed repository Url in Documentations
LeonardoVaquel Jun 25, 2019
2ce793f
Update regex validantion
LeonardoVaquel Jan 8, 2020
cbfee86
Removed resources
LeonardoVaquel Jan 8, 2020
0c06203
Bump mixin-deep from 1.3.1 to 1.3.2
dependabot[bot] Jan 8, 2020
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
temp
.tmp
dist
.sass-cache
.DS_Store
build
.directory
84 changes: 84 additions & 0 deletions Documentation/es/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<div align="center">
<h1>
Advertising Detector Plug-in
</h1>
<p>
<strong>Este desarrollo se llevo a cabo sobre <a href="https://github.com/EmailThis/extension-boilerplate">extension-boilerplate</a> </strong>
</p>
<img src="../images/plugin.png" alt="advertising detector plugin">
</div>

## Features
+ Se pueden configurar las cuentas de donde saldrá la publicidad a relevar.
+ Se puede configurar un backend donde se manda la información relevada.
+ Se puede buildear para Chrome, Mozilla y Opera.
+ Más features [aquí](https://github.com/EmailThis/extension-boilerplate#features)

## Instalación
+ Clonar el repositorio ```git clone https://github.com/Cambalab/adv-detector-plugin.git ```
+ Ejecutar ```npm install```
+ Ejecutar ```npm run build```

## Compilar para distintos Navegadores
+ Navegadores Chrome y Opera
- Para Google Chrome, ejectuar ```npm run chrome-build```
- Para Opera, ejecutar ```npm run opera-build```
+ Navegador Mozilla Firefox
- Ejecutar ```npm run firefox-build```

Se creará en el directorio ```adv-detector-plugin/build/``` una carpeta por navegador con la versión compilada.
+ Para cargar la extensión en Google Chrome y Opera, abrir el navegador y en escribir la dirección ```chrome://extensions``` elegir *"Modo Desarrollador"* hacer clic en *"Cargar Extensión sin empaquetar"* y cargar desde el file system ```adv-detector-plugin/build/chrome``` o ```adv-detector-plugin/build/opera```
+ Para cargar la extensión en Mozilla Firefox, abrir el navegador y escribir en la dirección ```about:debugging``` hacer clic en *"Cargar Complemento Temporario"* y desde el file system cargar el directorio ```adv-detector-plugin/build/firefox```

## Empaquetado
+ Ejecutar ```npm run chrome-dist``` , ```npm run firefox-dist``` o ```npm run opera-dist``` y se creará un archivo **.zip** en ```adv-detector-plugin/dist``` para el navegador elegido, listo para subirla a la AppStore.

## Configuración
+ En el archivo `adv-detector-plugin/src/config.js` se configuran en un array, las cuentas de Facebook de las que se van a querer monitorear su publicidad

```javascript
"accounts": [
{
"name": "Account Name", // for example: Facebook
"page_id": "Page id", // for example: 185150934832623
"page_name": "Url page" // for example: https://www.facebook.com/enespanol/
}
],
```

+ Para configurar las ciudades, agregarlas en *locations*

```javascript
"locations": [
"Select an option",
"City one",
"City two",
"City three",
"City four",
"City five",
"City six",
"City seven",
"City eight",
"City nine",
"City ten"
],
```

+ Dirección del Backend a donde va a mandar la información relevada

```javascript
"adUri": "API Backend URL", // Backend url
```

+ Configurar los selectores con el cual se define una *Publicidad* en Facebook

```javascript
"fbAds": {
"mainContainerQuerySelector": "[id^='topnews_main_stream_'",
"profileIdContainerQuerySelector": "a[title='Perfil']",
"targetAdWord": "Publicidad",
"postQuerySelector": "hyperfeed_story_id_",
"postSubtitleQuerySelector": "[id^='fe_edsubtitle']",
"postIdQuerySelector": "[name=ft_ent_identifier]"
}
```
Binary file added Documentation/images/plugin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 87 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<div align="center">
<h1>
Advertising Detector Plugin
</h1>
<p>
<strong>This Plugin was developed about <a href="https://github.com/EmailThis/extension-boilerplate">extension-boilerplate</a> </strong>
</p>
<img src="./Documentation/images/plugin.png" alt="advertising detector plugin">
</div>


***Spanish Version*** [here](./Documentation/es/README.md)

## Features
+ You can set the accounts where then it's going to get the advertising to monitor.
+ You can set the Backend API Url where it's going to send the info.
+ You can build to Chrome, Mozilla and Opera browsers.
+ More features [here](https://github.com/EmailThis/extension-boilerplate#features)

## Install
+ Clone the repository ```git clone https://github.com/Cambalab/adv-detector-plugin.git ```
+ Run ```npm install```
+ Run ```npm run build```

## Build for each Browser
+ For Chrome and Opera browsers
- **Chrome:** run ```npm run chrome-build```
- **Opera:**, run ```npm run opera-build```
+ For Mozilla **Firefox browser**
- Run ```npm run firefox-build```

In the directory ```adv-detector-plugin/build/``` will be create a new folder for each browser with the builded version.
+ For load the extension in Chrome and Opera browsers, open it and navigate to ```chrome://extensions``` then choose *"Developer Mode"*. Do click on *"Load unpacked extension"* and from the file system load ```adv-detector-plugin/build/chrome``` or ```adv-detector-plugin/build/opera```
+ For load the extension in Firefox browser, open it and navigate to ```about:debugging``` then choose *"Load Temporary Add-on"* and from the file system load ```adv-detector-plugin/build/firefox```

## Packaging
+ Run ```npm run chrome-dist``` , ```npm run firefox-dist``` or ```npm run opera-dist``` and will be create a **zipped** file in ```adv-detector-plugin/dist``` for the browser that has been choosed, ready to upload to the AppStore.

## Settings
+ In the file `adv-detector-plugin/src/config.js` is an array with the accounts that going to monitor.

```javascript
"accounts": [
{
"name": "Account Name", // for example: Facebook
"page_id": "Page id", // for example: 185150934832623
"page_name": "Url page" // for example: https://www.facebook.com/enespanol/
}
],
```

+ For configure the location, add the options in the array *locations*

```javascript
"locations": [
"Select an option",
"City one",
"City two",
"City three",
"City four",
"City five",
"City six",
"City seven",
"City eight",
"City nine",
"City ten"
],
```

+ Backend API Url, where it will be send the information

```javascript
"adUri": "API Backend URL", // Backend url
```

+ To set the *HTML* selectors with that Facebook define the **Sponsored** posts (advertising)

```javascript
"fbAds": {
"mainContainerQuerySelector": "[id^='topnews_main_stream_'",
"profileIdContainerQuerySelector": "a[title='Perfil']",
"targetAdWord": "Sponsored",
"postQuerySelector": "hyperfeed_story_id_",
"postSubtitleQuerySelector": "[id^='fe_edsubtitle']",
"postIdQuerySelector": "[name=ft_ent_identifier]"
}
```
3 changes: 3 additions & 0 deletions config/chrome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extension": "chrome"
}
3 changes: 3 additions & 0 deletions config/development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"env": "development"
}
3 changes: 3 additions & 0 deletions config/firefox.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extension": "firefox"
}
3 changes: 3 additions & 0 deletions config/opera.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extension": "opera"
}
3 changes: 3 additions & 0 deletions config/production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"env": "production"
}
153 changes: 153 additions & 0 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
var fs = require('fs');
var gulp = require('gulp');
var merge = require('event-stream').merge;
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var preprocessify = require('preprocessify');
var gulpif = require('gulp-if');

const $ = require('gulp-load-plugins')();

var production = process.env.NODE_ENV === "production";
var target = process.env.TARGET || "chrome";
var environment = process.env.NODE_ENV || "development";

var generic = JSON.parse(fs.readFileSync(`./config/${environment}.json`));
var specific = JSON.parse(fs.readFileSync(`./config/${target}.json`));
var context = Object.assign({}, generic, specific);

var manifest = {
dev: {
"background": {
"scripts": [
"scripts/background.js"
]
}
},

firefox: {
"applications": {
"gecko": {
"id": "advertising-detector-plugin"
}
}
}
}

// Tasks
gulp.task('clean', () => {
return pipe(`./build/${target}`, $.clean())
})

gulp.task('build', (cb) => {
$.runSequence('clean', 'styles', 'ext', cb)
});

gulp.task('default', ['build']);

gulp.task('ext', ['manifest', 'js'], () => {
return mergeAll(target)
});


// -----------------
// COMMON
// -----------------
gulp.task('js', () => {
return buildJS(target)
})

gulp.task('styles', () => {
return gulp.src('src/styles/**/*.scss')
.pipe($.plumber())
.pipe($.sass.sync({
outputStyle: 'expanded',
precision: 10,
includePaths: ['.']
}).on('error', $.sass.logError))
.pipe(gulp.dest(`build/${target}/styles`));
});

gulp.task("manifest", () => {
return gulp.src('./manifest.json')
.pipe(gulpif(!production, $.mergeJson({
fileName: "manifest.json",
jsonSpace: " ".repeat(4),
endObj: manifest.dev
})))
.pipe(gulpif(target === "firefox", $.mergeJson({
fileName: "manifest.json",
jsonSpace: " ".repeat(4),
endObj: manifest.firefox
})))
.pipe(gulp.dest(`./build/${target}`))
});



// -----------------
// DIST
// -----------------
gulp.task('dist', (cb) => {
$.runSequence('build', 'zip', cb)
});

gulp.task('zip', () => {
return pipe(`./build/${target}/**/*`, $.zip(`${target}.zip`), './dist')
})


// Helpers
function pipe(src, ...transforms) {
return transforms.reduce((stream, transform) => {
const isDest = typeof transform === 'string'
return stream.pipe(isDest ? gulp.dest(transform) : transform)
}, gulp.src(src))
}

function mergeAll(dest) {
return merge(
pipe('./src/icons/**/*', `./build/${dest}/icons`),
pipe(['./src/_locales/**/*'], `./build/${dest}/_locales`),
pipe([`./src/images/${target}/**/*`], `./build/${dest}/images`),
pipe(['./src/images/shared/**/*'], `./build/${dest}/images`),
pipe(['./src/**/*.html'], `./build/${dest}`)
)
}

function buildJS(target) {
const files = [
'background.js',
'contentscript.js',
'options.js',
'popup.js',
'../config/config.js'
]

let tasks = files.map( file => {
return browserify({
entries: 'src/scripts/' + file,
debug: true
})
.transform('babelify', { presets: ['es2015'] })
.transform(preprocessify, {
includeExtensions: ['.js'],
context: context
})
.bundle()
.pipe(source(file))
.pipe(buffer())
.pipe(gulpif(!production, $.sourcemaps.init({ loadMaps: true }) ))
.pipe(gulpif(!production, $.sourcemaps.write('./') ))
.pipe(gulpif(production, $.uglify({
"mangle": false,
"output": {
"ascii_only": true
}
})))
.pipe(gulp.dest(`build/${target}/scripts`));
});

return merge.apply(null, tasks);
}
Binary file added icons/icon-alt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "Advertising_Detector_Plug-in",
"version": "0.0.1",
"manifest_version": 2,
"description": "This Plug-in scans the advertising that appear on your Facebook news feed.",
"default_locale": "en",
"icons": {
"16": "icons/icon.png"
},
"permissions": [
"*://*.facebook.com/",
"*://*.facebook.com/?ref=logo",
"storage"
],
"background": {
"scripts": ["scripts/background.js"]
},
"content_scripts": [
{
"matches": [
"*://*.facebook.com/",
"*://*.facebook.com/?ref=logo"
],
"js": [
"scripts/contentscript.js"
],
"run_at": "document_end"
}
],
"browser_action": {
"default_icon": {
"16": "icons/icon.png"
},
"default_title": "Advertising Detector Plug-in",
"default_popup": "popup.html"
}
}
Loading