NecromancerCoding

Módulo de novedades con avatar de usuario

Aug 7th, 2025
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.22 KB | None | 0 0
  1. <script>
  2. $(function(){
  3. $('.news-topic').each(function(){
  4. var link = $(this).find('.news-info>a').attr('href');
  5. var name = $(this).find('.news-info>i>strong').text();
  6. var $target = $(this).find('.news-avatar');
  7.   console.log(name);
  8. $.get(link, function(data) {
  9. var avatar = $(data).find('.ppname:contains('+name+')').parents('.post').find('.ppavatar img');
  10. if (avatar.length) {
  11. $target.html(avatar);
  12. }
  13. });
  14. });
  15. });
  16. </script>
  17. <style>
  18. .news-topic {
  19.   display:grid;
  20.   grid-template-columns:3rem 1fr;
  21.   grid-template-rows:3rem;
  22.   gap:.5rem;
  23.   padding:.5rem;
  24.   border-radius:.25rem;
  25.   background:#ecf3f7;
  26.   &:not(:last-of-type) {
  27.    margin-bottom:.5rem;
  28.   }
  29.   & .news-avatar, & .news-avatar img {
  30.    width:100%;
  31.     height:100%;
  32.     object-fit:cover;
  33.     object-position:center;
  34.   }
  35.   & .news-info {
  36.    place-content:center;
  37.     text-align:center;
  38.     & i { font-style:normal; }
  39.   }
  40. }
  41. </style>
  42. <div class="news">
  43. <!-- BEGIN post_row -->
  44. <div class="news-topic">
  45. <div class="news-avatar"><img src="http://placehold.co/250x400/777/fff.png"/></div>
  46. <div class="news-info">
  47. {post_row.TITLE}<br/>
  48. <i>{BY} <strong>{post_row.POSTER}</strong> / {post_row.TIME}</i>
  49. </div>
  50. </div>
  51. <!-- END post_row -->
  52. </div>
Advertisement
Add Comment
Please, Sign In to add comment