Spaces:
Sleeping
Sleeping
Commit ·
353faba
1
Parent(s): db3dcda
fix(app.js): correct bad escape sequence in search filter button
Browse filesfix_lang_search.py's find/replace introduced t!==\'All\' inside a
template-literal expression slot (${...}), where a backslash-escaped
single quote is not valid JS syntax outside of a string. This threw
a SyntaxError at parse time and took down the entire app.js file --
Router, State, Views, initApp(), and the live-feed WebSocket logic
never got defined.
Changed to the double-quoted form (t!=="All") already used two
tokens earlier in the same expression, matching the surrounding
quoting style and needing no escaping.
Verified with: node --check frontend/js/app.js
- frontend/js/app.js +1 -1
frontend/js/app.js
CHANGED
|
@@ -298,7 +298,7 @@ const Views = {
|
|
| 298 |
<span style="font-size:var(--font-size-sm);color:var(--text-muted)">Filter:</span>
|
| 299 |
${["All","politician","company","audit","contract","ministry","party","scheme","tender","electoralbond","regulatory","enforcement","insolvency","ngo","parliamentquestion","vigilancecircular","icijentity","sanctionedentity","courtcase","localbody","datagov","crimereport"].map(t => `
|
| 300 |
<button class="btn btn--sm ${type === t || (!type && t==="All") ? "btn--primary" : "btn--secondary"}"
|
| 301 |
-
onclick="Router.navigate('/search?q=${encodeURIComponent(query)}${t!==
|
| 302 |
${t.charAt(0).toUpperCase()+t.slice(1)}
|
| 303 |
</button>
|
| 304 |
`).join("")}
|
|
|
|
| 298 |
<span style="font-size:var(--font-size-sm);color:var(--text-muted)">Filter:</span>
|
| 299 |
${["All","politician","company","audit","contract","ministry","party","scheme","tender","electoralbond","regulatory","enforcement","insolvency","ngo","parliamentquestion","vigilancecircular","icijentity","sanctionedentity","courtcase","localbody","datagov","crimereport"].map(t => `
|
| 300 |
<button class="btn btn--sm ${type === t || (!type && t==="All") ? "btn--primary" : "btn--secondary"}"
|
| 301 |
+
onclick="Router.navigate('/search?q=${encodeURIComponent(query)}${t!=="All"?"&type="+t.toLowerCase():""}'+(State.language&&State.language!=='en'?'&lang='+State.language:''))">
|
| 302 |
${t.charAt(0).toUpperCase()+t.slice(1)}
|
| 303 |
</button>
|
| 304 |
`).join("")}
|