Optional "flag style" and "flag alt" modifiers

This commit is contained in:
Michael Foster 2013-08-16 23:12:40 +10:00
parent 47ddd2f8b2
commit 0ad1c03997
3 changed files with 9 additions and 5 deletions

View File

@ -739,9 +739,9 @@
// Location of post flags/icons (where "%s" is the flag name). Defaults to static/flags/%s.png. // Location of post flags/icons (where "%s" is the flag name). Defaults to static/flags/%s.png.
// $config['uri_flags'] = 'http://static.example.org/flags/%s.png'; // $config['uri_flags'] = 'http://static.example.org/flags/%s.png';
// Width and height of post flags: // Width and height (and more?) of post flags. Can be overridden with the Tinyboard post modifier:
$config['flag_width'] = 16; // <tinyboard flag style>.
$config['flag_height'] = 11; $config['flag_style'] = 'width:16px;height:11px;';
/* /*
* ==================== * ====================

View File

@ -29,7 +29,9 @@
[<a style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>] [<a style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>]
{% endif %} {% endif %}
{% if config.display_flags and post.modifiers.flag %} {% if config.display_flags and post.modifiers.flag %}
<img class="flag" style="width:{{ config.flag_width }}px;height:{{ config.flag_height }}px" src="{{ config.uri_flags|sprintf(post.modifiers.flag) }}"> <img class="flag" src="{{ config.uri_flags|sprintf(post.modifiers.flag) }}"
style="{% if post.modifiers['flag style'] %}{{ post.modifiers['flag style'] }}{% else %}{{ config.flag_style }}{% endif %}"
{% if post.modifiers['flag alt'] %}title="{{ post.modifiers['flag alt'] | e('html_attr') }}"{% endif %}>
{% endif %} {% endif %}
<time datetime="{{ post.time|date('%Y-%m-%dT%H:%M:%S') }}{{ timezone() }}">{{ post.time|date(config.post_date) }}</time> <time datetime="{{ post.time|date('%Y-%m-%dT%H:%M:%S') }}{{ timezone() }}">{{ post.time|date(config.post_date) }}</time>
</label> </label>

View File

@ -83,7 +83,9 @@
[<a style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>] [<a style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>]
{% endif %} {% endif %}
{% if config.display_flags and post.modifiers.flag %} {% if config.display_flags and post.modifiers.flag %}
<img class="flag" style="width:{{ config.flag_width }}px;height:{{ config.flag_height }}px" src="{{ config.uri_flags|sprintf(post.modifiers.flag) }}"> <img class="flag" src="{{ config.uri_flags|sprintf(post.modifiers.flag) }}"
style="{% if post.modifiers['flag style'] %}{{ post.modifiers['flag style'] }}{% else %}{{ config.flag_style }}{% endif %}"
{% if post.modifiers['flag alt'] %}title="{{ post.modifiers['flag alt'] | e('html_attr') }}"{% endif %}>
{% endif %} {% endif %}
<time datetime="{{ post.time|date('%Y-%m-%dT%H:%M:%S') }}{{ timezone() }}">{{ post.time|date(config.post_date) }}</time> <time datetime="{{ post.time|date('%Y-%m-%dT%H:%M:%S') }}{{ timezone() }}">{{ post.time|date(config.post_date) }}</time>
</label> </label>