taiko-web development has returned to GitHub. This Gitea instance will be shut down soon.
If your taiko-web fork is unavailable due to DMCA takedown, you can contact GitHub Support and ask for it to be deleted.
Browse Source

Merge branch 'assets-css' of bui/taiko-web into master

Bui 2 weeks ago
parent
commit
566813363f
5 changed files with 28 additions and 14 deletions
  1. 13
    4
      app.py
  2. 1
    4
      public/src/js/about.js
  3. 4
    0
      public/src/js/assets.js
  4. 7
    1
      public/src/js/loader.js
  5. 3
    5
      templates/index.html

+ 13
- 4
app.py View File

11
 
11
 
12
 app = Flask(__name__)
12
 app = Flask(__name__)
13
 DATABASE = 'taiko.db'
13
 DATABASE = 'taiko.db'
14
+DEFAULT_URL = 'https://github.com/bui/taiko-web/'
14
 
15
 
15
 
16
 
16
 def get_db():
17
 def get_db():
119
 
120
 
120
 
121
 
121
 def get_version():
122
 def get_version():
122
-    version = None
123
+    version = {'commit': None, 'commit_short': '', 'version': None, 'url': DEFAULT_URL}
123
     if os.path.isfile('version.json'):
124
     if os.path.isfile('version.json'):
124
-        version = json.load(open('version.json', 'r'))
125
+        try:
126
+            ver = json.load(open('version.json', 'r'))
127
+        except ValueError:
128
+            print('Invalid version.json file')
129
+            return version
130
+
131
+        for key in version.keys():
132
+            if ver.get(key):
133
+                version[key] = ver.get(key)
125
 
134
 
126
     return version
135
     return version
127
 
136
 
213
     if os.path.isfile(song_path) and not os.path.isfile(prev_path):
222
     if os.path.isfile(song_path) and not os.path.isfile(prev_path):
214
         preview = get_preview(song_id, song_type) / 1000
223
         preview = get_preview(song_id, song_type) / 1000
215
         if not preview or preview <= 0.1:
224
         if not preview or preview <= 0.1:
216
-            print 'Skipping #%s due to no preview' % song_id
225
+            print('Skipping #%s due to no preview' % song_id)
217
             return False
226
             return False
218
 
227
 
219
-        print 'Making preview.mp3 for song #%s' % song_id
228
+        print('Making preview.mp3 for song #%s' % song_id)
220
         ff = FFmpeg(inputs={song_path: '-ss %s' % preview},
229
         ff = FFmpeg(inputs={song_path: '-ss %s' % preview},
221
                     outputs={prev_path: '-codec:a libmp3lame -ar 32000 -b:a 92k -y -loglevel panic'})
230
                     outputs={prev_path: '-codec:a libmp3lame -ar 32000 -b:a 92k -y -loglevel panic'})
222
         ff.run()
231
         ff.run()

+ 1
- 4
public/src/js/about.js View File

29
 		this.endButton.innerText = strings.tutorial.ok
29
 		this.endButton.innerText = strings.tutorial.ok
30
 		this.endButton.setAttribute("alt", strings.tutorial.ok)
30
 		this.endButton.setAttribute("alt", strings.tutorial.ok)
31
 		
31
 		
32
-		var versionUrl = "https://github.com/bui/taiko-web/"
33
-		if(gameConfig._version){
34
-			versionUrl = gameConfig._version.url
35
-		}
32
+		var versionUrl = gameConfig._version.url
36
 		this.getLink(this.linkIssues).href = versionUrl + "issues"
33
 		this.getLink(this.linkIssues).href = versionUrl + "issues"
37
 		
34
 		
38
 		pageEvents.add(this.linkIssues, ["click", "touchend"], this.linkButton.bind(this))
35
 		pageEvents.add(this.linkIssues, ["click", "touchend"], this.linkButton.bind(this))

+ 4
- 0
public/src/js/assets.js View File

37
 		"debug.css",
37
 		"debug.css",
38
 		"songbg.css"
38
 		"songbg.css"
39
 	],
39
 	],
