diff --git a/LICENSE b/LICENSE index 8dada3e..e45214f 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright 2017 Keno Clayton Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/assets/background.png b/assets/background.png new file mode 100644 index 0000000..a5ca291 Binary files /dev/null and b/assets/background.png differ diff --git a/assets/favicon.ico b/assets/favicon.ico new file mode 100644 index 0000000..b4ac4d7 Binary files /dev/null and b/assets/favicon.ico differ diff --git a/assets/rule.png b/assets/rule.png new file mode 100644 index 0000000..2e18cca Binary files /dev/null and b/assets/rule.png differ diff --git a/assets/scripts.js b/assets/scripts.js new file mode 100644 index 0000000..10a4596 --- /dev/null +++ b/assets/scripts.js @@ -0,0 +1,130 @@ +var Embed = Quill.import('blots/embed'); + +//Create a new spoiler class for span tags with class spoiler applied + +class Spoiler extends Embed { + static create(value) { + let node = super.create(value); + node.innerHTML = value; + return node; + } +} + +Spoiler.blotName = 'span'; +Spoiler.className = 'spoiler'; +Spoiler.tagName = 'span'; + +var steamSpoiler = function() { + var customSpan = document.createElement('span'); + var range = quill.getSelection(); + if (range) { + quill.insertEmbed(range.index, "span", customSpan); + } +}; + +Quill.register({ + 'formats/spoiler': Spoiler +}); + +var quill = new Quill('#editor', { + modules: { + toolbar : { container : '#toolbar', + handlers : { + 'spoiler' : steamSpoiler + } + } + }, + placeholder: 'Write your review here!', + theme: 'snow' +}); + +var text = quill.container.firstChild.innerHTML; + +// Enable all tooltips +$('[data-toggle="tooltip"]').tooltip(); + + +quill.on('selection-change', function(range, oldRange, source) { + text = quill.container.firstChild.innerHTML; + convertHTML(text); + if (range) { + $("#editorWindow").addClass("active"); + } else { + $("#editorWindow").removeClass("active"); + } +}); + +quill.on('text-change', function(delta, oldDelta, source) { + text = quill.container.firstChild.innerHTML; + convertHTML(text); +}); + +function convertHTML(convertText) { + //TODO: No Parse, Table + //Process the markup tags + var markupText = convertText.replace(/

/g, '').replace(/<\/p>/g, '\n').replace(//g, '[b]').replace(/<\/strong>/g, '[/b]').replace(/

/g, '[h1]').replace(/<\/h1>/g, '[/h1]\n').replace(//g, '[i]').replace(/<\/em>/g, '[/i]').replace(//g, '[u]').replace(/<\/u>/g, '[/u]').replace(/
    /g, '[olist]\n').replace(/<\/ol>/g, '[/olist]\n').replace(/