|
|
|
@ -197,7 +197,7 @@ exports.default = _default;
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
|
value: true
|
|
|
|
|
});
|
|
|
|
|
exports.default = exports.POSTS_SYNCED = exports.POST_DELETED = exports.POST_UPDATED = exports.POST_ADDED = exports.POST_ERROR = 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;
|
|
|
|
|
exports.default = exports.POSTS_SYNCED = exports.POST_DELETED = exports.POST_UPDATED = exports.POST_ADDED = exports.POST_ERROR = exports.FEATURE_IMAGE_ADDED = 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"); } }
|
|
|
|
|
|
|
|
|
@ -227,6 +227,8 @@ var PROJECTS_SORTED = 'projectsSorted';
|
|
|
|
|
exports.PROJECTS_SORTED = PROJECTS_SORTED;
|
|
|
|
|
var POST_IMAGE_ADDED = 'postImageAdded';
|
|
|
|
|
exports.POST_IMAGE_ADDED = POST_IMAGE_ADDED;
|
|
|
|
|
var FEATURE_IMAGE_ADDED = 'featureImageAdded';
|
|
|
|
|
exports.FEATURE_IMAGE_ADDED = FEATURE_IMAGE_ADDED;
|
|
|
|
|
var POST_ERROR = 'postError';
|
|
|
|
|
exports.POST_ERROR = POST_ERROR;
|
|
|
|
|
var POST_ADDED = 'postAdded';
|
|
|
|
@ -27361,7 +27363,94 @@ sanitizeHtml.simpleTransform = function (newTagName, newAttribs, merge) {
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
},{"htmlparser2":"../../../../node_modules/htmlparser2/lib/index.js","xtend":"../../../../node_modules/xtend/immutable.js","lodash.escaperegexp":"../../../../node_modules/lodash.escaperegexp/index.js","lodash.clonedeep":"../../../../node_modules/lodash.clonedeep/index.js","lodash.mergewith":"../../../../node_modules/lodash.mergewith/index.js","lodash.isstring":"../../../../node_modules/lodash.isstring/index.js","lodash.isplainobject":"../../../../node_modules/lodash.isplainobject/index.js","srcset":"../../../../node_modules/srcset/index.js","postcss":"../../../../node_modules/postcss/lib/postcss.js","url":"../../../../../../.nvm/versions/node/v8.12.0/lib/node_modules/parcel-bundler/node_modules/url/url.js"}],"../../../../node_modules/markdown-it/lib/common/entities.js":[function(require,module,exports) {
|
|
|
|
|
},{"htmlparser2":"../../../../node_modules/htmlparser2/lib/index.js","xtend":"../../../../node_modules/xtend/immutable.js","lodash.escaperegexp":"../../../../node_modules/lodash.escaperegexp/index.js","lodash.clonedeep":"../../../../node_modules/lodash.clonedeep/index.js","lodash.mergewith":"../../../../node_modules/lodash.mergewith/index.js","lodash.isstring":"../../../../node_modules/lodash.isstring/index.js","lodash.isplainobject":"../../../../node_modules/lodash.isplainobject/index.js","srcset":"../../../../node_modules/srcset/index.js","postcss":"../../../../node_modules/postcss/lib/postcss.js","url":"../../../../../../.nvm/versions/node/v8.12.0/lib/node_modules/parcel-bundler/node_modules/url/url.js"}],"../../../../brain/tools/utilities/DateUtils.js":[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 DateUtils =
|
|
|
|
|
/*#__PURE__*/
|
|
|
|
|
function () {
|
|
|
|
|
//--------------------------
|
|
|
|
|
// constructor
|
|
|
|
|
//--------------------------
|
|
|
|
|
function DateUtils() {
|
|
|
|
|
_classCallCheck(this, DateUtils);
|
|
|
|
|
} //--------------------------
|
|
|
|
|
// methods
|
|
|
|
|
//--------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_createClass(DateUtils, [{
|
|
|
|
|
key: "getMKtime",
|
|
|
|
|
value: function getMKtime() {
|
|
|
|
|
var time = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), new Date().getHours(), new Date().getMinutes(), new Date().getSeconds(), 0).getTime() / 1000;
|
|
|
|
|
return time;
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
key: "convertMKtime",
|
|
|
|
|
value: function convertMKtime(seconds) {
|
|
|
|
|
var date = new Date(seconds * 1000);
|
|
|
|
|
return date;
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
key: "getDate",
|
|
|
|
|
value: function getDate(type, rawdate) {
|
|
|
|
|
var day = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCDate()) : String(new Date().getUTCDate());
|
|
|
|
|
var month = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCMonth() + 1) : String(new Date().getUTCMonth() + 1);
|
|
|
|
|
var year = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCFullYear()) : String(new Date().getUTCFullYear());
|
|
|
|
|
var hour = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCHours()) : String(new Date().getUTCHours());
|
|
|
|
|
var minute = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCMinutes()) : String(new Date().getUTCMinutes());
|
|
|
|
|
var seconds = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCSeconds()) : String(new Date().getUTCSeconds());
|
|
|
|
|
var millisecond = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCMilliseconds()) : String(new Date().getUTCMilliseconds());
|
|
|
|
|
var offset = rawdate != null || rawdate != '' ? String(new Date(rawdate).getTimezoneOffset()) : String(new Date().getTimezoneOffset());
|
|
|
|
|
if (day.length == 1) day = String("0" + day);
|
|
|
|
|
if (month.length == 1) month = String("0" + month);
|
|
|
|
|
offset = String(offset / 60);
|
|
|
|
|
if (offset.length == 1) offset = String("0" + offset);
|
|
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
case "day":
|
|
|
|
|
return day;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "month":
|
|
|
|
|
return month;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "year":
|
|
|
|
|
return year;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "stamp":
|
|
|
|
|
return String(year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + seconds + "." + millisecond + "-" + offset);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return String(year + "-" + month + "-" + day);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} //--------------------------
|
|
|
|
|
// event handlers
|
|
|
|
|
//--------------------------
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
return DateUtils;
|
|
|
|
|
}();
|
|
|
|
|
|
|
|
|
|
var _default = DateUtils;
|
|
|
|
|
exports.default = _default;
|
|
|
|
|
},{}],"../../../../node_modules/markdown-it/lib/common/entities.js":[function(require,module,exports) {
|
|
|
|
|
// HTML5 entities map: { name -> utf16string }
|
|
|
|
|
//
|
|
|
|
|
'use strict';
|
|
|
|
@ -34785,7 +34874,100 @@ module.exports = MarkdownIt;
|
|
|
|
|
|
|
|
|
|
module.exports = require('./lib/');
|
|
|
|
|
|
|
|
|
|
},{"./lib/":"../../../../node_modules/markdown-it/lib/index.js"}],"actions/PostActions.js":[function(require,module,exports) {
|
|
|
|
|
},{"./lib/":"../../../../node_modules/markdown-it/lib/index.js"}],"../../../../node_modules/uuid/lib/rng-browser.js":[function(require,module,exports) {
|
|
|
|
|
// Unique ID creation requires a high quality random # generator. In the
|
|
|
|
|
// browser this is a little complicated due to unknown quality of Math.random()
|
|
|
|
|
// and inconsistent support for the `crypto` API. We do the best we can via
|
|
|
|
|
// feature-detection
|
|
|
|
|
|
|
|
|
|
// getRandomValues needs to be invoked in a context where "this" is a Crypto
|
|
|
|
|
// implementation. Also, find the complete implementation of crypto on IE11.
|
|
|
|
|
var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
|
|
|
|
|
(typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
|
|
|
|
|
|
|
|
|
|
if (getRandomValues) {
|
|
|
|
|
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
|
|
|
|
|
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
|
|
|
|
|
|
|
|
|
|
module.exports = function whatwgRNG() {
|
|
|
|
|
getRandomValues(rnds8);
|
|
|
|
|
return rnds8;
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
// Math.random()-based (RNG)
|
|
|
|
|
//
|
|
|
|
|
// If all else fails, use Math.random(). It's fast, but is of unspecified
|
|
|
|
|
// quality.
|
|
|
|
|
var rnds = new Array(16);
|
|
|
|
|
|
|
|
|
|
module.exports = function mathRNG() {
|
|
|
|
|
for (var i = 0, r; i < 16; i++) {
|
|
|
|
|
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
|
|
|
|
|
rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rnds;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},{}],"../../../../node_modules/uuid/lib/bytesToUuid.js":[function(require,module,exports) {
|
|
|
|
|
/**
|
|
|
|
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
|
|
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
|
|
|
*/
|
|
|
|
|
var byteToHex = [];
|
|
|
|
|
for (var i = 0; i < 256; ++i) {
|
|
|
|
|
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function bytesToUuid(buf, offset) {
|
|
|
|
|
var i = offset || 0;
|
|
|
|
|
var bth = byteToHex;
|
|
|
|
|
// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
|
|
|
|
return ([bth[buf[i++]], bth[buf[i++]],
|
|
|
|
|
bth[buf[i++]], bth[buf[i++]], '-',
|
|
|
|
|
bth[buf[i++]], bth[buf[i++]], '-',
|
|
|
|
|
bth[buf[i++]], bth[buf[i++]], '-',
|
|
|
|
|
bth[buf[i++]], bth[buf[i++]], '-',
|
|
|
|
|
bth[buf[i++]], bth[buf[i++]],
|
|
|
|
|
bth[buf[i++]], bth[buf[i++]],
|
|
|
|
|
bth[buf[i++]], bth[buf[i++]]]).join('');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = bytesToUuid;
|
|
|
|
|
|
|
|
|
|
},{}],"../../../../node_modules/uuid/v4.js":[function(require,module,exports) {
|
|
|
|
|
var rng = require('./lib/rng');
|
|
|
|
|
var bytesToUuid = require('./lib/bytesToUuid');
|
|
|
|
|
|
|
|
|
|
function v4(options, buf, offset) {
|
|
|
|
|
var i = buf && offset || 0;
|
|
|
|
|
|
|
|
|
|
if (typeof(options) == 'string') {
|
|
|
|
|
buf = options === 'binary' ? new Array(16) : null;
|
|
|
|
|
options = null;
|
|
|
|
|
}
|
|
|
|
|
options = options || {};
|
|
|
|
|
|
|
|
|
|
var rnds = options.random || (options.rng || rng)();
|
|
|
|
|
|
|
|
|
|
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
|
|
|
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
|
|
|
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
|
|
|
|
|
|
|
|
// Copy bytes to buffer, if provided
|
|
|
|
|
if (buf) {
|
|
|
|
|
for (var ii = 0; ii < 16; ++ii) {
|
|
|
|
|
buf[i + ii] = rnds[ii];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return buf || bytesToUuid(rnds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = v4;
|
|
|
|
|
|
|
|
|
|
},{"./lib/rng":"../../../../node_modules/uuid/lib/rng-browser.js","./lib/bytesToUuid":"../../../../node_modules/uuid/lib/bytesToUuid.js"}],"actions/PostActions.js":[function(require,module,exports) {
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
@ -34803,6 +34985,8 @@ var _dexie = _interopRequireDefault(require("dexie"));
|
|
|
|
|
|
|
|
|
|
var _sanitizeHtml = _interopRequireDefault(require("sanitize-html"));
|
|
|
|
|
|
|
|
|
|
var _DateUtils = _interopRequireDefault(require("../../../../../brain/tools/utilities/DateUtils"));
|
|
|
|
|
|
|
|
|
|
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; } }
|
|
|
|
@ -34815,6 +34999,8 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
|
|
|
|
|
|
|
var md = require('markdown-it')('commonmark');
|
|
|
|
|
|
|
|
|
|
var uuidv4 = require('uuid/v4');
|
|
|
|
|
|
|
|
|
|
var PostActions =
|
|
|
|
|
/*#__PURE__*/
|
|
|
|
|
function () {
|
|
|
|
@ -34825,6 +35011,7 @@ function () {
|
|
|
|
|
_classCallCheck(this, PostActions);
|
|
|
|
|
|
|
|
|
|
this.dataUtils = new _DataUtils.default();
|
|
|
|
|
this.dateUtils = new _DateUtils.default();
|
|
|
|
|
this.db = new _dexie.default("fipamo_posts");
|
|
|
|
|
this.db.version(1).stores({
|
|
|
|
|
postList: 'id,post'
|
|
|
|
@ -34836,7 +35023,7 @@ function () {
|
|
|
|
|
|
|
|
|
|
_createClass(PostActions, [{
|
|
|
|
|
key: "update",
|
|
|
|
|
value: function update(id, data, files) {
|
|
|
|
|
value: function update(id, data, files, lastKey) {
|
|
|
|
|
var _this = this;
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
@ -34868,21 +35055,70 @@ function () {
|
|
|
|
|
data.featured = document.getElementById('option-feature').getAttribute('data-active');
|
|
|
|
|
data.published = document.getElementById('option-published').getAttribute('data-active');
|
|
|
|
|
|
|
|
|
|
_this.db.postList.update(Number(id), {
|
|
|
|
|
post: data
|
|
|
|
|
}).then(function (updated) {
|
|
|
|
|
self.db.postList.toArray(function (array) {
|
|
|
|
|
self.dataUtils.request('/api/post/sync', DataEvent.POSTS_SYNCED, _DataUtils.REQUEST_TYPE_POST, _DataUtils.CONTENT_TYPE_JSON, array).then(function (response) {
|
|
|
|
|
resolve({
|
|
|
|
|
response: response
|
|
|
|
|
if (files.length != 0) {
|
|
|
|
|
for (var i = 0; i < files.length; i++) {
|
|
|
|
|
var file = files[i]; // Check the file type.
|
|
|
|
|
|
|
|
|
|
if (!file.type.match('image.*')) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data.feature = "/content/blog-images/" + _this.dateUtils.getDate('year', new Date()) + "/" + _this.dateUtils.getDate('month', new Date()) + "/" + file.name;
|
|
|
|
|
}
|
|
|
|
|
} else {//data.feature = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (id == null) {
|
|
|
|
|
_this.db.postList.put({
|
|
|
|
|
id: lastKey + 1,
|
|
|
|
|
post: {
|
|
|
|
|
uuid: uuidv4(),
|
|
|
|
|
title: data.title,
|
|
|
|
|
slug: data.slug,
|
|
|
|
|
plaintext: data.plaintext,
|
|
|
|
|
html: data.html,
|
|
|
|
|
feature: data.feature,
|
|
|
|
|
created: data.created,
|
|
|
|
|
tags: data.tags,
|
|
|
|
|
page: data.page,
|
|
|
|
|
featured: data.featured,
|
|
|
|
|
published: data.published,
|
|
|
|
|
author: "user"
|
|
|
|
|
}
|
|
|
|
|
}).then(function (fresh) {
|
|
|
|
|
self.db.postList.toArray(function (array) {
|
|
|
|
|
self.dataUtils.request('/api/post/sync', DataEvent.POSTS_SYNCED, _DataUtils.REQUEST_TYPE_POST, _DataUtils.CONTENT_TYPE_JSON, array).then(function (response) {
|
|
|
|
|
var bounce = {
|
|
|
|
|
message: response,
|
|
|
|
|
newPost: fresh
|
|
|
|
|
};
|
|
|
|
|
resolve({
|
|
|
|
|
bounce: bounce
|
|
|
|
|
});
|
|
|
|
|
}).catch(function (err) {
|
|
|
|
|
reject({
|
|
|
|
|
err: err
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}).catch(function (err) {
|
|
|
|
|
reject({
|
|
|
|
|
err: err
|
|
|
|
|
}); //(updated) ? resolve("UPDATED") : reject("NOT UPDATED");
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
_this.db.postList.update(Number(id), {
|
|
|
|
|
post: data
|
|
|
|
|
}).then(function (updated) {
|
|
|
|
|
self.db.postList.toArray(function (array) {
|
|
|
|
|
self.dataUtils.request('/api/post/sync', DataEvent.POSTS_SYNCED, _DataUtils.REQUEST_TYPE_POST, _DataUtils.CONTENT_TYPE_JSON, array).then(function (response) {
|
|
|
|
|
resolve({
|
|
|
|
|
response: response
|
|
|
|
|
});
|
|
|
|
|
}).catch(function (err) {
|
|
|
|
|
reject({
|
|
|
|
|
err: err
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}); //(updated) ? resolve("UPDATED") : reject("NOT UPDATED");
|
|
|
|
|
});
|
|
|
|
|
}); //(updated) ? resolve("UPDATED") : reject("NOT UPDATED");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
@ -35005,7 +35241,7 @@ function () {
|
|
|
|
|
}();
|
|
|
|
|
|
|
|
|
|
exports.default = PostActions;
|
|
|
|
|
},{"../../../../../brain//tools/utilities/DataUtils":"../../../../brain/tools/utilities/DataUtils.js","../../../../../brain//tools/events/DataEvent":"../../../../brain/tools/events/DataEvent.js","../../../../../brain//tools/utilities/StringUtils":"../../../../brain/tools/utilities/StringUtils.js","dexie":"../../../../node_modules/dexie/dist/dexie.es.js","sanitize-html":"../../../../node_modules/sanitize-html/dist/index.js","markdown-it":"../../../../node_modules/markdown-it/index.js"}],"../../../../brain/tools/events/EditorEvent.js":[function(require,module,exports) {
|
|
|
|
|
},{"../../../../../brain//tools/utilities/DataUtils":"../../../../brain/tools/utilities/DataUtils.js","../../../../../brain//tools/events/DataEvent":"../../../../brain/tools/events/DataEvent.js","../../../../../brain//tools/utilities/StringUtils":"../../../../brain/tools/utilities/StringUtils.js","dexie":"../../../../node_modules/dexie/dist/dexie.es.js","sanitize-html":"../../../../node_modules/sanitize-html/dist/index.js","../../../../../brain/tools/utilities/DateUtils":"../../../../brain/tools/utilities/DateUtils.js","markdown-it":"../../../../node_modules/markdown-it/index.js","uuid/v4":"../../../../node_modules/uuid/v4.js"}],"../../../../brain/tools/events/EditorEvent.js":[function(require,module,exports) {
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
@ -36236,93 +36472,6 @@ var global = arguments[3];
|
|
|
|
|
|
|
|
|
|
})));
|
|
|
|
|
|
|
|
|
|
},{}],"../../../../brain/tools/utilities/DateUtils.js":[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 DateUtils =
|
|
|
|
|
/*#__PURE__*/
|
|
|
|
|
function () {
|
|
|
|
|
//--------------------------
|
|
|
|
|
// constructor
|
|
|
|
|
//--------------------------
|
|
|
|
|
function DateUtils() {
|
|
|
|
|
_classCallCheck(this, DateUtils);
|
|
|
|
|
} //--------------------------
|
|
|
|
|
// methods
|
|
|
|
|
//--------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_createClass(DateUtils, [{
|
|
|
|
|
key: "getMKtime",
|
|
|
|
|
value: function getMKtime() {
|
|
|
|
|
var time = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), new Date().getHours(), new Date().getMinutes(), new Date().getSeconds(), 0).getTime() / 1000;
|
|
|
|
|
return time;
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
key: "convertMKtime",
|
|
|
|
|
value: function convertMKtime(seconds) {
|
|
|
|
|
var date = new Date(seconds * 1000);
|
|
|
|
|
return date;
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
key: "getDate",
|
|
|
|
|
value: function getDate(type, rawdate) {
|
|
|
|
|
var day = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCDate()) : String(new Date().getUTCDate());
|
|
|
|
|
var month = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCMonth() + 1) : String(new Date().getUTCMonth() + 1);
|
|
|
|
|
var year = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCFullYear()) : String(new Date().getUTCFullYear());
|
|
|
|
|
var hour = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCHours()) : String(new Date().getUTCHours());
|
|
|
|
|
var minute = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCMinutes()) : String(new Date().getUTCMinutes());
|
|
|
|
|
var seconds = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCSeconds()) : String(new Date().getUTCSeconds());
|
|
|
|
|
var millisecond = rawdate != null || rawdate != '' ? String(new Date(rawdate).getUTCMilliseconds()) : String(new Date().getUTCMilliseconds());
|
|
|
|
|
var offset = rawdate != null || rawdate != '' ? String(new Date(rawdate).getTimezoneOffset()) : String(new Date().getTimezoneOffset());
|
|
|
|
|
if (day.length == 1) day = String("0" + day);
|
|
|
|
|
if (month.length == 1) month = String("0" + month);
|
|
|
|
|
offset = String(offset / 60);
|
|
|
|
|
if (offset.length == 1) offset = String("0" + offset);
|
|
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
|
case "day":
|
|
|
|
|
return day;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "month":
|
|
|
|
|
return month;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "year":
|
|
|
|
|
return year;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "stamp":
|
|
|
|
|
return String(year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + seconds + "." + millisecond + "-" + offset);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return String(year + "-" + month + "-" + day);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} //--------------------------
|
|
|
|
|
// event handlers
|
|
|
|
|
//--------------------------
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|
|
|
|
|
|
return DateUtils;
|
|
|
|
|
}();
|
|
|
|
|
|
|
|
|
|
var _default = DateUtils;
|
|
|
|
|
exports.default = _default;
|
|
|
|
|
},{}],"../../../../node_modules/caret-pos/lib/esm2015/main.js":[function(require,module,exports) {
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
@ -37109,14 +37258,20 @@ function () {
|
|
|
|
|
this.dateUtils = new _DateUtils.default();
|
|
|
|
|
this.urlPieces = document.URL.split("/");
|
|
|
|
|
this.post = [];
|
|
|
|
|
this.postID = document.getElementById('post-edit-index').getAttribute('data-index');
|
|
|
|
|
this.postID = null;
|
|
|
|
|
this.postCount = null;
|
|
|
|
|
this.postFinalKey = null;
|
|
|
|
|
if (document.getElementById('post-edit-index').getAttribute('data-index')) this.postID = document.getElementById('post-edit-index').getAttribute('data-index');
|
|
|
|
|
var fipamoPosts = new _dexie.default("fipamo_posts");
|
|
|
|
|
fipamoPosts.version(1).stores({
|
|
|
|
|
postList: 'id, post'
|
|
|
|
|
});
|
|
|
|
|
fipamoPosts.postList.get(Number(this.postID)).then(function (obj) {
|
|
|
|
|
return _this.setPost(obj.post);
|
|
|
|
|
fipamoPosts.postList.toArray(function (array) {
|
|
|
|
|
self.setListVars(array);
|
|
|
|
|
});
|
|
|
|
|
if (this.postID != null) fipamoPosts.postList.get(Number(this.postID)).then(function (obj) {
|
|
|
|
|
return _this.setPost(obj.post);
|
|
|
|
|
});else this.start();
|
|
|
|
|
|
|
|
|
|
if (document.getElementById('edit-post-text')) {
|
|
|
|
|
this.editor = new _TextEditor.default(document.getElementById('edit-post-text'), document.getElementById('header').offsetHeight + document.getElementById('post-header').offsetHeight + document.getElementById('post-feature').offsetHeight);
|
|
|
|
@ -37154,6 +37309,12 @@ function () {
|
|
|
|
|
this.post = array;
|
|
|
|
|
this.start();
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
key: "setListVars",
|
|
|
|
|
value: function setListVars(array) {
|
|
|
|
|
this.postCount = array.length;
|
|
|
|
|
this.postFinalKey = array[this.postCount - 1].id;
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
key: "start",
|
|
|
|
|
value: function start() {
|
|
|
|
@ -37164,7 +37325,9 @@ function () {
|
|
|
|
|
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);
|
|
|
|
|
document.getElementById('featured-click').addEventListener('change', function (e) {
|
|
|
|
|
return _this2.handleFeatureImageAdd(e);
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
|
|
if (document.getElementById('new-upload-link')) {
|
|
|
|
|
document.getElementById('new-upload-link').addEventListener('click', function (e) {
|
|
|
|
@ -37216,38 +37379,28 @@ function () {
|
|
|
|
|
|
|
|
|
|
switch (e) {
|
|
|
|
|
case EditorEvent.EDITOR_SAVE:
|
|
|
|
|
case EditorEvent.EDITOR_UPDATE:
|
|
|
|
|
var edit = false; //if (e == EditorEvent.EDITOR_UPDATE) edit = true;
|
|
|
|
|
new _PostActions.default().update(this.postID, this.post, PostEditor.uploadFiles, this.postFinalKey).then(function (response) {
|
|
|
|
|
//console.log(response.bounce.newPost);
|
|
|
|
|
var freshDB = new _dexie.default("fipamo_posts");
|
|
|
|
|
freshDB.version(1).stores({
|
|
|
|
|
postList: 'id, post'
|
|
|
|
|
});
|
|
|
|
|
setTimeout(function (f) {
|
|
|
|
|
freshDB.postList.get(Number(response.bounce.newPost)).then(function (obj) {
|
|
|
|
|
window.location = "/@/dashboard/posts/edit/" + obj.post.slug;
|
|
|
|
|
});
|
|
|
|
|
}, 200); //this.editor.notify(DataEvent.POST_UPDATED, this.postID);
|
|
|
|
|
}).catch(function (err) {
|
|
|
|
|
console.log("ERROR", err);
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
new _PostActions.default().update(this.postID, this.post, PostEditor.uploadFiles).then(function (response) {
|
|
|
|
|
case EditorEvent.EDITOR_UPDATE:
|
|
|
|
|
new _PostActions.default().update(this.postID, this.post, PostEditor.uploadFiles, this.postFinalKey).then(function (response) {
|
|
|
|
|
_this3.editor.notify(DataEvent.POST_UPDATED, _this3.postID);
|
|
|
|
|
}).catch(function (err) {
|
|
|
|
|
console.log("ERROR", err);
|
|
|
|
|
});
|
|
|
|
|
/**
|
|
|
|
|
new PostActions().sync(PostEditor.uploadFiles).then((response) =>
|
|
|
|
|
{
|
|
|
|
|
let note = JSON.parse(response['response']['request'].response);
|
|
|
|
|
//this.editor.notify(note.message, note.postID);
|
|
|
|
|
//if (note.message == DataEvent.POST_ADDED) window.location = "/@/dashboard/posts/edit/" + note.postID;
|
|
|
|
|
}).catch((err) =>
|
|
|
|
|
{
|
|
|
|
|
console.log(err)
|
|
|
|
|
});
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
new PostActions().submitPost(edit, PostEditor.uploadFiles).then((response) =>
|
|
|
|
|
{
|
|
|
|
|
let note = JSON.parse(response['response']['request'].response);
|
|
|
|
|
this.editor.notify(note.message, note.postID);
|
|
|
|
|
if (note.message == DataEvent.POST_ADDED) window.location = "/@/dashboard/posts/edit/" + note.postID;
|
|
|
|
|
}).catch((err) =>
|
|
|
|
|
{
|
|
|
|
|
console.log(err)
|
|
|
|
|
});
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EditorEvent.EDITOR_DELETE:
|
|
|
|
@ -37276,12 +37429,11 @@ function () {
|
|
|
|
|
e.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
key: "handleClicked",
|
|
|
|
|
value: function handleClicked(e) {
|
|
|
|
|
key: "handleDrop",
|
|
|
|
|
value: function handleDrop(e) {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
e.preventDefault(); //console.log("IMAGES " + e.target.files);
|
|
|
|
|
|
|
|
|
|
PostEditor.uploadFiles = e.target.files;
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
PostEditor.uploadFiles = e.dataTransfer.files; //console.log(MemberArea.uploadFiles.length);
|
|
|
|
|
|
|
|
|
|
for (var i = 0, f; f = PostEditor.uploadFiles[i]; i++) {
|
|
|
|
|
// Only process image files.
|
|
|
|
@ -37294,14 +37446,11 @@ function () {
|
|
|
|
|
reader.onload = function (theFile) {
|
|
|
|
|
return function (f) {
|
|
|
|
|
// Render thumbnail.
|
|
|
|
|
var image = document.createElement('img');
|
|
|
|
|
image.src = f.target.result;
|
|
|
|
|
image.title = escape(theFile.name);
|
|
|
|
|
var span = document.createElement('div');
|
|
|
|
|
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(image);
|
|
|
|
|
document.getElementById('featured-image-drop').appendChild(span);
|
|
|
|
|
};
|
|
|
|
|
}(f); // Read in the image file as a data URL.
|
|
|
|
|
|
|
|
|
@ -37310,11 +37459,29 @@ function () {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, {
|
|
|
|
|
key: "handleDrop",
|
|
|
|
|
value: function handleDrop(e) {
|
|
|
|
|
key: "handleFeatureImageAdd",
|
|
|
|
|
value: function handleFeatureImageAdd(e) {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
PostEditor.uploadFiles = e.dataTransfer.files; //console.log(MemberArea.uploadFiles.length);
|
|
|
|
|
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('feature_image', file, file.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.dataUtils.request("/api/post/add-feature-image", DataEvent.FEATURE_IMAGE_ADDED, _DataUtils.REQUEST_TYPE_POST, _DataUtils.CONTENT_TYPE_FORM, postData).then(function (response) {//self.editor.notify(EditorEvent.EDITOR_UPLOAD_POST_IMAGE, JSON.parse(response.request['response']).url);
|
|
|
|
|
}).catch(function (err) {
|
|
|
|
|
console.log(err);
|
|
|
|
|
});
|
|
|
|
|
PostEditor.uploadFiles = e.target.files;
|
|
|
|
|
|
|
|
|
|
for (var i = 0, f; f = PostEditor.uploadFiles[i]; i++) {
|
|
|
|
|
// Only process image files.
|
|
|
|
@ -37327,11 +37494,14 @@ function () {
|
|
|
|
|
reader.onload = function (theFile) {
|
|
|
|
|
return function (f) {
|
|
|
|
|
// Render thumbnail.
|
|
|
|
|
var span = document.createElement('span');
|
|
|
|
|
var image = document.createElement('img');
|
|
|
|
|
image.src = f.target.result;
|
|
|
|
|
image.title = escape(theFile.name);
|
|
|
|
|
var span = document.createElement('div');
|
|
|
|
|
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);
|
|
|
|
|
document.getElementById('featured-image-drop').appendChild(image);
|
|
|
|
|
};
|
|
|
|
|
}(f); // Read in the image file as a data URL.
|
|
|
|
|
|
|
|
|
@ -37358,7 +37528,7 @@ function () {
|
|
|
|
|
postData.append('post_image', file, file.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.dataUtils.request("/api/blog/add-post-image", DataEvent.POST_IMAGE_ADDED, _DataUtils.REQUEST_TYPE_POST, _DataUtils.CONTENT_TYPE_FORM, postData).then(function (response) {
|
|
|
|
|
this.dataUtils.request("/api/post/add-post-image", DataEvent.POST_IMAGE_ADDED, _DataUtils.REQUEST_TYPE_POST, _DataUtils.CONTENT_TYPE_FORM, postData).then(function (response) {
|
|
|
|
|
self.editor.notify(EditorEvent.EDITOR_UPLOAD_POST_IMAGE, JSON.parse(response.request['response']).url);
|
|
|
|
|
}).catch(function (err) {
|
|
|
|
|
console.log(err);
|
|
|
|
@ -37650,7 +37820,7 @@ 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 + ':' + "61971" + '/');
|
|
|
|
|
var ws = new WebSocket(protocol + '://' + hostname + ':' + "64227" + '/');
|
|
|
|
|
|
|
|
|
|
ws.onmessage = function (event) {
|
|
|
|
|
var data = JSON.parse(event.data);
|
|
|
|
|