From 7ff7669ad190a608af5ed62146938de2877929f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mert=20KU=C4=9E?=
<56736947+mertkug@users.noreply.github.com>
Date: Wed, 27 Jul 2022 21:08:32 +0300
Subject: [PATCH] Add files via upload
---
hashsearch.js | 14 +++++++-------
index.html | 44 ++++++++++++--------------------------------
main.css | 10 ++++------
tree_utils.js | 40 +++++++++++++++++++++++++++++++---------
4 files changed, 54 insertions(+), 54 deletions(-)
diff --git a/hashsearch.js b/hashsearch.js
index e9db480..6114912 100644
--- a/hashsearch.js
+++ b/hashsearch.js
@@ -22,7 +22,7 @@ function searchhashlist(index) {
data: JSON.stringify(reqJson),
dataType: "json",
error: function () {
- ajaxlert("Error occurred during search.");
+ console.error("Error occurred during search.");
},
success: function (res) {
let mainTableBody = document.getElementById("main_table_body");
@@ -30,7 +30,7 @@ function searchhashlist(index) {
mainTableBody.firstChild.remove()
headerArrows.innerHTML = ""
}
-
+
$("#js-tree").jstree("delete_node",($("#js-tree").jstree("get_node", "#").children));
let results = res["results"]
@@ -44,7 +44,7 @@ function searchhashlist(index) {
let type = results[i].type
let string = results[i].string
- if (view_type == 'list') {
+ if (view_type === 'list') {
document.getElementById("main_table").style.visibility='visible';
document.getElementById("tree_node_selected").style.visibility="hidden";
document.getElementById("js-tree").style.visibility="hidden";
@@ -65,7 +65,7 @@ function searchhashlist(index) {
mainTableBody.appendChild(tableRow)
- if (i == results.length - 1) {
+ if (i === results.length - 1) {
let results_per_page_num = res.number_of_results
let results_per_page_index_num = res.page_number
if (!isNaN(results_per_page_num) && !isNaN(results_per_page_index_num)) {
@@ -92,12 +92,12 @@ function searchhashlist(index) {
}
}
- if(view_type == 'tree'){
+ if(view_type === 'tree'){
document.getElementById("main_table").style.visibility='hidden';
document.getElementById("tree_node_selected").style.visibility="visible";
document.getElementById("js-tree").style.visibility="visible";
- if (string != "" && !string.includes("*") && string.includes("[")) {
+ if (string !== "" && !string.includes("*") && string.includes("[")) {
let newPath = string.split("]")[0].replaceAll("[", "") + " (" + type.toLowerCase() + ")";
addToTree(newPath, string);
}
@@ -113,4 +113,4 @@ function searchhashlist(index) {
}
$("#js-tree").delete_node($("#js-tree").get_node("#").children);
}
-};
\ No newline at end of file
+};
diff --git a/index.html b/index.html
index 29fff12..7f9cb61 100644
--- a/index.html
+++ b/index.html
@@ -1,16 +1,20 @@
-
+
+
-
+
+
+
-
+
+
-
-
+
+
-
-
+
+
HitmanDB
@@ -146,31 +150,7 @@
-
-
+
diff --git a/main.css b/main.css
index f710738..f2ccddc 100644
--- a/main.css
+++ b/main.css
@@ -1,5 +1,3 @@
-@import url('https://rsms.me/inter/inter.css');
-
body {
background-color: #232425;
color: #fff;
@@ -54,7 +52,7 @@ a:visited {
box-shadow: 0 5px 0 #920404;
color: white;
padding: 0.1em 0.5em;
-}
+}
#apidocs:hover {
background-color: #b10606;
@@ -72,7 +70,7 @@ a:visited {
background-color: #525252;
}
-#copy_text_box {
+#copy_text_box {
position: relative;
padding-bottom: 100px;
z-index: index -10;
@@ -116,7 +114,7 @@ a:visited {
}
#underline{
- padding-top: 1%;
+ padding-top: 0.1vh;
border-bottom: 2px solid #05be99;
display:block;
}
@@ -125,4 +123,4 @@ a:visited {
visibility: hidden;
background-color: rgba(25, 26, 27, 0.596);
padding: 15px;
-}
\ No newline at end of file
+}
diff --git a/tree_utils.js b/tree_utils.js
index c3cc4e1..c899daa 100644
--- a/tree_utils.js
+++ b/tree_utils.js
@@ -12,16 +12,16 @@ function addToTree(path, fullPath) {
}
else {
//set properties for node
- var node_data = "_";
- var icon_path = "icons/opened-folder-24.png";
+ let node_data = "_";
+ let icon_path = "icons/opened-folder-24.png";
if(endsWith(pathSegments[i], "?")) icon_path = "icons/block-chain-24.png";
- if(i == pathSegments.length - 1){
+ if(i === pathSegments.length - 1){
icon_path = "icons/document-24.png";
node_data = fullPath;
- }
+ }
//define and add node
- var newNode = {
+ const newNode = {
id: CreateGuid(),
data: node_data,
text: pathSegments[i],
@@ -32,8 +32,8 @@ function addToTree(path, fullPath) {
$("#js-tree").jstree('create_node', currentNode.id, newNode);
currentNode = newNode;
}
- };
-};
+ }
+}
function findNode(root, search_string) {
@@ -43,7 +43,7 @@ function findNode(root, search_string) {
if (children) {
for (let i = 0; i < children.length; i++) {
let node = $("#js-tree").jstree("get_node", children[i]);
- if (node.text == search_string) {
+ if (node.text === search_string) {
return node;
}
else {
@@ -64,8 +64,30 @@ function endsWith(str, suffix) {
//creates a random Guid string
function CreateGuid() {
function _p8(s) {
- var p = (Math.random().toString(16) + "000000000").substr(2, 8);
+ const p = (Math.random().toString(16) + "000000000").substr(2, 8);
return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p;
}
return _p8() + _p8(true) + _p8(true) + _p8();
}
+
+//init empty tree
+$('#js-tree').jstree({
+ 'core': {
+ 'data': [],
+ check_callback: true
+ }
+});
+
+//tree node onclick
+$('#js-tree').on("changed.jstree", function (e, data) {
+ document.getElementById("tree_node_selected_input").innerHTML = $("#js-tree").jstree("get_node", data.selected).data;
+});
+
+//copy button onclick function
+function copy_selected(){
+ const text = document.getElementById("tree_node_selected_input").innerHTML;
+ navigator.clipboard.writeText(text).then(function () {
+ }, function (err) {
+ console.error('Async: Could not copy text: ', err);
+ });
+}