Skip to content

Commit

Permalink
Updated Readme, added contibution link.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderby committed Sep 18, 2017
1 parent f26ede7 commit 98a0439
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 7 deletions.
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,56 @@ This extension **inverts brightness** of web pages and aims to **reduce eyestrai

If some site is **already dark**, you can **add it to [dark_sites.json](https://github.com/alexanderby/darkreader/blob/master/src/config/dark_sites.json) file** *(please, preserve alphabetical order)*.

If some **parts** of web-pages are **wrongly inverted**, you can specify necessary **CSS selectors** at **[sites_fixes_v2.json](https://github.com/alexanderby/darkreader/blob/master/src/config/sites_fixes_v2.json) file** *(please, preserve alphabetical order by URL, use short selectors, preserve whitespace indentation and code style)*.
If some **parts** of web-pages are **wrongly inverted**, you can specify necessary **CSS selectors** at **[fix_inversion.json](https://github.com/alexanderby/darkreader/blob/master/src/config/fix_inversion.json) file** *(please, preserve alphabetical order by URL, use short selectors, preserve whitespace indentation and code style)*.

Notice that merged changes to these files are automatically delivered to all users **within 15 minutes**.

#### Using Dev Tools

- Open **Chrome Dev Tools** (F12).
- Click on **element picker** (top-left corner).
- Pick wrongly inverted element.
- Choose a **[selector](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors)** for that element or all similar elements (e.g. if element has `class="x-icon small"` selector may look like `.x-icon`).
- Click **Dark Reader icon**.
- Click **Open developer tools** (at bottom).
- Under `sites` section add a block containing URL and selectors to invert.
```json
...
"sites": [
{
"url": "example.com",
"invert": ".x-icon"
}
]
```
- It is also possible to specify multiple selectors (comma-separated list or an array) and custom CSS rules. If chosen element contains images or other content that becomes wrongly displayed, `noinvert` rule can be used. `removebg` removes background image from element.
```json
...
"sites": [
{
"url": "example.com",
"invert": [
".x-icon, .x-button",
"#player .player-button"
],
"noinvert": "#player *",
"removebg": ".bg-photo",
"rules": ".overlay { background: rgba(255,255,255,0.5); }"
}
]
```
- Click **Apply**.
- If the **fix worked** open **[fix_inversion.json](https://github.com/alexanderby/darkreader/blob/master/src/config/fix_inversion.json) file**.
- Click **edit** (sign-in to GitHub first).
- **Insert your fix** there. Preserve **alphabetical order** by URL, use 4 spaces for indentation.
- Provide a **short description** of what you have done.
- Click **Propose file change**.
- Review your changes. Click **Create pull request**.
- The Travis CI will run tests reviewing your changes.
- If you see a **red cross** click **Details** and see what is wrong.
- When you see a **green checkmark** than everything is fine.
- Dark Reader developer will **review** and merge your changes making them available for all users.

### Adding new features or fixing bugs

If you would like to **add new feature** to Dark Reader or **fix a bug**, **submit an issue** in GitHub (if there is no existing one), **discuss** it with active contributors, wait for **approvement**.
Expand Down
2 changes: 1 addition & 1 deletion src/background/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ style && style.parentElement.removeChild(style);
* installed in system.
*/
protected getFontList(onReturned: (fonts: string[]) => void) {
if (typeof chrome.fontSettings !== 'function') {
if (!chrome.fontSettings) {
// Todo: Remove it as soon as Firefox and Edge get support.
setTimeout(() => onReturned([
'serif',
Expand Down
5 changes: 1 addition & 4 deletions src/popup/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
popupWindow = getMockPopup();
}

// Disable text selection
document.onselectstart = (e) => false;

/**
* Mock for tests.
*/
Expand Down Expand Up @@ -63,7 +60,7 @@
'Segoe UI',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
],
getActiveTabInfo: function(callback) { callback({ host: 'server1.mail.veryverylongnameveryverylongnameveryverylongnameveryverylongname.com' }); }
getActiveTabInfo: function (callback) { callback({ host: 'server1.mail.veryverylongnameveryverylongnameveryverylongnameveryverylongname.com' }); }
}));
}
}
8 changes: 8 additions & 0 deletions src/popup/style/_dev_tools.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
right: 0;
top: 0;
}

.description:first-child {
text-transform: uppercase;
}

.inversionFixEditor {

Expand Down Expand Up @@ -59,4 +63,8 @@
}
}
}

a {
color: @color-description;
}
}
1 change: 1 addition & 0 deletions src/popup/style/_toggle.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
box-sizing: content-box;
display: flex;
position: relative;
user-select: none;

.on, .off {
color: @color-fore;
Expand Down
1 change: 1 addition & 0 deletions src/popup/style/_up_down.less
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
border: @size-border solid @color-border;
overflow: hidden;
position: relative;
user-select: none;
width: 100%;

.value {
Expand Down
5 changes: 5 additions & 0 deletions src/popup/style/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ html {
}
}

::selection {
background-color: @color-header;
color: @color-input-fore-active;
}

.hidden {
display: none !important; // Is overriden at least for .CheckBox .text
}
Expand Down
12 changes: 11 additions & 1 deletion src/popup/ui/dev_tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,17 @@ module DarkReader.Popup {
text: 'Apply',
onClick: () => markup.onApply(this.inversionFixText)
})
])
]),

new xp.Html({
html: `
<div class="description selectable">
Read about this tool <strong><a href="https://github.com/alexanderby/darkreader#how-to-contribute" target="_blank">here</a></strong>. If a <strong>popular</strong>
website looks incorrect e-mail to
<strong>[email protected]</strong>
</div>
`
})
])

]);
Expand Down

0 comments on commit 98a0439

Please sign in to comment.