Skip to content

Commit

Permalink
migration to manifest v3
Browse files Browse the repository at this point in the history
- the extraction tool is working fine on linkedin webpages without producing any error

- there is an error that stems from the events (background) file which states "Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist." I have been unable to find the cause of this error. It occurs if I click on the extension icon on a page other than linkedin. That can be used as a clue.
  • Loading branch information
DrakenWan committed Jul 30, 2022
1 parent 8baa526 commit af96ff1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 34 deletions.
17 changes: 8 additions & 9 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name":"Yal§",
"version": "1.0.0",
"manifest_version": 2,
"manifest_version": 3,
"icons": {
"128": "Y.png"
},
"page_action" : {
"action" : {
"default_title": "ext13"
},

"background": {
"scripts": ["./scripts/events.js"]
"service_worker": "./scripts/events.js"
},

"content_scripts": [
Expand All @@ -24,14 +24,13 @@
"permissions": [
"tabs",
"storage",
"activeTab",
"<all_urls>"
"activeTab"
],

"web_accessible_resources": [
"./views/slider.html",
"./scripts/jquery-3.6.0.min.js"
],
"web_accessible_resources": [{
"resources": ["./views/slider.html", "./scripts/jquery-3.6.0.min.js"],
"matches": ["<all_urls>"]
}],

"homepage_url": "https://github.com/drakenwan/"
}
14 changes: 0 additions & 14 deletions scripts/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,6 @@ function sliderGen() {
";

slider.innerHTML += sliderDivInnerHTML;
{
//blockity blockity ad removal property
/* apparently this doesn't work always
linkedin has a mechanism to block ad-banner removal
y-variable is working fine so far. kept in x just in case
*/

var x = document.getElementsByClassName("ad-banner");
var y = $(".ad-banner-container")
try {
x[0].remove();
y.remove();
} catch(err) {console.log(err);}
}

document.body.prepend(slider);
}
Expand Down
22 changes: 11 additions & 11 deletions scripts/events.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
//checking for pagAction request
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
if (request.todo == "showPageAction") {
chrome.tabs.query({
active: true,
currentWindow: true
}, function (tabs) {
chrome.pageAction.show(tabs[0].id);
});
}
});
// chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
// if (request.todo == "showPageAction") {
// chrome.tabs.query({
// active: true,
// currentWindow: true
// }, function (tabs) {
// //chrome.action.show(tabs[0].id);
// });
// }
// });


/* request to toggle slider whenever extension icon clicked
*/
chrome.pageAction.onClicked.addListener(function () {
chrome.action.onClicked.addListener(function () {
chrome.tabs.query({
active: true,
currentWindow: true
Expand Down

1 comment on commit af96ff1

@DrakenWan
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction for above statement: I am unable to find the solution for the error because I don't know which part of code it stems from

Please sign in to comment.