-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: more work on Manifest V3 support, new screenshots
- Loading branch information
Showing
26 changed files
with
137 additions
and
445 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!doctype html> | ||
<script src="/vendor/browser-polyfill.js"></script> | ||
<script src="/js/config.js"></script> | ||
<script src="/vendor/bower/jquery.min.js"></script> | ||
<script src="/js/common.js"></script> | ||
<script src="/js/offscreen.js"></script> |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,48 +1,12 @@ | ||
importScripts( | ||
"../vendor/browser-polyfill.js", | ||
"config.js", | ||
"../vendor/bower/jquery.min.js" | ||
); | ||
|
||
browser.runtime.onMessage.addListener(handleMessages); | ||
|
||
async function handleMessages(message) { | ||
if (message.target !== 'offscreen') { | ||
browser.runtime.onMessage.addListener(async (request) => { | ||
if (request.target !== 'offscreen') { | ||
return false; | ||
} | ||
|
||
if (message.type === 'parseProblemList') { | ||
parseProblemList(message.data); | ||
} else { | ||
console.warn(`Unexpected message type received: '${message.type}'.`); | ||
return false; | ||
if (request.type === 'parseProblemList') { | ||
return parseProblemList(request.data); | ||
} | ||
} | ||
|
||
function parseProblemList(htmlText) { | ||
const jqueryHandles = $.parseHTML(htmlText); | ||
|
||
return Object.fromEntries( | ||
jqueryHandles.flatMap((el) => | ||
[ | ||
...$(el).find('#content table.results tr:not(:first-of-type)'), | ||
].map((tr) => [ | ||
$(tr).find('td:nth-child(1)').text(), | ||
{ | ||
title: $(tr).find('td:nth-child(2)').text(), | ||
href: $(tr).find('td:nth-child(2) a').attr('href'), | ||
pdfHref: $(tr).find('td:nth-child(3) a').attr('href'), | ||
submitHref: $(tr).find('td:nth-child(5) a').attr('href'), | ||
}, | ||
]), | ||
), | ||
); | ||
} | ||
|
||
function sendToBackground(type, data) { | ||
browser.runtime.sendMessage({ | ||
type, | ||
target: 'background', | ||
data | ||
}); | ||
} | ||
console.warn(`Unexpected message type received: '${request.type}'.`); | ||
return false; | ||
}); |
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
Oops, something went wrong.