Skip to content

Commit 56cc9a2

Browse files
committed
Use Bootstrap 5.3.8
1 parent 00708dd commit 56cc9a2

47 files changed

Lines changed: 2543 additions & 2509 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ gem 'sanitize'
2323

2424
gem 'eventmachine', git: 'https://github.com/eventmachine/eventmachine.git'
2525

26-
gem "rack-mobile-detect"
27-
2826
gem 'thin', '~> 1.8'
2927

3028
# charts

Gemfile.lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ GEM
115115
raabro (1.4.0)
116116
racc (1.8.1)
117117
rack (2.2.16)
118-
rack-mobile-detect (0.4.0)
119-
rack
120118
rack-protection (3.2.0)
121119
base64 (>= 0.1.0)
122120
rack (~> 2.2, >= 2.2.4)
@@ -184,7 +182,6 @@ DEPENDENCIES
184182
json
185183
nokogiri
186184
pry
187-
rack-mobile-detect
188185
rack-test
189186
rake
190187
rspec

README.mobile_branch

Lines changed: 0 additions & 5 deletions
This file was deleted.

lib/junethack/sinatra_server.rb

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020

2121
require 'ext/numeric'
2222

23-
require 'rack/mobile-detect'
24-
use Rack::MobileDetect
25-
2623
$db_access = Sync.new
2724

2825
## settings for sinatra-cache
@@ -69,12 +66,6 @@ class WorkaroundLogger < Logger
6966
session["messages"] = []
7067
session["errors"] = []
7168

72-
# switch to a different layout for mobile devices
73-
@layout = env['X_MOBILE_DEVICE'] ? :layout_mobile : true
74-
# for debugging
75-
# @layout = :layout_mobile
76-
# puts env.sort.map{ |v| v.join(': ') }.join("\n") + "\n"
77-
7869
$db_access.lock :SH
7970
end
8071

@@ -98,14 +89,14 @@ def caching_check_application_start_time
9889
caching_check_application_start_time
9990

10091
@show_banner = true
101-
haml :splash, :layout => @layout
92+
haml :splash
10293
end
10394

10495
get "/login" do
10596
caching_check_application_start_time
10697

10798
@show_banner = true
108-
haml :login, :layout => @layout
99+
haml :login
109100
end
110101

111102
get "/logout" do
@@ -119,28 +110,28 @@ def caching_check_application_start_time
119110
caching_check_application_start_time
120111

121112
@show_banner = true
122-
haml :trophies, :layout => @layout
113+
haml :trophies
123114
end
124115

125116
get "/trophies/:variant" do
126117
caching_check_application_start_time
127118

128119
@variant = params[:variant]
129-
haml :variant_trophies, layout: @layout
120+
haml :variant_trophies
130121
end
131122

132123
get "/users" do
133124
caching_check_last_played_game
134125

135126
@users = User.all
136-
haml :users, :layout => @layout
127+
haml :users
137128
end
138129

139130
get "/about" do
140131
caching_check_application_start_time
141132

142133
@show_banner = true
143-
haml :about, :layout => @layout
134+
haml :about
144135
end
145136

146137
post "/login" do
@@ -159,14 +150,14 @@ def caching_check_application_start_time
159150
caching_check_application_start_time
160151

161152
@show_banner = true
162-
haml :register, :layout => @layout
153+
haml :register
163154
end
164155

165156
get "/rules" do
166157
caching_check_application_start_time
167158

168159
@show_banner = true
169-
haml :rules, :layout => @layout
160+
haml :rules
170161
end
171162

172163
get "/home" do
@@ -182,7 +173,7 @@ def caching_check_application_start_time
182173
@games_played = Game.all(:user_id => @user.id, :order => [ :endtime.desc ])
183174
@games_played_title = @user.display_game_statistics
184175

185-
haml :home, :layout => @layout
176+
haml :home
186177
end
187178

188179
post "/add_server_account" do
@@ -300,7 +291,7 @@ def caching_check_application_start_time
300291

301292
@user_id = @player.id
302293

303-
haml :user, :layout => @layout
294+
haml :user
304295
else
305296
session['errors'] << "Could not find user #{CGI::escape(params[:name])}"
306297
end
@@ -319,15 +310,15 @@ def caching_check_application_start_time
319310
caching_check_last_played_game
320311

321312
@clans = Clan.all
322-
haml :clans, :layout => @layout
313+
haml :clans
323314
end
324315

325316
get "/clan/:name" do
326317
@clan = Clan.get(params[:name])
327318
if @clan
328319
puts "Invitations: #{@clan.invitations.inspect}"
329320
@admin = @clan.get_admin
330-
haml :clan, :layout => @layout
321+
haml :clan
331322
else
332323
session['errors'] << "Could not find clan with id #{params[:name].inspect}"
333324
redirect "/clans"
@@ -488,27 +479,27 @@ def caching_check_application_start_time
488479
user_id = {:user_id => @u.id}
489480
@last_10_games = get_last_games(user_id)
490481
@most_ascended_users = most_ascensions_users(@u.id)
491-
haml :user_scores, :layout => @layout
482+
haml :user_scores
492483
end
493484

