Skip to content

Commit

Permalink
fix: tokopedia listen on url change on specific url pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
wikankun committed Nov 11, 2024
1 parent b65556d commit 932becc
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/background/background.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
if (request.type === "getProfileUserInfo") {
chrome.identity.getProfileUserInfo(function (userInfo) {
sendResponse({
id: userInfo.id,
email: userInfo.email
});
});
return true;
}
});
// chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
// if (request.type === "getProfileUserInfo") {
// chrome.identity.getProfileUserInfo(function (userInfo) {
// sendResponse({
// id: userInfo.id,
// email: userInfo.email
// });
// });
// return true;
// }
// });

chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
if (changeInfo.url) {
if (changeInfo.url && changeInfo.url.match('https:\/\/.*.tokopedia.com\/.*\/.*')) {
if (changeInfo.url.indexOf("#") === -1) {
let url = changeInfo.url;
url = url.replace(/^https?:\/\//, '');
Expand Down

0 comments on commit 932becc

Please sign in to comment.