Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(function(){
- $('.news-topic').each(function(){
- var link = $(this).find('.news-info>a').attr('href');
- var name = $(this).find('.news-info>i>strong').text();
- var $target = $(this).find('.news-avatar');
- console.log(name);
- $.get(link, function(data) {
- var avatar = $(data).find('.ppname:contains('+name+')').parents('.post').find('.ppavatar img');
- if (avatar.length) {
- $target.html(avatar);
- }
- });
- });
- });
- </script>
- <style>
- .news-topic {
- display:grid;
- grid-template-columns:3rem 1fr;
- grid-template-rows:3rem;
- gap:.5rem;
- padding:.5rem;
- border-radius:.25rem;
- background:#ecf3f7;
- &:not(:last-of-type) {
- margin-bottom:.5rem;
- }
- & .news-avatar, & .news-avatar img {
- width:100%;
- height:100%;
- object-fit:cover;
- object-position:center;
- }
- & .news-info {
- place-content:center;
- text-align:center;
- & i { font-style:normal; }
- }
- }
- </style>
- <div class="news">
- <!-- BEGIN post_row -->
- <div class="news-topic">
- <div class="news-avatar"><img src="http://placehold.co/250x400/777/fff.png"/></div>
- <div class="news-info">
- {post_row.TITLE}<br/>
- <i>{BY} <strong>{post_row.POSTER}</strong> / {post_row.TIME}</i>
- </div>
- </div>
- <!-- END post_row -->
- </div>
Advertisement
Add Comment
Please, Sign In to add comment