-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
125 lines (110 loc) · 4.24 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<title>SafeView-IPFS Demo</title>
<style>
.span_cid {
font-size: .8em;
color: white;
}
</style>
</head>
<body onload="onBodyLoad()">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
crossorigin="anonymous"></script>
<script src="/cidFeed/script"></script>
<script>
function onBodyLoad() {
var blockNsfw = true;
function refreshCIDs() {
let cidList = [
'QmW94MHGtU3RCFmL2P87Q5Yxd1VkaQUv1h8kQrJzbYufvw',
'Qmb6K7kBaKdw7TTG3oU1acNwyQd75iD1uuZuzytVvt6fXN',
'QmbmR55fd9ugd66HH4hJrMksCkPvjH3dRGkDrqTZTS75y8',
'QmcrMrXTaq6FDg9rf8MyzvLWMzywwvDALwEZHJUKBmTDcN',
'QmearXhonYgnxQ6d6WRoQ5VdmdYPP7i2Y8ncgs3LXvLkTo',
'QmZqQ4rcmFJENpoU1fquqo5tmvFpEhJUaw4QHK5RRTKv54',
'QmP6yTkk5JBt2U9K8SPP56FRhP1HRMNiodAPRwk261HQUd',
'QmYx7u33nMY5yJCouGMxaZFhXY85Xry7hG6pbgkJW8eg8e',
'QmQDN29j4oWwNoKbtkJzeQbzMn4qM62q3o4PotN2JGpuFf',
'QmeSfyDz2oRQdcM9jLfKE6PHoY5mwgpoJ9h1n8PoGBW7K1',
];
let imageTag = $('img').toArray();
let labelTag = $(".span_cid").toArray();
imageTag.forEach((img, index) => {
if (cidList.length >= index + 1) {
if (blockNsfw) {
if (BloomFilter.test(cidList[index])) {
$(img).attr("src", 'https://gateway.pinata.cloud/ipfs/' + cidList[index]);
} else {
$(img).attr("src", 'https://gateway.pinata.cloud/ipfs/' + 'Qmcq3QT4gRLBbMfLtkiw9VvCdMEWE7xoSVdiM64gKUR37t');
}
} else {
$(img).attr("src", 'https://gateway.pinata.cloud/ipfs/' + cidList[index]);
}
$(labelTag[index]).html(cidList[index]);
}
});
}
$('#btn_enable_safeview').click(() => {
blockNsfw = !blockNsfw;
refreshCIDs();
});
refreshCIDs();
}
</script>
<div class="jumbotron mb-5 px-4">
<h1 class="display-4">SafeView IPFS Demo</h1>
<p class="lead">Instant content moderation tool for IPFS links</p>
<input type="checkbox" checked="true" class="btn-check" id="btn_enable_safeview" autocomplete="off">
<label class="btn btn-outline-primary" for="btn_enable_safeview">Enable SafeView</label>
<span>SafeView is enabled by default</span>
</div>
<div class="container">
<div class="row row-cols-3">
<div class="col mb-2">
<img style="width: 20em; height: 13em;">
<span class="span_cid"></span>
</div>
<div class="col mb-2">
<img style="width: 20em; height: 13em;">
<span class="span_cid"></span>
</div>
<div class="col mb-2">
<img style="width: 20em; height: 13em;">
<span class="span_cid"></span>
</div>
<div class="col mb-2">
<img style="width: 20em; height: 13em;">
<span class="span_cid"></span>
</div>
<div class="col mb-2">
<img style="width: 20em; height: 13em;">
<span class="span_cid"></span>
</div>
<div class="col mb-2">
<img style="width: 20em; height: 13em;">
<span class="span_cid"></span>
</div>
<div class="col mb-2">
<img style="width: 20em; height: 13em;">
<span class="span_cid"></span>
</div>
<div class="col mb-2">
<img style="width: 20em; height: 13em;">
<span class="span_cid"></span>
</div>
<div class="col mb-2">
<img style="width: 20em; height: 13em;">
<span class="span_cid"></span>
</div>
</body>
</html>