|
@@ -1,6 +1,43 @@
|
|
|
{% extends "base.html" %}
|
|
|
{% load static %}
|
|
|
|
|
|
+{% block head_extra %}
|
|
|
+<script>
|
|
|
+$(document).ready(function() {
|
|
|
+ // Initialize the tooltip.
|
|
|
+ $('#copy-button').tooltip();
|
|
|
+
|
|
|
+ // When the copy button is clicked, select the value of the text box, attempt
|
|
|
+ // to execute the copy command, and trigger event to update tooltip message
|
|
|
+ // to indicate whether the text was successfully copied.
|
|
|
+ $('#copy-button').bind('click', function() {
|
|
|
+ var input = document.querySelector('#copy-input');
|
|
|
+ input.setSelectionRange(0, input.value.length + 1);
|
|
|
+ try {
|
|
|
+ var success = document.execCommand('copy');
|
|
|
+ if (success) {
|
|
|
+ $('#copy-button').trigger('copied', ['Copied!']);
|
|
|
+ } else {
|
|
|
+ $('#copy-button').trigger('copied', ['Copy with Ctrl-c']);
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ $('#copy-button').trigger('copied', ['Copy with Ctrl-c']);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // Handler for updating the tooltip message.
|
|
|
+ $('#copy-button').bind('copied', function(event, message) {
|
|
|
+ $(this).attr('title', message)
|
|
|
+ .tooltip('fixTitle')
|
|
|
+ .tooltip('show')
|
|
|
+ .attr('title', "Copy to Clipboard")
|
|
|
+ .tooltip('fixTitle');
|
|
|
+ });
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+
|
|
|
+{% endblock %}
|
|
|
{% block title %}{{object.name}}{% endblock %}
|
|
|
|
|
|
{% block content %}
|
|
@@ -36,8 +73,25 @@
|
|
|
<dd>{{game.rating_by_100}}</dd>
|
|
|
</dl>
|
|
|
|
|
|
- <p>{{object.description}}</p>
|
|
|
- {% if object.get_play_url %}
|
|
|
- <p><a href="{{game.get_play_url}}" class="btn btn-primary" targe="_blank">Play</a></p>
|
|
|
+ {% if object.webretro_url %}
|
|
|
+ <p><a href="{{game.webretro_url}}" class="btn btn-primary" targe="_blank">Play</a></p>
|
|
|
+ {% elif object.retroarch_cmd %}
|
|
|
+ <p>
|
|
|
+ <form>
|
|
|
+ <div class="input-group">
|
|
|
+ <input type="text" class="form-control"
|
|
|
+ value="{{object.retroarch_cmd}}" placeholder="" id="copy-input">
|
|
|
+ <span class="input-group-btn">
|
|
|
+ <button class="btn btn-default" type="button" id="copy-button"
|
|
|
+ data-toggle="tooltip" data-placement="button"
|
|
|
+ title="Copy to Clipboard">
|
|
|
+ Copy
|
|
|
+ </button>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </p>
|
|
|
{% endif %}
|
|
|
+
|
|
|
+ <p>{{object.description}}</p>
|
|
|
{% endblock %}
|