Immortal2004
New Coder
I have tried many, many times to make this possible but can't figure out how to get the comments box and button to be inline with the reactions emojis and I can't get it working. It has frustrated me so much that I have thought of quitting the project but I'm hoping I won't have to and I'm hoping that I'll get some help here.
My code is below and an image is below as well:
My code is below and an image is below as well:
Code:
<style>
.custom-context-menu {
display: none;
position: absolute;
z-index: 1000;
background-color: #fff;
border-radius: 5px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.custom-context-menu a {
color: black;
text-align: left;
padding: 12px;
text-decoration: none;
display: block;
border-radius: 0; /* Added this line */
}
</style>
<script>
function copyToClipboard(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
}
// Add unique class to each video element
$('.context-video').addClass('context-video-' + ".$row['id'].");
$('.context-video-' + ".$row['id'].").contextmenu(function(e) {
e.preventDefault();
var video = $(this)[0];
var contextMenu = $('#contextMenu".$row['id']."');
contextMenu.empty();
contextMenu.append(\"<a href='https://raxie.42web.io/".$fileURL."' title='Click to download ".$fileURL."' id='download-link' download><img src='save.png' style='width:19px; margin-bottom:-3px'> Download</a>\");
contextMenu.css({ top: e.pageY + 'px', left: e.pageX + 'px' }).fadeIn(200);
$(document).click(function() {
contextMenu.fadeOut(200);
});
$('.share-link').click(function(e) {
e.preventDefault();
// Copy the link to the clipboard when the 'Share' link is clicked
copyToClipboard('https://raxie.42web.io/".$fileURL."');
});
});
</script>
";
} else {
// Display Image
echo "
<div class='image-container'>
<div class='reactions-overlay'>
<form style='display:inline; margin-right:6px' class='reaction-form'>
<input type='hidden' id='reactionSadCount-{$row['id']}' value='0'>
<button class='reaction-btn' onclick='addReaction('{$row['id']}', 'Sad');'>
<img src='sads-icon.png' title='Sad' alt='Sad' style='width:20px'>
<span class='counter' id='reactionSadCounter-{$row['id']}'>0</span>
</button>
</form>
<form style='display:inline; margin-right:6px' class='reaction-form'>
<input type='hidden' id='reactionSadCount-{$row['id']}' value='0'>
<button class='reaction-btn' onclick='addReaction('{$row['id']}', 'Angry');'>
<img src='mad-icon.png' title='Angry' alt='Angry' style='width:20px'>
<span class='counter' id='reactionSadCounter-{$row['id']}'>0</span>
</button>
</form>
<form style='display:inline; margin-right:6px' class='reaction-form'>
<input type='hidden' id='reactionSadCount-{$row['id']}' value='0'>
<button class='reaction-btn' onclick='addReaction('{$row['id']}', 'Laughing');'>
<img src='happy-icon.png' title='Laughing' alt='Laugh' style='width:20px'>
<span class='counter' id='reactionSadCounter-{$row['id']}'>0</span>
</button>
</form>
<form style='display:inline; margin-right:6px' class='reaction-form'>
<input type='hidden' id='reactionSadCount-{$row['id']}' value='0'>
<button class='reaction-btn' onclick='addReaction('{$row['id']}', 'LOL');'>
<img src='lols-icon.png' title='LOL' alt='LOLs' style='width:20px'>
<span class='counter' id='reactionSadCounter-{$row['id']}'>0</span>
</button>
</form>
<form style='display:inline; margin-right:6px' class='reaction-form'>
<input type='hidden' id='reactionSadCount-{$row['id']}' value='0'>
<button class='reaction-btn' onclick='addReaction('{$row['id']}', 'Love it');'>
<img src='love-it.png' title='Love it!' alt='Love It' style='width:20px'>
<span class='counter' id='reactionSadCounter-{$row['id']}'>0</span>
</button>
</form>
<form style='display:inline; margin-right:6px' class='reaction-form'>
<input type='hidden' id='reactionSadCount-{$row['id']}' value='0'>
<button class='reaction-btn' onclick='addReaction('{$row['id']}', 'Amazed');'>
<img src='amazed-icon.png' title='Amazing!' alt='Amazed' style='width:20px'>
<span class='counter' id='reactionSadCounter-{$row['id']}'>0</span>
</button>
</form>
<form style='display:inline; margin-right:6px' class='reaction-form'>
<input type='hidden' id='reactionSadCount-{$row['id']}' value='0'>
<button class='reaction-btn' onclick='addReaction('{$row['id']}', 'Disgusted');'>
<img src='sick-icons.png' title='Disgusted' alt='Amazed' style='width:20px'>
<span class='counter' id='reactionSadCounter-{$row['id']}'>0</span>
</button>
</form>
</div>
<div class='black-gradient'>
<form method='post' class='reaction-form' style='>
<input type='hidden' name='title' id='".$row['title']."' value='".$row['title']."'>
<input type='hidden' id='username' style='background-color:rgba(255, 255, 255, 0.2); border:2px solid rgba(255, 255, 255, 0.3)' value='".$_SESSION['username']."' name='username' required>
<input type='hidden' name='postId' id='".$row['id']."' value='".$row['id']."' />
<input type='text' id='comment-".$row['id']."' class='add-comment' placeholder='Add Comment...' style='padding:6px 10px; margin-right:-200px; color:white; font-weight:600; font-size:12px; background-color:rgba(255, 255, 255, 0.3); border:2px solid rgba(255, 255, 255, 0.7); resize:none; border-radius:50px; outline:none; font-family:Montserrat, sans-serif; width:40%' name='comment' required>
<button class='postBtn' onclick='return addComment(".$row['id'].");' style='background-color:white; padding:6px 10px; font-weight:600; float:right; margin-top:-4px; font-size:12px; font-family:Montserrat, sans-serif; border-radius:50px'>Add</button>
</form>
</div>
<img src='" . $fileURL . "' could not load' preload='metadata' title='You are viewing " . $row['title'] . "' style='width:100%; border-top:2px solid rgba(255, 255, 255, 0.3)'/>
</div>
";
}
} else {
// Display default image
echo "<img src='save.png' preload='metadata' style='width:0%'/>";
}