From d51919e57f6b96f0c81da09f349f5246cdb7a48b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Jun 2026 21:24:33 +0000 Subject: [PATCH] remove react-router: replace with hash-based routing --- index.html | 1 - package.json | 1 - script.jsx | 57 +++++++++++++++++++++++++++------------------------- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/index.html b/index.html index f5e8cd9..960804f 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,6 @@ - diff --git a/package.json b/package.json index a3b8b06..87f9858 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "firebase": "^12.9.0", "react": "^19.2.4", "react-dom": "^19.2.4", - "react-router": "^7.13.0", "reactfire": "^4.2.3", "underscore": "^1.13.7" }, diff --git a/script.jsx b/script.jsx index 556558d..8e10cf5 100644 --- a/script.jsx +++ b/script.jsx @@ -10,6 +10,15 @@ var nextTypes = { text: 'text' }; +function getHashParams() { + var hash = window.location.hash.replace(/^#\/?/, ''); + var parts = hash ? hash.split('/') : []; + return { + scriptId: parts[0] || null, + action: parts[1] || null + }; +} + var StopPropagationMixin = { stopProp: function(event) { event.nativeEvent.stopImmediatePropagation(); @@ -66,13 +75,13 @@ function guid() { var Script = React.createClass({ - mixins: [ReactFireMixin, ReactRouter.State], + mixins: [ReactFireMixin], getInitialState: function() { highlight = ''; - + var params = getHashParams(); return { - scriptId: this.getParams().scriptId, - action: this.getParams().action, + scriptId: params.scriptId, + action: params.action, script: {}, editing: {} }; @@ -85,7 +94,7 @@ var Script = React.createClass({ }, loadScript: function() { if (this.firebaseRefs.script) this.unbind('script'); - this.bindAsObject(new Firebase("https://screenwrite.firebaseio.com/"+this.getParams().scriptId), "script"); + this.bindAsObject(new Firebase("https://screenwrite.firebaseio.com/"+getHashParams().scriptId), "script"); // CLEANUP OLD DATA var fb = new Firebase("https://screenwrite.firebaseio.com/"+this.state.scriptId); fb.once('value', (function(snapshot){ @@ -262,12 +271,12 @@ var Script = React.createClass({ var highlight = ''; var Line = React.createClass({ - mixins: [ReactFireMixin, StopPropagationMixin, ReactRouter.State], + mixins: [ReactFireMixin, StopPropagationMixin], getInitialState: function() { return { comments: this.props.line.comments, commenting: false, - scriptId: this.getParams().scriptId, + scriptId: getHashParams().scriptId, focused: false, }; }, @@ -441,12 +450,12 @@ var ContentEditable = React.createClass({ }); var Nav = React.createClass({ - mixins: [ReactFireMixin, StopPropagationMixin, ReactRouter.State], + mixins: [ReactFireMixin, StopPropagationMixin], getInitialState: function() { return { open: null, script: {}, - scriptId: this.getParams().scriptId, + scriptId: getHashParams().scriptId, highlight: '' }; }, @@ -602,7 +611,7 @@ var Home = React.createClass({

New Script   - Demo Script + Demo Script

@@ -635,23 +644,17 @@ var Home = React.createClass({ var App = React.createClass({ render: function() { - return ; + var params = getHashParams(); + if (params.scriptId) { + return