Skip to content

Compatibility changes for gekko and blink based browsers #181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"tailwindcss": "^4.1.4"
},
"dependencies": {
"@tailwindcss/cli": "^4.1.3"
"@tailwindcss/cli": "^4.1.3",
"browser-polyfill": "^3.20.2"
}
}
}
14 changes: 11 additions & 3 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
"96": "icons/icon.png",
"48": "icons/icon.png"
},
"background": {
"service_worker": "scripts/background.js"
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
"strict_min_version": "109.0"
}
},
"content_scripts": [
{
Expand All @@ -25,7 +28,12 @@
"*://outlook.office.com/*",
"*://mail.yahoo.com/*"
],
"js": ["scripts/jquery-3.2.1.min.js", "scripts/emailClientAdapter.js", "scripts/scrumHelper.js"]
"js": [
"scripts/browser-polyfill.js",
"scripts/jquery-3.2.1.min.js",
"scripts/emailClientAdapter.js",
"scripts/scrumHelper.js"
]
}
],

Expand Down
1 change: 1 addition & 0 deletions src/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ <h4 class="font-semibold text-xl">Note:</h4>
</div>
</div>
</div>
<script src="scripts/browser-polyfill.js"></script>
<script src="scripts/jquery-3.2.1.min.js"></script>
<script type="text/javascript" type="text/javascript" src="materialize/js/materialize.min.js"></script>
<script src="scripts/main.js"></script>
Expand Down
Empty file removed src/scripts/background.js
Empty file.
7 changes: 7 additions & 0 deletions src/scripts/browser-polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if (typeof browser === "undefined") {
window.browser = typeof chrome !== "undefined" ? chrome : {};
// Create global browser reference
if (typeof chrome !== "undefined") {
var browser = chrome;
}
}
37 changes: 17 additions & 20 deletions src/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let userReasonElement = document.getElementById('userReason');
let showCommitsElement = document.getElementById('showCommits');

function handleBodyOnLoad() {
chrome.storage.local.get(
browser.storage.local.get(
[
'githubUsername',
'projectName',
Expand Down Expand Up @@ -43,7 +43,6 @@ function handleBodyOnLoad() {
if (items.enableToggle) {
enableToggleElement.checked = items.enableToggle;
} else if (items.enableToggle !== false) {
// undefined
enableToggleElement.checked = true;
handleEnableChange();
}
Expand All @@ -56,7 +55,6 @@ function handleBodyOnLoad() {
if (items.showOpenLabel) {
showOpenLabelElement.checked = items.showOpenLabel;
} else if (items.showOpenLabel !== false) {
// undefined
showOpenLabelElement.checked = true;
handleOpenLabelChange();
}
Expand All @@ -79,7 +77,7 @@ function handleBodyOnLoad() {
yesterdayContributionElement.checked = true;
handleYesterdayContributionChange();
}
if (items.showCommits){
if (items.showCommits) {
showCommitsElement.checked = items.showCommits;
} else {
showCommitsElement.checked = false;
Expand All @@ -95,14 +93,13 @@ document.getElementById('refreshCache').addEventListener('click', async (e) => {
button.disabled = true;

try {
const tabs = await chrome.tabs.query({ active: true, currentWindow: true });
await chrome.tabs.sendMessage(tabs[0].id, {
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
await browser.tabs.sendMessage(tabs[0].id, {
action: 'forceRefresh',
timestamp: Date.now()
});

// Reload the active tab to re-inject content
chrome.tabs.reload(tabs[0].id);
browser.tabs.reload(tabs[0].id);

Materialize.toast({ html: 'Data refreshed successfully!', classes: 'green' });
} catch (err) {
Expand All @@ -117,15 +114,15 @@ document.getElementById('refreshCache').addEventListener('click', async (e) => {

function handleEnableChange() {
let value = enableToggleElement.checked;
chrome.storage.local.set({ enableToggle: value });
browser.storage.local.set({ enableToggle: value });
}
function handleStartingDateChange() {
let value = startingDateElement.value;
chrome.storage.local.set({ startingDate: value });
browser.storage.local.set({ startingDate: value });
}
function handleEndingDateChange() {
let value = endingDateElement.value;
chrome.storage.local.set({ endingDate: value });
browser.storage.local.set({ endingDate: value });
}
function handleLastWeekContributionChange() {
let value = lastWeekContributionElement.checked;
Expand All @@ -146,7 +143,7 @@ function handleLastWeekContributionChange() {
labelElement.classList.remove("selectedLabel");
}

chrome.storage.local.set({ lastWeekContribution: value });
browser.storage.local.set({ lastWeekContribution: value });
}

function handleYesterdayContributionChange() {
Expand All @@ -168,7 +165,7 @@ function handleYesterdayContributionChange() {
labelElement.classList.add("unselectedLabel");
labelElement.classList.remove("selectedLabel");
}
chrome.storage.local.set({ yesterdayContribution: value });
browser.storage.local.set({ yesterdayContribution: value });
}

function getLastWeek() {
Expand Down Expand Up @@ -216,19 +213,19 @@ function getToday() {

function handleGithubUsernameChange() {
let value = githubUsernameElement.value;
chrome.storage.local.set({ githubUsername: value });
browser.storage.local.set({ githubUsername: value });
}
function handleGithubTokenChange() {
let value = githubTokenElement.value;
chrome.storage.local.set({ githubToken: value });
browser.storage.local.set({ githubToken: value });
}
function handleProjectNameChange() {
let value = projectNameElement.value;
chrome.storage.local.set({ projectName: value });
browser.storage.local.set({ projectName: value });
}
function handleCacheInputChange() {
let value = cacheInputElement.value;
chrome.storage.local.set({ cacheInput: value });
browser.storage.local.set({ cacheInput: value });
}
function handleOpenLabelChange() {
let value = showOpenLabelElement.checked;
Expand All @@ -242,17 +239,17 @@ function handleOpenLabelChange() {
labelElement.classList.remove("selectedLabel");
}

chrome.storage.local.set({ showOpenLabel: value });
browser.storage.local.set({ showOpenLabel: value });
}

function handleUserReasonChange() {
let value = userReasonElement.value;
chrome.storage.local.set({ userReason: value });
browser.storage.local.set({ userReason: value });
}

function handleShowCommitsChange() {
let value = showCommitsElement.checked;
chrome.storage.local.set({ showCommits: value });
browser.storage.local.set({ showCommits: value });
}

enableToggleElement.addEventListener('change', handleEnableChange);
Expand Down
Loading