Last active
April 6, 2023 20:55
-
-
Save mayronceccon/bb4d740ef27d0ac59aeaece28c2e9110 to your computer and use it in GitHub Desktop.
Linkedin Post Patrocinado
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Linkedin Post Patrocinado | |
| // @description Desabilita os posts patrocinados | |
| // @version 0.2 | |
| // @author Mayron Ceccon | |
| // @match https://www.linkedin.com/feed/* | |
| // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAudJREFUaEPtml9IU1Ecx793rolo8y/UJFwyRExDIoykSBF9KIJ6KPPFV/cSQU+FE1sNQV8K+gNaDz0ElUZgVHuwtYbUSI2G6BL/TJm2P0FzarUx9y82SoZ3jrMOu9uNex4vv3PO9/P7nt8951wuA/WQBP5cDRBuBxgZ+NDCjB0iPIL4ZzeDLm0vwuErfNDN0sgwfQxUr+y8yTw7y04GqtdhXmb/j2gBIN3uCQ4IDlBmIKkldGRfAW6dqkLtXikmnRu4rJ3B+Nc1Sgl03YkBZLuzYb50AoU5u7ZmdHv9qL49CscPH50Kit7EAMq6MvSfqWFNpXwxjfsTyxQS6LoSA3TUlWEgDkDH8BQefFqhU0HRmxiA90sokqRIEd88WYVamRSTjkgRf8GEbZ0if/RdiR2gnyo1IxADNJYXo7G8iKXCsLQKw5Ir+vy4vBDH5OyYD9ZVvLe6kSvJQsP+IlSW5EEiFsGzGcTKuhf6RRc2fIF/IiQGUDdV4FpTBWuS6/p5qPXz0eeJYhbdHtw5XQ1ptpg1hscfxN2PVqjezCIQSu5wzAnA40k7Wg/KIBYxCbP8bNqB1qempJzgBODXZjC6fEjauSef8dzsJAmNxnACQKwGgM7yHS0Px4m7ZBxApAbyNSOI1AVJ4wzAFwhheOYblte8kBfk4OyBPZBkieJqPNpvxBjhIZETgIj4+gEjTI6NLcGHS/NhVNbHhbgwaMLQlIPEAG5qYHDKgbZB9ttlqO0QztewP0VdfGnGvTFr5gD0GBbQpZtjCeppqURng4L1/OrILPpGLZkDELvZxaraaePrfjsHzbsF/gLsBByPiJMiTtYBASCeVbSHub8HPpIaEBwQHNiWAaGIE+wIwmuU9EqZ9rcQyaW+WVGCZkUxy3CdxRW9qGxvycZT7cREB5M0BBHXQBq0EU0pABClKYVBggMpTC7R0P+BA51aG5hwKRFu5gXZ+P2zB9DLRH+3CeTdQAjtvHEi5neb36ldPQEJ7wjAAAAAAElFTkSuQmCC | |
| // @grant none | |
| // @updateURL https://gist.githubusercontent.com/mayronceccon/bb4d740ef27d0ac59aeaece28c2e9110/raw/3afc124fc3a4661cf3e2cc8dda5d918dd642f1f6/linkedin-post-patrocinado.js | |
| // @downloadURL https://gist.githubusercontent.com/mayronceccon/bb4d740ef27d0ac59aeaece28c2e9110/raw/3afc124fc3a4661cf3e2cc8dda5d918dd642f1f6/linkedin-post-patrocinado.js | |
| // @supportURL https://github.com/mayronceccon | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| const feedSelector = '.feed-shared-update-v2'; | |
| const componentSelector = '.update-components-actor'; | |
| const searchStrings = { | |
| 'da': /.*Promoveret.*/, | |
| 'en': /.*Promoted.*/, | |
| 'es': /.*Promocionado.*/, | |
| 'fr': /.*Post sponsorisé.*/, | |
| 'pt': /.*Patrocinado.*/, | |
| }; | |
| const language = searchStrings.hasOwnProperty(document.documentElement.lang) ? document.documentElement.lang : 'en'; | |
| function block() { | |
| const stories = document.querySelectorAll(feedSelector); | |
| for (const story of stories) { | |
| if (story.style.display == 'none') { | |
| continue; | |
| } | |
| const descriptions = story.querySelectorAll(componentSelector); | |
| for (const description of descriptions) { | |
| const descriptionContent = description.innerText.trim(); | |
| if (RegExp(searchStrings[language]).test(descriptionContent)) { | |
| story.style.display = 'none'; | |
| } | |
| } | |
| } | |
| } | |
| const observer = new MutationObserver(block); | |
| observer.observe(document.body, { | |
| 'childList': true, | |
| 'subtree': true | |
| }); | |
| block(); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment