This commit is contained in:
Mirco Wittrien 2023-10-29 22:00:17 +01:00
parent 1aaf8ef21f
commit 6a78c6015e
2 changed files with 4 additions and 25 deletions

View File

@ -2,7 +2,7 @@
* @name BetterSearchPage * @name BetterSearchPage
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.2.3 * @version 1.2.4
* @description Makes the Controls in the Search Results Page sticky * @description Makes the Controls in the Search Results Page sticky
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -58,23 +58,9 @@ module.exports = (_ => {
return template.content.firstElementChild; return template.content.firstElementChild;
} }
} : (([Plugin, BDFDB]) => { } : (([Plugin, BDFDB]) => {
var stickySearchPagination, SearchResultsPaginationComponent;
const StickySearchPaginationComponent = class StickySearchPagination extends BdApi.React.Component {
componentDidMount() {
stickySearchPagination = this;
}
render() {
if (!SearchResultsPaginationComponent) return null;
return BDFDB.ReactUtils.createElement(SearchResultsPaginationComponent, this.props);
}
};
return class BetterSearchPage extends Plugin { return class BetterSearchPage extends Plugin {
onLoad () { onLoad () {
this.modulePatches = { this.modulePatches = {
before: [
"SearchResultsPagination"
],
after: [ after: [
"SearchResults" "SearchResults"
] ]
@ -106,20 +92,13 @@ module.exports = (_ => {
if (!e.instance.props.search) return; if (!e.instance.props.search) return;
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "SearchResultsHeader"}); let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "SearchResultsHeader"});
if (index == -1) return; if (index == -1) return;
children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(StickySearchPaginationComponent, { children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SearchResultsPagination, {
changePage: newPage => !e.instance.props.search.searching && BDFDB.LibraryModules.SearchPageUtils.changePage(e.instance.props.searchId, newPage - 1), changePage: newPage => !e.instance.props.search.searching && BDFDB.LibraryModules.SearchPageUtils.changePage(e.instance.props.searchId, newPage - 1),
offset: e.instance.props.search.offset, offset: e.instance.props.search.offset,
totalResults: e.instance.props.search.totalResults, totalResults: e.instance.props.search.totalResults,
pageLength: BDFDB.DiscordConstants.SEARCH_PAGE_SIZE pageLength: BDFDB.DiscordConstants.SEARCH_PAGE_SIZE
})); }));
} }
processSearchResultsPagination (e) {
if (!SearchResultsPaginationComponent) {
SearchResultsPaginationComponent = e.component;
BDFDB.ReactUtils.forceUpdate(stickySearchPagination);
}
}
}; };
})(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog)); })(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));
})(); })();

View File

@ -1622,10 +1622,10 @@ a.metadataDownload__6b32d {
/* ---- 10.12. CHANGELOGMODAL ---- */ /* ---- 10.12. CHANGELOGMODAL ---- */
#app-mount .improved_fd72d9 { /* modal improved category */ #app-mount .improved_df526b { /* modal improved category */
color: rgb(var(--accentcolor)); color: rgb(var(--accentcolor));
} }
#app-mount .improved_fd72d9::after { #app-mount .improved_df526b::after {
background-color: rgb(var(--accentcolor)); background-color: rgb(var(--accentcolor));
} }
.premiumBanner_d2ce99 { .premiumBanner_d2ce99 {