Skip to content

Commit

Permalink
Migration of assets to new repo
Browse files Browse the repository at this point in the history
  • Loading branch information
dons20 committed Jan 23, 2017
1 parent 86e1ae3 commit d7c4933
Show file tree
Hide file tree
Showing 10 changed files with 819 additions and 1 deletion.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Binary file added assets/background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/favicon.ico
Binary file not shown.
Binary file added assets/rule.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 130 additions & 0 deletions assets/scripts.js
Original file line number Diff line number Diff line change
@@ -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(/<p>/g, '').replace(/<\/p>/g, '\n').replace(/<strong>/g, '[b]').replace(/<\/strong>/g, '[/b]').replace(/<h1>/g, '[h1]').replace(/<\/h1>/g, '[/h1]\n').replace(/<em>/g, '[i]').replace(/<\/em>/g, '[/i]').replace(/<u>/g, '[u]').replace(/<\/u>/g, '[/u]').replace(/<ol>/g, '[olist]\n').replace(/<\/ol>/g, '[/olist]\n').replace(/<ul>/g, '[list]\n').replace(/<\/ul>/g, '[/list]\n').replace(/<li>/g, '[*]').replace(/<\/li>/g, '\n').replace(/<br>/g, '\n').replace(/<a href="/g, '[url=').replace(/" target="_blank">/g ,']').replace(/<\/a>/g ,'[/url]').replace(/<s>/g, '[strike]').replace(/<\/s>/g, '[/strike]').replace(/<blockquote>/g, '[quote=author]').replace(/<\/blockquote>/g, '[/quote]\n').replace(/<span class="spoiler">/g, '[spoiler]').replace(/<\/span>/g, '[/spoiler]').replace(/<pre spellcheck="false">/g, '[code]').replace(/<\/pre>/g, '[/code]\n').replace(/<code>/g, '[noparse]').replace(/<\/code>/g, '[/noparse]');

//Process the preview
//var previewText = text;

//Set the markup display
$('#markup').html(markupText);

//Set the preview display
$('#preview').html(convertText);
}

function CopyToClipboard(containerid) {
// creating new textarea element and giveing it id 't'
let t = document.createElement('textarea')
t.id = 't'
// Optional step to make less noise in the page, if any!
t.style.height = 0
// You have to append it to your page somewhere, I chose <body>
document.body.appendChild(t)
// Copy whatever is in your div to our new textarea
t.value = document.getElementById(containerid).innerText
// Now copy whatever inside the textarea to clipboard
let selector = document.querySelector('#t')
selector.select()
document.execCommand('copy')
// Remove the textarea
document.body.removeChild(t)
alert("Markup copied to clipboard!");
};

function pushFooter() {
var docHeight = $(window).height();
var footerHeight = $('#footer').height();
var footerTop = $('#footer').position().top + footerHeight;

if (footerTop < docHeight) {
$('#footer').css('margin-top', 10+ (docHeight - footerTop) + 'px');
}
}

//Show Preview
$('#previewCollapse').on('show.bs.collapse', function() {
quill.blur();
console.log(text);
document.getElementById("showBtn").innerHTML = "Hide Preview";
});

//Hide Preview
$('#previewCollapse').on('hide.bs.collapse', function() {
document.getElementById("showBtn").innerHTML = "Show Preview";
quill.focus();
});

$('#closeBtn').click(function() {
$('#help').fadeOut(1000, function complete() {
pushFooter();
});
});

$(document).ready(function () {
pushFooter();
var fade = $(".fade");
fade.css({ "opacity":"0"});
fade.fadeTo(500, 1, "swing");
});
208 changes: 208 additions & 0 deletions assets/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions assets/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions assets/style.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d7c4933

Please sign in to comment.