Skip to content

Commit 7eaef71

Browse files
committed
@standard JS updates
1 parent a757cf4 commit 7eaef71

File tree

4 files changed

+36
-36
lines changed

4 files changed

+36
-36
lines changed

mink-plugin/content.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ setInitialStateWithChecks()
2626
function setActiveBasedOnDisabledProperty (cb) {
2727
chrome.storage.local.get('disabled', function (items) {
2828
if (items.disabled) {
29-
chrome.runtime.sendMessage({method: 'stopWatchingRequests'}, function (response) {})
29+
chrome.runtime.sendMessage({ method: 'stopWatchingRequests' }, function (response) {})
3030
} else {
3131
cb()
3232
}
@@ -44,7 +44,7 @@ function setActiveBasedOnBlacklistedProperty (cb) {
4444
const documentHostname = (new window.URL(document.URL)).hostname
4545
const blacklistEntryHostname = (new window.URL(items.blacklist[ii])).hostname
4646
if (documentHostname === blacklistEntryHostname) {
47-
chrome.runtime.sendMessage({method: 'stopWatchingRequestsBlacklisted'})
47+
chrome.runtime.sendMessage({ method: 'stopWatchingRequestsBlacklisted' })
4848
return
4949
}
5050
}
@@ -219,7 +219,7 @@ function displayUIBasedOnStoredTimeMap (tmDataIn) {
219219

220220
if (debug) { console.log(tmDataIn) }
221221
const mementoCountFromCache = tmDataIn.mementos.list.length
222-
chrome.runtime.sendMessage({method: 'setBadgeText', value: '' + mementoCountFromCache})
222+
chrome.runtime.sendMessage({ method: 'setBadgeText', value: '' + mementoCountFromCache })
223223
}
224224

225225
function getBlacklist (cb) {
@@ -322,7 +322,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
322322
'19': clockIcons19[clockIcons19.length - 1]
323323
}
324324
})
325-
chrome.runtime.sendMessage({method: 'setBadgeText', text: ''}, function (response) {
325+
chrome.runtime.sendMessage({ method: 'setBadgeText', text: '' }, function (response) {
326326
})
327327
animateBrowserActionIcon = true
328328
setTimeout(animatePageActionIcon, 500)
@@ -376,15 +376,15 @@ function getMementos (uri) {
376376
if (debug) { console.log('getMementosWithTimemap()') }
377377
const timemapLocation = memgatorJson + uri
378378

379-
chrome.runtime.sendMessage({method: 'setBadge',
379+
chrome.runtime.sendMessage({ method: 'setBadge',
380380
text: '',
381381
iconPath: {
382382
'38': clockIcons38[clockIcons38.length - 1],
383383
'19': clockIcons19[clockIcons19.length - 1]
384384
}
385385
})
386386

387-
chrome.runtime.sendMessage({method: 'setBadgeText', text: ''}, function (response) {})
387+
chrome.runtime.sendMessage({ method: 'setBadgeText', text: '' }, function (response) {})
388388

389389
animateBrowserActionIcon = true
390390

@@ -423,7 +423,7 @@ function animatePageActionIcon () {
423423
chrome.runtime.sendMessage({
424424
method: 'setBadge',
425425
text: '',
426-
iconPath: {'38': clockIcons38[iteration], '19': clockIcons19[iteration]}})
426+
iconPath: { '38': clockIcons38[iteration], '19': clockIcons19[iteration] } })
427427
iteration--
428428

429429
if (iteration < 0) { iteration = clockIcons38.length - 1 }

mink-plugin/js/displayMinkUI.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ function bindSteps () {
544544

545545
function bindOptions () {
546546
$('#options').click(function () {
547-
chrome.runtime.sendMessage({method: 'openOptionsPage'})
547+
chrome.runtime.sendMessage({ method: 'openOptionsPage' })
548548
})
549549
}
550550

mink-plugin/mink.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ chrome.browserAction.onClicked.addListener(function (tab) {
6262
})
6363

6464
function setEnabledBasedOnURIInBlacklist (cb) {
65-
chrome.tabs.query({active: true}, function (tab) {
65+
chrome.tabs.query({ active: true }, function (tab) {
6666
if (debug) {
6767
console.log('is URI in blacklist?')
6868
console.log(tab)
@@ -91,9 +91,9 @@ function showMinkBadgeInfoBasedOnProcessingState (tabid) {
9191
function setBadgeTextBasedOnBrowserActionState (tabid) {
9292
// TODO: This should not rely on the badge count to detect zero mementos, as badges are no longer used for no mementos present
9393
// - maybe rely on the title, since the icon's src path cannot be had.
94-
chrome.browserAction.getBadgeText({tabId: tabid}, function (result) {
94+
chrome.browserAction.getBadgeText({ tabId: tabid }, function (result) {
9595
if (!result.length && !Number.isInteger(result) && result !== maxBadgeDisplay) {
96-
chrome.browserAction.getTitle({tabId: tabid}, function (result) {
96+
chrome.browserAction.getTitle({ tabId: tabid }, function (result) {
9797
// Only set badge text if not viewing a memento
9898
if (result === browserActionTitleNoMementos) {
9999
displayMinkUI(tabid)
@@ -117,7 +117,7 @@ function setBadgeTextBasedOnBrowserActionState (tabid) {
117117
}
118118
if (debug) { console.log('u') }
119119

120-
chrome.browserAction.getBadgeText({tabId: tabid}, function (currentBadgeText) {
120+
chrome.browserAction.getBadgeText({ tabId: tabid }, function (currentBadgeText) {
121121
if (currentBadgeText !== stillProcessingBadgeDisplay) {
122122
displayMinkUI(tabid)
123123
}
@@ -127,7 +127,7 @@ function setBadgeTextBasedOnBrowserActionState (tabid) {
127127

128128
function displayMinkUI (tabId) {
129129
if (debug) { console.log('Injecting displayMinkUI.js') }
130-
chrome.tabs.executeScript(tabId, {code: 'var tmData = ' + JSON.stringify(tmData) + '; var tabId = ' + tabId + ';'},
130+
chrome.tabs.executeScript(tabId, { code: 'var tmData = ' + JSON.stringify(tmData) + '; var tabId = ' + tabId + ';' },
131131
function () {
132132
chrome.tabs.executeScript(tabId, {
133133
// TODO: Account for data: URIs like the "connection unavailable" page.
@@ -150,7 +150,7 @@ chrome.runtime.onMessage.addListener(
150150
window.localStorage.setItem('mementos', request.mementos)
151151
window.localStorage.setItem('memento_datetime', request.memento_datetime)
152152

153-
sendResponse({value: 'noise'})
153+
sendResponse({ value: 'noise' })
154154
} else if (request.method === 'findTMURI') {
155155
if (debug) { console.log('Got findTMURI') }
156156
findTMURI(request.timegate, sender.tab.id)
@@ -240,7 +240,7 @@ function fetchTimeMap (uri, tabid) {
240240
// TODO: data.normalize()
241241
const mems = data.mementos
242242
delete data.mementos
243-
data.mementos = {list: mems}
243+
data.mementos = { list: mems }
244244
if (debug) { console.log(data) }
245245
}
246246

@@ -294,22 +294,22 @@ function setBadgeText (value, tabid) {
294294
badgeValue = ''
295295
}
296296

297-
chrome.browserAction.setBadgeText({text: badgeValue + '', tabId: tabid})
298-
chrome.browserAction.setBadgeBackgroundColor({color: badgeColor, tabId: tabid})
297+
chrome.browserAction.setBadgeText({ text: badgeValue + '', tabId: tabid })
298+
chrome.browserAction.setBadgeBackgroundColor({ color: badgeColor, tabId: tabid })
299299
}
300300

301301
function setBadgeTitle (newTitle, tabid) {
302302
if (debug) { console.warn('setting badge title') }
303-
chrome.browserAction.setTitle({title: newTitle, tabId: tabid})
303+
chrome.browserAction.setTitle({ title: newTitle, tabId: tabid })
304304
}
305305

306306
function setBadgeIcon (icons, tabid) {
307-
chrome.browserAction.setIcon({tabId: tabid, path: icons})
307+
chrome.browserAction.setIcon({ tabId: tabid, path: icons })
308308
}
309309

310310
function setBadge (value, icon, tabid) {
311311
if (value === '') {
312-
chrome.browserAction.getBadgeText({tabId: tabid}, function (currentBadgeText) {
312+
chrome.browserAction.getBadgeText({ tabId: tabid }, function (currentBadgeText) {
313313
setBadgeText(currentBadgeText + '', tabid)
314314
})
315315
} else {
@@ -319,9 +319,9 @@ function setBadge (value, icon, tabid) {
319319
setBadgeIcon(icon, tabid)
320320

321321
if (JSON.stringify(icon) === JSON.stringify(badgeImagesIsAMemento)) {
322-
chrome.browserAction.setTitle({title: browserActionTitleViewingMemento})
322+
chrome.browserAction.setTitle({ title: browserActionTitleViewingMemento })
323323
} else {
324-
chrome.browserAction.setTitle({title: browserActionTitleNormal})
324+
chrome.browserAction.setTitle({ title: browserActionTitleNormal })
325325
}
326326
}
327327

@@ -352,7 +352,7 @@ function startWatchingRequests () {
352352

353353
function stopWatchingRequests () {
354354
if (debug) { console.log('stopWatchingRequests() executing') }
355-
chrome.storage.local.set({'disabled': true}, function () {
355+
chrome.storage.local.set({ 'disabled': true }, function () {
356356
chrome.contextMenus.update('mink_stopStartWatching', {
357357
'title': 'Restart Live-Archived Web Integration',
358358
'onclick': startWatchingRequests
@@ -434,7 +434,7 @@ chrome.webRequest.onCompleted.addListener(function (deets) {
434434
})
435435
})
436436
},
437-
{urls: ['*://twitter.com/*/status/*'], types: ['xmlhttprequest']}, ['responseHeaders'])
437+
{ urls: ['*://twitter.com/*/status/*'], types: ['xmlhttprequest'] }, ['responseHeaders'])
438438

439439
chrome.webRequest.onHeadersReceived.addListener(function (deets) {
440440
chrome.storage.local.get('headers', function (items) {
@@ -456,7 +456,7 @@ chrome.webRequest.onHeadersReceived.addListener(function (deets) {
456456
}
457457

458458
data[deets.url] = deets.responseHeaders
459-
chrome.storage.local.set({'headers': data}, function () {
459+
chrome.storage.local.set({ 'headers': data }, function () {
460460
if (chrome.runtime.lastError) {
461461
if (debug) { console.log('There was an error last time we tried to store a memento ' + chrome.runtime.lastError.message) }
462462
if (chrome.runtime.lastError.message.indexOf('QUOTA_BYTES_PER_ITEM') > -1) {
@@ -467,7 +467,7 @@ chrome.webRequest.onHeadersReceived.addListener(function (deets) {
467467
})
468468
})
469469
},
470-
{urls: ['<all_urls>'], types: ['main_frame']}, ['responseHeaders', 'blocking'])
470+
{ urls: ['<all_urls>'], types: ['main_frame'] }, ['responseHeaders', 'blocking'])
471471

472472
function createTimemapFromURI (uri, tabId, accumulatedArrayOfTimemaps) {
473473
if (debug) {
@@ -517,7 +517,7 @@ function createTimemapFromURI (uri, tabId, accumulatedArrayOfTimemaps) {
517517
// Send two messages first stop animation then display stored
518518
// If use displayUIBasedOnContext the correctly gotten items wont be display
519519
// Rather we will ask memgator.cs for mementos
520-
chrome.tabs.sendMessage(tabId, {'method': 'stopAnimatingBrowserActionIcon'})
520+
chrome.tabs.sendMessage(tabId, { 'method': 'stopAnimatingBrowserActionIcon' })
521521
chrome.tabs.sendMessage(tabId, {
522522
'method': 'displayUIStoredTM',
523523
'data': firstTm
@@ -534,7 +534,7 @@ function displayMementosMissingTM (mementos, urir, tabId) {
534534
tm.original = urir
535535
setTimemapInStorage(tm, tm.original)
536536

537-
chrome.tabs.sendMessage(tabId, {'method': 'stopAnimatingBrowserActionIcon'})
537+
chrome.tabs.sendMessage(tabId, { 'method': 'stopAnimatingBrowserActionIcon' })
538538
chrome.tabs.sendMessage(tabId, {
539539
'method': 'displayUIStoredTM',
540540
'data': tm
@@ -624,7 +624,7 @@ function setTimemapInStorageAndCall (tm, url, cb) {
624624
console.log(tms)
625625
}
626626

627-
chrome.storage.local.set({'timemaps': tms}, function () {
627+
chrome.storage.local.set({ 'timemaps': tms }, function () {
628628
chrome.storage.local.getBytesInUse('timemaps', function (bytesUsed) {
629629
if (debug) {
630630
console.log('current bytes used:' + bytesUsed)
@@ -644,7 +644,7 @@ function setTimemapInStorageAndCall (tm, url, cb) {
644644
console.log('Re-setting chrome.storage.local with:')
645645
console.log(tms)
646646
}
647-
chrome.storage.local.set({'timemaps': tms}, function () {
647+
chrome.storage.local.set({ 'timemaps': tms }, function () {
648648
cb()
649649
})
650650
}
@@ -688,7 +688,7 @@ function setTimemapInStorage (tm, url) {
688688
console.log(tms)
689689
}
690690

691-
chrome.storage.local.set({'timemaps': tms}, function () {
691+
chrome.storage.local.set({ 'timemaps': tms }, function () {
692692
chrome.storage.local.getBytesInUse('timemaps', function (bytesUsed) {
693693
if (debug) { console.log('current bytes used:' + bytesUsed) }
694694
})
@@ -702,7 +702,7 @@ function setTimemapInStorage (tm, url) {
702702
console.log('Re-setting chrome.storage.local with:')
703703
console.log(tms)
704704
}
705-
chrome.storage.local.set({'timemaps': tms}, function () {})
705+
chrome.storage.local.set({ 'timemaps': tms }, function () {})
706706
}
707707
}
708708
})

mink-plugin/options.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function getListItemHTML (uri, classIn, buttonText) {
3535
}
3636

3737
function clearBlacklist () {
38-
chrome.storage.local.set({'blacklist': []})
38+
chrome.storage.local.set({ 'blacklist': [] })
3939
document.location.reload()
4040
}
4141

@@ -200,7 +200,7 @@ function removeTMFromCache (originalURI) {
200200
chrome.storage.local.get('timemaps', function (items) {
201201
let tms = items.timemaps
202202
delete tms[originalURI]
203-
chrome.storage.local.set({'timemaps': tms},
203+
chrome.storage.local.set({ 'timemaps': tms },
204204
function () {
205205
console.log('Cache updated, updating UI')
206206
$('#cachedTimemaps').empty()
@@ -211,15 +211,15 @@ function removeTMFromCache (originalURI) {
211211
}
212212

213213
function clearTimemapCache () {
214-
chrome.storage.local.set({'timemaps': {}},
214+
chrome.storage.local.set({ 'timemaps': {} },
215215
function () {
216216
console.log('Remove all cached TMs')
217217
$('#cachedTimemaps').empty()
218218
populatedCachedTimeMapsUI()
219219
}
220220
)
221221

222-
chrome.storage.local.set({'headers': {}},
222+
chrome.storage.local.set({ 'headers': {} },
223223
function () {
224224
console.log('Remove headers')
225225
}

0 commit comments

Comments
 (0)