fipamo/themes/dash/assets/js/dash.min.js
2018-10-31 12:00:31 -04:00

1952 lines
67 KiB
JavaScript

// modules are defined as an array
// [ module function, map of requires ]
//
// map of requires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the require for previous bundles
// eslint-disable-next-line no-global-assign
parcelRequire = (function (modules, cache, entry, globalName) {
// Save the require from previous bundle to this closure if any
var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
var nodeRequire = typeof require === 'function' && require;
function newRequire(name, jumped) {
if (!cache[name]) {
if (!modules[name]) {
// if we cannot find the module within our internal map or
// cache jump to the current global require ie. the last bundle
// that was added to the page.
var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
if (!jumped && currentRequire) {
return currentRequire(name, true);
}
// If there are other bundles on this page the require from the
// previous one is saved to 'previousRequire'. Repeat this as
// many times as there are bundles until the module is found or
// we exhaust the require chain.
if (previousRequire) {
return previousRequire(name, true);
}
// Try the node require function if it exists.
if (nodeRequire && typeof name === 'string') {
return nodeRequire(name);
}
var err = new Error('Cannot find module \'' + name + '\'');
err.code = 'MODULE_NOT_FOUND';
throw err;
}
localRequire.resolve = resolve;
localRequire.cache = {};
var module = cache[name] = new newRequire.Module(name);
modules[name][0].call(module.exports, localRequire, module, module.exports, this);
}
return cache[name].exports;
function localRequire(x){
return newRequire(localRequire.resolve(x));
}
function resolve(x){
return modules[name][1][x] || x;
}
}
function Module(moduleName) {
this.id = moduleName;
this.bundle = newRequire;
this.exports = {};
}
newRequire.isParcelRequire = true;
newRequire.Module = Module;
newRequire.modules = modules;
newRequire.cache = cache;
newRequire.parent = previousRequire;
newRequire.register = function (id, exports) {
modules[id] = [function (require, module) {
module.exports = exports;
}, {}];
};
for (var i = 0; i < entry.length; i++) {
newRequire(entry[i]);
}
if (entry.length) {
// Expose entry point to Node, AMD or browser globals
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
var mainExports = newRequire(entry[entry.length - 1]);
// CommonJS
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = mainExports;
// RequireJS
} else if (typeof define === "function" && define.amd) {
define(function () {
return mainExports;
});
// <script>
} else if (globalName) {
this[globalName] = mainExports;
}
}
// Override the current require with this new one
return newRequire;
})({"tools/events/EventEmitter.jsx":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var EventEmitter =
/*#__PURE__*/
function () {
//--------------------------
// constructor
//--------------------------
function EventEmitter() {
_classCallCheck(this, EventEmitter);
this.listeners = new Map();
} //--------------------------
// methods
//--------------------------
_createClass(EventEmitter, [{
key: "addListener",
value: function addListener(label, callback) {
this.listeners.has(label) || this.listeners.set(label, []);
this.listeners.get(label).push(callback);
}
}, {
key: "removeListener",
value: function removeListener(label, callback) {
var isFunction = function isFunction(obj) {
return typeof obj == 'function' || false;
};
var listeners = this.listeners.get(label),
index;
if (listeners && listeners.length) {
index = listeners.reduce(function (i, listener, index) {
return isFunction(listener) && listener === callback ? i = index : i;
}, -1);
if (index > -1) {
listeners.splice(index, 1);
this.listeners.set(label, listeners);
return true;
}
}
return false;
}
}, {
key: "emitEvent",
value: function emitEvent(label) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var listeners = this.listeners.get(label);
if (listeners && listeners.length) {
listeners.forEach(function (listener) {
listener.apply(void 0, args);
});
return true;
}
return false;
} //--------------------------
// event handlers
//--------------------------
}]);
return EventEmitter;
}();
var _default = EventEmitter;
exports.default = _default;
},{}],"tools/events/DataEvent.jsx":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.POST_IMAGE_ADDED = exports.PROJECTS_SORTED = exports.PROJECT_ADDED = exports.PROJECT_UPDATED = exports.ARCHIVES_ENTRY_LOADED = exports.ARCHIVES_PAGE_LOADED = exports.ARCHIVES_JSON_LOADED = exports.HTML_LOADED = exports.SETTINGS_LOADED = exports.IMG_REQUEST_LAME = exports.IMG_REQUEST_GOOD = exports.REQUEST_LAME = exports.REQUEST_GOOD = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var REQUEST_GOOD = 'requestGood';
exports.REQUEST_GOOD = REQUEST_GOOD;
var REQUEST_LAME = 'requestLame';
exports.REQUEST_LAME = REQUEST_LAME;
var IMG_REQUEST_GOOD = 'imgRequestGood';
exports.IMG_REQUEST_GOOD = IMG_REQUEST_GOOD;
var IMG_REQUEST_LAME = 'imgRequestLame';
exports.IMG_REQUEST_LAME = IMG_REQUEST_LAME;
var SETTINGS_LOADED = 'dataLoaded';
exports.SETTINGS_LOADED = SETTINGS_LOADED;
var HTML_LOADED = 'htmlLoaded';
exports.HTML_LOADED = HTML_LOADED;
var ARCHIVES_JSON_LOADED = 'archivesJSONLoaded';
exports.ARCHIVES_JSON_LOADED = ARCHIVES_JSON_LOADED;
var ARCHIVES_PAGE_LOADED = 'archivesPAGELoaded';
exports.ARCHIVES_PAGE_LOADED = ARCHIVES_PAGE_LOADED;
var ARCHIVES_ENTRY_LOADED = 'archivesEntryLoaded';
exports.ARCHIVES_ENTRY_LOADED = ARCHIVES_ENTRY_LOADED;
var PROJECT_UPDATED = 'projectUpdated';
exports.PROJECT_UPDATED = PROJECT_UPDATED;
var PROJECT_ADDED = 'projectAdded';
exports.PROJECT_ADDED = PROJECT_ADDED;
var PROJECTS_SORTED = 'projectsSorted';
exports.PROJECTS_SORTED = PROJECTS_SORTED;
var POST_IMAGE_ADDED = 'postImageAdded';
exports.POST_IMAGE_ADDED = POST_IMAGE_ADDED;
var DataEvent = function DataEvent() {
_classCallCheck(this, DataEvent);
};
var _default = new DataEvent();
exports.default = _default;
},{}],"tools/utilities/DataUtils.jsx":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.CONTENT_TYPE_FORM = exports.CONTENT_TYPE_JSON = exports.REQUEST_TYPE_DELETE = exports.REQUEST_TYPE_PUT = exports.REQUEST_TYPE_GET = exports.REQUEST_TYPE_POST = void 0;
var _EventEmitter2 = _interopRequireDefault(require("../events/EventEmitter.jsx"));
var DataEvent = _interopRequireWildcard(require("../events/DataEvent.jsx"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
var REQUEST_TYPE_POST = "POST";
exports.REQUEST_TYPE_POST = REQUEST_TYPE_POST;
var REQUEST_TYPE_GET = "GET";
exports.REQUEST_TYPE_GET = REQUEST_TYPE_GET;
var REQUEST_TYPE_PUT = "PUT";
exports.REQUEST_TYPE_PUT = REQUEST_TYPE_PUT;
var REQUEST_TYPE_DELETE = "DELETE";
exports.REQUEST_TYPE_DELETE = REQUEST_TYPE_DELETE;
var CONTENT_TYPE_JSON = 'json';
exports.CONTENT_TYPE_JSON = CONTENT_TYPE_JSON;
var CONTENT_TYPE_FORM = 'x-www-form-urlencoded';
exports.CONTENT_TYPE_FORM = CONTENT_TYPE_FORM;
var DataUtils =
/*#__PURE__*/
function (_EventEmitter) {
_inherits(DataUtils, _EventEmitter);
//--------------------------
// constructor
//--------------------------
function DataUtils() {
var _this;
_classCallCheck(this, DataUtils);
_this = _possibleConstructorReturn(this, _getPrototypeOf(DataUtils).call(this));
var self = _assertThisInitialized(_assertThisInitialized(_this));
return _this;
} //--------------------------
// methods
//--------------------------
_createClass(DataUtils, [{
key: "request",
value: function request(requestURL, eventType) {
var requestType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : REQUEST_TYPE_GET;
var contentType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : CONTENT_TYPE_JSON;
var requestData = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
var self = this;
return new Promise(function (resolve, reject) {
var request = new XMLHttpRequest();
request.upload.onprogress = self.handleLoadProgress;
request.open(requestType, requestURL, true);
request.onload = function (e) {
if (request.status == 200) {
resolve({
request: request,
eventType: eventType
});
} else {
reject({
request: request,
eventType: eventType
});
}
;
};
if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST) {
switch (contentType) {
case CONTENT_TYPE_JSON:
request.setRequestHeader("Content-type", "application/" + contentType);
request.send(JSON.stringify(requestData));
break;
case CONTENT_TYPE_FORM:
request.send(requestData);
break;
}
} else {
request.send();
}
});
}
}, {
key: "imgLoad",
value: function imgLoad(url) {
'use strict'; // Create new promise with the Promise() constructor;
// This has as its argument a function with two parameters, resolve and reject
return new Promise(function (resolve, reject) {
// Standard XHR to load an image
var request = new XMLHttpRequest();
request.open('GET', url);
request.responseType = 'blob'; // When the request loads, check whether it was successful
request.onload = function () {
if (request.status === 200) {
// If successful, resolve the promise by passing back the request response
resolve(request.response);
} else {
// If it fails, reject the promise with a error message
reject(new Error('Image didn\'t load successfully; error code:' + request.statusText));
}
};
request.onerror = function () {
// Also deal with the case when the entire request fails to begin with
// This is probably a network error, so reject the promise with an appropriate message
reject(new Error('There was a network error.'));
}; // Send the request
request.send();
});
}
}, {
key: "loadImage",
value: function loadImage(src) {
'use strict';
var self = this;
return new Promise(function (resolve, reject) {
// Get a reference to the body element, and create a new image object
var body = document.querySelector('body'),
myImage = new Image();
myImage.crossOrigin = ""; // or "anonymous"
// Call the function with the URL we want to load, but then chain the
// promise then() method on to the end of it. This contains two callbacks
self.imgLoad(src).then(function (response) {
// The first runs when the promise resolves, with the request.reponse specified within the resolve() method.
var imageURL = window.URL.createObjectURL(response);
resolve(imageURL); //$('background-content').setStyle('background-image', 'url('+imageURL+')') //myImage.src = imageURL;
//console.log(imageURL);
//body.appendChild(myImage);
// The second runs when the promise is rejected, and logs the Error specified with the reject() method.
}, function (Error) {
reject(Error);
});
});
} //--------------------------
// event handlers
//--------------------------
}, {
key: "handleLoadProgress",
value: function handleLoadProgress(e) {
var percentComplete = Math.ceil(e.loaded / e.total * 100); //console.log(percentComplete);
}
}]);
return DataUtils;
}(_EventEmitter2.default);
var _default = DataUtils;
exports.default = _default;
},{"../events/EventEmitter.jsx":"tools/events/EventEmitter.jsx","../events/DataEvent.jsx":"tools/events/DataEvent.jsx"}],"tools/effects/Animate.jsx":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _EventEmitter2 = _interopRequireDefault(require("../events/EventEmitter.jsx"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
;
var Animate =
/*#__PURE__*/
function (_EventEmitter) {
_inherits(Animate, _EventEmitter);
//--------------------------
// constructor
//--------------------------
function Animate() {
_classCallCheck(this, Animate);
return _possibleConstructorReturn(this, _getPrototypeOf(Animate).call(this));
} //--------------------------
// methods
//--------------------------
_createClass(Animate, [{
key: "object",
value: function object(properties) {
var animation = anime(properties); //animation.start(properties);
} //--------------------------
// event handlers
//--------------------------
}]);
return Animate;
}(_EventEmitter2.default);
var _default = Animate;
exports.default = _default;
},{"../events/EventEmitter.jsx":"tools/events/EventEmitter.jsx"}],"tools/effects/TextEffects.jsx":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var TexEffects =
/*#__PURE__*/
function () {
//--------------------------
// constructor
//--------------------------
function TexEffects() {
_classCallCheck(this, TexEffects);
} //--------------------------
// methods
//--------------------------
_createClass(TexEffects, [{
key: "scramble",
value: function scramble(obj, offset, complete) {
var scrambleText = new ScrambleText(obj, {
timeOffset: offset,
chars: ['安', '以', '宇', '衣', '於', '加', '幾', '久', '計', '己', '左', '之', '寸', '世', '曽', '太', '知', '川', '天', '止', '奈', '仁', '奴', '称', '乃', '波', '比', '不', '部', '保', '末', '美', '武', '女', '毛', '也', '為', '由', '恵', '与', '良', '利', '留', '礼', '呂', '和', '遠', '无'],
callback: complete
}).start();
} //--------------------------
// event handlers
//--------------------------
}]);
return TexEffects;
}();
var _default = TexEffects;
exports.default = _default;
},{}],"tools/utilities/StringUtils.jsx":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var StringUtils =
/*#__PURE__*/
function () {
//--------------------------
// constructor
//--------------------------
function StringUtils() {
_classCallCheck(this, StringUtils);
} //--------------------------
// methods
//--------------------------
_createClass(StringUtils, [{
key: "cleanString",
value: function cleanString(string) {
var clean = string.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g, '').toLowerCase().replace(/[\/_| -]+/g, '-');
return clean;
}
}, {
key: "decodeHTML",
value: function decodeHTML(string, quote_style) {
var optTemp = 0,
i = 0,
noquotes = false;
if (typeof quote_style === 'undefined') {
quote_style = 2;
}
string = string.toString().replace(/&lt;/g, '<').replace(/&gt;/g, '>');
var OPTS = {
'ENT_NOQUOTES': 0,
'ENT_HTML_QUOTE_SINGLE': 1,
'ENT_HTML_QUOTE_DOUBLE': 2,
'ENT_COMPAT': 2,
'ENT_QUOTES': 3,
'ENT_IGNORE': 4
};
if (quote_style === 0) {
noquotes = true;
}
if (typeof quote_style !== 'number') {
// Allow for a single string or an array of string flags
quote_style = [].concat(quote_style);
for (i = 0; i < quote_style.length; i++) {
// Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4
if (OPTS[quote_style[i]] === 0) {
noquotes = true;
} else if (OPTS[quote_style[i]]) {
optTemp = optTemp | OPTS[quote_style[i]];
}
}
quote_style = optTemp;
}
if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) {
string = string.replace(/&#0*39;/g, "'"); // PHP doesn't currently escape if more than one 0, but it should
// string = string.replace(/&apos;|&#x0*27;/g, "'"); // This would also be useful here, but not a part of PHP
}
if (!noquotes) {
string = string.replace(/&quot;/g, '"');
} // Put this in last place to avoid escape being double-decoded
string = string.replace(/&amp;/g, '&');
return string;
} //--------------------------
// event handlers
//--------------------------
}]);
return StringUtils;
}();
var _default = StringUtils;
exports.default = _default;
},{}],"tasks/EntryTasks.jsx":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _DataUtils = _interopRequireWildcard(require("../tools/utilities/DataUtils"));
var DataEvent = _interopRequireWildcard(require("../tools/events/DataEvent"));
var _StringUtils = _interopRequireDefault(require("../tools/utilities/StringUtils"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var EntryTasks =
/*#__PURE__*/
function () {
//--------------------------
// constructor
//--------------------------
function EntryTasks() {
_classCallCheck(this, EntryTasks);
var folio = [];
this.dataUtils = new _DataUtils.default();
} //--------------------------
// methods
//--------------------------
_createClass(EntryTasks, [{
key: "start",
value: function start() {}
}, {
key: "submitPost",
value: function submitPost(edit, uploadFiles) {
var self = this;
return new Promise(function (resolve, reject) {
//collect form data
//if(!this.validateForm())
var postData = new FormData(); //let projectImages = document.getElementById('projectImages');
//var fileSelect = projectImages;
var files = uploadFiles;
for (var i = 0; i < files.length; i++) {
var file = files[i]; // Check the file type.
if (!file.type.match('image.*')) {
continue;
} // Add the file to the request.
postData.append('feature_image', file, file.name);
} //var category = document.getElementById("content_category");
//let project_form = document.forms.namedItem("folio-project");
var txt = document.createElement("textarea");
txt.innerHTML = document.getElementById('edit-text-code').innerHTML;
postData.append("title", document.getElementById('entry_title').value);
postData.append('slug', new _StringUtils.default().cleanString(document.getElementById('entry_title').value));
postData.append("entry_plaintext", txt.value);
postData.append("tags", document.getElementById('entry_tags').value);
var postURL;
var postEventType;
if (edit) {
var postID = document.getElementById('post-sumbit-btn').getAttribute('data-id');
console.log("POST ID: " + postID);
postURL = "/api/blog/update/" + postID;
postEventType = DataEvent.POST_UPDATED;
} else {
postURL = "/api/blog/add";
postEventType = DataEvent.POST_ADDED;
}
self.dataUtils.request(postURL, postEventType, _DataUtils.REQUEST_TYPE_POST, _DataUtils.CONTENT_TYPE_FORM, postData).then(function (response) {
resolve({
response: response
});
}).catch(function (err) {
reject({
err: err
});
});
});
}
}, {
key: "validateForm",
value: function validateForm() {
var valid = false;
if (this.entry_form.title.value == "" || this.entry_form.price.value == "" || this.entry_form.description == "") {
return valid;
} else {
valid = true;
return valid;
}
} //--------------------------
// event handlers
//--------------------------
}]);
return EntryTasks;
}();
exports.default = EntryTasks;
},{"../tools/utilities/DataUtils":"tools/utilities/DataUtils.jsx","../tools/events/DataEvent":"tools/events/DataEvent.jsx","../tools/utilities/StringUtils":"tools/utilities/StringUtils.jsx"}],"../../../../node_modules/caret-pos/lib/esm2015/main.js":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getOffset = exports.offset = exports.position = void 0;
var attributes = ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopStyle', 'borderRightStyle', 'borderBottomStyle', 'borderLeftStyle', 'borderTopWidth', 'boxSizing', 'fontFamily', 'fontSize', 'fontWeight', 'height', 'letterSpacing', 'lineHeight', 'marginBottom', 'marginLeft', 'marginRight', 'marginTop', 'outlineWidth', 'overflow', 'overflowX', 'overflowY', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop', 'textAlign', 'textOverflow', 'textTransform', 'whiteSpace', 'wordBreak', 'wordWrap'];
/**
* Create a mirror
*
* @param {Element} element The element
* @param {string} html The html
*
* @return {object} The mirror object
*/
var createMirror = function createMirror(element, html) {
/**
* The mirror element
*/
var mirror = document.createElement('div');
/**
* Create the CSS for the mirror object
*
* @return {object} The style object
*/
var mirrorCss = function mirrorCss() {
var css = {
position: 'absolute',
left: -9999,
top: 0,
zIndex: -2000
};
if (element.tagName === 'TEXTAREA') {
attributes.push('width');
}
attributes.forEach(function (attr) {
css[attr] = getComputedStyle(element)[attr];
});
return css;
};
/**
* Initialize the mirror
*
* @param {string} html The html
*
* @return {void}
*/
var initialize = function initialize(html) {
var styles = mirrorCss();
Object.keys(styles).forEach(function (key) {
mirror.style[key] = styles[key];
});
mirror.innerHTML = html;
element.parentNode.insertBefore(mirror, element.nextSibling);
};
/**
* Get the rect
*
* @return {Rect} The bounding rect
*/
var rect = function rect() {
var marker = mirror.ownerDocument.getElementById('caret-position-marker');
var boundingRect = {
left: marker.offsetLeft,
top: marker.offsetTop,
height: marker.offsetHeight
};
mirror.parentNode.removeChild(mirror);
return boundingRect;
};
initialize(html);
return {
rect: rect
};
};
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
/**
* Check if a DOM Element is content editable
*
* @param {Element} element The DOM element
*
* @return {bool} If it is content editable
*/
var isContentEditable = function isContentEditable(element) {
return !!(element.contentEditable && element.contentEditable === 'true');
};
/**
* Get the context from settings passed in
*
* @param {object} settings The settings object
*
* @return {object} window and document
*/
var getContext = function getContext() {
var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var customPos = settings.customPos,
iframe = settings.iframe,
noShadowCaret = settings.noShadowCaret;
if (iframe) {
return {
iframe: iframe,
window: iframe.contentWindow,
document: iframe.contentDocument || iframe.contentWindow.document,
noShadowCaret: noShadowCaret,
customPos: customPos
};
}
return {
window: window,
document: document,
noShadowCaret: noShadowCaret,
customPos: customPos
};
};
/**
* Get the offset of an element
*
* @param {Element} element The DOM element
* @param {object} ctx The context
*
* @return {object} top and left
*/
var getOffset = function getOffset(element, ctx) {
var win = ctx && ctx.window || window;
var doc = ctx && ctx.document || document;
var rect = element.getBoundingClientRect();
var docEl = doc.documentElement;
var scrollLeft = win.pageXOffset || docEl.scrollLeft;
var scrollTop = win.pageYOffset || docEl.scrollTop;
return {
top: rect.top + scrollTop,
left: rect.left + scrollLeft
};
};
/**
* Check if a value is an object
*
* @param {any} value The value to check
*
* @return {bool} If it is an object
*/
exports.getOffset = getOffset;
var isObject = function isObject(value) {
return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value !== null;
};
/**
* Create a Input caret object.
*
* @param {Element} element The element
* @param {Object} ctx The context
*/
var createInputCaret = function createInputCaret(element, ctx) {
/**
* Get the current position
*
* @returns {int} The caret position
*/
var getPos = function getPos() {
return element.selectionStart;
};
/**
* Set the position
*
* @param {int} pos The position
*
* @return {Element} The element
*/
var setPos = function setPos(pos) {
element.setSelectionRange(pos, pos);
return element;
};
/**
* The offset
*
* @param {int} pos The position
*
* @return {object} The offset
*/
var getOffset$$1 = function getOffset$$1(pos) {
var rect = getOffset(element);
var position = getPosition(pos);
return {
top: rect.top + position.top + ctx.document.body.scrollTop,
left: rect.left + position.left + ctx.document.body.scrollLeft,
height: position.height
};
};
/**
* Get the current position
*
* @param {int} pos The position
*
* @return {object} The position
*/
var getPosition = function getPosition(pos) {
var format = function format(val) {
var value = val.replace(/<|>|`|"|&/g, '?').replace(/\r\n|\r|\n/g, '<br/>');
return value;
};
if (ctx.customPos || ctx.customPos === 0) {
pos = ctx.customPos;
}
var position = pos === undefined ? getPos() : pos;
var startRange = element.value.slice(0, position);
var endRange = element.value.slice(position);
var html = '<span style="position: relative; display: inline;">' + format(startRange) + '</span>';
html += '<span id="caret-position-marker" style="position: relative; display: inline;">|</span>';
html += '<span style="position: relative; display: inline;">' + format(endRange) + '</span>';
var mirror = createMirror(element, html);
var rect = mirror.rect();
rect.pos = getPos();
return rect;
};
return {
getPos: getPos,
setPos: setPos,
getOffset: getOffset$$1,
getPosition: getPosition
};
};
/**
* Create an Editable Caret
* @param {Element} element The editable element
* @param {object|null} ctx The context
*
* @return {EditableCaret}
*/
var createEditableCaret = function createEditableCaret(element, ctx) {
/**
* Set the caret position
*
* @param {int} pos The position to se
*
* @return {Element} The element
*/
var setPos = function setPos(pos) {
var sel = ctx.window.getSelection();
if (sel) {
var offset = 0;
var found = false;
var find = function find(position, parent) {
for (var i = 0; i < parent.childNodes.length; i++) {
var node = parent.childNodes[i];
if (found) {
break;
}
if (node.nodeType === 3) {
if (offset + node.length >= position) {
found = true;
var range = ctx.document.createRange();
range.setStart(node, position - offset);
sel.removeAllRanges();
sel.addRange(range);
break;
} else {
offset += node.length;
}
} else {
find(pos, node);
}
}
};
find(pos, element);
}
return element;
};
/**
* Get the offset
*
* @return {object} The offset
*/
var getOffset = function getOffset() {
var range = getRange();
var offset = {
height: 0,
left: 0,
right: 0
};
if (!range) {
return offset;
}
var hasCustomPos = ctx.customPos || ctx.customPos === 0; // endContainer in Firefox would be the element at the start of
// the line
if (range.endOffset - 1 > 0 && range.endContainer !== element || hasCustomPos) {
var clonedRange = range.cloneRange();
var fixedPosition = hasCustomPos ? ctx.customPos : range.endOffset;
clonedRange.setStart(range.endContainer, fixedPosition - 1 < 0 ? 0 : fixedPosition - 1);
clonedRange.setEnd(range.endContainer, fixedPosition);
var rect = clonedRange.getBoundingClientRect();
offset = {
height: rect.height,
left: rect.left + rect.width,
top: rect.top
};
clonedRange.detach();
}
if ((!offset || offset && offset.height === 0) && !ctx.noShadowCaret) {
var _clonedRange = range.cloneRange();
var shadowCaret = ctx.document.createTextNode('|');
_clonedRange.insertNode(shadowCaret);
_clonedRange.selectNode(shadowCaret);
var _rect = _clonedRange.getBoundingClientRect();
offset = {
height: _rect.height,
left: _rect.left,
top: _rect.top
};
shadowCaret.parentNode.removeChild(shadowCaret);
_clonedRange.detach();
}
if (offset) {
var doc = ctx.document.documentElement;
offset.top += ctx.window.pageYOffset - (doc.clientTop || 0);
offset.left += ctx.window.pageXOffset - (doc.clientLeft || 0);
}
return offset;
};
/**
* Get the position
*
* @return {object} The position
*/
var getPosition = function getPosition() {
var offset = getOffset();
var pos = getPos();
var rect = element.getBoundingClientRect();
var inputOffset = {
top: rect.top + ctx.document.body.scrollTop,
left: rect.left + ctx.document.body.scrollLeft
};
offset.left -= inputOffset.left;
offset.top -= inputOffset.top;
offset.pos = pos;
return offset;
};
/**
* Get the range
*
* @return {Range|null}
*/
var getRange = function getRange() {
if (!ctx.window.getSelection) {
return;
}
var sel = ctx.window.getSelection();
return sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
};
/**
* Get the caret position
*
* @return {int} The position
*/
var getPos = function getPos() {
var range = getRange();
var clonedRange = range.cloneRange();
clonedRange.selectNodeContents(element);
clonedRange.setEnd(range.endContainer, range.endOffset);
var pos = clonedRange.toString().length;
clonedRange.detach();
return pos;
};
return {
getPos: getPos,
setPos: setPos,
getPosition: getPosition,
getOffset: getOffset,
getRange: getRange
};
};
var createCaret = function createCaret(element, ctx) {
if (isContentEditable(element)) {
return createEditableCaret(element, ctx);
}
return createInputCaret(element, ctx);
};
var position = function position(element, value) {
var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var options = settings;
if (isObject(value)) {
options = value;
value = null;
}
var ctx = getContext(options);
var caret = createCaret(element, ctx);
if (value || value === 0) {
return caret.setPos(value);
}
return caret.getPosition();
};
/**
*
* @param {Element} element The DOM element
* @param {number|undefined} value The value to set
* @param {object} settings Any settings for context
*/
exports.position = position;
var offset = function offset(element, value) {
var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var options = settings;
if (isObject(value)) {
options = value;
value = null;
}
var ctx = getContext(options);
var caret = createCaret(element, ctx);
return caret.getOffset(value);
};
exports.offset = offset;
},{}],"tools/utilities/TextEditor.jsx":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _DataUtils = _interopRequireWildcard(require("./DataUtils"));
var DataEvent = _interopRequireWildcard(require("../events/DataEvent"));
var _caretPos = require("caret-pos");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var TextEditor =
/*#__PURE__*/
function () {
//--------------------------
// constructor
//--------------------------
function TextEditor() {
_classCallCheck(this, TextEditor);
this.setInputs();
hljs.initHighlightingOnLoad();
this.dataUtils = new _DataUtils.default();
this.url = '';
window.addEventListener("scroll", function (f) {
var fixLimit = document.getElementById('header').offsetHeight + document.getElementById('entry-header').offsetHeight + document.getElementById('entry-feature').offsetHeight;
if (window.pageYOffset >= fixLimit) {
document.getElementById('edit-control').style.position = "fixed";
} else {
document.getElementById('edit-control').style.position = "relative";
}
});
this.refresh();
} //--------------------------
// methods
//--------------------------
_createClass(TextEditor, [{
key: "setInputs",
value: function setInputs() {
var _this = this;
var self = this;
var editorButtons = document.querySelectorAll('.editor-button');
for (var i = 0, length = editorButtons.length; i < length; i++) {
editorButtons[i].addEventListener('click', function (e) {
return _this.handleEditorOption(e);
}, false);
}
document.getElementById('edit-text-code').addEventListener('input', function (f) {
self.refresh();
});
document.getElementById('post-image').addEventListener('change', function (e) {
return _this.handlePostImageAdd(e);
}, false);
document.getElementById('option-image').addEventListener('click', function (e) {
document.getElementById('post-image').click();
});
}
}, {
key: "refresh",
value: function refresh() {
var caret = (0, _caretPos.position)(document.getElementById('edit-text-code')).pos;
var spiffed = hljs.highlight('markdown', document.getElementById('edit-text-code').innerText).value;
var temp = document.createElement("div");
temp.innerText = spiffed;
document.getElementById('edit-text-code').innerHTML = temp.innerText;
(0, _caretPos.position)(document.getElementById('edit-text-code'), caret);
} //--------------------------
// event handlers
//--------------------------
}, {
key: "handleEditorOption",
value: function handleEditorOption(e) {
e.preventDefault();
var self = this;
var sel, range, pulled;
sel = window.getSelection(); //console.log(sel)
if (sel.rangeCount) {
range = sel.getRangeAt(0);
pulled = sel.getRangeAt(0).toString();
range.deleteContents();
switch (e.target.id) {
case "option-bold":
range.insertNode(document.createTextNode("**" + pulled + "**"));
break;
case "option-italic":
range.insertNode(document.createTextNode("*" + pulled + "*"));
break;
case "option-strikethrough":
range.insertNode(document.createTextNode("<del>" + pulled + "</del>"));
break;
case "option-header1":
range.insertNode(document.createTextNode("# " + pulled));
break;
case "option-header2":
range.insertNode(document.createTextNode("## " + pulled));
break;
case "option-header3":
range.insertNode(document.createTextNode("### " + pulled));
break;
case "option-link":
range.insertNode(document.createTextNode("[" + pulled + "](PASTE URL HERE)"));
break;
case "option-date":
console.log("DATE UPDATE");
break;
default:
//range.insertNode(document.createTextNode("[" + self.url + "](PASTE URL HERE)"));
break;
}
}
this.refresh();
}
}, {
key: "handlePostImageAdd",
value: function handlePostImageAdd(e) {
e.stopPropagation();
e.preventDefault();
var self = this;
var postData = new FormData();
var files = e.target.files;
for (var i = 0; i < files.length; i++) {
var file = files[i]; // Check the file type.
if (!file.type.match('image.*')) {
continue;
}
postData.append('post_image', file, file.name);
}
var caret = (0, _caretPos.position)(document.getElementById('edit-text-code')).pos;
self.dataUtils.request("/api/blog/add-post-image", DataEvent.POST_IMAGE_ADDED, _DataUtils.REQUEST_TYPE_POST, _DataUtils.CONTENT_TYPE_FORM, postData).then(function (response) {
//console.log("01 "+response.request['response']);
(0, _caretPos.position)(document.getElementById('edit-text-code'), caret);
var sel, range, pulled;
sel = window.getSelection(); //console.log(sel)
//console.log(note.message)
if (sel.rangeCount) {
range = sel.getRangeAt(0);
pulled = sel.getRangeAt(0).toString();
range.deleteContents();
range.insertNode(document.createTextNode("![image alt text](" + JSON.parse(response.request['response']).url + " 'image title')"));
}
self.refresh();
}).catch(function (err) {
console.log(err);
});
}
}]);
return TextEditor;
}();
var _default = TextEditor;
exports.default = _default;
},{"./DataUtils":"tools/utilities/DataUtils.jsx","../events/DataEvent":"tools/events/DataEvent.jsx","caret-pos":"../../../../node_modules/caret-pos/lib/esm2015/main.js"}],"controllers/DashEntry.jsx":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _DataUtils = _interopRequireWildcard(require("../tools/utilities/DataUtils"));
var DataEvent = _interopRequireWildcard(require("../tools/events/DataEvent"));
var Ease = _interopRequireWildcard(require("../tools/effects/Animate"));
var _TextEffects = _interopRequireDefault(require("../tools/effects/TextEffects"));
var _EntryTasks = _interopRequireDefault(require("../tasks/EntryTasks"));
var _TextEditor = _interopRequireDefault(require("../tools/utilities/TextEditor"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var Entry =
/*#__PURE__*/
function () {
//--------------------------
// constructor
//--------------------------
function Entry() {
_classCallCheck(this, Entry);
reframe('iframe');
this.uploadFiles;
this.start();
this.editor = new _TextEditor.default();
} //--------------------------
// methods
//--------------------------
_createClass(Entry, [{
key: "start",
value: function start() {
new Ease.default().object({
targets: document.getElementById('loader'),
duration: 300,
opacity: 0,
easing: 'easeInOutQuad',
complete: function complete() {
document.getElementById('loader').style.display = 'none';
document.getElementById('loader').style.visibility = 'hidden';
new Ease.default().object({
targets: document.getElementById('header'),
duration: 10,
opacity: 1,
easing: 'easeInOutQuad',
complete: function complete() {
new _TextEffects.default().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
});
}
});
}
});
if (document.getElementById('featured-image-drop')) {
document.getElementById('featured-image-drop').addEventListener('dragover', this.handleDragOver, false);
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', function (e) {
document.getElementById('featured-click').click();
});
}
document.getElementById("post-sumbit-btn").addEventListener('click', function (f) {
f.preventDefault();
var edit = false;
if (f.target.getAttribute('data-action') == 'blog-update') edit = true;
console.log('clicked');
new _EntryTasks.default().submitPost(edit, Entry.uploadFiles).then(function (response) {
var note = JSON.parse(response['response']['request'].response);
console.log(note.message);
}).catch(function (err) {
console.log(err);
});
});
}
} //--------------------------
// event handlers
//--------------------------
}, {
key: "handleDragOver",
value: function handleDragOver(e) {
e.stopPropagation();
e.preventDefault();
e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
}
}, {
key: "handleClicked",
value: function handleClicked(e) {
e.stopPropagation();
e.preventDefault(); //console.log("IMAGES " + e.target.files);
Entry.uploadFiles = e.target.files;
for (var i = 0, f; f = Entry.uploadFiles[i]; i++) {
// Only process image files.
if (!f.type.match('image.*')) {
continue;
}
var reader = new FileReader(); // Closure to capture the file information.
reader.onload = function (theFile) {
return function (f) {
// Render thumbnail.
var span = document.createElement('span');
span.innerHTML = ['<img src="', f.target.result, '" title="', escape(theFile.name), '"/>'].join(''); //document.getElementById('featured-image-drop').insertBefore(span, null);
document.getElementById('featured-image-drop').innerHTML = '';
document.getElementById('featured-image-drop').appendChild(span);
};
}(f); // Read in the image file as a data URL.
reader.readAsDataURL(f);
}
}
}, {
key: "handleDrop",
value: function handleDrop(e) {
e.stopPropagation();
e.preventDefault();
Entry.uploadFiles = e.dataTransfer.files; //console.log(MemberArea.uploadFiles.length);
for (var i = 0, f; f = Entry.uploadFiles[i]; i++) {
// Only process image files.
if (!f.type.match('image.*')) {
continue;
}
var reader = new FileReader(); // Closure to capture the file information.
reader.onload = function (theFile) {
return function (f) {
// Render thumbnail.
var span = document.createElement('span');
span.innerHTML = ['<img src="', f.target.result, '" title="', escape(theFile.name), '"/>'].join(''); //document.getElementById('featured-image-drop').insertBefore(span, null);
document.getElementById('featured-image-drop').innerHTML = '';
document.getElementById('featured-image-drop').appendChild(span);
};
}(f); // Read in the image file as a data URL.
reader.readAsDataURL(f);
}
}
}]);
return Entry;
}();
exports.default = Entry;
Entry.uploadFiles = [];
},{"../tools/utilities/DataUtils":"tools/utilities/DataUtils.jsx","../tools/events/DataEvent":"tools/events/DataEvent.jsx","../tools/effects/Animate":"tools/effects/Animate.jsx","../tools/effects/TextEffects":"tools/effects/TextEffects.jsx","../tasks/EntryTasks":"tasks/EntryTasks.jsx","../tools/utilities/TextEditor":"tools/utilities/TextEditor.jsx"}],"controllers/DisplayManager.jsx":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _DataUtils = _interopRequireWildcard(require("../tools/utilities/DataUtils.jsx"));
var _DashEntry = _interopRequireDefault(require("./DashEntry"));
var _Animate = _interopRequireDefault(require("../tools/effects/Animate.jsx"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var DisplayManager =
/*#__PURE__*/
function () {
//--------------------------
// constructor
//--------------------------
function DisplayManager() {
_classCallCheck(this, DisplayManager);
this.dataUtils = new _DataUtils.default();
this.currentDisplay = '';
this.urlPieces = document.URL.split("/"); //grab url so system knows what to display
this.chooseDisplay(this.urlPieces[5], this.urlPieces[6]);
} //--------------------------
// methods
//--------------------------
_createClass(DisplayManager, [{
key: "start",
value: function start() {
var self = this;
new _Animate.default().object({
targets: document.getElementById('loader'),
duration: 300,
opacity: 0,
easing: 'easeInOutQuad',
complete: function complete() {
document.getElementById('loader').style.display = 'none';
document.getElementById('loader').style.visibility = 'hidden';
new _Animate.default().object({
targets: document.getElementById('header'),
duration: 10,
opacity: 1,
easing: 'easeInOutQuad',
complete: function complete() {
document.getElementById('loader').style.display = 'none';
document.getElementById('loader').style.visibility = 'hidden';
}
});
}
});
}
}, {
key: "chooseDisplay",
value: function chooseDisplay(section, page) {
this.currentDisplay = ''; //console.log(section+" "+page)
switch (section) {
case 'entries':
this;
this.currentDisplay = new _DashEntry.default();
break;
default:
// just chill
break;
}
this.start();
} //--------------------------
// event handlers
//--------------------------
}]);
return DisplayManager;
}();
exports.default = DisplayManager;
},{"../tools/utilities/DataUtils.jsx":"tools/utilities/DataUtils.jsx","./DashEntry":"controllers/DashEntry.jsx","../tools/effects/Animate.jsx":"tools/effects/Animate.jsx"}],"Base.jsx":[function(require,module,exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _DataUtils = _interopRequireWildcard(require("./tools/utilities/DataUtils.jsx"));
var DataEvent = _interopRequireWildcard(require("./tools/events/DataEvent.jsx"));
var _DisplayManager = _interopRequireDefault(require("./controllers/DisplayManager.jsx"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var Base =
/*#__PURE__*/
function () {
//--------------------------
// constructor
//--------------------------
//TODO: Flip to unified structure defined in BMG, brah
function Base() {
_classCallCheck(this, Base);
var self = this;
var admin = [];
var folio = [];
var displayManager = [];
this.dataUtils = new _DataUtils.default();
this.settings = [];
this.start();
}
_createClass(Base, [{
key: "start",
value: function start() {
this.displayManager = new _DisplayManager.default();
} //--------------------------
// methods
//--------------------------
}, {
key: "loadSettings",
value: function loadSettings() {
var _this = this;
var self = this;
this.dataUtils.request('/base-assets/data/settings.json', DataEvent.SETTINGS_LOADED).then(function (response) {
_this.settings = JSON.parse(response['request'].response);
_this.start(); //transfer
}).catch(function (err) {//console.log(err);
});
} //--------------------------
// event handlers
//--------------------------
}]);
return Base;
}();
exports.default = Base;
},{"./tools/utilities/DataUtils.jsx":"tools/utilities/DataUtils.jsx","./tools/events/DataEvent.jsx":"tools/events/DataEvent.jsx","./controllers/DisplayManager.jsx":"controllers/DisplayManager.jsx"}],"Start.jsx":[function(require,module,exports) {
"use strict";
var _Base = _interopRequireDefault(require("./Base.jsx"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
document.addEventListener('DOMContentLoaded', function () {
var base = new _Base.default();
}, false);
},{"./Base.jsx":"Base.jsx"}],"../../../../../../../.nvm/versions/node/v8.12.0/lib/node_modules/parcel-bundler/src/builtins/hmr-runtime.js":[function(require,module,exports) {
var global = arguments[3];
var OVERLAY_ID = '__parcel__error__overlay__';
var OldModule = module.bundle.Module;
function Module(moduleName) {
OldModule.call(this, moduleName);
this.hot = {
data: module.bundle.hotData,
_acceptCallbacks: [],
_disposeCallbacks: [],
accept: function (fn) {
this._acceptCallbacks.push(fn || function () {});
},
dispose: function (fn) {
this._disposeCallbacks.push(fn);
}
};
module.bundle.hotData = null;
}
module.bundle.Module = Module;
var parent = module.bundle.parent;
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var hostname = "" || location.hostname;
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
var ws = new WebSocket(protocol + '://' + hostname + ':' + "49864" + '/');
ws.onmessage = function (event) {
var data = JSON.parse(event.data);
if (data.type === 'update') {
console.clear();
data.assets.forEach(function (asset) {
hmrApply(global.parcelRequire, asset);
});
data.assets.forEach(function (asset) {
if (!asset.isNew) {
hmrAccept(global.parcelRequire, asset.id);
}
});
}
if (data.type === 'reload') {
ws.close();
ws.onclose = function () {
location.reload();
};
}
if (data.type === 'error-resolved') {
console.log('[parcel] ✨ Error resolved');
removeErrorOverlay();
}
if (data.type === 'error') {
console.error('[parcel] 🚨 ' + data.error.message + '\n' + data.error.stack);
removeErrorOverlay();
var overlay = createErrorOverlay(data);
document.body.appendChild(overlay);
}
};
}
function removeErrorOverlay() {
var overlay = document.getElementById(OVERLAY_ID);
if (overlay) {
overlay.remove();
}
}
function createErrorOverlay(data) {
var overlay = document.createElement('div');
overlay.id = OVERLAY_ID; // html encode message and stack trace
var message = document.createElement('div');
var stackTrace = document.createElement('pre');
message.innerText = data.error.message;
stackTrace.innerText = data.error.stack;
overlay.innerHTML = '<div style="background: black; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; opacity: 0.85; font-family: Menlo, Consolas, monospace; z-index: 9999;">' + '<span style="background: red; padding: 2px 4px; border-radius: 2px;">ERROR</span>' + '<span style="top: 2px; margin-left: 5px; position: relative;">🚨</span>' + '<div style="font-size: 18px; font-weight: bold; margin-top: 20px;">' + message.innerHTML + '</div>' + '<pre>' + stackTrace.innerHTML + '</pre>' + '</div>';
return overlay;
}
function getParents(bundle, id) {
var modules = bundle.modules;
if (!modules) {
return [];
}
var parents = [];
var k, d, dep;
for (k in modules) {
for (d in modules[k][1]) {
dep = modules[k][1][d];
if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) {
parents.push(k);
}
}
}
if (bundle.parent) {
parents = parents.concat(getParents(bundle.parent, id));
}
return parents;
}
function hmrApply(bundle, asset) {
var modules = bundle.modules;
if (!modules) {
return;
}
if (modules[asset.id] || !bundle.parent) {
var fn = new Function('require', 'module', 'exports', asset.generated.js);
asset.isNew = !modules[asset.id];
modules[asset.id] = [fn, asset.deps];
} else if (bundle.parent) {
hmrApply(bundle.parent, asset);
}
}
function hmrAccept(bundle, id) {
var modules = bundle.modules;
if (!modules) {
return;
}
if (!modules[id] && bundle.parent) {
return hmrAccept(bundle.parent, id);
}
var cached = bundle.cache[id];
bundle.hotData = {};
if (cached) {
cached.hot.data = bundle.hotData;
}
if (cached && cached.hot && cached.hot._disposeCallbacks.length) {
cached.hot._disposeCallbacks.forEach(function (cb) {
cb(bundle.hotData);
});
}
delete bundle.cache[id];
bundle(id);
cached = bundle.cache[id];
if (cached && cached.hot && cached.hot._acceptCallbacks.length) {
cached.hot._acceptCallbacks.forEach(function (cb) {
cb();
});
return true;
}
return getParents(global.parcelRequire, id).some(function (id) {
return hmrAccept(global.parcelRequire, id);
});
}
},{}]},{},["../../../../../../../.nvm/versions/node/v8.12.0/lib/node_modules/parcel-bundler/src/builtins/hmr-runtime.js","Start.jsx"], null)
//# sourceMappingURL=/dash/assets/js/dash.min.map