diff --git a/pythonie/core/static/js/hallo-custombuttons.js b/pythonie/core/static/js/hallo-custombuttons.js deleted file mode 100644 index f4e0163..0000000 --- a/pythonie/core/static/js/hallo-custombuttons.js +++ /dev/null @@ -1,53 +0,0 @@ - -(function() { - (function($) { - return $.widget("IKS.clicktotweet", { - options: { - uuid: '', - editable: null - }, - populateToolbar: function(toolbar) { - var button, widget; - - widget = this; - button = $(''); - button.hallobutton({ - uuid: this.options.uuid, - editable: this.options.editable, - label: 'Click to tweet', - icon: 'fa fa-twitter', - command: null - }); - toolbar.append(button); - return button.on("click", function(event) { - var insertionPoint, lastSelection; - - lastSelection = widget.options.editable.getSelection(); - insertionPoint = $(lastSelection.endContainer).parentsUntil('.richtext').last(); - var quoted = "“" + lastSelection + "”"; - var escaped = $("
").text(quoted).html(); - var link_ref = "https://twitter.com/share?text="+escaped+"&url=https://www.python.ie/" - var link = $("").attr({ - "target": '_blank', - "href": link_ref, - }).text(quoted); - var elem = $("
").attr({ - "class" : 'tm-click-to-tweet', - }).append(link); - - var tweet = $("

").attr({"class" : 'tm-ctt-tip'}).append( - link.clone().attr({"class": 'tm-ctt-btn'}).text('Click to tweet')); - - elem.append(tweet); - var node = lastSelection.createContextualFragment($('

').append(elem).html()); - - lastSelection.deleteContents(); - lastSelection.insertNode(node); - - return widget.options.editable.element.trigger('change'); - }); - } - }); - })(jQuery); - -}).call(this); diff --git a/pythonie/core/wagtail_hooks.py b/pythonie/core/wagtail_hooks.py deleted file mode 100644 index 7bce220..0000000 --- a/pythonie/core/wagtail_hooks.py +++ /dev/null @@ -1,69 +0,0 @@ -from django.conf import settings -from django.utils.html import format_html, format_html_join -from django.utils.safestring import mark_safe -from wagtail import hooks -from wagtail.whitelist import attribute_rule, check_url - - -@hooks.register("insert_editor_js") -def enable_source(): - return mark_safe( - """ - - """ - ) - - -@hooks.register("construct_whitelister_element_rules") -def allow_iframes(): - return { - "iframe": attribute_rule( - { - "src": True, - "width": True, - "height": True, - "frameborder": True, - "marginheight": True, - "marginwidth": True, - } - ), - "tito-widget": attribute_rule({"event": True}), - "tito-button": attribute_rule({"event": True}), - } - - -@hooks.register("construct_whitelister_element_rules") -def allow_blockquotes(): - return { - "a": attribute_rule({"href": check_url, "target": True, "class": True}), - "blockquote": attribute_rule({"class": True}), - } - - -@hooks.register("insert_editor_js") -def enable_quotes(): - js_files = [ - "js/hallo-custombuttons.js", - ] - js_includes = format_html_join( - "\n", - '', - ((settings.STATIC_URL, filename) for filename in js_files), - ) - - return js_includes + mark_safe( - """ - - """ - ) - - -@hooks.register("insert_editor_css") -def font_awesome_css(): - return format_html( - '', settings.STATIC_URL - )