Skip to content

Commit

Permalink
Move default aggregator specification to separate module, to be expan…
Browse files Browse the repository at this point in the history
…ded for #369
  • Loading branch information
machawk1 committed Jan 29, 2025
1 parent cb30e76 commit 6f12b08
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
10 changes: 10 additions & 0 deletions mink-plugin/MinkDefaults.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

function MinkDefaults () {
this.defaultAggregators = [
'https://memgator.cs.odu.edu',
'https://aggregator.matkelly.com'
]

}

export {MinkDefaults}
4 changes: 4 additions & 0 deletions mink-plugin/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
chrome.storage.local.set(storedHeaders, displayUIBasedOnContext)
})
}

if (request.method === 'setDefaultAggregators') {
console.log('TODO: set default aggregators from content.js')
}
})

function getMementos (uri) {
Expand Down
11 changes: 8 additions & 3 deletions mink-plugin/mink.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ const browserActionTitleNormal = 'Mink - Integrating the Live and Archived Web'
const browserActionTitleNoMementos = 'Mink - No Mementos Available'
const browserActionTitleIgnorelisted = 'Mink - Viewing Ignored Site'

const defaultAggregators = [
'https://memgator.cs.odu.edu',
'https://aggregator.matkelly.com'
]

const badgeImagesDisabled = {
38: chrome.runtime.getURL('images/minkLogo38_disabled.png'),
19: chrome.runtime.getURL('images/minkLogo19_disabled.png')
Expand Down Expand Up @@ -781,10 +786,10 @@ chrome.action.onClicked.addListener(tab => {
chrome.runtime.onInstalled.addListener(({ reason }) => {
if (reason === 'install') {
console.log('extension installed, reported via SW registration')
console.log('setting default aggregators')
chrome.storage.local.set({'aggregators': defaultAggregators})
//chrome.storage.local.set({
// apiSuggestions: ['tabs', 'storage', 'scripting']
//});
}
});


})
2 changes: 1 addition & 1 deletion mink-plugin/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Mink options</title>
<script src="js/jquery-3.4.1.min.js"></script>
<script src="options.js" defer></script>
<script src="options.js" type="module" defer></script>
<link rel="stylesheet" href="css/options.css">
</head>
<body>
Expand Down
7 changes: 2 additions & 5 deletions mink-plugin/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ var debug = true
const tmDropdownString = '<option>&nbsp;&nbsp;&darr; Mink has TimeMaps for... &darr;</option>'
const tmDropdownNoTimemapsString = '<option>--- No TimeMaps available ---</option>'

const defaultAggregators = [
'https://memgator.cs.odu.edu',
'https://aggregator.matkelly.com'
]
import {MinkDefaults} from './MinkDefaults.js'

function restoreOptions () {
chrome.storage.local.get('ignorelist').then(function (items) {
Expand Down Expand Up @@ -295,7 +292,7 @@ function clearAggregatorListInLocalStorage () {
}

function resetDefaultAggregators () {
chrome.storage.local.set({'aggregators': defaultAggregators})
chrome.storage.local.set({'aggregators': MinkDefaults.defaultAggregators})
}

function updateAggregatorsUIBasedOnLocalStorage () {
Expand Down

0 comments on commit 6f12b08

Please sign in to comment.