Skip to content

Commit

Permalink
feat(startpage): cleaned up code, added popup entries
Browse files Browse the repository at this point in the history
  • Loading branch information
ManagarmrWhisperer committed Mar 14, 2024
1 parent d5aa1ca commit 5b83279
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 143 deletions.
4 changes: 4 additions & 0 deletions defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ export default function () {
},
ddg: {
mode: 'rewrite'
},
startpage: {
mode: 'rewrite'
}

}
};
}
5 changes: 5 additions & 0 deletions js/popup/SearchFilterSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export default class SearchFilterSettings {
supportsFilter: true,
supportsRewrite: true,
},
{
id: 'startpage',
supportsFilter: true,
supportsRewrite: true,
}
];


Expand Down
16 changes: 7 additions & 9 deletions js/search/startpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,17 @@ const wikis = prepareWikisInfo( getWikis( false, true ), {


class DdgSearchModule extends GenericSearchModule {
ENGINE_LAYOUT_SELECTOR = '.w-gl--desktop';
RESULT_CONTAINER_SELECTOR = '.w-gl__result';
URL_ELEMENT_SELECTOR = '.w-gl__result-url';
SPAN_TITLE_ELEMENT_SELECTOR = '.w-gl__result-title > h3';
BADGE_ELEMENT_SELECTOR = '.w-gl__result-title';
ANCHOR_ELEMENT_SELECTOR = '.w-gl__result-url'; // URL breadcumb
ENGINE_LAYOUT_SELECTOR = '.w-gl--desktop, .w-gl';
RESULT_CONTAINER_SELECTOR = '.w-gl__result, .result';
SPAN_TITLE_ELEMENT_SELECTOR = '.w-gl__result-title > h3, .result-title > h2 ';
BADGE_ELEMENT_SELECTOR = this.SPAN_TITLE_ELEMENT_SELECTOR; // Element that will hold the badge.
ANCHOR_ELEMENT_SELECTOR = '.w-gl__result-url, .css-1su0nhd > span, .css-1qvmgy0 > span'; // URL breadcumb
/**
* @protected
* @return {string}
*/
getId() {
return 'ddg';
return 'startpage';
}


Expand Down Expand Up @@ -96,7 +95,7 @@ class DdgSearchModule extends GenericSearchModule {
allMoved: true,
theme: {
fontSize: '80%',
color: document.documentElement.classList.contains("startpage-html--dark" || "startpage-html--night") ? '#a7b1fc' : '#000000',
color: document.documentElement.classList.contains("dark" || "startpage-html--night") ? '#a7b1fc' : '#000000',
marginBottom: '1%',
display: 'inline-block'
}
Expand All @@ -110,7 +109,6 @@ class DdgSearchModule extends GenericSearchModule {
}
}

debugger;
document.onreadystatechange = () => {
if (document.readyState === "complete") {
DdgSearchModule.invoke( wikis );
Expand Down
134 changes: 0 additions & 134 deletions manifests/chrome_dev.json

This file was deleted.

0 comments on commit 5b83279

Please sign in to comment.