diff --git a/.gitignore b/.gitignore index b19367f..3d8ed18 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,4 @@ lib64 pip-selfcheck.json /Pipfile.lock /dev_https +node_modules diff --git a/brutaldon/static/js/mousetrap.min.js b/brutaldon/static/js/mousetrap.min.js new file mode 100644 index 0000000..105ae55 --- /dev/null +++ b/brutaldon/static/js/mousetrap.min.js @@ -0,0 +1,11 @@ +/* mousetrap v1.6.2 craig.is/killing/mice */ +(function(p,t,h){function u(a,b,d){a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent("on"+b,d)}function y(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);a.shiftKey||(b=b.toLowerCase());return b}return m[a.which]?m[a.which]:q[a.which]?q[a.which]:String.fromCharCode(a.which).toLowerCase()}function E(a){var b=[];a.shiftKey&&b.push("shift");a.altKey&&b.push("alt");a.ctrlKey&&b.push("ctrl");a.metaKey&&b.push("meta");return b}function v(a){return"shift"==a||"ctrl"==a||"alt"==a|| +"meta"==a}function z(a,b){var d,e=[];var c=a;"+"===c?c=["+"]:(c=c.replace(/\+{2}/g,"+plus"),c=c.split("+"));for(d=0;dh||m.hasOwnProperty(h)&&(n[m[h]]=h)}d=n[c]?"keydown":"keypress"}"keypress"==d&&e.length&&(d="keydown");return{key:k,modifiers:e,action:d}}function C(a,b){return null===a||a===t?!1:a===b?!0:C(a.parentNode,b)}function e(a){function b(a){a= +a||{};var b=!1,l;for(l in n)a[l]?b=!0:n[l]=0;b||(w=!1)}function d(a,b,r,g,F,e){var l,D=[],h=r.type;if(!f._callbacks[a])return[];"keyup"==h&&v(a)&&(b=[a]);for(l=0;l":".","?":"/","|":"\\"},A={option:"alt",command:"meta","return":"enter", +escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},n;for(h=1;20>h;++h)m[111+h]="f"+h;for(h=0;9>=h;++h)m[h+96]=h.toString();e.prototype.bind=function(a,b,d){a=a instanceof Array?a:[a];this._bindMultiple.call(this,a,b,d);return this};e.prototype.unbind=function(a,b){return this.bind.call(this,a,function(){},b)};e.prototype.trigger=function(a,b){if(this._directMap[a+":"+b])this._directMap[a+":"+b]({},a);return this};e.prototype.reset=function(){this._callbacks={}; +this._directMap={};return this};e.prototype.stopCallback=function(a,b){return-1<(" "+b.className+" ").indexOf(" mousetrap ")||C(b,this.target)?!1:"INPUT"==b.tagName||"SELECT"==b.tagName||"TEXTAREA"==b.tagName||b.isContentEditable};e.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)};e.addKeycodes=function(a){for(var b in a)a.hasOwnProperty(b)&&(m[b]=a[b]);n=null};e.init=function(){var a=e(t),b;for(b in a)"_"!==b.charAt(0)&&(e[b]=function(b){return function(){return a[b].apply(a, +arguments)}}(b))};e.init();p.Mousetrap=e;"undefined"!==typeof module&&module.exports&&(module.exports=e);"function"===typeof define&&define.amd&&define(function(){return e})}})("undefined"!==typeof window?window:null,"undefined"!==typeof window?document:null); diff --git a/brutaldon/templates/base.html b/brutaldon/templates/base.html index e3aed12..f201a67 100644 --- a/brutaldon/templates/base.html +++ b/brutaldon/templates/base.html @@ -14,6 +14,8 @@ integrity="sha256-MGU/JUq/40CFrfxjXb5pZjpoZmxiP2KuICN5ElLFNd8=" crossorigin="anonymous"> + {% block page_scripts %} + {% endblock %} {% else %} {% endif %} @@ -126,6 +128,9 @@ document.addEventListener('DOMContentLoaded', function () { }); + {% block page_scripts_inline %} + {% endblock %} + {% endif %} diff --git a/brutaldon/templates/main/post.html b/brutaldon/templates/main/post.html index 0c3e76c..87efa7b 100644 --- a/brutaldon/templates/main/post.html +++ b/brutaldon/templates/main/post.html @@ -1,10 +1,27 @@ {% extends "base.html" %} +{% load static %} {% block title %} Brutaldon - toot {% endblock %} +{% block page_scripts %} + +{% endblock %} + {% block content %}

Toot!

{% include "main/post_partial.html" %}
{% endblock %} + +{% block page_scripts_inline %} + +{% endblock %} diff --git a/brutaldon/templates/main/post_minimal_partial.html b/brutaldon/templates/main/post_minimal_partial.html index 321f585..ddcc2bd 100644 --- a/brutaldon/templates/main/post_minimal_partial.html +++ b/brutaldon/templates/main/post_minimal_partial.html @@ -1,11 +1,11 @@ {% load widget_tweaks %} -
+ {% csrf_token %}
- {% render_field form.status class+="textarea is-primary" rows="4" %} + {% render_field form.status class+="textarea is-primary mousetrap" rows="4" %}
diff --git a/brutaldon/templates/main/post_partial.html b/brutaldon/templates/main/post_partial.html index d637ad3..a04ca65 100644 --- a/brutaldon/templates/main/post_partial.html +++ b/brutaldon/templates/main/post_partial.html @@ -1,7 +1,7 @@ {% load widget_tweaks %} {% if reply %} - + {% else %} {% endif %} @@ -10,14 +10,14 @@
- {% render_field form.spoiler_text class+="input" placeholder="Optional" %} + {% render_field form.spoiler_text class+="input mousetrap" placeholder="Optional" %}
- {% render_field form.status class+="textarea is-primary" rows="4" %} + {% render_field form.status class+="textarea mousetrap is-primary" rows="4" %}
@@ -48,7 +48,7 @@
- {% render_field form.media_text_1 class+="input" placeholder="Describe attachment" %} + {% render_field form.media_text_1 class+="input mousetrap" placeholder="Describe attachment" %}
@@ -67,7 +67,7 @@
- {% render_field form.media_text_2 class+="input" placeholder="Describe attachment" %} + {% render_field form.media_text_2 class+="input mousetrap" placeholder="Describe attachment" %}
@@ -86,7 +86,7 @@
- {% render_field form.media_text_3 class+="input" placeholder="Describe attachment" %} + {% render_field form.media_text_3 class+="input mousetrap" placeholder="Describe attachment" %}
@@ -104,7 +104,7 @@
- {% render_field form.media_text_4 class+="input" placeholder="Describe attachment" %} + {% render_field form.media_text_4 class+="input mousetrap" placeholder="Describe attachment" %}
diff --git a/brutaldon/templates/main/reply.html b/brutaldon/templates/main/reply.html index 63d98da..9c13a36 100644 --- a/brutaldon/templates/main/reply.html +++ b/brutaldon/templates/main/reply.html @@ -1,20 +1,37 @@ {% extends "base.html" %} {% load humanize %} +{% load static %} {% block title %} -Brutaldon - reply + Brutaldon - reply +{% endblock %} + +{% block page_scripts %} + {% endblock %} {% block content %} -

Thread

-{% for ancestor in context.ancestors %} -{% include "main/toot_partial.html" with toot=ancestor %} - -{% endfor %} -{% include "main/toot_partial.html" with toot=toot active=True %} - -
- {% include "main/post_partial.html" %} -
+

Thread

+ {% for ancestor in context.ancestors %} + {% include "main/toot_partial.html" with toot=ancestor %} + + {% endfor %} + {% include "main/toot_partial.html" with toot=toot active=True %} + +
+ {% include "main/post_partial.html" %} +
{% endblock %} + +{% block page_scripts_inline %} + +{% endblock %} diff --git a/brutaldon/templates/main/timeline.html b/brutaldon/templates/main/timeline.html index 498d533..e22cafd 100644 --- a/brutaldon/templates/main/timeline.html +++ b/brutaldon/templates/main/timeline.html @@ -1,10 +1,15 @@ {% extends "base.html" %} {% load humanize %} +{% load static %} {% block title %} Brutaldon - {{ timeline_name }} timelime {% endblock %} +{% block page_scripts %} + +{% endblock %} + {% block content %} {% if form %}

Post

@@ -34,3 +39,15 @@ Brutaldon - {{ timeline_name }} timelime {% endblock %} {% endblock %} + +{% block page_scripts_inline %} + +{% endblock %} diff --git a/package.json b/package.json new file mode 100644 index 0000000..5429c30 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "mousetrap": "^1.6.2" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..4886940 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,7 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +mousetrap@^1.6.2: + version "1.6.2" + resolved "https://registry.yarnpkg.com/mousetrap/-/mousetrap-1.6.2.tgz#caadd9cf886db0986fb2fee59a82f6bd37527587"