📝 Fix up docs

This commit is contained in:
trickypr 2022-04-10 17:18:42 +10:00
parent d0e6248fd2
commit 41f7b46d93
32 changed files with 33 additions and 621 deletions

View file

@ -0,0 +1,5 @@
+++
title = "Guides"
weight = 2
sort_by = "weight"
+++

View file

@ -0,0 +1,88 @@
+++
title = "Including addons"
weight = 10
+++
# Including addons
Melon provides an automated system for including extensions in your project. The addons are downloaded and included during the `download` build step. Addons can be included in the project config (`melon.json`).
```json
{
// Your options here
"addons": {
"ublock": {
"id": "uBlock0@raymondhill.net",
"url": "https://github.com/gorhill/uBlock/releases/download/1.39.0/uBlock0_1.39.0.firefox.xpi"
}
}
}
```
Note that the `id` is the gecko application id specified in the `manifest.json`.
```json
{
// ...
"browser_specific_settings": {
"gecko": {
"id": "uBlock0@raymondhill.net",
"strict_min_version": "60.0"
}
}
// ...
}
```
## Specifying location in customizable ui
By default, when an addon with a toolbar button, it will placed next to the hamburger menu. However, you may want to place it somewhere else. To do this, you must change the customizable ui in a similar way to how you would to remove pocket.
You are going to want to open `engine/browser/components/customizableui/CustomizableUI.jsm`. At the top, you want to import the `ExtensionCommon` module.
```js
const { makeWidgetId } = ChromeUtils.import(
'resource://gre/modules/ExtensionCommon.jsm'
).ExtensionCommon
```
Then, at the top add a constant with the id of the addon at the top of the file, for example:
```js
const kUBlockOriginID = 'uBlock0@raymondhill.net'
```
Now, you can go down to the `navbarPlacements` array (around line 240) and add
```js
`${makeWidgetId(kUBlockOriginID)}-browser-action`,
```
To the array where you want the icon to appear, for example:
```js
let navbarPlacements = [
'back-button',
'forward-button',
'stop-reload-button',
Services.policies.isAllowed('removeHomeButtonByDefault')
? null
: 'home-button',
'spring',
`${makeWidgetId(kUBlockOriginID)}-browser-action`,
'urlbar-container',
'spring',
'save-to-pocket-button',
'downloads-button',
AppConstants.MOZ_DEV_EDITION ? 'developer-button' : null,
'fxa-toolbar-menu-button',
].filter((name) => name)
```
Finally, export the changes you have made:
```sh
melon export-file browser/components/customizableui/CustomizableUI.jsm
```

View file

@ -0,0 +1,74 @@
+++
title = "Removing pocket"
weight = 5
+++
# Removing pocket
**Note:** This expects you have melon setup.
## Disabling in firefox.js
The goal of this guide is to disable pocket and remove its icon from the toolbar. The first changes we will need to make is to the firefox.js file located in `engine/browser/app/profile/firefox.js`. Scroll to the lines that include the following settings (around line 1980 in firefox 94):
```js
pref('extensions.pocket.api', 'api.getpocket.com')
pref('extensions.pocket.enabled', true)
pref('extensions.pocket.oAuthConsumerKey', '40249-e88c401e1b1f2242d9e441c4')
pref('extensions.pocket.site', 'getpocket.com')
pref('extensions.pocket.onSaveRecs', true)
pref('extensions.pocket.onSaveRecs.locales', 'en-US,en-GB,en-CA')
```
Delete these lines and replace them with the following:
```js
// Taken from BetterFox user.js
user_pref('extensions.pocket.enabled', false)
user_pref('extensions.pocket.api', ' ')
user_pref('extensions.pocket.oAuthConsumerKey', ' ')
user_pref('extensions.pocket.site', ' ')
```
Next, you will need to remove pocket from the new tab page. You can do this by simply adding the following line to the bottom of `firefox.js`:
```js
user_pref(
'browser.newtabpage.activity-stream.section.highlights.includePocket',
false
)
```
Now you simply need to export the changes made to `firefox.js`:
```sh
melon export-file browser/app/profile/firefox.js
```
## Removing pocket icon from toolbar
Whilst the steps above will have disabled pocket. The pocket icon will still be visible in the toolbar. Instead you must remove it from the CustomizableUI layout. Open `engine/browser/components/customizableui/CustomizableUI.jsm` and find the array that looks like this (around line 240):
```js
let navbarPlacements = [
'back-button',
'forward-button',
'stop-reload-button',
Services.policies.isAllowed('removeHomeButtonByDefault')
? null
: 'home-button',
'spring',
'urlbar-container',
'spring',
'save-to-pocket-button',
'downloads-button',
AppConstants.MOZ_DEV_EDITION ? 'developer-button' : null,
'fxa-toolbar-menu-button',
].filter((name) => name)
```
Remove the `save-to-pocket-button` item from the array and export the changes:
```sh
melon export-file browser/components/customizableui/CustomizableUI.jsm
```