macros.html 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <!-- Draw glyphicon icon from bootstrap-theme -->
  2. {% macro icon(action, alt) -%}
  3. <span title="{{ alt }}" class="ion-icon-big ion-{{ action }}"></span>
  4. {%- endmacro %}
  5. {% macro icon_small(action) -%}
  6. <span class="ion-icon ion-{{ action }}"></span>
  7. {%- endmacro %}
  8. <!-- Draw favicon -->
  9. {% macro draw_favicon(favicon) -%}
  10. <img width="14" height="14" class="favicon" src="{{ url_for('static', filename='themes/simple/img/icons/' + favicon + '.png') }}" alt="{{ favicon }}" />
  11. {%- endmacro %}
  12. {% macro result_open_link(url, classes='') -%}
  13. <a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>
  14. {%- endmacro %}
  15. {%- macro result_close_link() -%}
  16. </a>
  17. {%- endmacro %}
  18. {%- macro result_link(url, title, classes='') -%}
  19. {{ result_open_link(url, classes) }}{{ title }}{{ result_close_link() }}
  20. {%- endmacro -%}
  21. <!-- Draw result header -->
  22. {% macro result_header(result, favicons, image_proxify) -%}
  23. <article class="result {% if result['template'] %}result-{{ result.template|replace('.html', '') }}{% else %}result-default{% endif %} {% if result['category'] %}category-{{ result['category'] }}{% endif %}{% for e in result.engines %} {{ e }}{% endfor %}">
  24. {%- if result.img_src %}{{ result_open_link(result.url) }}<img class="image" src="{{ image_proxify(result.img_src) }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="image" />{{ result_close_link() }}{% endif -%}
  25. {%- if result.thumbnail %}{{ result_open_link(result.url) }}<img class="thumbnail" src="{{ image_proxify(result.thumbnail) }}" title="{{ result.title|striptags }}" alt="{{ result.title|striptags }}"/>{{ result_close_link() }}{% endif -%}
  26. <h3>{{ result_link(result.url, result.title|safe) }}</h3>
  27. {%- endmacro -%}
  28. <!-- Draw result sub header -->
  29. {%- macro result_sub_header(result) -%}
  30. {% if result.publishedDate %}<time class="published_date" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
  31. {%- endmacro -%}
  32. <!-- Draw result sub footer -->
  33. {%- macro result_sub_footer(result, proxify) -%}
  34. <div class="engines">{% for engine in result.engines %}<span>{{ engine }}</span>{% endfor %}</div>{{- '' -}}
  35. <p class="url"><span class="url">{{ result.pretty_url }}</span>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "cache_link") }}&lrm; {% if proxify %} {{ result_link(proxify(result.url), icon('link') + _('proxied'), "proxyfied_link") }} {% endif %}</p>{{- '' -}}
  36. <div class="break"></div>{{- '' -}}
  37. {%- endmacro -%}
  38. <!-- Draw result footer -->
  39. {%- macro result_footer(result) -%}
  40. </article>
  41. {%- endmacro -%}
  42. <!-- -->
  43. {%- macro tabs_open() -%}
  44. <div class="tabs" role="tablist">
  45. {%- endmacro -%}
  46. {%- macro tab_header(name, id, label) -%}
  47. <input type="radio" name="{{ name }}" id="tab_{{ id }}"/>
  48. <label for="tab_{{ id }}" role="tab"
  49. aria-controls="panel{{ id }}">{{ label }}</label>
  50. <section id="tab-content{{ id }}" role="tabpanel"
  51. aria-labelledby="{{ label }}" aria-hidden="false">
  52. {%- endmacro -%}
  53. {%- macro tab_footer() -%}
  54. </section>
  55. {%- endmacro -%}
  56. {%- macro tabs_close() -%}
  57. </div>
  58. {%- endmacro -%}
  59. {%- macro checkbox_onoff(name, checked) -%}
  60. <div class="checkbox-onoff">{{- '' -}}
  61. <input type="checkbox" value="None" id="{{ name }}" name="{{ name }}" {% if checked %}checked{% endif %}/>{{- '' -}}
  62. <label for="{{ name }}"></label>{{- '' -}}
  63. </div>
  64. {%- endmacro -%}
  65. {%- macro checkbox(name, checked, readonly, disabled) -%}
  66. <div class="checkbox">{{- '' -}}
  67. <input type="checkbox" value="None" id="{{ name }}" name="{{ name }}" {% if checked %}checked{% endif %}{% if readonly %} readonly="readonly" {% endif %}{% if disabled %} disabled="disabled" {% endif %}/>{{- '' -}}
  68. <label for="{{ name }}"></label>{{- '' -}}
  69. </div>
  70. {%- endmacro -%}