Skip to content

Remove bundled ProximaNova font #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/content-feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ import { camelcase, matchHostname, processAttr } from './utils.js'
import { immutableJSONPatch } from 'immutable-json-patch'
import { PerformanceMonitor } from './performance.js'

/**
* @typedef {object} AssetConfig
* @property {string} regularFontUrl
* @property {string} boldFontUrl
*/

export default class ContentFeature {
constructor (featureName) {
this.name = featureName
Expand All @@ -21,6 +27,13 @@ export default class ContentFeature {
return this._platform
}

/**
* @type {AssetConfig}
*/
get assetConfig () {
return this._args?.assets || {}
}

/**
* Get the value of a config setting.
* If the value is not set, return the default value.
Expand Down
9 changes: 6 additions & 3 deletions src/features/click-to-load.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createCustomEvent, sendMessage, originalWindowDispatchEvent } from '../utils.js'
import { logoImg, loadingImages, closeIcon } from './click-to-load/ctl-assets.js'
import { styles, getConfig } from './click-to-load/ctl-config.js'
import { getStyles, getConfig } from './click-to-load/ctl-config.js'
import ContentFeature from '../content-feature.js'

/**
Expand All @@ -22,6 +22,7 @@ const titleID = 'DuckDuckGoPrivacyEssentialsCTLElementTitle'
// @see {getConfig}
let config = null
let sharedStrings = null
let styles = null

// TODO: Remove these redundant data structures and refactor the related code.
// There should be no need to have the entity configuration stored in two
Expand Down Expand Up @@ -893,10 +894,10 @@ function makeBaseStyleElement (mode = 'lightMode') {
* Creates an anchor element with no destination. It is expected that a click
* handler is added to the element later.
* @param {string} linkText
* @param {displayMode} [mode='lightMode']
* @param {displayMode} mode
* @returns {HTMLAnchorElement}
*/
function makeTextButton (linkText, mode) {
function makeTextButton (linkText, mode = 'lightMode') {
const linkElement = document.createElement('a')
linkElement.style.cssText = styles.headerLink + styles[mode].linkFont
linkElement.textContent = linkText
Expand Down Expand Up @@ -1620,6 +1621,8 @@ export default class ClickToLoad extends ContentFeature {
const localizedConfig = getConfig(locale)
config = localizedConfig.config
sharedStrings = localizedConfig.sharedStrings
// update styles if asset config was sent
styles = getStyles(this.assetConfig)

for (const entity of Object.keys(config)) {
// Strip config entities that are first-party, or aren't enabled in the
Expand Down
3 changes: 0 additions & 3 deletions src/features/click-to-load/ctl-assets.js

Large diffs are not rendered by default.

Loading