Skip to content
This repository was archived by the owner on Feb 14, 2022. It is now read-only.

Commit 575b18a

Browse files
committed
Added links to tags; added tags to problem
1 parent 9495fd9 commit 575b18a

2 files changed

Lines changed: 30 additions & 6 deletions

File tree

css/override-commons.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,14 @@
6969
background: #e5e5e5;
7070
color: #000;
7171
padding: 0 4px;
72-
margin-left: 4px;
72+
margin-right: 4px;
7373
font-size: .9em;
7474
}
7575

76+
.comment {
77+
margin-right: 4px;
78+
}
79+
7680
#algorithm_input {
7781
width: 100%;
7882
border: 1px solid #ddd;

src/content/main.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,22 @@ async function addLevelIndicators() {
165165
const showTagsInEnglish = JSON.parse(await getPrefs('show_tags_in_english', 'false'))
166166

167167
if (document.querySelector(".label-success") || nick === "solvedac") {
168+
if (levelData.algorithms) {
169+
problemInfo.appendChild(document.createElement("br"))
170+
}
171+
for (var j = 0; j < levelData.algorithms.length; j++) {
172+
var algo = levelData.algorithms[j]
173+
var algorithmTag = document.createElement("a")
174+
algorithmTag.setAttribute("href", "https://solved.ac/problems/algorithms/" + algo.algorithm_id)
175+
if (showTagsInEnglish) {
176+
algorithmTag.innerText = algo.full_name_en
177+
} else {
178+
algorithmTag.innerText = algo.full_name_ko
179+
}
180+
algorithmTag.className = "algorithm_tag"
181+
problemInfo.appendChild(algorithmTag)
182+
}
183+
168184
if (levelData.level != 0 && !standard) {
169185
var difficultyVotesContainer = document.createElement("div");
170186
difficultyVotesContainer.className = "difficulty_vote_container"
@@ -186,26 +202,30 @@ async function addLevelIndicators() {
186202
+ "</a> ➔ " + levelLabel(vote.voted_level)
187203
difficultyVote.appendChild(document.createElement("br"))
188204

189-
var voteComment = document.createElement("div")
205+
var voteCommentContainer = document.createElement("div")
206+
var voteComment = document.createElement("span")
207+
voteComment.className = "comment"
190208
voteComment.innerText = vote.comment
191209
if (!vote.comment) {
192-
voteComment.classList.add("comment_none")
210+
voteCommentContainer.classList.add("comment_none")
193211
voteComment.innerText = "난이도 의견을 입력하지 않았습니다"
194212
}
213+
difficultyVote.appendChild(voteCommentContainer)
214+
voteCommentContainer.appendChild(voteComment)
195215
if (vote.algorithms) {
196216
for (var j = 0; j < vote.algorithms.length; j++) {
197217
var algo = vote.algorithms[j]
198-
var algorithmTag = document.createElement("div")
218+
var algorithmTag = document.createElement("a")
219+
algorithmTag.setAttribute("href", "https://solved.ac/problems/algorithms/" + algo.algorithm_id)
199220
if (showTagsInEnglish) {
200221
algorithmTag.innerText = algo.full_name_en
201222
} else {
202223
algorithmTag.innerText = algo.full_name_ko
203224
}
204225
algorithmTag.className = "algorithm_tag"
205-
voteComment.appendChild(algorithmTag)
226+
voteCommentContainer.appendChild(algorithmTag)
206227
}
207228
}
208-
difficultyVote.appendChild(voteComment)
209229
difficultyVotesContainer.appendChild(difficultyVote)
210230
}
211231
problemInfo.appendChild(difficultyVotesContainer)

0 commit comments

Comments
 (0)