-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
167 additions
and
85 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<link rel="stylesheet" href="{{styles.css}}"> | ||
|
||
<center> | ||
<img src="{{/assets/chrome.png}}" height="5%" width="5%"> | ||
<h1 align>New Chrome Extension</h1> | ||
</center> | ||
<hr> | ||
<body> | ||
<label for="project_name">Project Name:</label> | ||
<input type="text" id="project_name" required> | ||
|
||
<br><br> | ||
|
||
<label for="extension_type">Extension Type <small>[<a href="https://github.com/gadhagod/chrome-extension-cli-client/blob/master/templates/README.md#templates">?</a>]</small>:</label> | ||
|
||
<select id="extension_type"> | ||
<option value="popup">Popup</option> | ||
<option value="override_page">Override page</option> | ||
<option value="devtools">Dev tools</option> | ||
</select> | ||
|
||
<br><br> | ||
|
||
<label id="location_label" for="choose_location">Location: </label> | ||
<button id="choose_location" onclick="getLocation()">Choose</button> | ||
|
||
<br><br> | ||
|
||
<button id="submit" onclick="submit()">Create</button> | ||
|
||
<div id="loading" style="display: none"> | ||
<hr> | ||
<center> | ||
<p id="loading_text">Creating extension and installing dependencies.</p> | ||
<div id="loader"></div> | ||
</center> | ||
</div> | ||
</body> | ||
|
||
<script src="{{index.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
const vscode = acquireVsCodeApi(); | ||
|
||
window.addEventListener("message", (data) => { | ||
var res = data.data; | ||
|
||
if (res.status === "GIVE") { | ||
document.getElementById("location_label").innerHTML = "Location: " + res.message.path; | ||
} else if (res.status === "ERR") { | ||
document.getElementById("loading").style.display = "none"; | ||
document.getElementById("project_name").removeAttribute("disabled"); | ||
document.getElementById("extension_type").removeAttribute("disabled"); | ||
document.getElementById("choose_location").removeAttribute("disabled"); | ||
document.getElementById("submit").removeAttribute("disabled"); | ||
} else if (res.status === "LOAD") { | ||
document.getElementById("loader").innerHTML += "\n" + res.message; | ||
} | ||
}); | ||
|
||
function getLocation() { | ||
vscode.postMessage({ | ||
status: "GET", | ||
message: "Get location", | ||
}); | ||
} | ||
|
||
function submit() { | ||
let projectName = document.getElementById("project_name").value; | ||
let extensionType = document.getElementById("extension_type").value; | ||
let chosenPath = document.getElementById("location_label").innerHTML.replace("Location: ", ""); | ||
|
||
document.getElementById("project_name").setAttribute("disabled", ""); | ||
document.getElementById("extension_type").setAttribute("disabled", ""); | ||
document.getElementById("choose_location").setAttribute("disabled", ""); | ||
document.getElementById("submit").setAttribute("disabled", ""); | ||
|
||
if (!projectName || !extensionType || !chosenPath) { | ||
document.getElementById("project_name").removeAttribute("disabled"); | ||
document.getElementById("extension_type").removeAttribute("disabled"); | ||
document.getElementById("choose_location").removeAttribute("disabled"); | ||
vscode.postMessage({ | ||
status: "ERR", | ||
message: "Missing project configuration", | ||
}); | ||
return; | ||
} | ||
|
||
document.getElementById("loading").style.display = "block"; | ||
|
||
vscode.postMessage({ | ||
status: "OK", | ||
message: { | ||
projectName: projectName, | ||
extensionType: extensionType, | ||
chosenPath: chosenPath, | ||
}, | ||
}); | ||
} | ||
|
||
(async function() { | ||
let loadingText = document.getElementById("loading_text"); | ||
let ellipsisDotCount = 1; | ||
setInterval(() => { | ||
if(ellipsisDotCount > 2) { | ||
loadingText.innerHTML = loadingText.innerHTML.replace("...", "."); | ||
ellipsisDotCount = 1; | ||
} else { | ||
loadingText.innerHTML += "."; | ||
ellipsisDotCount++; | ||
} | ||
}, 1000); | ||
})(); |
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,20 @@ | ||
img { | ||
margin-top: 1%; | ||
} | ||
body { | ||
margin-left: 3%; | ||
} | ||
#loader { | ||
/* https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_loader */ | ||
border: 10px solid rgba(255, 255, 255, 0.061); | ||
border-top: 10px solid blue; | ||
border-radius: 10%; | ||
width: 20px; | ||
height: 20px; | ||
animation: spin 2s linear infinite; | ||
} | ||
@keyframes spin { | ||
/* https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_loader */ | ||
0% { transform: rotate(0deg); } | ||
100% { transform: rotate(360deg); } | ||
} |