diff --git a/client/admin/brewUtils/brewLookup/brewLookup.jsx b/client/admin/brewUtils/brewLookup/brewLookup.jsx index fa5784501..922613559 100644 --- a/client/admin/brewUtils/brewLookup/brewLookup.jsx +++ b/client/admin/brewUtils/brewLookup/brewLookup.jsx @@ -1,3 +1,5 @@ +require('./brewLookup.less'); + const React = require('react'); const createClass = require('create-react-class'); const cx = require('classnames'); @@ -27,18 +29,21 @@ const BrewLookup = createClass({ this.setState({ searching: true, error: null, checkForScript: false, scriptCount: undefined }); request.get(`/admin/lookup/${this.state.query}`) - .then((res)=>this.setState({ foundBrew: res.body })) + .then((res)=>{ + const foundBrew = res.body; + const scriptCheck = foundBrew.text.match(/(<\/?s)cript/); + this.setState({ + foundBrew : foundBrew, + scriptCount : scriptCheck?.length || 0, + checkForScript : scriptCheck?.length > 0 + }); + }) .catch((err)=>this.setState({ error: err })) - .finally(()=>this.setState({ searching: false })); - }, - - checkForScript(){ - const brew = this.state.foundBrew; - const scriptCheck = brew.text.match(/(<\/?s)cript/); - this.setState({ - checkForScript : !!scriptCheck, - scriptCount : scriptCheck?.length || 0 - }); + .finally(()=>{ + this.setState({ + searching : false + }); + }); }, cleanScript(){ @@ -71,10 +76,15 @@ const BrewLookup = createClass({
Num of Views
{brew.views}
+ +
Number of SCRIPT tags detected
+
{this.state.scriptCount}
- - {(typeof this.state.scriptCount == 'number') &&

Number of SCRIPT tags found: {this.state.scriptCount}

} - {this.state.checkForScript && } + {this.state.checkForScript && +
+ +
+ } ; }, diff --git a/client/admin/brewUtils/brewLookup/brewLookup.less b/client/admin/brewUtils/brewLookup/brewLookup.less new file mode 100644 index 000000000..da15e3a64 --- /dev/null +++ b/client/admin/brewUtils/brewLookup/brewLookup.less @@ -0,0 +1,6 @@ +.brewLookup { + .cleanButton { + display : inline-block; + width : 100%; + } +} \ No newline at end of file