mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Added search query minifying
Seeing 'page=1' and 'query=' in every other link was tiresome. I changed the rules so that such keys are appended only if they hold nontrivial values.
This commit is contained in:
@ -237,6 +237,17 @@ App.Util.Misc = function(_, jQuery, marked, promise) {
|
||||
return result.slice(0, -1);
|
||||
}
|
||||
|
||||
function simplifySearchQuery(query) {
|
||||
if (typeof(query) === 'undefined') {
|
||||
return {};
|
||||
}
|
||||
if (query.page === 1) {
|
||||
delete query.page;
|
||||
}
|
||||
query = _.pick(query, _.identity); //remove falsy values
|
||||
return query;
|
||||
}
|
||||
|
||||
return {
|
||||
promiseTemplate: promiseTemplate,
|
||||
formatRelativeTime: formatRelativeTime,
|
||||
@ -249,6 +260,7 @@ App.Util.Misc = function(_, jQuery, marked, promise) {
|
||||
transparentPixel: transparentPixel,
|
||||
loadImagesNicely: loadImagesNicely,
|
||||
appendComplexRouteParam: appendComplexRouteParam,
|
||||
simplifySearchQuery: simplifySearchQuery,
|
||||
};
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user