ReferenceError: C:\Users\Ilya\Downloads\my-musician-network\views\profile.ejs:259 257…
- User
ReferenceError: C:\Users\Ilya\Downloads\my-musician-network\views\profile.ejs:259 257| const cityInput = document.querySelector("#edit-profile-modal input[name='city']");
258|259| queryInput.value = "<%= query %>";
260| roleInput.value = "<%= role %>"; 261| cityInput.value = cityInput.getAttribute('data-value'); 262|query is not defined
<script src="/jquery/dist/jquery.min.js"></script><script>const modal = document.getElementById("edit-profile-modal"); const btn = document.getElementsByTagName("a")[0]; const span = document.getElementsByClassName("close")[0];
btn.onclick = function() { modal.style.display = "block"; } span.onclick = function() { modal.style.display = "none"; } window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } } //скрыть плеер, если ссылка не внесена const song1Input = document.getElementById("soundcloud");const song2Input = document.getElementById("soundcloud1"); const player1 = document.getElementsByTagName('iframe')[0]; const player2 = document.getElementsByTagName('iframe')[1]; let songs = { song: "", song1: "" }
function hidePlayer(player) { player.src = ""; player.style.display = "none"; }
function updateSongs() { songs.song = song1Input.value.trim(); songs.song1 = song2Input.value.trim(); }
function updatePlayers() { if (songs.song !== "") { player1.src =
https://w.soundcloud.com/player/?url=${songs.song}&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true; player1.style.display = "block"; } else { hidePlayer(player1); }if (songs.song1 !== "") { player2.src =
https://w.soundcloud.com/player/?url=${songs.song1}&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true; player2.style.display = "block"; } else { hidePlayer(player2); } }song1Input.addEventListener("input", function() { updateSongs(); updatePlayers(); });
song2Input.addEventListener("input", function() { updateSongs(); updatePlayers(); });
updateSongs(); updatePlayers(); //Валидация ссылок с soundcloud function updatePlayers() { if (isValidSoundcloudUrl(songs.song)) { player1.src =
https://w.soundcloud.com/player/?url=${songs.song}&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true; player1.style.display = "block"; } else { hidePlayer(player1); }if (isValidSoundcloudUrl(songs.song1)) { player2.src =
https://w.soundcloud.com/player/?url=${songs.song1}&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true; player2.style.display = "block"; } else { hidePlayer(player2); } }function isValidSoundcloudUrl(url) { const regex = /^https?://(soundcloud.com|snd.sc)/(.*)$/; return regex.test(url); }
$("input[name='city']").autocomplete({ source: '/autocomplete/cities', minLength: 1,});
const queryInput = document.querySelector("#query"); const roleInput = document.querySelector("#role"); const cityInput = document.querySelector("#edit-profile-modal input[name='city']");
queryInput.value = "<%= query %>"; roleInput.value = "<%= role %>"; cityInput.value = cityInput.getAttribute('data-value');
const query = queryInput.value; const role = roleInput.value; const city = cityInput.value; .ui-autocomplete { z-index: 9999; }
- Assistant
There is a reference error in line 259 of the "profile.ejs" file. The error message indicates that "query" is not defined. It seems that the "query" variable is not defined or assigned a value in the script section of this file, but it is being used in that line of code. The code block uses queryInput, roleInput, and cityInput variables to set their respective input values. It is possible that the code that defines the "query" variable is missing or incomplete, or the variable name is incorrect.