Blogger Yorumlarında Görsel ve Video Ekleme

Blogger, kullanıcıların düşüncelerini paylaştığı, etkileşimde bulunduğu harika bir platform. Ancak yorumlara sadece metin yazmak anlatmak istediğiniz şeyi eksik anltamanıza sebep olabilir. Özellikle bir konuyu görsel veya video ile desteklemek istediğimizde bu bir eksiklik olarak hissedilebiliyor.

Bu  kod  sayesinde Blogger yorumlarınıza doğrudan video ve görsel ekleyebileceksiniz.

<b:if cond='data:view.isPost'>
<b:if cond='data:view.url != data:view.url params { amp: "1" }'>
<script>/*<![CDATA[*/ /* Comment tag, license: dte.web.id/teknis/paket-javascript-fitur-manipulasi */ function repText(id) {var a = document.getElementById(id); if (!a) return; var b = a.innerHTML; b = b.replace(/<i rel="image">(.*?)<\/i>/ig, "<img class='lazy' data-src='$1' src='$1' alt='Resim Yorumu' \/>"); b = b.replace(/<i rel="youtube">(.*?)<\/i>/ig, function(match, url) { var videoId = ''; var isShorts = false; var youtubeRegex = /(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|playlist\?list=))([\w-]{11})(?:&.*)?$/i; var shortsRegex = /(?:https?:\/\/)?(?:www\.)?(?:m\.)?(?:youtube\.com\/shorts\/)([\w-]{11})(?:.*)?$/i; var matchResult = url.match(youtubeRegex); if (matchResult && matchResult[1]) { videoId = matchResult[1]; } else { matchResult = url.match(shortsRegex); if (matchResult && matchResult[1]) { videoId = matchResult[1]; isShorts = true; } else { return 'Geçersiz YouTube Bağlantısı'; } } if (isShorts) { return '<iframe width="379" height="674" src="https://www.youtube.com/embed/' + videoId + '" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>'; } else { return '<iframe width="560" height="280" src="https://www.youtube.com/embed/' + videoId + '" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>'; } }); a.innerHTML = b;} repText('comments-content'); /*]]>*/</script>
</b:if>
</b:if>

Son  olarak yorumlardaki videonun taşmasını önlemek için CSS kısmına şu kodu ekleyin, yoksa videolar yorum alanının dışına taşar.

.comments-content iframe { 
width:100%;
overflow:hidden;
}
3 Yorum