浏览代码

added JavaScript for removing random images

solr_update
Simon Bowie 2 年前
父节点
当前提交
c43f79afe0
共有 2 个文件被更改,包括 8 次插入2 次删除
  1. +6
    -0
      web/app/static/js/main.js
  2. +2
    -2
      web/app/templates/images.html

+ 6
- 0
web/app/static/js/main.js 查看文件

@@ -41,6 +41,12 @@ function removeRandomTitle() {
RandomSpan.style.display = "inline-block";
}

function removeRandomImage() {
var elts = document.getElementsByClassName("img-fluid");
var RandomImg = elts[Math.floor(Math.random() * elts.length)];
RandomImg.remove();
}

// code adapted from w3collective
function readingTime(text) {
const wpm = 200;

+ 2
- 2
web/app/templates/images.html 查看文件

@@ -8,8 +8,8 @@

<div class="action">
<button onClick="refresh(this)" type="button" value="Refresh" title="new iteration">↻</button>
<button onclick="" title="add one">+</button>
<button onclick="" title="remove">-</button>
<!--<button onclick="" title="add one">+</button>-->
<button onclick="removeRandomImage()" title="remove">-</button>
</div>

<a href="{{ url_for('main.index') }}" class="h1 text-left contrast" style="color: var(--color-lightyellow) !important;"> ⇽ </a>

正在加载...
取消
保存