heartranked

git clone https://git.tarina.org/heartranked
Log | Files | Refs | README

heartranked.html (12329B)


      1 $def with (markdown, visitors, total, unique, logged, rights, namn, getlikes, formattime, feedbase, totbilder, limit, offset, bildpersida, search, bilder, searchform, getcombines, timebase, getfeed, getcombofeed, userimage, postexist, show, loadjson, loadtext, len, heart, hearted, sitename, siteslogan, siterendered, siteaddress, usrfeed)
      2 
      3 <HEAD>
      4     <meta charset="utf-8">
      5     <title>$sitename | $siteslogan | $siterendered</title>
      6     <link rel="stylesheet" href="static/splash.css?v=159" type="text/css" rel="stylesheet"/>
      7     <meta name="viewport" content="width=device-width, initial-scale=1">
      8 </HEAD>
      9 
     10 <BODY>
     11 <div class="introtext">
     12 <a href="/">go back</a> 
     13 $if rights=='mod' or rights=='admin':
     14     or <a href="/logout">log out</a>
     15 <div id="visitors">
     16 last VISITS by COUNTRIES<br>
     17 $for i in visitors:
     18     <img src="static/flags/${i}.png" onerror="this.remove()"> 
     19 <br>
     20 $unique UNICORNS 🦄 PEACE! ☮️
     21 <br>
     22 <div id="mod">
     23 $if rights=='mod' or rights=='admin':
     24     $#displayname = db.query("SELECT displayname FROM rymdadmin WHERE name='"+namn+"';")[0]
     25     $ displayname=loadjson('r/users/'+namn)
     26     hey <b><a href="/tuning">$displayname['displayname']</a></b>, <a href="/invites">invite</a>, <a href="/trust">trust</a> or <a href="/editor?new=yes">write</a>
     27     <br>
     28 $else:
     29     <a href="/login">login</a> 
     30 </div>
     31 $if rights=='mod' or rights=='admin':
     32     <form method="POST">
     33     $:searchform.render()
     34     </form>
     35 </div>
     36 $if search != '':
     37     <p>posts with search word $search: $totbilder</p>
     38     <p><a href="/?search=">remove search</a></p>
     39     $for b in bilder:
     40         $for g in b:
     41             <div class="post" id="$g['soundname']">
     42             <br>
     43             <br>
     44             <div class="heartpost">
     45             $:markdown.markdown(loadtext('p/posts/'+g['postid']+'/intro'))
     46             </div>
     47             <div class="postmenu">
     48             <small>by $g['creator'] g['timeadded']</small><br>
     49             $ getcombines(g['postid'])
     50             $if 'combine' in g:
     51                 $#combined = db.select('published', where="postid='"+g['combine']+"'")[0]
     52                 $ combined=loadjson('p/posts/'+g['combine']+'/meta')
     53                 <small>combo with <a href="/?show=$combined.postid">$combined['soundname']</a></small><br>
     54             $if 'remix' in g:
     55                 $#remixed = db.select('published', where="postid='"+g['remix']+"'")[0]
     56                 $ combined=loadjson('p/posts/'+g['remix']+'/meta')
     57                 <small>remixed <a href="/?show=$remixed['postid']">$remixed['soundname']</a></small><br>
     58             $if loadtext('p/posts/'+g['postid']+'/post') != '':
     59                 $if len(loadtext('p/posts/'+g['postid']+'/post')) > 255:
     60                     <a href="/?show=$g['postid']">read plenty more</a>
     61                 $else:
     62                     <a href="/?show=$g['postid']">read more</a>
     63             $else:
     64                 <a href="/editor?combine=$g['postid']">combo</a>
     65                 or <a href="/?show=$g['postid']">more</a>
     66             or <div class="megalike" id="megalike$g['postid']" onclick="like('$g['postid']')">$getlikes(g['postid'],namn)</div>
     67             <br>
     68             </div>
     69             </div>
     70 $else:
     71     $if show == None:
     72         $if usrfeed != '':
     73             <br>
     74             <b>showing only $usrfeed's
     75             $:userimage(usrfeed)
     76             feed now <a href='/?usrfeed='>show all</a></b>
     77             <br>
     78             <br>
     79         $#<small><a href="/?feedbase=timebased">timebased🌍</a> <a href="/?feedbase=heart1day">heartbased❤️day</a> <a href="/?feedbase=heart1week">week</a> <a href="/?feedbase=heart1month">month</a> <a href="/?feedbase=heart1year">year</a> <a href="/?feedbase=alltime">alltime</a></small>
     80         <small>🌍 <a href="/?feedbase=time">time</a> ❤️ <a href="/?feedbase=heart">heart</a> ⚭ <a href="/?feedbase=combo">combo</a> for <a href="/?timebase=today">day</a> <a href="/?timebase=week">week</a> <a href="/?timebase=month">month</a> <a href="/?timebase=year">year</a> <a href="/?timebase=all">all</a></small>
     81         <br>
     82         $ goodies=getfeed()
     83         $if goodies != []:
     84             $for g in goodies:
     85                 <div class="post" id="$g['soundname']">
     86                 <br>
     87                 <br>
     88                 <div class="heartpost">
     89                 $:markdown.markdown(loadtext('p/posts/'+g['postid']+'/intro'))
     90                 </div>
     91                 <div class="postmenu">
     92                 <small><small>$g['timeadded']</small></small>
     93                 <small>by <a href='?usrfeed=$g['creator']'>$g['creator']</a></small>
     94                 $:userimage(g['creator'])
     95                 <br>
     96                 $getcombines(g['postid'])
     97                 $if 'combine' in g:
     98                     $if g['combine'] != '':
     99                         $if postexist(g['combine']):
    100                             $#combined = db.select('published', where="postid='"+g['combine']+"'")[0]
    101                             $ combined=loadjson('p/posts/'+g['combine']+'/meta')
    102                             <small>combo with <a href="/?show=$combined['postid']">$combined['soundname']</a></small><br>
    103                 $if 'remix' in g:
    104                     $if g['remix'] != '':
    105                         $if postexist(g['remix']):
    106                             $#remixed = db.select('published', where="postid='"+g['remix']+"'")
    107                             $ remixed=loadjson('p/posts/'+g['remix']+'/meta')
    108                             <small>remixed <a href="/?show=$remixed['postid']">$remixed['soundname']</a></small><br>
    109                 $if loadtext('p/posts/'+g['postid']+'/post') != '':
    110                     $if len(loadtext('p/posts/'+g['postid']+'/post')) > 255:
    111                         <a href="/?show=$g['postid']">read plenty more</a>
    112                     $else:
    113                         <a href="/?show=$g['postid']">read more</a>
    114                 $else:
    115                     $if namn:
    116                         <a href="/editor?combine=$g['postid']">combo</a>
    117                         or <a href="/?show=$g['postid']">more</a>
    118                     $else:
    119                         <a href="/?show=$g['postid']">combo</a>
    120                 or <div class="megalike" id="megalike$g['postid']" onclick="like('$g['postid']')">$getlikes(g['postid'],namn)</div>
    121                 <br>
    122                 </div>
    123                 </div>
    124         $else:
    125             <br>
    126             <br>
    127             $:markdown.markdown('###welcome to HEARTRANKED!')
    128     $else:
    129         $#goodies = db.select('published', where="postid='"+show+"'")
    130         $ g=loadjson('p/posts/'+show+'/meta')
    131         $if g != {}:
    132             <a href="/#$g['soundname']">back</a> 
    133             $if namn == g['creator']:
    134                 or <a href="/?edit=$g['postid']">edit</a> 
    135             $if namn:
    136                 or <a href="/editor?remix=$g['postid']">remix</a> 
    137                 or <a href="/editor?combine=$g['postid']">combo</a> 
    138             $if namn == g['creator']:
    139                 or <small><a href="/?remove=$g['postid']">remove</a></small>
    140             <div class="post" id="$g['soundname']">
    141             <br>
    142             <div class="heartpost">
    143             $:markdown.markdown(loadtext('p/posts/'+g['postid']+'/intro'))
    144             $:markdown.markdown(loadtext('p/posts/'+g['postid']+'/post'))
    145             </div>
    146             <div class="postmenu">
    147             <small><small>$g['timeadded']</small></small>
    148             <small>by <a href='?usrfeed=$g['creator']'>$g['creator']</a></small>
    149             $:userimage(g['creator'])
    150             <br>
    151             $getcombines(g['postid'])
    152             $if 'combine' in g:
    153                 $if g['combine'] != '':
    154                     $#combined = db.select('published', where="postid='"+g['combine']+"'")[0]
    155                     $ combined=loadjson('p/posts/'+g['combine']+'/meta')
    156                     <small>combo with <a href="/?show=$combined['postid']">$combined['soundname']</a></small><br>
    157             $if 'remix' in g:
    158                 $if g['remix'] != '':
    159                     $#remixed = db.select('published', where="postid='"+g['remix']+"'")[0]
    160                     $ remixed=loadjson('p/posts/'+g['remix']+'/meta')
    161                     <small>remixed <a href="/?show=$remixed['postid']">$remixed['soundname']</a></small><br>
    162             or <a href="/#$g['soundname']">back</a> 
    163             $if namn == g['creator']:
    164                 or <a href="/?edit=$g['postid']">edit</a> 
    165             $if namn:
    166                 or <a href="/editor?remix=$g['postid']">remix</a> 
    167                 or <a href="/editor?combine=$g['postid']">combo</a> 
    168             <div class="megalike" id="megalike$g['postid']" onclick="like('$g['postid']')">$getlikes(g['postid'],namn)</div>
    169             <br>
    170             </div>
    171             </div>
    172         <br>
    173         <br>
    174         $ comboposts=getcombofeed(show)
    175         $ choose_feed = False
    176         $for c in comboposts:
    177             $if c['postid'] and choose_feed == False:
    178                 $#<small><a href="/?show=$g['postid']&feedbase=timebased">timebased 🌍</a> <a href="/?show=$g['postid']&feedbase=heart1day">heartbased ❤️ day</a> <a href="/?show=$g['postid']&feedbase=heart1week">week</a> <a href="/?show=$g['postid']&feedbase=heart1month">month</a> <a href="/?show=$g['postid']&feedbase=heart1year">year</a> <a href="/?show=$g['postid']&feedbase=alltime">alltime</a></small>
    179                 <small>🌍 <a href="/?show=$g['postid']&feedbase=time">time</a> ❤️ <a href="/?show=$g['postid']&feedbase=heart">heart</a> ⚭ <a href="/?show=$g['postid']&feedbase=combo">combo</a> for <a href="/?show=$g['postid']&feedbase=today">day</a> <a href="/?show=$g['postid']&timebase=week">week</a> <a href="/?show=$g['postid']&timebase=month">month</a> <a href="/?show=$g['postid']&timebase=year">year</a> <a href="/?show=$g['postid']&timebase=all">all</a></small>
    180                 $ choose_feed = True
    181             <div class="post" id="$c['soundname']">
    182             <br>
    183             <br>
    184             <div class="heartpost">
    185             $:markdown.markdown(loadtext('p/posts/'+c['postid']+'/intro'))
    186             $:markdown.markdown(loadtext('p/posts/'+c['postid']+'/post'))
    187             </div>
    188             <div class="postmenu">
    189             <small><small>$c['timeadded']</small></small>
    190             <small>by <a href='?usrfeed=$c['creator']'>$c['creator']</a></small>
    191             $:userimage(c['creator'])
    192             <br>
    193             $getcombines(c['postid'])
    194             $if 'combine' in c:
    195                 $if c['combine'] != '':
    196                     $#combined = db.select('published', where="postid='"+c['combine']+"'")[0]
    197                     $ combined=loadjson('p/posts/'+c['combine']+'/meta')
    198                     <small>combo with <a href="/?show=$combined['postid']">$combined['soundname']</a></small><br>
    199             $if 'remix' in c:
    200                 $if c['remix'] != '':
    201                     $#remixed = db.select('published', where="postid='"+c['remix']+"'")[0]
    202                     $ remixed=loadjson('p/posts/'+c['remix']+'/meta')
    203                     <small>remixed <a href="/?show=$remixed['postid']">$remixed['soundname']</a></small><br>
    204             <a href="/?show=$c['postid']">more</a>
    205             or <a href="/#$c['soundname']">back</a>
    206             $if namn == c['creator']:
    207                 or <a href="/?edit=$c['postid']">edit</a> 
    208             $if namn:
    209                 or <a href="/editor?combine=$c['postid']">combo</a> 
    210             <div class="megalike" id="megalike$c['postid']" onclick="like('$c['postid']')">$getlikes(c['postid'],namn)</div>
    211             <br>
    212             </div>
    213             </div>
    214 
    215 <br>
    216 <br>
    217 $sitename<br>
    218 $siteslogan<br>
    219 $siteaddress<br>
    220 $siterendered<br>
    221 <br>
    222 $if show:
    223     <a href="/?show=$show#">back up?</a> or <a href="/#$show">go back</a>
    224 $else:
    225     <a href="/#">back up?</a> or <br>
    226 </div>
    227 <br>
    228 <br>
    229 <br>
    230 <br>
    231 <br>
    232 <br>
    233 <br>
    234 </BODY>
    235 <script type="text/javascript">
    236 async function like(id) {
    237     const megalike = document.getElementById('megalike'+id);
    238     const response = await fetch('/like?imghash='+id, {
    239       method: 'POST',
    240       headers: {
    241         'Content-Type': 'application/json'
    242       },
    243     })
    244     const responseJson = await response.json()
    245     if (responseJson.user_likes === true) {
    246         megalike.innerText = responseJson.hearted+' '+responseJson.likes; 
    247     } else {
    248         megalike.innerText = responseJson.heart+' '+responseJson.likes;
    249     }
    250 }
    251 </script>