Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Commit

Permalink
added css editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellscaped committed Oct 7, 2023
1 parent 8042f75 commit 48d3e3f
Show file tree
Hide file tree
Showing 7 changed files with 577 additions and 6 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"devDependencies": {
"eslint-plugin-userscripts": "^0.4.0"
},
"dependencies": {
"codemirror": "^6.0.1",
"react-codemirror2": "^7.3.0"
}
}
1 change: 1 addition & 0 deletions userscript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.1.0",
"private": true,
"dependencies": {
"@uiw/react-textarea-code-editor": "^2.1.9",
"react": "^17.0.2",
"react-app-rewired": "^2.1.8",
"react-dom": "^17.0.2",
Expand Down
16 changes: 13 additions & 3 deletions userscript/src/PlusPage.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import React from "react";
import "./App.css";

import CodeEditor from '@uiw/react-textarea-code-editor';

function PlusPage() {
function handleCSSChange(reactEvent) {
localStorage.setItem("customcss", reactEvent.target.value);
}
return (
<div className="App">
<header className="App-header">
<h1>SYNTAX+</h1>
<p>SYNTAX+ is a userscript that brings Roblox+ features to the Syntax website.</p>
<p>It is currently in development.</p>
<p>Check back later!</p>
<p>Custom CSS</p>
<CodeEditor
value={localStorage.getItem("customcss")}
onChange={handleCSSChange}
language="css"
placeholder="/* Syntax+ Custom CSS */"
/>

</header>
</div>
);
Expand Down
6 changes: 5 additions & 1 deletion userscript/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ async function main() {
// the page has loaded enough for that element to exist.

// get the synplus logo

if (!localStorage.getItem("customcss")) {
localStorage.setItem("customcss", "/* Syntax+ Custom CSS */");
}
// eslint-disable-next-line no-undef
GM_addStyle(localStorage.getItem("customcss"));
if (window.location.pathname in route_overrides) {
const oldcontainer = document.getElementsByClassName("d-flex align-items-center justify-content-center")[0];
deleteAllChildren(oldcontainer);
Expand Down
2 changes: 1 addition & 1 deletion userscript/src/userscript-header.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 48d3e3f

Please sign in to comment.