├── .gitignore ├── LICENSE ├── README.md ├── build ├── app.css ├── description.txt ├── icons │ ├── icon-128.png │ ├── icon-16.png │ └── icon-48.png └── manifest.json ├── contrib ├── demo.gif ├── normal.png └── screenshot.png ├── package.json ├── src └── app.coffee └── tests └── tests.coffee /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | build/*.js 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Eduardo Cuducos 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UOL Esportes Sexista 2 | 3 | A [Google Chrome](https://www.google.com/chrome) extension that redacts arguably sexist contents from [UOL](hrtp://uol.com.br) sports coverage. 4 | 5 | [![Install it directly from Chrome Web Store](https://developer.chrome.com/webstore/images/ChromeWebStore_BadgeWBorder_v2_206x58.png)](https://chrome.google.com/webstore/detail/uol-esportes-sexista/igafcoicgojeeaiglfmbgdppgbfaifjh) 6 | 7 | > In the future I might port this to Firefox, Safari… and surely _pull request_ are welcomed! 8 | 9 | ## Example 10 | 11 | ![Example](contrib/demo.gif) 12 | 13 | ## Contribute 14 | 15 | Basically the extension is based on the file `build/app.js`, generated with `npm run build`. 16 | 17 | To install the dependencies just run `npm install --only dev`. 18 | 19 | The plugin is coded using [CoffeeScript](http://coffeescript.org) and tested with [mocha](http://mochajs.org/) via `npm t`. 20 | 21 | ## Credits 22 | 23 | Icon 24 | [Winner Podium](https://thenounproject.com/term/winner-podium/114603) by [TukTuk Design](https://thenounproject.com/tuktuk) from the [Noun Project](https://thenounproject.com/). 25 | 26 | ## License 27 | 28 | Licensed under the [MIT LICENSE](https://github.com/cuducos/SemBelas/blob/master/LICENSE). -------------------------------------------------------------------------------- /build/app.css: -------------------------------------------------------------------------------- 1 | .conteudo-sexista{text-decoration:line-through} 2 | -------------------------------------------------------------------------------- /build/description.txt: -------------------------------------------------------------------------------- 1 | Extensão que censura conteúdos sexistas do portal de Espores do UOL. 2 | -------------------------------------------------------------------------------- /build/icons/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuducos/UOLEsportesSexista/c071ab7b0b85f6c227b32f987e71fc98a9d5ad07/build/icons/icon-128.png -------------------------------------------------------------------------------- /build/icons/icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuducos/UOLEsportesSexista/c071ab7b0b85f6c227b32f987e71fc98a9d5ad07/build/icons/icon-16.png -------------------------------------------------------------------------------- /build/icons/icon-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuducos/UOLEsportesSexista/c071ab7b0b85f6c227b32f987e71fc98a9d5ad07/build/icons/icon-48.png -------------------------------------------------------------------------------- /build/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "UOL Esportes Sexista", 3 | "short_name": "uolsexista", 4 | "version": "0.0.1", 5 | "description": "Chega de conteúdos sexistas no portal de Espores do UOL.", 6 | "content_scripts": [{ 7 | "matches": ["*://esporte.uol.com.br/*", "*://uolesporte.blogosfera.uol.com.br/*"], 8 | "js": ["app.js"], 9 | "css": ["app.css"], 10 | "run_at": "document_start" 11 | }], 12 | "icons": { 13 | "16": "icons/icon-16.png", 14 | "48": "icons/icon-48.png", 15 | "128": "icons/icon-128.png" 16 | }, 17 | "manifest_version": 2 18 | } 19 | -------------------------------------------------------------------------------- /contrib/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuducos/UOLEsportesSexista/c071ab7b0b85f6c227b32f987e71fc98a9d5ad07/contrib/demo.gif -------------------------------------------------------------------------------- /contrib/normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuducos/UOLEsportesSexista/c071ab7b0b85f6c227b32f987e71fc98a9d5ad07/contrib/normal.png -------------------------------------------------------------------------------- /contrib/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuducos/UOLEsportesSexista/c071ab7b0b85f6c227b32f987e71fc98a9d5ad07/contrib/screenshot.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uolsexista", 3 | "version": "0.0.1", 4 | "description": "Chrome Extension that redacts sexist contents from UOL sports coverage", 5 | "scripts": { 6 | "build": "browserify -t coffeeify ./src/app.coffee -o ./build/app.js", 7 | "postbuild": "uglifyjs -o ./build/app.js ./build/app.js", 8 | "test": "mocha --compilers coffee:coffee-script/register tests/tests.coffee" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/cuducos/UOLEsportesSexista.git" 13 | }, 14 | "keywords": [ 15 | "feminismo", 16 | "sexismo", 17 | "sexista", 18 | "uol", 19 | "belas da torcida" 20 | ], 21 | "author": "Eduardo Cuducos", 22 | "license": "MIT", 23 | "bugs": { 24 | "url": "https://github.com/cuducos/UOLEsportesSexista/issues" 25 | }, 26 | "homepage": "https://github.com/cuducos/UOLEsportesSexista#readme", 27 | "devDependencies": { 28 | "browserify": "^13.0.0", 29 | "coffee-script": "^1.10.0", 30 | "coffeeify": "^2.0.1", 31 | "jsdom": "^8.3.0", 32 | "mocha": "^2.4.5", 33 | "mocha-jsdom": "^1.1.0", 34 | "uglify-js": "^2.6.2" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/app.coffee: -------------------------------------------------------------------------------- 1 | class NoSexism 2 | 3 | constructor: -> 4 | @expressions = [ 5 | /(bela)(s)*([ -_])(da)([ -_])(torcida)/gi 6 | /(bela)([ -_])(d)([a|o])/gi 7 | /(ensaio)([ -_])(sensual)/gi 8 | /(namoradinha)(s)*([ -_])(do)([ -_])(esporte)/gi 9 | /([qual|quem])(.)+(a)(.)+(do)([ -_])(esporte)/gi 10 | /(qual|quem)(.)+(namorada|mulher|esposa|amante|dama)(.)+(bela|bonita|gostosa)/gi 11 | ] 12 | 13 | run: => 14 | for link in document.getElementsByTagName('a') 15 | @cleanUpLink(link) if @isSexist(link) 16 | for img in document.getElementsByTagName('img') 17 | @cleanUpImage(img) if @isSexist(img) 18 | 19 | isSexist: (node) => 20 | if node isnt 'undefined' 21 | for attr in ['href', 'title', 'src', 'alt'] 22 | value = node.getAttribute attr 23 | for re in @expressions 24 | return true if re.test value 25 | false 26 | 27 | cleanUpLink: (link) => 28 | @addClass(link) 29 | for img in link.getElementsByTagName 'img' 30 | @cleanUpImage img 31 | 32 | cleanUpImage: (img) => 33 | width = img.clientWidth 34 | height = img.clientHeight 35 | img.setAttribute 'src', "http://dummyimage.com/#{width}x#{height}/ff007f/ffffff&text=Conteúdo+Sexista" 36 | 37 | addClass: (node) => 38 | toAdd = 'conteudo-sexista' 39 | classOrNull = node.getAttribute 'class' 40 | className = if classOrNull then classOrNull else '' 41 | classes = if className then className.split(/\s+/) else [] 42 | if toAdd not in classes 43 | node.setAttribute 'class', "#{className} #{toAdd}".trim() 44 | 45 | if typeof window isnt 'undefined' 46 | noSexism = new NoSexism() 47 | window.addEventListener 'DOMContentLoaded', noSexism.run 48 | else 49 | module.exports = NoSexism 50 | -------------------------------------------------------------------------------- /tests/tests.coffee: -------------------------------------------------------------------------------- 1 | assert = require 'assert' 2 | jsdom = require 'mocha-jsdom' 3 | NoSexism = require '../src/app.coffee' 4 | 5 | describe "No Sexism: isSexist", -> 6 | 7 | jsdom() 8 | 9 | testLinkTo = (url, title) -> 10 | noSexism = new NoSexism() 11 | link = document.createElement 'a' 12 | link.setAttribute 'href', url 13 | link.setAttribute 'title', title 14 | noSexism.isSexist link 15 | 16 | testImgTag = (src, alt) -> 17 | noSexism = new NoSexism() 18 | img = document.createElement 'img' 19 | img.setAttribute 'src', src 20 | img.setAttribute 'alt', alt 21 | noSexism.isSexist img 22 | 23 | it "Links with target URL should be considered sexist", -> 24 | result = testLinkTo 'http://j.mp/belas-da-torcida/?42', 'Joanne Doe' 25 | assert.equal result, true 26 | 27 | it "Links with target title should be considered sexist ", -> 28 | result = testLinkTo '#', 'Belas da torcida' 29 | assert.equal result, true 30 | 31 | it "Links with target URL & title should be considered sexist ", -> 32 | result = testLinkTo 'http://j.mp/bela-da-torcida/', 'Bela da torcida' 33 | assert.equal result, true 34 | 35 | it "Links with no target should pass", -> 36 | result = testLinkTo 'http://cuducos.me/', 'Eduardo Cuducos' 37 | assert.equal result, false 38 | 39 | it "Image with target src should be considered sexist", -> 40 | result = testImgTag 'thumb_belas_da_torcida.png?cache=true', 'Joanne Doe' 41 | assert.equal result, true 42 | 43 | it "Image with target alt should be considered sexist ", -> 44 | result = testImgTag 'img.png', 'Quem tem a dama mais bonita' 45 | assert.equal result, true 46 | 47 | it "Image with target src & alt should be considered sexist ", -> 48 | result = testImgTag 'thumb_bela_da_torcida.png', 'Qual bela da torcida..' 49 | assert.equal result, true 50 | 51 | it "Image with no target should pass", -> 52 | result = testImgTag 'http://cuducos.me/assets/img/cuducos.jpg', 'Cuducos' 53 | assert.equal result, false 54 | 55 | describe "No Sexism: cleanUpLink", -> 56 | 57 | jsdom() 58 | 59 | testLink = (link) -> 60 | noSexism = new NoSexism() 61 | noSexism.cleanUpLink link 62 | link.getAttribute 'class' 63 | 64 | it "Processed link without classes should have 1 class", -> 65 | link = document.createElement 'a' 66 | result = testLink link 67 | assert.equal 'conteudo-sexista', result 68 | 69 | it "Processed link with 1 classshould have 2 classes", -> 70 | link = document.createElement 'a' 71 | link.setAttribute 'class', '42' 72 | result = testLink link 73 | assert.equal '42 conteudo-sexista', result 74 | 75 | it "Processed link two classes, one added, should have 2 classes", -> 76 | link = document.createElement 'a' 77 | link.setAttribute 'class', '42 conteudo-sexista' 78 | result = testLink link 79 | assert.equal '42 conteudo-sexista', result 80 | --------------------------------------------------------------------------------