Skip to content
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

GH-1975 Theme Framework & GH-1972 Palm Theme #517

Closed
wants to merge 22 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Fix (sort of)
  • Loading branch information
zarembsky committed Mar 19, 2020
commit 1ff8eb4370ff6333a9748319f880a6823d189178
@@ -78,12 +78,12 @@ export default (state = initialState, action) => {
case SET_THEME: {
const { name, css } = action.data;
console.log('PANEL ACTION SET THEME', name, css);
setTheme(document, name, { themeData: { [name]: { name, css } } });
setTheme(document, name, { themeData: { [name]: { name, css } } }, true);
return Object.assign({}, state, { current_theme: name });
}
case CLEAR_THEME: {
console.log('CLEAR THEME IS CALLED');
setTheme(document, initialState.current_theme);
setTheme(document, initialState.current_theme, null);
return Object.assign({}, state, { current_theme: initialState.current_theme });
}
case SHOW_NOTIFICATION: {
@@ -212,7 +212,7 @@ export function doXHR(method, url, query) {
* @param {string} themeName unique name of the theme
* @param {string} theme css of the theme
*/
export function setTheme(doc, name, account) {
export function setTheme(doc, name, account, reload = false) {
// if themeName is 'default' all we have to do is to remove style element
const styleTitlePrefix = 'Ghostery Theme';
// First remove all other style elements which may be there
@@ -245,5 +245,10 @@ export function setTheme(doc, name, account) {
// Set content of style element to the theme text.
themeStyle.href = css;
doc.head.appendChild(themeStyle);

if( reload ) {
console.log("DOCUMENT RELOADED");
doc.location.reload();
}
}
}
@@ -96,7 +96,7 @@ class Globals {
'alert_expanded',
'block_by_default',
'cliqz_module_whitelist',
// 'current_theme',
'current_theme',
'enable_ad_block',
'enable_anti_tracking',
'enable_autoupdate',
@@ -128,7 +128,6 @@ class Globals {
];

this.SESSION = {
current_theme: 'default',
paused_blocking: false,
paused_blocking_timeout: 0,
abtests: {},
ProTip! Use n and p to navigate between commits in a pull request.