Skip to content

Commit

Permalink
Use chrome.runtime, not deprecated chrome.extension for #316
Browse files Browse the repository at this point in the history
  • Loading branch information
machawk1 committed Dec 27, 2020
1 parent b1f08f2 commit 5706033
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 41 deletions.
36 changes: 18 additions & 18 deletions mink-plugin/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ function normalDisplayUIBC (items) {
method: 'setBadge',
text: '',
iconPath: {
'38': chrome.extension.getURL('images/mLogo38_isAMemento.png'),
'19': chrome.extension.getURL('images/mLogo19_isAMemento.png')
'38': chrome.runtime.getURL('images/mLogo38_isAMemento.png'),
'19': chrome.runtime.getURL('images/mLogo19_isAMemento.png')
}
})
} else { // Live web page revisited w/ a TM in cache
Expand Down Expand Up @@ -371,22 +371,22 @@ function getMementos (uri) {
})
}

const clockIcons38 = [chrome.extension.getURL('images/mementoLogos/mLogo38_7.5.png'),
chrome.extension.getURL('images/mementoLogos/mLogo38_15.png'),
chrome.extension.getURL('images/mementoLogos/mLogo38_22.5.png'),
chrome.extension.getURL('images/mementoLogos/mLogo38_30.png'),
chrome.extension.getURL('images/mementoLogos/mLogo38_37.5.png'),
chrome.extension.getURL('images/mementoLogos/mLogo38_45.png'),
chrome.extension.getURL('images/mementoLogos/mLogo38_52.5.png'),
chrome.extension.getURL('images/mementoLogos/mLogo38_60.png')]
const clockIcons19 = [chrome.extension.getURL('images/mementoLogos/mLogo19_7.5.png'),
chrome.extension.getURL('images/mementoLogos/mLogo19_15.png'),
chrome.extension.getURL('images/mementoLogos/mLogo19_22.5.png'),
chrome.extension.getURL('images/mementoLogos/mLogo19_30.png'),
chrome.extension.getURL('images/mementoLogos/mLogo19_37.5.png'),
chrome.extension.getURL('images/mementoLogos/mLogo19_45.png'),
chrome.extension.getURL('images/mementoLogos/mLogo19_52.5.png'),
chrome.extension.getURL('images/mementoLogos/mLogo19_60.png')]
const clockIcons38 = [chrome.runtime.getURL('images/mementoLogos/mLogo38_7.5.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo38_15.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo38_22.5.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo38_30.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo38_37.5.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo38_45.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo38_52.5.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo38_60.png')]
const clockIcons19 = [chrome.runtime.getURL('images/mementoLogos/mLogo19_7.5.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo19_15.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo19_22.5.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo19_30.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo19_37.5.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo19_45.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo19_52.5.png'),
chrome.runtime.getURL('images/mementoLogos/mLogo19_60.png')]
let iteration = clockIcons38.length - 1

