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