@@ -134,9 +134,9 @@ function initializeVoting(token, problemId, defaultLevel, myVote) {
134134 difficultySection . appendChild ( commentSection )
135135 difficultySection . appendChild ( document . createElement ( "br" ) )
136136
137- const whitelist = algorithms . map ( algorithmToTag , showTagsInEnglish )
137+ const whitelist = algorithms . map ( ( algo ) => algorithmToTag ( algo , showTagsInEnglish ) )
138138 var selectedAlgorithms = [ ]
139- if ( myVote ) selectedAlgorithms = myVote . algorithms . map ( algorithmToTag , showTagsInEnglish )
139+ if ( myVote ) selectedAlgorithms = myVote . algorithms . map ( ( algo ) => algorithmToTag ( algo , showTagsInEnglish ) )
140140
141141 const algorithmCaption = document . createElement ( "span" )
142142 algorithmCaption . className = "vote_caption"
@@ -285,58 +285,59 @@ function addLevelIndicators() {
285285 var standard = ( difficultyVotes . length > 0 && difficultyVotes [ 0 ] . user_id == "solvedac" )
286286
287287 getPrefs ( 'hide_other_votes' , ( hideOtherVotes ) => {
288- if ( ! document . querySelector ( ".label-success" ) && nick !== "solvedac" ) return
289- if ( levelData . level != 0 && ! standard ) {
290- var difficultyVotesContainer = document . createElement ( "div" ) ;
291- difficultyVotesContainer . className = "difficulty_vote_container"
292-
293- for ( var i = 0 ; i < difficultyVotes . length ; i ++ ) {
294- var vote = difficultyVotes [ i ]
295- if ( vote . user_id === nick ) {
296- votedFlag = true
297- myVote = vote
298- }
288+ getPrefs ( 'show_tags_in_english' , ( showTagsInEnglish ) => {
299289
300- if ( hideOtherVotes === undefined || JSON . parse ( hideOtherVotes ) === false ) {
301- var difficultyVote = document . createElement ( "div" )
302- difficultyVote . className = "difficulty_vote"
303- difficultyVote . innerHTML = "<a href=\"/user/" + vote . user_id + "\">"
304- + "<span class=\"text-" + levelCssClass ( vote . user_level ) + "\">"
305- + levelLabel ( vote . user_level ) + vote . user_id
306- + "</span>"
307- + "</a> ➔ " + levelLabel ( vote . voted_level )
308- difficultyVote . appendChild ( document . createElement ( "br" ) )
290+ if ( ! document . querySelector ( ".label-success" ) && nick !== "solvedac" ) return
291+ if ( levelData . level != 0 && ! standard ) {
292+ var difficultyVotesContainer = document . createElement ( "div" ) ;
293+ difficultyVotesContainer . className = "difficulty_vote_container"
309294
310-
311- var voteComment = document . createElement ( "div" )
312- voteComment . innerText = vote . comment
313- if ( ! vote . comment ) {
314- voteComment . classList . add ( "comment_none" )
315- voteComment . innerText = "난이도 의견을 입력하지 않았습니다"
295+ for ( var i = 0 ; i < difficultyVotes . length ; i ++ ) {
296+ var vote = difficultyVotes [ i ]
297+ if ( vote . user_id === nick ) {
298+ votedFlag = true
299+ myVote = vote
316300 }
317- if ( vote . algorithms ) {
318- getPrefs ( 'show_tags_in_english' , ( showTagsInEnglish ) => {
319- for ( var j = 0 ; j < vote . algorithms . length ; j ++ ) {
320- var algo = vote . algorithms [ j ]
321- var algorithmTag = document . createElement ( "div" )
322- if ( JSON . parse ( showTagsInEnglish ) === true ) {
323- algorithmTag . innerText = algo . full_name_en
324- } else {
325- algorithmTag . innerText = algo . full_name_ko
301+
302+ if ( hideOtherVotes === undefined || JSON . parse ( hideOtherVotes ) === false ) {
303+ var difficultyVote = document . createElement ( "div" )
304+ difficultyVote . className = "difficulty_vote"
305+ difficultyVote . innerHTML = "<a href=\"/user/" + vote . user_id + "\">"
306+ + "<span class=\"text-" + levelCssClass ( vote . user_level ) + "\">"
307+ + levelLabel ( vote . user_level ) + vote . user_id
308+ + "</span>"
309+ + "</a> ➔ " + levelLabel ( vote . voted_level )
310+ difficultyVote . appendChild ( document . createElement ( "br" ) )
311+
312+
313+ var voteComment = document . createElement ( "div" )
314+ voteComment . innerText = vote . comment
315+ if ( ! vote . comment ) {
316+ voteComment . classList . add ( "comment_none" )
317+ voteComment . innerText = "난이도 의견을 입력하지 않았습니다"
318+ }
319+ if ( vote . algorithms ) {
320+ for ( var j = 0 ; j < vote . algorithms . length ; j ++ ) {
321+ var algo = vote . algorithms [ j ]
322+ var algorithmTag = document . createElement ( "div" )
323+ if ( showTagsInEnglish !== undefined && JSON . parse ( showTagsInEnglish ) === true ) {
324+ algorithmTag . innerText = algo . full_name_en
325+ } else {
326+ algorithmTag . innerText = algo . full_name_ko
327+ }
328+ algorithmTag . className = "algorithm_tag"
329+ voteComment . appendChild ( algorithmTag )
326330 }
327- algorithmTag . className = "algorithm_tag"
328- voteComment . appendChild ( algorithmTag )
329- }
330- } )
331+ }
332+ difficultyVote . appendChild ( voteComment )
333+
334+ difficultyVotesContainer . appendChild ( difficultyVote )
331335 }
332- difficultyVote . appendChild ( voteComment )
333-
334- difficultyVotesContainer . appendChild ( difficultyVote )
335336 }
337+
338+ problemInfo . appendChild ( difficultyVotesContainer )
336339 }
337-
338- problemInfo . appendChild ( difficultyVotesContainer )
339- }
340+ } )
340341
341342 if ( standard ) {
342343 var standardIndicator = document . createElement ( "img" )
0 commit comments