494485
get "/servers" do
495486
caching_check_application_start_time
496487

497488
@servers = Server.all
498-
haml :servers, layout: @layout, locals: { verbose: false }
489+
haml :servers, locals: { verbose: false }
499490
end
500491

501492
get "/servers/check" do
502493
@servers = Server.all
503-
haml :servers, layout: @layout, locals: { verbose: true }
494+
haml :servers, locals: { verbose: true }
504495
end
505496

506497
get "/server/:name" do
507498
caching_check_last_played_game
508499
@server = Server.first(:name => params[:name])
509500
if @server
510501
@games = @server.games :conditions => [ 'user_id > 0' ], :order => [ :endtime.desc ], :limit => 100
511-
haml :server, :layout => @layout
502+
haml :server
512503
else
513504
session['errors'] << "Could not find server #{ params[:name] }"
514505
redirect "/"
@@ -522,7 +513,7 @@ def caching_check_application_start_time
522513
# limit by date for not permanently showing users that haven't
523514
# added themselves to Junethack
524515
@games = @server.games :conditions => [ "endtime > #{Time.new.to_i-7*60*60*24}" ], :order => [ :endtime.desc ], :limit => 100
525-
haml :server, :layout => @layout
516+
haml :server
526517
else
527518
session['errors'] << "Could not find server #{ params[:name] }"
528519
redirect "/"
@@ -554,7 +545,7 @@ def caching_check_application_start_time
554545
@games_played = Game.all(hash)
555546
@games_played_title = "Last #{@games_played.count} games played" + title_variant + title_date
556547

557-
haml :last_games_played, :layout => @layout
548+
haml :last_games_played
558549
end
559550

560551
get %r{/ascensions/?(\d{4}-\d{2}-\d{2})?/?([-0-9a-zNH.]+)?} do |date, variant|
@@ -580,43 +571,43 @@ def caching_check_application_start_time
580571

581572
@games_played_title = "Last #{@games_played.count} ascended games" + title_variant + title_date
582573

583-
haml :last_games_played, :layout => @layout
574+
haml :last_games_played
584575
end
585576

586577
get "/activity" do
587578
caching_check_last_played_game
588579

589-
haml :activity, :layout => @layout
580+
haml :activity
590581
end
591582

592583
get "/deaths" do
593584
caching_check_last_played_game
594585

595-
haml :deaths, :layout => @layout
586+
haml :deaths
596587
end
597588

598589
get "/scoreboard" do
599590
caching_check_last_played_game
600591

601-
haml :scoreboard, :layout => @layout
592+
haml :scoreboard
602593
end
603594

604595
get "/trophy_scoreboard" do
605596
caching_check_last_played_game
606597

607-
haml :trophy_scoreboard, :layout => @layout
598+
haml :trophy_scoreboard
608599
end
609600

610601
get "/player_scoreboard" do
611602
caching_check_last_played_game
612603

613-
haml :player_scoreboard, :layout => @layout
604+
haml :player_scoreboard
614605
end
615606

616607
get "/post_tournament_statistics" do
617608
caching_check_last_played_game
618609

619-
haml :post_tournament_statistics, :layout => @layout
610+
haml :post_tournament_statistics
620611
end
621612

622613
get "/junethack.rss" do

public/javascript.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
function setupTrophyToggling() {
22
const expandAllIcon = document.querySelector("h2 .min-max-trophies");
3+
if (!expandAllIcon) {
4+
return;
5+
}
6+
37
expandAllIcon.addEventListener("click", function() {
4-
uls = document.querySelectorAll(".content_bulk ul")
8+
uls = document.querySelectorAll(".container ul, .card-body ul");
59

610
uls.forEach(function (ul) {
711
ul.classList.toggle("collapsed");
@@ -11,15 +15,17 @@ function setupTrophyToggling() {
1115
const expandIcons = document.querySelectorAll("h3 .min-max-trophies");
1216
expandIcons.forEach(function (expandIcon) {
1317
expandIcon.addEventListener("click", function() {
14-
section = expandIcon.closest("section");
15-
uls = section.querySelectorAll("ul")
18+
section = expandIcon.closest("section, .card-body");
19+
if (!section) {
20+
return;
21+
}
22+
uls = section.querySelectorAll("ul");
1623

1724
uls.forEach(function (ul) {
1825
ul.classList.toggle("collapsed");
1926
});
2027
});
2128
});
22-
2329
}
2430

2531
document.addEventListener("DOMContentLoaded", function () {

0 commit comments

Comments
 (0)