-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Morea
committed
Oct 22, 2023
1 parent
3846b1e
commit 4c518d1
Showing
6 changed files
with
168 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
const defaultConfig: Settings = { | ||
onlyNewTitles: false, | ||
useCache: true, | ||
sizeDifferenceThreshold: 1.2, | ||
}; | ||
|
||
// Initialize the library | ||
GM_config.init({ | ||
id: "find-unique-titles-settings", | ||
title: "Find Unique Titles", | ||
fields: { | ||
onlyNewTitles: { | ||
label: "Only new titles", | ||
type: "checkbox", | ||
default: defaultConfig.onlyNewTitles, | ||
}, | ||
useCache: { | ||
label: "Use cache", | ||
type: "checkbox", | ||
default: defaultConfig.useCache, | ||
}, | ||
sizeDifferenceThreshold: { | ||
label: "Size Difference Threshold", | ||
type: "float", | ||
default: defaultConfig.sizeDifferenceThreshold, | ||
}, | ||
}, | ||
css: ` | ||
#find-unique-titles-settings { | ||
} | ||
#find-unique-titles-settings .config_var { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
`, | ||
events: { | ||
open: function () { | ||
GM_config.frame.style.width = "400px"; // Adjust width as needed | ||
GM_config.frame.style.height = "250px"; // Adjust width as needed | ||
GM_config.frame.style.position = "fixed"; | ||
GM_config.frame.style.left = "50%"; | ||
GM_config.frame.style.top = "50%"; | ||
GM_config.frame.style.transform = "translate(-50%, -50%)"; | ||
}, | ||
save: function () { | ||
GM_config.close(); | ||
}, | ||
}, | ||
}); | ||
|
||
// Add menu command to open the configuration | ||
GM_registerMenuCommand("Settings", () => GM_config.open()); | ||
|
||
export const getSettings = (): Settings => { | ||
return { | ||
onlyNewTitles: GM_config.get("onlyNewTitles"), | ||
useCache: GM_config.get("useCache"), | ||
sizeDifferenceThreshold: GM_config.get("sizeDifferenceThreshold"), | ||
}; | ||
}; | ||
|
||
interface Settings { | ||
useCache: boolean; | ||
onlyNewTitles: boolean; | ||
sizeDifferenceThreshold: number; | ||
} |