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

Commit 2151c46

Browse files
committed
Added indicator for standardized difficulty problems
1 parent 1dfc88a commit 2151c46

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

content.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ if (isProblemPage()) {
180180
problemInfo.appendChild(titleBadge)
181181
}
182182

183-
if (levelData.level != 0) {
183+
var standard = (difficultyVotes.length > 0 && difficultyVotes[0].user_id == "solvedac")
184+
185+
if (levelData.level != 0 && !standard) {
184186
problemInfo.appendChild(document.createElement("br"))
185187
problemInfo.appendChild(document.createElement("br"))
186188
var difficultyVotesHeader = document.createElement("b")
@@ -191,17 +193,23 @@ if (isProblemPage()) {
191193
for (var i = 0; i < difficultyVotes.length; i++) {
192194
var vote = difficultyVotes[i]
193195
if (vote.user_id === nick) votedFlag = true
194-
195196
var difficultyVote = document.createElement("span")
196197
difficultyVote.className = "difficulty_vote"
197198
difficultyVote.innerHTML = "<span class=\"text-" + levelCssClass(vote.user_level) + "\">" + levelLabel(vote.user_level) + vote.user_id + "</span> ➔ " + levelLabel(vote.voted_level)
198199
problemInfo.appendChild(difficultyVote)
199200
}
200201
}
201202

202-
chrome.storage.local.get('token', function(items) {
203-
initializeVoting(items.token, problemId, votedFlag)
204-
})
203+
if (standard) {
204+
var standardIndicator = document.createElement("span")
205+
standardIndicator.className = "standard label"
206+
standardIndicator.innerText = "solved.ac 표준"
207+
problemInfo.appendChild(standardIndicator)
208+
} else {
209+
chrome.storage.local.get('token', function(items) {
210+
initializeVoting(items.token, problemId, votedFlag)
211+
})
212+
}
205213
})
206214
})
207215
}

css/override-commons.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,9 @@
7171

7272
.text-ruby {
7373
color: #ff0062;
74+
}
75+
76+
.label.standard {
77+
margin-left: 8px;
78+
background: #ec9a00;
7479
}

0 commit comments

Comments
 (0)