Skip to content

Commit

Permalink
History mods
Browse files Browse the repository at this point in the history
  • Loading branch information
madprops committed Sep 28, 2024
1 parent 8b6bd6e commit d3deb6e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion js/main/bookmarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ App.setup_bookmarks = () => {
App.setup_bookmarks_ready = true
}

App.get_bookmarks = async (query = ``, deep = false) => {
App.get_bookmarks = async (query = ``, deep = false, by_what) => {
App.getting(`bookmarks`)
let results = []

Expand Down
5 changes: 3 additions & 2 deletions js/main/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ App.do_filter = async (args = {}) => {
query: svalue,
deep: args.deep,
date: search_date,
by_what,
})

if (App.filter_search_date !== search_date) {
Expand Down Expand Up @@ -1002,7 +1003,7 @@ App.get_filter_exact = (mode) => {
App.search_items = async (args = {}) => {
let q = args.query || `Empty`
App.debug(`Searching ${args.mode}: ${q}`)
let items = await App[`get_${args.mode}`](args.query, args.deep)
let items = await App[`get_${args.mode}`](args.query, args.deep, args.by_what)

if (App.filter_search_date !== args.date) {
return []
Expand Down Expand Up @@ -1297,7 +1298,7 @@ App.toggle_filter = (mode, cmd, refine = false) => {
App.filter_all(mode)
return
}

App.set_filter_mode({mode, cmd, refine})
}

Expand Down
21 changes: 16 additions & 5 deletions js/main/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,35 @@ App.history_time = (deep = false) => {
return App.now() - (App.DAY * 30 * months)
}

App.get_history = async (query = ``, deep = false) => {
App.get_history = async (query = ``, deep = false, by_what = `all`) => {
App.getting(`history`)
let results, max_items

if (query && App.get_setting(`auto_deep_search_history`)) {
deep = true
}

if (deep) {
max_items = App.get_setting(`deep_max_search_items_history`)
let normal_max = App.get_setting(`max_search_items_history`)
let deep_max = App.get_setting(`deep_max_search_items_history`)
let text = ``

if (by_what.startsWith(`re`)) {
max_items = Math.max(deep_max, 10 * 1000)
}
else {
max_items = App.get_setting(`max_search_items_history`)
text = query

if (deep) {
max_items = deep_max
}
else {
max_items = normal_max
}
}

try {
results = await browser.history.search({
text: ``,
text,
maxResults: max_items,
startTime: App.history_time(deep)
})
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Grasshopper",
"version": "3309",
"version": "3311",
"description": "Godspeed You Tab Emperor",
"permissions": [
"tabs",
Expand Down

0 comments on commit d3deb6e

Please sign in to comment.