This repository was archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 970
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a basic about:adblock placeholder
- Loading branch information
Showing
9 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<!-- This Source Code Form is subject to the terms of the Mozilla Public | ||
- License, v. 2.0. If a copy of the MPL was not distributed with this | ||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="availableLanguages" content=""> | ||
<meta name="defaultLanguage" content="en-US"> | ||
<meta name='theme-color' content='#035500'> | ||
<link rel="shortcut icon"type="image/x-icon" href="data:image/x-icon;,"> | ||
<title data-l10n-id="adblockTitle"></title> | ||
<script src='js/about.js'></script> | ||
<script src="ext/l20n.min.js" async></script> | ||
<link rel="localization" href="locales/{locale}/adblock.properties"> | ||
</head> | ||
<body> | ||
<div id="appContainer"/> | ||
</body> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
adblockTitle=Ad Block | ||
adblock=Ad Block | ||
lastUpdateCheckDateLabel=Last update check: | ||
lastCheckETagLabel=Last check ETag: | ||
blockedCountLabel=Blocked count: |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
// Note that these are webpack requires, not CommonJS node requiring requires | ||
const React = require('react') | ||
const Immutable = require('immutable') | ||
const messages = require('../constants/messages') | ||
|
||
const ipc = window.chrome.ipc | ||
|
||
// Stylesheets | ||
require('../../less/about/itemList.less') | ||
require('../../less/about/adblock.less') | ||
|
||
class AboutAdBlock extends React.Component { | ||
constructor () { | ||
super() | ||
this.state = { | ||
adblock: Immutable.Map() | ||
} | ||
ipc.on(messages.ADBLOCK_UPDATED, (e, detail) => { | ||
if (!detail) { | ||
return | ||
} | ||
this.setState({ | ||
adblock: Immutable.fromJS(detail.adblock) | ||
}) | ||
}) | ||
} | ||
render () { | ||
const lastUpdateDate = new Date(this.state.adblock.get('lastCheckDate')) | ||
return <div className='adblockDetailsPage'> | ||
<h2 data-l10n-id='adblock' /> | ||
<list> | ||
<div role='listitem'> | ||
<div className='adblockDetailsPageContent'> | ||
<div className='adblockCount'><span data-l10n-id='blockedCountLabel' /> <span className='blockedCountTotal'>{this.state.adblock.get('count') || 0}</span></div> | ||
{ | ||
Number.isNaN(lastUpdateDate.getTime()) | ||
? null | ||
: <div className='adblockLastChecked'><span data-l10n-id='lastUpdateCheckDateLabel' /> <span>{lastUpdateDate.toLocaleDateString()}</span></div> | ||
} | ||
{ | ||
this.state.adblock.get('etag') | ||
? <div className='adblockLastETag'><span data-l10n-id='lastCheckETagLabel' /> <span>{this.state.adblock.get('etag')}</span></div> | ||
: null | ||
} | ||
</div> | ||
</div> | ||
</list> | ||
</div> | ||
} | ||
} | ||
|
||
module.exports = <AboutAdBlock /> |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@import "./itemList.less"; | ||
|
||
.adblockDetailsPage { | ||
margin: 20px; | ||
min-width: 704px; | ||
|
||
h2 { | ||
margin-bottom: 10px; | ||
} | ||
|
||
list .listItem { | ||
display: flex; | ||
-webkit-user-select: text; | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* global describe, it, before */ | ||
|
||
const Brave = require('../lib/brave') | ||
const {urlInput} = require('../lib/selectors') | ||
const {getTargetAboutUrl} = require('../../js/lib/appUrlUtil') | ||
|
||
describe('about:adblock', function () { | ||
Brave.beforeAll(this) | ||
before(function * () { | ||
const url = getTargetAboutUrl('about:adblock') | ||
yield this.app.client | ||
.waitUntilWindowLoaded() | ||
.waitForUrl(Brave.newTabUrl) | ||
.waitForBrowserWindow() | ||
.waitForVisible('#window') | ||
.waitForVisible(urlInput) | ||
.windowByUrl(Brave.browserWindowUrl) | ||
.waitForExist('.tab[data-frame-key="1"]') | ||
.tabByIndex(0) | ||
.url(url) | ||
}) | ||
|
||
it('lists adblock count', function * () { | ||
yield this.app.client | ||
.getText('.blockedCountTotal').should.eventually.be.equal('0') | ||
}) | ||
}) |