|
|
|
@ -13,6 +13,9 @@ import * as Ease from '../tools/effects/Animate';
|
|
|
|
|
import TextEffects from '../tools/effects/TextEffects';
|
|
|
|
|
import EntryTasks from '../tasks/EntryTasks';
|
|
|
|
|
import TextEditor from '../tools/utilities/TextEditor';
|
|
|
|
|
import TinyDatePicker from 'tiny-date-picker';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Entry {
|
|
|
|
|
//--------------------------
|
|
|
|
|
// constructor
|
|
|
|
@ -22,17 +25,26 @@ class Entry {
|
|
|
|
|
this.uploadFiles;
|
|
|
|
|
this.start();
|
|
|
|
|
this.editor = new TextEditor();
|
|
|
|
|
|
|
|
|
|
TinyDatePicker(document.getElementById('entry-date'), {
|
|
|
|
|
mode: 'dp-below',
|
|
|
|
|
format(date) {
|
|
|
|
|
//return date;
|
|
|
|
|
return self.dateUtils.getDate('origin', date);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//--------------------------
|
|
|
|
|
// methods
|
|
|
|
|
//--------------------------
|
|
|
|
|
start() {
|
|
|
|
|
let self = this;
|
|
|
|
|
new Animate().object({
|
|
|
|
|
targets: document.getElementById('loader'),
|
|
|
|
|
duration: 300,
|
|
|
|
|
opacity: 0,
|
|
|
|
|
easing: 'easeInOutQuad',
|
|
|
|
|
complete: function() {
|
|
|
|
|
complete: function () {
|
|
|
|
|
document.getElementById('loader').style.display = 'none';
|
|
|
|
|
document.getElementById('loader').style.visibility = 'hidden';
|
|
|
|
|
new Animate().object({
|
|
|
|
@ -40,15 +52,11 @@ class Entry {
|
|
|
|
|
duration: 10,
|
|
|
|
|
opacity: 1,
|
|
|
|
|
easing: 'easeInOutQuad',
|
|
|
|
|
complete: function() {
|
|
|
|
|
new TextEffects().scramble(document.getElementById('the-title'), 50, function() {
|
|
|
|
|
|
|
|
|
|
if (document.getElementById('the-intro'))
|
|
|
|
|
document.getElementById('the-intro').style.opacity = 1;
|
|
|
|
|
if (document.getElementById('blog-entry'))
|
|
|
|
|
document.getElementById('blog-entry').style.opacity = 1;
|
|
|
|
|
//START SEcTION
|
|
|
|
|
});
|
|
|
|
|
complete: function () {
|
|
|
|
|
if (document.getElementById('the-intro'))
|
|
|
|
|
document.getElementById('the-intro').style.opacity = 1;
|
|
|
|
|
if (document.getElementById('blog-entry'))
|
|
|
|
|
document.getElementById('blog-entry').style.opacity = 1;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -59,9 +67,8 @@ class Entry {
|
|
|
|
|
document.getElementById('featured-image-drop').addEventListener('drop', this.handleDrop, false);
|
|
|
|
|
document.getElementById('featured-click').addEventListener('change', this.handleClicked, false);
|
|
|
|
|
|
|
|
|
|
if(document.getElementById('new-upload-link'))
|
|
|
|
|
{
|
|
|
|
|
document.getElementById('new-upload-link').addEventListener('click', e=>{
|
|
|
|
|
if (document.getElementById('new-upload-link')) {
|
|
|
|
|
document.getElementById('new-upload-link').addEventListener('click', e => {
|
|
|
|
|
document.getElementById('featured-click').click();
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
@ -70,10 +77,9 @@ class Entry {
|
|
|
|
|
let edit = false;
|
|
|
|
|
if (f.target.getAttribute('data-action') == 'blog-update')
|
|
|
|
|
edit = true;
|
|
|
|
|
console.log('clicked')
|
|
|
|
|
new EntryTasks().submitPost(edit, Entry.uploadFiles).then((response) => {
|
|
|
|
|
let note = JSON.parse(response['response']['request'].response);
|
|
|
|
|
console.log(note.message);
|
|
|
|
|
self.editor.notify(note.message);
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
});
|
|
|
|
@ -101,8 +107,8 @@ class Entry {
|
|
|
|
|
}
|
|
|
|
|
var reader = new FileReader();
|
|
|
|
|
// Closure to capture the file information.
|
|
|
|
|
reader.onload = (function(theFile) {
|
|
|
|
|
return function(f) {
|
|
|
|
|
reader.onload = (function (theFile) {
|
|
|
|
|
return function (f) {
|
|
|
|
|
// Render thumbnail.
|
|
|
|
|
var span = document.createElement('span');
|
|
|
|
|
span.innerHTML = [
|
|
|
|
@ -135,8 +141,8 @@ class Entry {
|
|
|
|
|
}
|
|
|
|
|
var reader = new FileReader();
|
|
|
|
|
// Closure to capture the file information.
|
|
|
|
|
reader.onload = (function(theFile) {
|
|
|
|
|
return function(f) {
|
|
|
|
|
reader.onload = (function (theFile) {
|
|
|
|
|
return function (f) {
|
|
|
|
|
// Render thumbnail.
|
|
|
|
|
var span = document.createElement('span');
|
|
|
|
|
span.innerHTML = [
|
|
|
|
|