mirror of https://github.com/CIRCL/AIL-framework
chg: [show item] replace canevas by image blur + add a button to wrap text
parent
1b0a2b46ca
commit
1e1d431880
|
@ -34,6 +34,9 @@
|
||||||
-webkit-transform:rotate(180deg);
|
-webkit-transform:rotate(180deg);
|
||||||
transform:rotate(180deg);
|
transform:rotate(180deg);
|
||||||
}
|
}
|
||||||
|
.text_wrap{
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
@ -255,78 +258,78 @@
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if meta['duplicates'] %}
|
{# {% if meta['duplicates'] %}#}
|
||||||
<div id="accordionDuplicate" class="mb-2 mx-3">
|
{# <div id="accordionDuplicate" class="mb-2 mx-3">#}
|
||||||
<div class="card">
|
{# <div class="card">#}
|
||||||
<div class="card-header py-1" id="headingDuplicate">
|
{# <div class="card-header py-1" id="headingDuplicate">#}
|
||||||
<div class="row">
|
{# <div class="row">#}
|
||||||
<div class="col-11">
|
{# <div class="col-11">#}
|
||||||
<div class="mt-2">
|
{# <div class="mt-2">#}
|
||||||
<i class="far fa-clone"></i> duplicates
|
{# <i class="far fa-clone"></i> duplicates #}
|
||||||
<div class="badge badge-warning">{{meta['duplicates']|length}}</div>
|
{# <div class="badge badge-warning">{{meta['duplicates']|length}}</div>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
<div class="col-1">
|
{# <div class="col-1">#}
|
||||||
<button class="btn btn-link btn-lg py-2 float-right rotate" data-toggle="collapse" data-target="#collapseDuplicate" aria-expanded="true" aria-controls="collapseDuplicate">
|
{# <button class="btn btn-link btn-lg py-2 float-right rotate" data-toggle="collapse" data-target="#collapseDuplicate" aria-expanded="true" aria-controls="collapseDuplicate">#}
|
||||||
<i class="fas fa-chevron-circle-down"></i>
|
{# <i class="fas fa-chevron-circle-down"></i>#}
|
||||||
</button>
|
{# </button>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
|
{##}
|
||||||
<div id="collapseDuplicate" class="collapse" aria-labelledby="headingDuplicate" data-parent="#accordionDuplicate">
|
{# <div id="collapseDuplicate" class="collapse" aria-labelledby="headingDuplicate" data-parent="#accordionDuplicate">#}
|
||||||
<div class="card-body">
|
{# <div class="card-body">#}
|
||||||
|
{##}
|
||||||
<table class="table" id="tableDup">
|
{# <table class="table" id="tableDup">#}
|
||||||
<thead class="thead-dark">
|
{# <thead class="thead-dark">#}
|
||||||
<tr>
|
{# <tr>#}
|
||||||
<th>Date</th>
|
{# <th>Date</th>#}
|
||||||
<th>Similarity</th>
|
{# <th>Similarity</th>#}
|
||||||
<th>Item</th>
|
{# <th>Item</th>#}
|
||||||
<th>Diff</th>
|
{# <th>Diff</th>#}
|
||||||
</tr>
|
{# </tr>#}
|
||||||
</thead>
|
{# </thead>#}
|
||||||
<tbody>
|
{# <tbody>#}
|
||||||
{% for duplicate_id in meta['duplicates'] %}
|
{# {% for duplicate_id in meta['duplicates'] %}#}
|
||||||
<tr>
|
{# <tr>#}
|
||||||
<td>{{meta['duplicates'][duplicate_id]['date']}}</td>
|
{# <td>{{meta['duplicates'][duplicate_id]['date']}}</td>#}
|
||||||
<td class="py-0">
|
{# <td class="py-0">#}
|
||||||
<table class="table table-borderless table-sm my-0">
|
{# <table class="table table-borderless table-sm my-0">#}
|
||||||
<tbody>
|
{# <tbody>#}
|
||||||
{%for dict_algo in meta['duplicates'][duplicate_id]|sort(attribute='algo')%}
|
{# {%for dict_algo in meta['duplicates'][duplicate_id]|sort(attribute='algo')%}#}
|
||||||
<tr>
|
{# <tr>#}
|
||||||
<td class="py-0">{{dict_algo['algo']}}</td>
|
{# <td class="py-0">{{dict_algo['algo']}}</td>#}
|
||||||
<td class="w-100 py-0">
|
{# <td class="w-100 py-0">#}
|
||||||
<div class="progress mt-1">
|
{# <div class="progress mt-1">#}
|
||||||
<div class="progress-bar progress-bar-striped {%if dict_algo['algo']=='tlsh'%}bg-secondary{%endif%}" role="progressbar" style="width: {{dict_algo['similarity']}}%;" aria-valuenow="{{dict_algo['similarity']}}" aria-valuemin="0" aria-valuemax="100">
|
{# <div class="progress-bar progress-bar-striped {%if dict_algo['algo']=='tlsh'%}bg-secondary{%endif%}" role="progressbar" style="width: {{dict_algo['similarity']}}%;" aria-valuenow="{{dict_algo['similarity']}}" aria-valuemin="0" aria-valuemax="100">#}
|
||||||
{{dict_algo['similarity']}}%
|
{# {{dict_algo['similarity']}}%#}
|
||||||
</div>
|
{# </div>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
</td>
|
{# </td>#}
|
||||||
</tr>
|
{# </tr>#}
|
||||||
{%endfor%}
|
{# {%endfor%}#}
|
||||||
</tbody>
|
{# </tbody>#}
|
||||||
</table>
|
{# </table>#}
|
||||||
</td>
|
{# </td>#}
|
||||||
<td>
|
{# <td>#}
|
||||||
<a href="{{ url_for('objects_item.showItem')}}?id={{duplicate_id}}" target="_blank">
|
{# <a href="{{ url_for('objects_item.showItem')}}?id={{duplicate_id}}" target="_blank">#}
|
||||||
{{duplicate_id}}
|
{# {{duplicate_id}}#}
|
||||||
</a>
|
{# </a>#}
|
||||||
</td>
|
{# </td>#}
|
||||||
<td>
|
{# <td>#}
|
||||||
<a target="_blank" href="{{ url_for('objects_item.object_item_diff') }}?id1={{meta['id']}}&id2={{duplicate_id}}" class="fa fa-columns" title="Show diff"></a>
|
{# <a target="_blank" href="{{ url_for('objects_item.object_item_diff') }}?id1={{meta['id']}}&id2={{duplicate_id}}" class="fa fa-columns" title="Show diff"></a>#}
|
||||||
</td>
|
{# </td>#}
|
||||||
</tr>
|
{# </tr>#}
|
||||||
{% endfor %}
|
{# {% endfor %}#}
|
||||||
</tbody>
|
{# </tbody>#}
|
||||||
</table>
|
{# </table>#}
|
||||||
|
{##}
|
||||||
</div>
|
{# </div>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
|
{##}
|
||||||
</div>
|
{# </div>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
{% endif %}
|
{# {% endif %}#}
|
||||||
|
|
||||||
|
|
||||||
{# {% if l_64|length != 0 %}#}
|
{# {% if l_64|length != 0 %}#}
|
||||||
|
@ -433,26 +436,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-7">
|
<div class="col-md-7">
|
||||||
<div class="card my-2" style="background-color:#ecf0f1;">
|
|
||||||
<div class="card-body py-2">
|
<div class="mt-2">
|
||||||
<div class="row">
|
{% include 'objects/image/block_blur_img_slider.html' %}
|
||||||
<div class="col-md-8">
|
|
||||||
<input class="custom-range mt-2" id="blocks" type="range" min="1" max="50" value="{%if meta['crawler']['is_tags_safe']%}13{%else%}0{%endif%}">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<span><img class="object_image mb-1" src="{% if meta['crawler']['screenshot'] %}{{ url_for('objects_item.screenshot', filename=meta['crawler']['screenshot']) }}{% endif %}" style="width: 100%;" alt=""></span>
|
||||||
<button class="btn {%if meta['crawler']['is_tags_safe']%}btn-primary{%else%}btn-danger{%endif%}" onclick="blocks.value=50;pixelate();">
|
|
||||||
{%if meta['crawler']['is_tags_safe']%}
|
|
||||||
<i class="fas fas fa-plus-square"></i>
|
|
||||||
{%else%}
|
|
||||||
<i class="fas fa-exclamation-triangle"></i>
|
|
||||||
{%endif%}
|
|
||||||
<span class="label-icon">Full resolution</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<canvas id="canvas" style="width:100%;"></canvas>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -540,19 +528,25 @@
|
||||||
<a class="dropdown-item" href="{{ url_for('objects_item.item_download', id=meta['id']) }}"><i class="fas fa-download"></i> Download</a>
|
<a class="dropdown-item" href="{{ url_for('objects_item.item_download', id=meta['id']) }}"><i class="fas fa-download"></i> Download</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<button class="btn btn-info" onclick="wrap_content()"><span id="btn_wrap_text">Wrap Text</span></button>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content" id="pills-tabContent">
|
<div class="tab-content" id="pills-tabContent">
|
||||||
<div class="tab-pane fade show active" id="pills-content" role="tabpanel" aria-labelledby="pills-content-tab">
|
<div class="tab-pane fade show active" id="pills-content" role="tabpanel" aria-labelledby="pills-content-tab">
|
||||||
{% if not extracted %}
|
{% if not extracted %}
|
||||||
<p class="my-0"> <pre class="border">{{ meta['content'] }}</pre></p>
|
<p class="my-0"> <pre class="border" id="obj_content">{{ meta['content'] }}</pre></p>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="my-0"> <pre class="border">{{ meta['content'][:extracted[0][0]] }}{% for row in extracted %}<span class="hg-text" data-toggle="popover" data-trigger="hover" data-html="true" title="Extracted:" data-content="<ul class="list-group">{% for r in row[3] %}<li class="list-group-item"><div><svg height="26" width="26"><g class="nodes"><circle cx="13" cy="13" r="13" fill="{{ extracted_matches[r[0]]['icon']['color'] }}"></circle><text x="13" y="13" text-anchor="middle" dominant-baseline="central" class="{{ extracted_matches[r[0]]['icon']['style'] }}" font-size="16px">{{ extracted_matches[r[0]]['icon']['icon'] }}</text></g></svg> {{ extracted_matches[r[0]]['subtype'] }}</div>{{ extracted_matches[r[0]]['id'] }} <div><b>{{ r[1] }}</b></div></li>{% endfor %}</ul>" id="{{ row[0] }}:{{ row[1] }}">{{ meta['content'][row[0]:row[1]] }}</span>{% if loop.index + 1 > extracted|length %}{{ meta['content'][extracted[-1][1]:] }}{% else %}{{ meta['content'][row[1]:extracted[loop.index][0]] }}{% endif %}{% endfor %}</pre></p>
|
<p class="my-0"> <pre class="border" id="obj_content">{{ meta['content'][:extracted[0][0]] }}{% for row in extracted %}<span class="hg-text" data-toggle="popover" data-trigger="hover" data-html="true" title="Extracted:" data-content="<ul class="list-group">{% for r in row[3] %}<li class="list-group-item"><div><svg height="26" width="26"><g class="nodes"><circle cx="13" cy="13" r="13" fill="{{ extracted_matches[r[0]]['icon']['color'] }}"></circle><text x="13" y="13" text-anchor="middle" dominant-baseline="central" class="{{ extracted_matches[r[0]]['icon']['style'] }}" font-size="16px">{{ extracted_matches[r[0]]['icon']['icon'] }}</text></g></svg> {{ extracted_matches[r[0]]['subtype'] }}</div>{{ extracted_matches[r[0]]['id'] }} <div><b>{{ r[1] }}</b></div></li>{% endfor %}</ul>" id="{{ row[0] }}:{{ row[1] }}">{{ meta['content'][row[0]:row[1]] }}</span>{% if loop.index + 1 > extracted|length %}{{ meta['content'][extracted[-1][1]:] }}{% else %}{{ meta['content'][row[1]:extracted[loop.index][0]] }}{% endif %}{% endfor %}</pre></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="pills-html2text" role="tabpanel" aria-labelledby="pills-html2text-tab">
|
<div class="tab-pane fade" id="pills-html2text" role="tabpanel" aria-labelledby="pills-html2text-tab">
|
||||||
<p class="my-0"> <pre id="html2text-container" class="border"></pre></p>
|
<p class="my-0"> <pre id="html2text-container" class="border"></pre></p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="tab-pane fade" id="pills-html2text" role="tabpanel" aria-labelledby="pills-html2text-tab">
|
||||||
|
<p class="my-0"> <pre id="html2text-container" class="border"></pre></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -561,90 +555,50 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var ltags
|
|
||||||
var ltagsgalaxies
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('#tableDup').DataTable();
|
{% if meta['crawler'] %}
|
||||||
// $('#tableb64').DataTable({
|
{% if not meta['crawler']['is_tags_safe'] %}
|
||||||
// "aLengthMenu": [[5, 10, 15, -1], [5, 10, 15, "All"]],
|
blur_unsafe();
|
||||||
// "iDisplayLength": 5,
|
{% else %}
|
||||||
// "order": [[ 1, "asc" ]]
|
blur_images();
|
||||||
// });
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% if extracted %}
|
{% if extracted %}
|
||||||
$('#table_extracted').DataTable();
|
$('#table_extracted').DataTable();
|
||||||
{% endif %}
|
{% endif %}
|
||||||
$(".rotate").click(function(){
|
$(".rotate").click(function(){
|
||||||
$(this).toggleClass("down");
|
$(this).toggleClass("down");
|
||||||
})
|
});
|
||||||
$('[data-toggle="popover"]').popover({
|
$('[data-toggle="popover"]').popover({
|
||||||
boundary:'window',
|
boundary:'window',
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
let text_wrapped = false;
|
||||||
|
function wrap_content() {
|
||||||
|
if (text_wrapped) {
|
||||||
|
$('#obj_content').removeClass("text_wrap");
|
||||||
|
$('#btn_wrap_text').text("Wrap Text");
|
||||||
|
text_wrapped = false;
|
||||||
|
} else {
|
||||||
|
$('#obj_content').addClass("text_wrap");
|
||||||
|
$('#btn_wrap_text').text("UnWrap Text");
|
||||||
|
text_wrapped = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#pills-html2text-tab').on('shown.bs.tab', function (e) {
|
$('#pills-html2text-tab').on('shown.bs.tab', function (e) {
|
||||||
if ($('#html2text-container').is(':empty')){
|
if ($('#html2text-container').is(':empty')){
|
||||||
$.get("{{ url_for('objects_item.html2text') }}?id={{ meta['id'] }}").done(function(data){
|
$.get("{{ url_for('objects_item.html2text') }}?id={{ meta['id'] }}").done(function(data){
|
||||||
$('#html2text-container').text(data);
|
$('#html2text-container').text(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('[data-toggle="popover"]').popover();
|
// $('[data-toggle="popover"]').popover();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% if meta['crawler'] %}
|
|
||||||
<script>
|
|
||||||
var ctx = canvas.getContext('2d'), img = new Image();
|
|
||||||
|
|
||||||
/// turn off image smoothing
|
|
||||||
ctx.webkitImageSmoothingEnabled = false;
|
|
||||||
ctx.imageSmoothingEnabled = false;
|
|
||||||
|
|
||||||
img.onload = pixelate;
|
|
||||||
img.addEventListener("error", img_error);
|
|
||||||
var draw_img = false;
|
|
||||||
|
|
||||||
{% if meta['crawler']['screenshot'] %}
|
|
||||||
img.src = "{{ url_for('objects_item.screenshot', filename=meta['crawler']['screenshot']) }}";
|
|
||||||
{% else %}
|
|
||||||
img.src = "";
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
function pixelate() {
|
|
||||||
|
|
||||||
/// use slider value
|
|
||||||
if( blocks.value == 50 ){
|
|
||||||
size = 1;
|
|
||||||
} else {
|
|
||||||
var size = (blocks.value) * 0.01;
|
|
||||||
}
|
|
||||||
|
|
||||||
canvas.width = img.width;
|
|
||||||
canvas.height = img.height;
|
|
||||||
|
|
||||||
/// cache scaled width and height
|
|
||||||
w = canvas.width * size;
|
|
||||||
h = canvas.height * size;
|
|
||||||
|
|
||||||
/// draw original image to the scaled size
|
|
||||||
ctx.drawImage(img, 0, 0, w, h);
|
|
||||||
|
|
||||||
/// pixelated
|
|
||||||
ctx.drawImage(canvas, 0, 0, w, h, 0, 0, canvas.width, canvas.height);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function img_error() {
|
|
||||||
img.onerror=null;
|
|
||||||
img.src="{{ url_for('static', filename='image/AIL.png') }}";
|
|
||||||
blocks.value = 50;
|
|
||||||
pixelate;
|
|
||||||
}
|
|
||||||
|
|
||||||
blocks.addEventListener('change', pixelate, false);
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue