heartranked

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

showuploads.html (1337B)


      1 $def with (uploads, user, allowed, random)
      2 <div id="container">
      3 <a href="javascript:history.back()"><-- back</a>
      4 <br>
      5 
      6 $for i in uploads[:100]:
      7     <code><a href="/static/users/$user/images/$i">/static/users/$user/images/web/$i</a></code>
      8     <br>
      9     $ nocache=random.choices(allowed, k=5)
     10     <img src="/static/users/$user/images/web/$i?random=$nocache"><br>
     11     <a style="color: white;" class="insert-link" onclick="rotateright('$i')">↻</a>
     12     <a style="color: white;" class="insert-link" onclick="rotateleft('$i')">↺</a>
     13     <code>![$i](/static/users/$user/images/web/$i '$i')</code>
     14 </div>
     15 
     16 <script>
     17 async function rotateright(text) {
     18   try {
     19     const res = await fetch('/imageapi', {
     20       method: 'POST',
     21       headers: { 'Content-Type': 'application/json' },
     22       body: JSON.stringify({ image: text , action: 'rotateright'})
     23     });
     24   } catch (e) {
     25     console.error(e);
     26     status.innerHTML = '<span style="color:red">❌ Failed to send</span>';
     27   }
     28 }
     29 
     30 async function rotateleft(text) {  
     31   try {
     32     const res = await fetch('/imageapi', {
     33       method: 'POST',
     34       headers: { 'Content-Type': 'application/json' },
     35       body: JSON.stringify({ image: text , action: 'rotateleft'})
     36     });
     37   } catch (e) {
     38     console.error(e);
     39     status.innerHTML = '<span style="color:red">❌ Failed to send</span>';
     40   }
     41 }
     42 </script>