function animatePageActionIcon () {
Expand Down
20 changes: 10 additions & 10 deletions mink-plugin/js/displayMinkUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function setupDrilldownInteractions () {
}

function appendHTMLToShadowDOM () {
$.ajax(chrome.extension.getURL('minkui.html'))
$.ajax(chrome.runtime.getURL('minkui.html'))
.done(function (data) {
// TODO: before invoking any further, check to verify that some mementos exist (the aggregator query has returned).

Expand Down Expand Up @@ -149,7 +149,7 @@ function switchToArchiveNowInterface () {
}

function appendCSSToShadowDOM (cb) {
$.ajax(chrome.extension.getURL('css/minkui.css'))
$.ajax(chrome.runtime.getURL('css/minkui.css'))
.done(function (data) {
const styleElement = '<style type="text/css">\n' + data + '\n</style>\n'
$('#minkuiX').prepend(styleElement)
Expand Down Expand Up @@ -547,11 +547,11 @@ function setupUI () {
}

function replaceContentScriptImagesWithChromeExtensionImages () {
document.getElementById('minkLogo').src = chrome.extension.getURL('images/mink_marvel_80.png')
document.getElementById('minkLogo').src = chrome.runtime.getURL('images/mink_marvel_80.png')

document.getElementById('archivelogo_ia').src = chrome.extension.getURL('images/archives/iaLogo.png')
document.getElementById('archivelogo_ais').src = chrome.extension.getURL('images/archives/archiveisLogo.png')
document.getElementById('archivelogo_ala').src = chrome.extension.getURL('images/archives/allListedArchives.png')
document.getElementById('archivelogo_ia').src = chrome.runtime.getURL('images/archives/iaLogo.png')
document.getElementById('archivelogo_ais').src = chrome.runtime.getURL('images/archives/archiveisLogo.png')
document.getElementById('archivelogo_ala').src = chrome.runtime.getURL('images/archives/allListedArchives.png')
}

function bindSteps () {
Expand Down Expand Up @@ -707,7 +707,7 @@ function bindArchiveLogos () {

let that = this
const newSrc = $(this).attr('src').replace('.png', '_success.png')
$(this).attr('src', chrome.extension.getURL('./images/spinner.gif'))
$(this).attr('src', chrome.runtime.getURL('./images/spinner.gif'))

const archiveLogoID = $(this).attr('id')
const cb = function () { changeIconFor(that, newSrc) }
Expand All @@ -730,8 +730,8 @@ function bindArchiveLogos () {
changeArchiveAllIconWhenComplete(alaLogo)
}

$(iaLogo).attr('src', chrome.extension.getURL('./images/spinner.gif'))
$(aisLogo).attr('src', chrome.extension.getURL('./images/spinner.gif'))
$(iaLogo).attr('src', chrome.runtime.getURL('./images/spinner.gif'))
$(aisLogo).attr('src', chrome.runtime.getURL('./images/spinner.gif'))

openInNewTab = true
archiveURIArchiveOrg(iaCb, openInNewTab)
Expand All @@ -744,7 +744,7 @@ var archivesFinished = 0 /* TOFIX This is doubly declared if 'let' */
function changeArchiveAllIconWhenComplete (iconObj) {
archivesFinished++
if (archivesFinished >= 2) {
$(iconObj).attr('src', chrome.extension.getURL('./images/archives/allListedArchives_success.png'))
$(iconObj).attr('src', chrome.runtime.getURL('./images/archives/allListedArchives_success.png'))
$(iconObj).unbind()
$(iconObj).removeClass('archiveLogo')
}
Expand Down
9 changes: 6 additions & 3 deletions mink-plugin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"background": {
"service_worker": "mink.js"
},
"browser_action": {
"action": {
"default_title": "Mink - Integrating the Live and Archived Web",
"default_icon": {
"19": "images/minkLogo19.png",
Expand All @@ -23,14 +23,16 @@
},
"permissions": [
"webRequest",
"<all_urls>",
"tabs",
"storage",
"notifications",
"contextMenus",
"activeTab",
"unlimitedStorage"
],
"host_permissions": [
"<all_urls>"
],
"content_scripts": [
{
"js": [
Expand All @@ -55,6 +57,7 @@
"open_in_tab": true
},
"web_accessible_resources": [
/*
"images/mementoLogo-19px-30.png", "images/mementoLogo-19px-37_5.png", "images/mementoLogo-19px-45.png", "images/mementoLogo38_working.png", "images/icon-on-19.png","images/icon128.png","images/icon128flipped.png","images/icon128_error.png",
"images/minkLogo38_noMementos.png",
"images/m38_isAMemento.png",
Expand Down Expand Up @@ -83,6 +86,6 @@
"font-awesome-4.0.3/fonts/fontawesome-webfont.svg",
"font-awesome-4.0.3/fonts/fontawesome-webfont.ttf",
"font-awesome-4.0.3/fonts/fontawesome-webfont.woff",
"font-awesome-4.0.3/fonts/fontAwesome.otf"
"font-awesome-4.0.3/fonts/fontAwesome.otf"*/
]
}
20 changes: 10 additions & 10 deletions mink-plugin/mink.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@ const browserActionTitleNoMementos = 'Mink - No Mementos Available'
const browserActionTitleIgnorelisted = 'Mink - Viewing Ignored Site'

const badgeImagesDisabled = {
'38': chrome.extension.getURL('images/minkLogo38_disabled.png'),
'19': chrome.extension.getURL('images/minkLogo19_disabled.png')
'38': chrome.runtime.getURL('images/minkLogo38_disabled.png'),
'19': chrome.runtime.getURL('images/minkLogo19_disabled.png')
}

const badgeImagesIgnorelisted = {
'38': chrome.extension.getURL('images/minkLogo38_ignorelisted.png'),
'19': chrome.extension.getURL('images/minkLogo19_ignorelisted.png')
'38': chrome.runtime.getURL('images/minkLogo38_ignorelisted.png'),
'19': chrome.runtime.getURL('images/minkLogo19_ignorelisted.png')
}

const badgeImagesNoMementos = {
'38': chrome.extension.getURL('images/minkLogo38_noMementos2.png'),
'19': chrome.extension.getURL('images/minkLogo19_noMementos2.png')
'38': chrome.runtime.getURL('images/minkLogo38_noMementos2.png'),
'19': chrome.runtime.getURL('images/minkLogo19_noMementos2.png')
}

const badgeImagesMink = {
'38': chrome.extension.getURL('images/minkLogo38.png'),
'19': chrome.extension.getURL('images/minkLogo19.png')
'38': chrome.runtime.getURL('images/minkLogo38.png'),
'19': chrome.runtime.getURL('images/minkLogo19.png')
}

const badgeImagesIsAMemento = {
'38': chrome.extension.getURL('images/mLogo38_isAMemento.png'),
'19': chrome.extension.getURL('images/mLogo19_isAMemento.png')
'38': chrome.runtime.getURL('images/mLogo38_isAMemento.png'),
'19': chrome.runtime.getURL('images/mLogo19_isAMemento.png')
}

function log (...messages) {
Expand Down

0 comments on commit 5706033

Please sign in to comment.