40
+	"assetsCss": [
41
+		"fonts/fonts.css",
42
+		"img/img.css"
43
+	],
40
 	"img": [
44
 	"img": [
41
 		"title-screen.png",
45
 		"title-screen.png",
42
 		"notes.png",
46
 		"notes.png",

+ 7
- 1
public/src/js/loader.js View File

23
 		this.loaderPercentage = document.querySelector("#loader .percentage")
23
 		this.loaderPercentage = document.querySelector("#loader .percentage")
24
 		this.loaderProgress = document.querySelector("#loader .progress")
24
 		this.loaderProgress = document.querySelector("#loader .progress")
25
 		
25
 		
26
-		var queryString = gameConfig._version ? "?" + gameConfig._version.commit_short : ""
26
+		var queryString = gameConfig._version.commit_short ? "?" + gameConfig._version.commit_short : ""
27
 		
27
 		
28
 		assets.js.forEach(name => {
28
 		assets.js.forEach(name => {
29
 			var script = document.createElement("script")
29
 			var script = document.createElement("script")
40
 				stylesheet.href = "/src/css/" + name + queryString
40
 				stylesheet.href = "/src/css/" + name + queryString
41
 				document.head.appendChild(stylesheet)
41
 				document.head.appendChild(stylesheet)
42
 			})
42
 			})
43
+			assets.assetsCss.forEach(name => {
44
+				var stylesheet = document.createElement("link")
45
+				stylesheet.rel = "stylesheet"
46
+				stylesheet.href = gameConfig.assets_baseurl + name + queryString
47
+				document.head.appendChild(stylesheet)
48
+			})
43
 			var checkStyles = () => {
49
 			var checkStyles = () => {
44
 				if(document.styleSheets.length >= cssCount){
50
 				if(document.styleSheets.length >= cssCount){
45
 					resolve()
51
 					resolve()

+ 3
- 5
templates/index.html View File

8
 	<meta name="description" content="パソコンとスマホのブラウザ向けの太鼓の達人シミュレータ 🥁 Taiko no Tatsujin rhythm game simulator for desktop and mobile browsers">
8
 	<meta name="description" content="パソコンとスマホのブラウザ向けの太鼓の達人シミュレータ 🥁 Taiko no Tatsujin rhythm game simulator for desktop and mobile browsers">
9
 
9
 
10
 	<link rel="stylesheet" href="/src/css/loader.css?{{version.commit_short}}">
10
 	<link rel="stylesheet" href="/src/css/loader.css?{{version.commit_short}}">
11
-	<link rel="stylesheet" href="{{config.assets_baseurl}}fonts/fonts.css?{{version.commit_short}}">
12
-	<link rel="stylesheet" href="{{config.assets_baseurl}}img/img.css?{{version.commit_short}}">
13
-	
11
+
14
 	<script src="/src/js/assets.js?{{version.commit_short}}"></script>
12
 	<script src="/src/js/assets.js?{{version.commit_short}}"></script>
15
 	<script src="/src/js/strings.js?{{version.commit_short}}"></script>
13
 	<script src="/src/js/strings.js?{{version.commit_short}}"></script>
16
 	<script src="/src/js/pageevents.js?{{version.commit_short}}"></script>
14
 	<script src="/src/js/pageevents.js?{{version.commit_short}}"></script>
21
 	<div id="assets"></div>
19
 	<div id="assets"></div>
22
 	<div id="screen" class="pattern-bg"></div>
20
 	<div id="screen" class="pattern-bg"></div>
23
 	<div id="version">
21
 	<div id="version">
24
-		{% if version %}
22
+		{% if version.version and version.commit_short and version.commit %}
25
 			<a href="{{version.url}}commit/{{version.commit}}" target="_blank" id="version-link" class="stroke-sub" alt="taiko-web ver.{{version.version}} ({{version.commit_short}})">taiko-web ver.{{version.version}} ({{version.commit_short}})</a>
23
 			<a href="{{version.url}}commit/{{version.commit}}" target="_blank" id="version-link" class="stroke-sub" alt="taiko-web ver.{{version.version}} ({{version.commit_short}})">taiko-web ver.{{version.version}} ({{version.commit_short}})</a>
26
 		{% else %}
24
 		{% else %}
27
-			<a href="https://github.com/bui/taiko-web" target="_blank" id="version-link" class="stroke-sub" alt="taiko-web (unknown version)">taiko-web (unknown version)</a>
25
+			<a href="{{version.url}}" target="_blank" id="version-link" class="stroke-sub" alt="taiko-web (unknown version)">taiko-web (unknown version)</a>
28
 		{% endif %}
26
 		{% endif %}
29
 	</div>
27
 	</div>
30
 	<script src="/src/js/browsersupport.js?{{version.commit_short}}"></script>
28
 	<script src="/src/js/browsersupport.js?{{version.commit_short}}"></script>

Loading…
Cancel
Save