From d0dae6753e5c32a4f0f81a17934a19fd193aa9aa Mon Sep 17 00:00:00 2001
From: zvizvi <5633910@gmail.com>
Date: Mon, 4 Apr 2022 03:01:58 +0300
Subject: [PATCH] Add VSCode Dev & default options bug fix
---
.github/FUNDING.yml | 4 ++--
README.md | 2 ++
src/html/options.html | 11 ++++++++---
src/js/main.js | 27 ++++++++++++++++++++++++++-
src/js/options.js | 17 +++++++++--------
src/manifest.json | 2 +-
src/package-lock.json | 4 ++--
src/package.json | 2 +-
8 files changed, 51 insertions(+), 18 deletions(-)
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 1b5e7a2..cd55721 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -2,8 +2,8 @@
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
-open_collective: GitHub-Web-IDE
-ko_fi: # Replace with a single Ko-fi username
+open_collective: # Replace with a single Open Collective username
+ko_fi: zvizvi
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
diff --git a/README.md b/README.md
index f17dfa1..85ab7f9 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@ This extension adds to any GitHub repository a new drop down menu which offers l
Services currently supported:
* [GitHub Dev](https://github.dev/)
+* [VSCode Dev](https://vscode.dev/)
* [CodeSandbox](https://codesandbox.io/)
* [GitHub1s](https://github1s.com/)
* [Repl.it](https://replit.com/)
@@ -26,6 +27,7 @@ Services currently supported:
### What's changed?
+* v2.0.1 Open in VSCodeDev option
* v2.0.0
* Extension customizing options page.
* Open in VSCode Remote Repositories option.
diff --git a/src/html/options.html b/src/html/options.html
index ea6a532..d983ecf 100644
--- a/src/html/options.html
+++ b/src/html/options.html
@@ -68,6 +68,12 @@
Enabled IDE list
GitHub Dev
+
+
+
-
-
-
+
+
diff --git a/src/js/main.js b/src/js/main.js
index ea7dde9..9c1193f 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -10,6 +10,14 @@ const ideWebsitesList = [
openInNewTab: true,
icon: ''
},
+ {
+ title: 'VSCode Dev',
+ name: 'vsCodeDev',
+ baseurl: 'https://vscode.dev/github/',
+ platforms: ['github'],
+ openInNewTab: true,
+ icon: ''
+ },
{
title: 'CodeSandbox',
name: 'codeSandbox',
@@ -107,6 +115,23 @@ const ideWebsitesList = [
class: 'd-none d-md-block'
}
];
+const defaultOptions = {
+ gitHubDev: true,
+ vsCodeDev: true,
+ codeSandbox: true,
+ gitHub1s: true,
+ replit: true,
+ stackBlitz: true,
+ gitpod: true,
+ glitch: true,
+ sourcegraph: true,
+ activeForks: false,
+ gitpop2: false,
+ gitHubMemory: false,
+ cloneInVSCode: true,
+ vsCodeRemoteRepositories: false,
+ openInNewTab: true
+};
const repoUrlPath = location.pathname.split('/').slice(1, 3).join('/');
const hasPackageJson = [...document.querySelectorAll('.Details > .js-active-navigation-container > .Box-row a.js-navigation-open')].some((el) => el.innerText === 'package.json');
@@ -114,7 +139,7 @@ const hasPackageJson = [...document.querySelectorAll('.Details > .js-active-navi
let options;
const init = async function () {
const storage = await chrome.storage.sync.get('options');
- options = storage.options;
+ options = storage.options || defaultOptions;
switch (platform) {
case 'github': {
diff --git a/src/js/options.js b/src/js/options.js
index 74d77dd..5330c86 100644
--- a/src/js/options.js
+++ b/src/js/options.js
@@ -2,6 +2,7 @@
const defaultOptions = {
gitHubDev: true,
+ vsCodeDev: true,
codeSandbox: true,
gitHub1s: true,
replit: true,
@@ -56,14 +57,9 @@ const show = function () {
}
};
-// Reset to defaults
-const reset = async function () {
- await save(defaultOptions);
-};
-
-// On save button clicked
-document.addEventListener('click', async (event) => {
- if (event.target.id === 'save-button') {
+// On checkbox changed
+document.addEventListener('input', async (event) => {
+ if (event.target.type === 'checkbox') {
for (const key in defaultOptions) {
switch (typeof defaultOptions[key]) {
case ('boolean'): {
@@ -81,6 +77,11 @@ document.addEventListener('click', async (event) => {
}
});
+// Reset to defaults
+const reset = async function () {
+ await save(defaultOptions);
+};
+
// On reset button clicked
document.addEventListener('click', async (event) => {
if (event.target.id === 'reset-button') {
diff --git a/src/manifest.json b/src/manifest.json
index 7bdf0cd..28573ca 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -4,7 +4,7 @@
"manifest_version": 3,
"update_url": "https://clients2.google.com/service/update2/crx",
"homepage_url": "https://github.com/zvizvi/GitHub-Web-IDE",
- "version": "2.0.0",
+ "version": "2.0.1",
"author": "zvizvi5@outlook.com",
"action": {
"default_icon": {
diff --git a/src/package-lock.json b/src/package-lock.json
index 2189208..45066a6 100644
--- a/src/package-lock.json
+++ b/src/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "github-web-ide",
- "version": "2.0.0",
+ "version": "2.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "github-web-ide",
- "version": "2.0.0",
+ "version": "2.0.1",
"dependencies": {
"@primer/css": "^19.5.0"
}
diff --git a/src/package.json b/src/package.json
index 478455e..d883eeb 100644
--- a/src/package.json
+++ b/src/package.json
@@ -1,6 +1,6 @@
{
"name": "github-web-ide",
- "version": "2.0.0",
+ "version": "2.0.1",
"description": "⚡ Open GitHub repositories in online web IDE",
"main": "README.md",
"dependencies": {