Improve my profile.ejs with bootstrap features, improve… · The Chat Archivegpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2) Improve my profile.ejs with bootstrap features, improve design. и сделай так, чтоб…
Download ▾
Improve my profile.ejs with bootstrap features, improve design. и сделай так, чтоб подсказки с городами работали:
<div class="col-md-8">
<h1><%= musician.name %></h1>
<p><strong>Role:</strong> <%= musician.role %></p>
<p><strong>Genre:</strong> <%= musician.genre %></p>
<% if (musician.role === 'Artist' && musician.instrument) { %>
<p><strong>Instrument:</strong> <%= musician.instrument %></p>
<% } %>
<p><strong>Location:</strong> <%= musician.city %></p>
<p><strong>Bio:</strong> <%= musician.bio %></p>
<% if (musician.soundcloud) { %>
<iframe width="100%" height="150" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<%= musician.soundcloud %>&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>
<% } %>
<% if (musician.soundcloud1) { %>
<iframe width="100%" height="300" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<%= musician.soundcloud1 %>&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>
<% } %>
<% if (userLoggedIn && username === musician.name) { %>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#edit-profile-modal">Edit profile</button>
<div id="edit-profile-modal" class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Edit Profile</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<form action="/profile/<%= musician.id %>/edit" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" id="name" name="name" value="<%= musician.name %>" class="form-control">
</div>
<div class="form-group">
<label for="role">Role:</label>
<select id="role" name="role" class="form-control">
<option value="">Select a genre</option>
<option value="Band" <%= musician.role === 'Band' ? 'selected' : '' %>>Band</option>
<option value="Artist" <%= musician.genre === 'Artist' ? 'selected' : '' %>>Artist</option>
</select>
</div>
<div class="form-group">
<label for="genre">Genre:</label>
<select id="genre" name="genre" class="form-control">
<option value="">Select a genre</option>
<option value="Rock" <%= musician.genre === 'Rock' ? 'selected' : '' %>>Rock</option>
<option value="Pop" <%= musician.genre === 'Pop' ? 'selected' : '' %>>Pop</option>
<option value="Hip hop" <%= musician.genre === 'Hip hop' ?'selected' : '' %>>Hip hop</option>
<option value="Electronic" <%= musician.genre === 'Electronic' ? 'selected' : '' %>>Electronic</option>
</select>
</div>
<% if (musician.role === 'Artist') { %>
<div class="form-group">
<label for="instrument">Instrument:</label>
<input type="text" id="instrument" name="instrument" value="<%= musician.instrument %>" class="form-control">
</div>
<% } %>
<div class="form-group">
<label for="city">City:</label>
<input id="city" name="city" type="text" autocomplete="on" value="<%= musician.city %>" data-value="" class="form-control">
</div>
<div class="form-group">
<label for="bio">Bio:</label>
<textarea id="bio" name="bio" class="form-control"><%= musician.bio %></textarea>
</div>
<div class="form-group">
<label for="soundcloud">Song 1:</label>
<input type="text" id="soundcloud" name="soundcloud" value="<%= musician.soundcloud %>" class="form-control">
</div>
<div class="form-group">
<label for="soundcloud1">Song 2:</label>
<input type="text" id="soundcloud1" name="soundcloud1" value="<%= musician.soundcloud1 %>" class="form-control">
</div>
<div class="form-group">
<label for="thumbnail">Thumbnail:</label>
<input type="file" id="thumbnail" name="thumbnail" class="form-control-file">
</div>
<button type="submit" class="btn btn-primary">Save</button>
</form>
</div>
</div>
</div>
</div>
<% } %>
</div>
</div>
</div>
<script>
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
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);
}
$("#city").autocomplete({
source: '/autocomplete/cities',
minLength: 1,
});
const queryInput = document.querySelector("#query");
const roleInput = document.querySelector("#role");
const cityInput = document.querySelector("#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;
<div class="col-md-8">
<h1><%= musician.name %></h1>
<p><strong>Role:</strong> <%= musician.role %></p>
<p><strong>Genre:</strong> <%= musician.genre %></p>
<% if (musician.role === 'Artist' && musician.instrument) { %>
<p><strong>Instrument:</strong> <%= musician.instrument %></p>
<% } %>
<p><strong>Location:</strong> <%= musician.city %></p>
<p><strong>Bio:</strong> <%= musician.bio %></p>
<% if (musician.soundcloud) { %>
<iframe width="100%" height="150" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<%= musician.soundcloud %>&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>
<% } %>
<% if (musician.soundcloud1) { %>
<iframe width="100%" height="300" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=<%= musician.soundcloud1 %>&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>
<% } %>
<% if (userLoggedIn && username === musician.name) { %>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#edit-profile-modal">Edit profile</button>
<div id="edit-profile-modal" class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Edit Profile</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<form action="/profile/<%= musician.id %>/edit" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" id="name" name="name" value="<%= musician.name %>" class="form-control">
</div>
<div class="form-group">
<label for="role">Role:</label>
<select id="role" name="role" class="form-control">
<option value="">Select a genre</option>
<option value="Band" <%= musician.role === 'Band' ? 'selected' : '' %>>Band</option>
<option value="Artist" <%= musician.genre === 'Artist' ? 'selected' : '' %>>Artist</option>
</select>
</div>
<div class="form-group">
<label for="genre">Genre:</label>
<select id="genre" name="genre" class="form-control">
<option value="">Select a genre</option>
<option value="Rock" <%= musician.genre === 'Rock' ? 'selected' : '' %>>Rock</option>
<option value="Pop" <%= musician.genre === 'Pop' ? 'selected' : '' %>>Pop</option>
<option value="Hip hop" <%= musician.genre === 'Hip hop' ?'selected' : '' %>>Hip hop</option>
<option value="Electronic" <%= musician.genre === 'Electronic' ? 'selected' : '' %>>Electronic</option>
</select>
</div>
<% if (musician.role === 'Artist') { %>
<div class="form-group">
<label for="instrument">Instrument:</label>
<input type="text" id="instrument" name="instrument" value="<%= musician.instrument %>" class="form-control">
</div>
<% } %>
<div class="form-group">
<label for="city">City:</label>
<input id="city" name="city" type="text" autocomplete="on" value="<%= musician.city %>" data-value="<%= musician.city %>" class="form-control">
<input type="hidden" id="city-hidden" name="city-hidden" value="<%= musician.city %>">
</div>
<div class="form-group">
<label for="bio">Bio:</label>
<textarea id="bio" name="bio" class="form-control"><%= musician.bio %></textarea>
</div>
<div class="form-group">
<label for="soundcloud">Song 1:</label>
<input type="text" id="soundcloud" name="soundcloud" value="<%= musician.soundcloud %>" class="form-control">
</div>
<div class="form-group">
<label for="soundcloud1">Song 2:</label>
<input type="text" id="soundcloud1" name="soundcloud1" value="<%= musician.soundcloud1 %>" class="form-control">
</div>
<div class="form-group">
<label for="thumbnail">Thumbnail:</label>
<input type="file" id="thumbnail" name="thumbnail" class="form-control-file">
</div>
<button type="submit" class="btn btn-primary">Save</button>
</form>
</div>
</div>
</div>
</div>
<% } %>
</div>
</div>
</div>
<script>
//скрыть плеер, если ссылка не внесена
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`;