Improve dolphin-emu.org page loading time.

* Point to minified versions of jquery and font-awesome.
* Use {% static %} everywhere to benefit from caching.
* pngcrush our static images.
This commit is contained in:
Pierre Bourdon 2014-03-02 15:16:45 +01:00
parent ef405dfd4d
commit 5065e48ab1
34 changed files with 24 additions and 11 deletions

View File

@ -1,5 +1,7 @@
{% load i18n %}
{% load url from future %}
{% load static from staticfiles %}
<form method="get" action="{% url 'zinnia_entry_search' %}" role="search">
<div class="input-group">
<input type="text" placeholder="{% trans "Search articles" %}" name="pattern" class="form-control" />
@ -12,6 +14,6 @@
</form>
<p class="alert alert-info" style="margin-top: 1em">
<img src="{{ STATIC_URL }}zinnia/img/help.png" alt="?" class="help" width="14" height="14" />
<img src="{% static "zinnia/img/help.png" %}" alt="?" class="help" width="14" height="14" />
{% trans "You can use - to exclude words or phrases, &quot;double quotes&quot; for exact phrases and the AND/OR boolean operators combined with parenthesis for complex queries." %}
</p>

View File

@ -4,6 +4,7 @@
{% load humanize %}
{% load i18n %}
{% load l10n %}
{% load static from staticfiles %}
{% block "metadescr" %}{% trans "The Dolphin Emulator compatibility list contains all the games we tested, sorted by how well they work on the emulator." %}{% endblock %}
@ -22,11 +23,11 @@
<h3>{% trans "How to read the ratings" %}</h3>
<ul>
<li><img src="{{ STATIC_URL }}img/stars/5.png" alt="{% trans "5 out of 5" %}"> {% trans "<strong>Perfect</strong>: No issues at all!" %}</li>
<li><img src="{{ STATIC_URL }}img/stars/4.png" alt="{% trans "4 out of 5" %}"> {% trans "<strong>Playable</strong>: Runs well, only minor graphical or audio glitches. Games can be played all the way through." %}</li>
<li><img src="{{ STATIC_URL }}img/stars/3.png" alt="{% trans "3 out of 5" %}"> {% trans "<strong>Starts</strong>: Starts, maybe even plays well, but crashes or major graphical/audio glitches." %}</li>
<li><img src="{{ STATIC_URL }}img/stars/2.png" alt="{% trans "2 out of 5" %}"> {% trans "<strong>Intro/Menu</strong>: Hangs/crashes somewhere between booting and starting." %}</li>
<li><img src="{{ STATIC_URL }}img/stars/1.png" alt="{% trans "1 out of 5" %}"> {% trans "<strong>Broken</strong>: Crashes when booting." %}</li>
<li><img src="{% static "img/stars/5.png" %}" alt="{% trans "5 out of 5" %}"> {% trans "<strong>Perfect</strong>: No issues at all!" %}</li>
<li><img src="{% static "img/stars/4.png" %}" alt="{% trans "4 out of 5" %}"> {% trans "<strong>Playable</strong>: Runs well, only minor graphical or audio glitches. Games can be played all the way through." %}</li>
<li><img src="{% static "img/stars/3.png" %}" alt="{% trans "3 out of 5" %}"> {% trans "<strong>Starts</strong>: Starts, maybe even plays well, but crashes or major graphical/audio glitches." %}</li>
<li><img src="{% static "img/stars/2.png" %}" alt="{% trans "2 out of 5" %}"> {% trans "<strong>Intro/Menu</strong>: Hangs/crashes somewhere between booting and starting." %}</li>
<li><img src="{% static "img/stars/1.png" %}" alt="{% trans "1 out of 5" %}"> {% trans "<strong>Broken</strong>: Crashes when booting." %}</li>
</ul>
</div>
</div>
@ -62,10 +63,10 @@
<tbody>
{% for game, cat, ts, hash in games %}
<tr>
<td class="category"><img src="{{ STATIC_URL }}img/platforms/{{ cat }}.png" width="32" height="32" alt="{{ cat|capfirst }}" title="{{ cat|capfirst }}"></td>
<td class="category"><img src="{% platform_img_url cat %}" width="32" height="32" alt="{{ cat|capfirst }}" title="{{ cat|capfirst }}"></td>
<td class="banner"><div class="bnr bnr-{{ hash }}"></div></td>
<td class="title always-ltr"><a href="{{ game.wiki_url }}">{{ game.title }}</a></td>
<td class="rating"><img src="{{ STATIC_URL }}img/stars/{{ game.latest.text.data }}.png" alt="{{ game.latest.text.data|compat_text }}" title="{{ game.latest.text.data|compat_text }}"></td>
<td class="rating"><img src="{% compat_img_url game.latest.text.data|compat_text %}" alt="{{ game.latest.text.data|compat_text }}" title="{{ game.latest.text.data|compat_text }}"></td>
<td class="update">{{ ts|naturaltime }}</td>
</tr>
{% endfor %}

View File

@ -1,5 +1,6 @@
from django import template
from django.conf import settings
from django.contrib.staticfiles.storage import staticfiles_storage
from django.utils.translation import ugettext_lazy as _
from dolweb.compat.models import get_rating_count, get_rated_games
@ -41,3 +42,11 @@ def rating_class(compat):
4: 'success',
5: 'info',
}[int(compat)]
@register.simple_tag
def platform_img_url(platform):
return staticfiles_storage.url('img/platforms/%s.png' % platform)
@register.simple_tag
def compat_img_url(compat):
return staticfiles_storage.url('img/stars/%s.png' % compat)

View File

@ -1,10 +1,11 @@
{% extends "_base.html" %}
{% load i18n %}
{% load static from staticfiles %}
{% block "title" %}{{ title }}{% endblock %}
{% block "extracss" %}
<link href="{{ STATIC_URL }}css/wiki.css" rel="stylesheet">
<link href="{% static "css/wiki.css" %}" rel="stylesheet">
{% endblock %}
{% block "body" %}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 573 B

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 930 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 618 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 615 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1022 B

After

Width:  |  Height:  |  Size: 971 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -22,7 +22,7 @@
<link rel="alternate" type="application/rss+xml" title="{% trans "Latest blog articles" %}" href="{% url zinnia_entry_latest_feed %}" />
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">
<link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
<link href="{% static "css/bootstrap-theme.min.css" %}" rel="stylesheet">
<link href="{% static "css/dolphin.css" %}" rel="stylesheet">
@ -114,7 +114,7 @@
</p>
</footer>
<script src="//code.jquery.com/jquery.js"></script>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="{% static "js/bootstrap.min.js" %}"></script>
{% block "extrajs" %}
{% endblock %}