-
-
Notifications
You must be signed in to change notification settings - Fork 30
Browser Extension
Denny George edited this page Jul 4, 2023
·
2 revisions
Content Script
Background Service Worker
Options Page
Tweet Control UI
When you visit a URL of the form http://twitter.com/*, Uli injects a content script into page. This script is located at browser extension/plugin/src/content-script.js
. This is the entry point for all Uli features.
The control flow is as follows :
┌───────────────────────┐ ┌───────────────────────┐
│ set MutationObserver ├────onMutation───►│ check if added node │ ┌─────────┐
│ on the <main> element │ │ is <section> ├──No──►│ Drop It │
└───────────────────────┘ └───────────┬───────────┘ └─────────┘
│
Yes
│
┌───────────────────────┐ ▼
│ set Message Listener │ ┌───────────────────┐
│ on Chrome Runtime ├─────onUrlChange────┤ hande new page │
└───────────────────────┘ └─┬─────────────────┘
│
│ ┌────────────────────────┐
┌────┼─►│ process existing nodes │
│ │ └────────────────────────┘
│ │
│ │ ┌───────────────────────────┐
│ └─►│set listener for new nodes │
│ └─────────┬─────────────────┘
│ │
└─onNewNode───────┘
Prerequisite :
- a background service worker(
background.js
) that runs in the background all the time and sends a 'URL_CHANGED' message to the content script -
a chrome.runtime.onMessage
listener configured in thecontent-script.js
which processes the page whenever url changes
If anything breaks in this setup, the tweet control UI will work inconsistently. You will see that it is injected into the twitter UI correctly the first time you load a twitter page but if you click on any links within that page and arrive at a new page, it won't be injected on that page.
Every page has its getTimeline
function defined in src/twitter/pages
Try copy pasting it in your Browser's dev console
- About Us
- Our Team
- Contributing to Uli
- Code of Conduct
- Internal Communications
- FAQs
- Curated Issues and Proposals for beginners
- Contributing Code
- Monitoring Issues and Triaging
- Helping review PRs
- Helping with QA
- Helping with Translations
- Sponsor Tattle
- 16 Days of Activism
- Mitigating Harms of Digitally Manipulated Images
- Setup Uli on Windows for Chrome
- Setup Uli on Windows for Chrominum Browsers (Brave, Kiwi etc)
- Setup Uli on Windows for Firefox
- Setup Uli on Windows for Firefox for Android
- Setup Uli on Linux for Chrome
- Setup Uli on Linux for Firefox
- Setup Uli on Linux for Firefox for Android
- Setup Uli on Linux for for Chromium Browsers(Kiwi, Brave etc)