Skip to content

Commit 92fec02

Browse files
committed
FEATURE: Search for comment content
1 parent d98a0a8 commit 92fec02

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h1>Instant View Open Issues</h1>
2323
<div class="search-box">
2424
<input class="search-bar domain-search" id="domain-search-bar" type="text" placeholder="Search for domain..." autocomplete="off" onkeyup="search()"></input>
2525
<input class="search-bar user-search" id="user-search-bar" type="text" placeholder="Search for user..." autocomplete="off" onkeyup="search_user()"></input>
26-
<input class="search-bar comment-search" id="comment-search-bar" type="text" placeholder="Search for comment..." autocomplete="off"></input>
26+
<input class="search-bar comment-search" id="comment-search-bar" type="text" placeholder="Search for comment..." autocomplete="off" onkeyup="search_comment()"></input>
2727
</div>
2828
</div>
2929

iv_script.js

+24
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,21 @@ function filter_user(name) {
9696
}
9797
}
9898

99+
function filter_comment(text) {
100+
list = document.getElementById("main-list");
101+
list.innerHTML = "";
102+
103+
for (i = 0; i < issue_data.length; i++) {
104+
var issue = issue_data[i];
105+
var regExp = /https:\/\/instantview\.telegram\.org\/contest\/(.*?)\/template[0-9]+\/issue[0-9]+\/?/g;
106+
var domain_name = regExp.exec(issue.url)[1]
107+
if (issue.comment.includes(String(text)) || issue.creator_comment.includes(String(text))) {
108+
var container = create_issue(issue.url, domain_name, issue.author, issue.template_creator, issue.comment, issue.creator_comment);
109+
list.appendChild(container);
110+
}
111+
}
112+
}
113+
99114
function search_user() {
100115
var text = document.getElementById("user-search-bar").value;
101116
if (text === "") {
@@ -105,6 +120,15 @@ function search_user() {
105120
}
106121
}
107122

123+
function search_comment () {
124+
var text = document.getElementById("comment-search-bar").value;
125+
if (text === "") {
126+
remove_filter();
127+
} else {
128+
filter_comment(text);
129+
}
130+
}
131+
108132
function remove_filter() {
109133
issue_checkbox = document.getElementById("self-made-cb");
110134
issue_checkbox.checked = false;

0 commit comments

Comments
 (0)