';
- var _iterator2 = _createForOfIteratorHelper(diagnostics), _step2;
- try {
- for(_iterator2.s(); !(_step2 = _iterator2.n()).done;){
- var diagnostic = _step2.value;
- var stack = diagnostic.codeframe ? diagnostic.codeframe : diagnostic.stack;
- errorHTML += "\n
\n
\n \uD83D\uDEA8 ".concat(diagnostic.message, "\n
\n
").concat(stack, "
\n
\n ").concat(diagnostic.hints.map(function(hint) {
- return '
💡 ' + hint + '
';
- }).join(''), "\n
\n ").concat(diagnostic.documentation ? "
") : '', "\n
\n ");
- }
- } catch (err) {
- _iterator2.e(err);
- } finally{
- _iterator2.f();
- }
- errorHTML += '
';
+ let errorHTML = '';
+ for (let diagnostic of diagnostics){
+ let stack = diagnostic.frames.length ? diagnostic.frames.reduce((p, frame)=>{
+ return `${p}
+
${frame.location}
+${frame.code}`;
+ }, "") : diagnostic.stack;
+ errorHTML += `
+
+
+ 🚨 ${diagnostic.message}
+
+
${stack}
+
+ ${diagnostic.hints.map((hint)=>"
\uD83D\uDCA1 " + hint + "
").join("")}
+
+ ${diagnostic.documentation ? `
` : ""}
+
+ `;
+ }
+ errorHTML += "
";
overlay.innerHTML = errorHTML;
return overlay;
}
@@ -380,7 +330,7 @@ function updateLink(link) {
if (link.parentNode !== null) // $FlowFixMe
link.parentNode.removeChild(link);
};
- newLink.setAttribute('href', link.getAttribute('href').split('?')[0] + '?' + Date.now()); // $FlowFixMe
+ newLink.setAttribute("href", link.getAttribute("href").split("?")[0] + "?" + Date.now()); // $FlowFixMe
link.parentNode.insertBefore(newLink, link.nextSibling);
}
var cssTimeout = null;
@@ -390,23 +340,82 @@ function reloadCSS() {
var links = document.querySelectorAll('link[rel="stylesheet"]');
for(var i = 0; i < links.length; i++){
// $FlowFixMe[incompatible-type]
- var href = links[i].getAttribute('href');
+ var href = links[i].getAttribute("href");
var hostname = getHostname();
- var servedFromHMRServer = hostname === 'localhost' ? new RegExp('^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):' + getPort()).test(href) : href.indexOf(hostname + ':' + getPort());
- var absolute = /^https?:\/\//i.test(href) && href.indexOf(window.location.origin) !== 0 && !servedFromHMRServer;
+ var servedFromHMRServer = hostname === "localhost" ? new RegExp("^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):" + getPort()).test(href) : href.indexOf(hostname + ":" + getPort());
+ var absolute = /^https?:\/\//i.test(href) && href.indexOf(location.origin) !== 0 && !servedFromHMRServer;
if (!absolute) updateLink(links[i]);
}
cssTimeout = null;
}, 50);
}
+async function hmrApplyUpdates(assets) {
+ global.parcelHotUpdate = Object.create(null);
+ let scriptsToRemove;
+ try {
+ // If sourceURL comments aren't supported in eval, we need to load
+ // the update from the dev server over HTTP so that stack traces
+ // are correct in errors/logs. This is much slower than eval, so
+ // we only do it if needed (currently just Safari).
+ // https://bugs.webkit.org/show_bug.cgi?id=137297
+ // This path is also taken if a CSP disallows eval.
+ if (!supportsSourceURL) {
+ let promises = assets.map((asset)=>{
+ if (asset.type === "js") {
+ if (typeof document !== "undefined") {
+ let script = document.createElement("script");
+ script.src = asset.url;
+ return new Promise((resolve, reject)=>{
+ var _document$head;
+ script.onload = ()=>resolve(script);
+ script.onerror = reject;
+ (_document$head = document.head) === null || _document$head === void 0 || _document$head.appendChild(script);
+ });
+ } else if (typeof importScripts === "function") return new Promise((resolve, reject)=>{
+ try {
+ importScripts(asset.url);
+ } catch (err) {
+ reject(err);
+ }
+ });
+ }
+ });
+ scriptsToRemove = await Promise.all(promises);
+ }
+ assets.forEach(function(asset) {
+ hmrApply(module.bundle.root, asset);
+ });
+ } finally{
+ delete global.parcelHotUpdate;
+ if (scriptsToRemove) scriptsToRemove.forEach((script)=>{
+ if (script) {
+ var _document$head2;
+ (_document$head2 = document.head) === null || _document$head2 === void 0 || _document$head2.removeChild(script);
+ }
+ });
+ }
+}
function hmrApply(bundle, asset) {
var modules = bundle.modules;
if (!modules) return;
- if (asset.type === 'css') reloadCSS();
- else if (asset.type === 'js') {
- var deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID];
+ if (asset.type === "css") reloadCSS();
+ else if (asset.type === "js") {
+ let deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID];
if (deps) {
- var fn = new Function('require', 'module', 'exports', asset.output);
+ if (modules[asset.id]) {
+ // Remove dependencies that are removed and will become orphaned.
+ // This is necessary so that if the asset is added back again, the cache is gone, and we prevent a full page reload.
+ let oldDeps = modules[asset.id][1];
+ for(let dep in oldDeps)if (!deps[dep] || deps[dep] !== oldDeps[dep]) {
+ let id = oldDeps[dep];
+ let parents = getParents(module.bundle.root, id);
+ if (parents.length === 1) hmrDelete(module.bundle.root, id);
+ }
+ }
+ if (supportsSourceURL) // Global eval. We would use `new Function` here but browser
+ // support for source maps is better with eval.
+ (0, eval)(asset.output);
+ let fn = global.parcelHotUpdate[asset.id];
modules[asset.id] = [
fn,
deps
@@ -414,7 +423,48 @@ function hmrApply(bundle, asset) {
} else if (bundle.parent) hmrApply(bundle.parent, asset);
}
}
+function hmrDelete(bundle, id1) {
+ let modules = bundle.modules;
+ if (!modules) return;
+ if (modules[id1]) {
+ // Collect dependencies that will become orphaned when this module is deleted.
+ let deps = modules[id1][1];
+ let orphans = [];
+ for(let dep in deps){
+ let parents = getParents(module.bundle.root, deps[dep]);
+ if (parents.length === 1) orphans.push(deps[dep]);
+ } // Delete the module. This must be done before deleting dependencies in case of circular dependencies.
+ delete modules[id1];
+ delete bundle.cache[id1]; // Now delete the orphans.
+ orphans.forEach((id)=>{
+ hmrDelete(module.bundle.root, id);
+ });
+ } else if (bundle.parent) hmrDelete(bundle.parent, id1);
+}
function hmrAcceptCheck(bundle, id, depsByBundle) {
+ if (hmrAcceptCheckOne(bundle, id, depsByBundle)) return true;
+ // Traverse parents breadth first. All possible ancestries must accept the HMR update, or we'll reload.
+ let parents = getParents(module.bundle.root, id);
+ let accepted = false;
+ while(parents.length > 0){
+ let v = parents.shift();
+ let a = hmrAcceptCheckOne(v[0], v[1], null);
+ if (a) // If this parent accepts, stop traversing upward, but still consider siblings.
+ accepted = true;
+ else {
+ // Otherwise, queue the parents in the next level upward.
+ let p = getParents(module.bundle.root, v[1]);
+ if (p.length === 0) {
+ // If there are no parents, then we've reached an entry without accepting. Reload.
+ accepted = false;
+ break;
+ }
+ parents.push(...p);
+ }
+ }
+ return accepted;
+}
+function hmrAcceptCheckOne(bundle, id, depsByBundle) {
var modules = bundle.modules;
if (!modules) return;
if (depsByBundle && !depsByBundle[bundle.HMR_BUNDLE_ID]) {
@@ -430,17 +480,11 @@ function hmrAcceptCheck(bundle, id, depsByBundle) {
bundle,
id
]);
- if (cached && cached.hot && cached.hot._acceptCallbacks.length) return true;
- var parents = getParents(module.bundle.root, id); // If no parents, the asset is new. Prevent reloading the page.
- if (!parents.length) return true;
- return parents.some(function(v) {
- return hmrAcceptCheck(v[0], v[1], null);
- });
+ if (!cached || cached.hot && cached.hot._acceptCallbacks.length) return true;
}
function hmrAcceptRun(bundle, id) {
var cached = bundle.cache[id];
- bundle.hotData = {
- };
+ bundle.hotData = {};
if (cached && cached.hot) cached.hot.data = bundle.hotData;
if (cached && cached.hot && cached.hot._disposeCallbacks.length) cached.hot._disposeCallbacks.forEach(function(cb) {
cb(bundle.hotData);
@@ -458,15 +502,15 @@ function hmrAcceptRun(bundle, id) {
acceptedAssets[id] = true;
}
-},{}],"bEyX8":[function(require,module,exports) {
+},{}],"7bZzU":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
var _base = require("./Base");
var _baseDefault = parcelHelpers.interopDefault(_base);
document.addEventListener("DOMContentLoaded", function() {
- new _baseDefault.default();
+ new (0, _baseDefault.default)();
}, false);
-},{"./Base":"kvSpR","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"kvSpR":[function(require,module,exports) {
+},{"./Base":"cqs8R","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"cqs8R":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
var _fipamoAdminAPI = require("../libraries/FipamoAdminAPI");
@@ -480,8 +524,8 @@ var _dashManager = require("./controllers/DashManager");
var _dashManagerDefault = parcelHelpers.interopDefault(_dashManager);
var _notifications = require("./ui/Notifications");
var _notificationsDefault = parcelHelpers.interopDefault(_notifications);
-const data = new _dataUtilsDefault.default();
-const notify = new _notificationsDefault.default();
+const data = new (0, _dataUtilsDefault.default)();
+const notify = new (0, _notificationsDefault.default)();
class Base {
//--------------------------
// constructor
@@ -493,24 +537,18 @@ class Base {
// methods
//--------------------------
start() {
- if (document.getElementById('dash-form') || document.getElementById('dash-init')) {
- var options = document.getElementsByClassName('init-option');
- for(let index = 0; index < options.length; index++)options[index].addEventListener('click', (e)=>this.handleOptions(e)
- );
- if (document.getElementById('dash-form')) document.getElementById('login-btn').addEventListener('click', (e)=>this.handleLogin(e)
- );
+ if (document.getElementById("dash-form") || document.getElementById("dash-init")) {
+ var options = document.getElementsByClassName("init-option");
+ for(let index = 0; index < options.length; index++)options[index].addEventListener("click", (e)=>this.handleOptions(e));
+ if (document.getElementById("dash-form")) document.getElementById("login-btn").addEventListener("click", (e)=>this.handleLogin(e));
else {
- document.getElementById('init-blog').addEventListener('click', (e)=>this.handleSetup(e)
- );
- document.getElementById('blog-restore').addEventListener('click', (e)=>this.handleRestore(e)
- );
+ document.getElementById("init-blog").addEventListener("click", (e)=>this.handleSetup(e));
+ document.getElementById("blog-restore").addEventListener("click", (e)=>this.handleRestore(e));
}
- } else if (document.getElementById('dash-reset')) {
- document.getElementById('get-secret-btn').addEventListener('click', (e)=>this.handleReset(e)
- );
- document.getElementById('reset-btn').addEventListener('click', (e)=>this.handleReset(e)
- );
- } else new _dashManagerDefault.default();
+ } else if (document.getElementById("dash-reset")) {
+ document.getElementById("get-secret-btn").addEventListener("click", (e)=>this.handleReset(e));
+ document.getElementById("reset-btn").addEventListener("click", (e)=>this.handleReset(e));
+ } else new (0, _dashManagerDefault.default)();
}
// event handlers
//--------------------------
@@ -518,9 +556,9 @@ class Base {
if (this.processing) return;
let self = this;
e.preventDefault();
- let authForm = data.formDataToJSON(document.getElementById('login'));
- notify.alert('Looking, hold up', null);
- let api = new _fipamoAdminAPIDefault.default();
+ let authForm = data.formDataToJSON(document.getElementById("login"));
+ notify.alert("Looking, hold up", null);
+ let api = new (0, _fipamoAdminAPIDefault.default)();
this.processing = true;
api.login(authForm).then((response)=>{
self.processing = false;
@@ -529,7 +567,7 @@ class Base {
notify.alert(response.message, true);
e.target.innerHTML = response.message;
setTimeout(()=>{
- window.location = '/dashboard';
+ window.location = "/dashboard";
}, 500);
}
}).catch((err)=>{
@@ -537,13 +575,13 @@ class Base {
notify.alert(err, false);
});
}
- handleSetup(e1) {
+ handleSetup(e) {
if (this.processing) return;
let self = this;
- e1.stopPropagation();
- e1.preventDefault();
- let setUpForm = data.formDataToJSON(document.getElementById('init-form'));
- let mm = new _maintenanceManagerDefault.default();
+ e.stopPropagation();
+ e.preventDefault();
+ let setUpForm = data.formDataToJSON(document.getElementById("init-form"));
+ let mm = new (0, _maintenanceManagerDefault.default)();
this.processing = true;
mm.create(setUpForm).then((response)=>{
if (response.type === _dataEvent.API_INIT_LAME) {
@@ -553,7 +591,7 @@ class Base {
self.processing = false;
notify.alert(response.message, true);
setTimeout(()=>{
- window.location = '/dashboard';
+ window.location = "/dashboard";
}, 700);
}
}).catch((err)=>{
@@ -561,13 +599,13 @@ class Base {
notify.alert(err, false);
});
}
- handleRestore(e2) {
+ handleRestore(e) {
if (this.processing) return;
let self = this;
- e2.stopPropagation();
- e2.preventDefault();
- let mm = new _maintenanceManagerDefault.default();
- var form = document.getElementById('init-restore');
+ e.stopPropagation();
+ e.preventDefault();
+ let mm = new (0, _maintenanceManagerDefault.default)();
+ var form = document.getElementById("init-restore");
this.processing = true;
mm.restore(form).then((response)=>{
if (response.type === _dataEvent.REQUEST_LAME) {
@@ -577,7 +615,7 @@ class Base {
self.processing = false;
notify.alert(response.message, true);
setTimeout(()=>{
- window.location = '/dashboard';
+ window.location = "/dashboard";
}, 1500);
}
}).catch((err)=>{
@@ -585,41 +623,41 @@ class Base {
notify.alert(err, false);
});
}
- handleReset(e3) {
- e3.stopPropagation();
- e3.preventDefault();
+ handleReset(e) {
+ e.stopPropagation();
+ e.preventDefault();
let self = this;
- let mm = new _maintenanceManagerDefault.default();
- if (e3.target.id == 'get-secret-btn') {
- let data = {
- email: document.getElementById('email').value,
- task: 'retrieveSecret'
+ let mm = new (0, _maintenanceManagerDefault.default)();
+ if (e.target.id == "get-secret-btn") {
+ let data1 = {
+ email: document.getElementById("email").value,
+ task: "retrieveSecret"
};
this.processing = true;
- mm.secret(data).then((response)=>{
+ mm.secret(data1).then((response)=>{
self.processing = false;
if (response.secret) {
- document.getElementById('secret').value = response.secret;
+ document.getElementById("secret").value = response.secret;
notify.alert(response.message, true);
- } else if (response.type == 'mailSent') notify.alert(response.message, true);
+ } else if (response.type == "mailSent") notify.alert(response.message, true);
else notify.alert(response.message, false);
}).catch((err)=>{
self.processing = false;
notify.alert(err, false);
});
} else {
- let data = {
- newPass: document.getElementById('new_password').value,
- newPassConfirm: document.getElementById('new_password2').value,
- secret: document.getElementById('secret').value
+ let data2 = {
+ newPass: document.getElementById("new_password").value,
+ newPassConfirm: document.getElementById("new_password2").value,
+ secret: document.getElementById("secret").value
};
- mm.newPass(data).then((response)=>{
+ mm.newPass(data2).then((response)=>{
self.processing = false;
- if (response.type == 'passNotCreated') notify.alert(response.message, false);
+ if (response.type == "passNotCreated") notify.alert(response.message, false);
else {
notify.alert(response.message, true);
setTimeout(()=>{
- window.location = '/dashboard';
+ window.location = "/dashboard";
}, 1000);
}
}).catch((err)=>{
@@ -628,95 +666,62 @@ class Base {
});
}
}
- handleOptions(e4) {
- e4.stopPropagation();
- e4.preventDefault();
- let init = document.getElementById('dash-init');
- let restore = document.getElementById('dash-restore');
- if (e4.target.id === 'init-switch-restore') {
- init.style.display = 'none';
- init.style.visibility = 'hidden';
- restore.style.display = 'flex';
- restore.style.visibility = 'visible';
+ handleOptions(e) {
+ e.stopPropagation();
+ e.preventDefault();
+ let init = document.getElementById("dash-init");
+ let restore = document.getElementById("dash-restore");
+ if (e.target.id === "init-switch-restore") {
+ init.style.display = "none";
+ init.style.visibility = "hidden";
+ restore.style.display = "flex";
+ restore.style.visibility = "visible";
} else {
- init.style.display = 'flex';
- init.style.visibility = 'visible';
- restore.style.display = 'none';
- restore.style.visibility = 'hidden';
+ init.style.display = "flex";
+ init.style.visibility = "visible";
+ restore.style.display = "none";
+ restore.style.visibility = "hidden";
}
}
}
exports.default = Base;
-},{"../libraries/FipamoAdminAPI":"6M96o","./controllers/MaintenanceManager":"kY7L1","./utils/DataUtils":"lpIyf","./events/DataEvent":"edzJV","./controllers/DashManager":"7hyn2","./ui/Notifications":"fmUxI","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"6M96o":[function(require,module,exports) {
+},{"../libraries/FipamoAdminAPI":"3dcvg","./controllers/MaintenanceManager":"cYXLM","./utils/DataUtils":"eM6UW","./events/DataEvent":"hCRFh","./controllers/DashManager":"9gCOB","./ui/Notifications":"9GRdG","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"3dcvg":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
-parcelHelpers.export(exports, "REQUEST_TYPE_POST", ()=>REQUEST_TYPE_POST
-);
-parcelHelpers.export(exports, "REQUEST_TYPE_GET", ()=>REQUEST_TYPE_GET
-);
-parcelHelpers.export(exports, "REQUEST_TYPE_PUT", ()=>REQUEST_TYPE_PUT
-);
-parcelHelpers.export(exports, "REQUEST_TYPE_DELETE", ()=>REQUEST_TYPE_DELETE
-);
-parcelHelpers.export(exports, "CONTENT_TYPE_JSON", ()=>CONTENT_TYPE_JSON
-);
-parcelHelpers.export(exports, "CONTENT_TYPE_FORM", ()=>CONTENT_TYPE_FORM
-);
-parcelHelpers.export(exports, "API_STATUS", ()=>API_STATUS
-);
-parcelHelpers.export(exports, "API_GET_SETTINGS", ()=>API_GET_SETTINGS
-);
-parcelHelpers.export(exports, "API_GET_MEMBER_INFO", ()=>API_GET_MEMBER_INFO
-);
-parcelHelpers.export(exports, "API_NEW_PAGE", ()=>API_NEW_PAGE
-);
-parcelHelpers.export(exports, "API_EDIT_PAGE", ()=>API_EDIT_PAGE
-);
-parcelHelpers.export(exports, "API_DELETE_PAGE", ()=>API_DELETE_PAGE
-);
-parcelHelpers.export(exports, "API_SETTINGS_SYNC", ()=>API_SETTINGS_SYNC
-);
-parcelHelpers.export(exports, "API_PUBLISH_PAGES", ()=>API_PUBLISH_PAGES
-);
-parcelHelpers.export(exports, "API_NAV_SYNC", ()=>API_NAV_SYNC
-);
-parcelHelpers.export(exports, "API_REINDEX_PAGES", ()=>API_REINDEX_PAGES
-);
-parcelHelpers.export(exports, "API_SEND_MAIL", ()=>API_SEND_MAIL
-);
-parcelHelpers.export(exports, "API_LOGIN", ()=>API_LOGIN
-);
-parcelHelpers.export(exports, "AUTH_STATUS", ()=>AUTH_STATUS
-);
-parcelHelpers.export(exports, "TASK_SETTINGS_WRITE", ()=>TASK_SETTINGS_WRITE
-);
-parcelHelpers.export(exports, "TASK_PUBLISH_SITE", ()=>TASK_PUBLISH_SITE
-);
-parcelHelpers.export(exports, "TASK_PAGE_CREATE", ()=>TASK_PAGE_CREATE
-);
-parcelHelpers.export(exports, "TASK_PAGE_EDIT", ()=>TASK_PAGE_EDIT
-);
-parcelHelpers.export(exports, "TASK_PAGE_DELETE", ()=>TASK_PAGE_DELETE
-);
-parcelHelpers.export(exports, "TASK_SEND_MAIL", ()=>TASK_SEND_MAIL
-);
-parcelHelpers.export(exports, "TASK_REINDEX_PAGE", ()=>TASK_REINDEX_PAGE
-);
-parcelHelpers.export(exports, "TASK_SYNC_SETTNIGS", ()=>TASK_SYNC_SETTNIGS
-);
-parcelHelpers.export(exports, "TASK_SYNC_NAV", ()=>TASK_SYNC_NAV
-);
-parcelHelpers.export(exports, "TASK_GET_SETTINGS", ()=>TASK_GET_SETTINGS
-);
-parcelHelpers.export(exports, "TASK_GET_MEMBER_INFO", ()=>TASK_GET_MEMBER_INFO
-);
-parcelHelpers.export(exports, "API_ACCESS_GOOD", ()=>API_ACCESS_GOOD
-);
-parcelHelpers.export(exports, "API_ACCESS_BAD", ()=>API_ACCESS_BAD
-);
-parcelHelpers.export(exports, "default", ()=>FipamoAdminAPI
-);
+parcelHelpers.export(exports, "REQUEST_TYPE_POST", ()=>REQUEST_TYPE_POST);
+parcelHelpers.export(exports, "REQUEST_TYPE_GET", ()=>REQUEST_TYPE_GET);
+parcelHelpers.export(exports, "REQUEST_TYPE_PUT", ()=>REQUEST_TYPE_PUT);
+parcelHelpers.export(exports, "REQUEST_TYPE_DELETE", ()=>REQUEST_TYPE_DELETE);
+parcelHelpers.export(exports, "CONTENT_TYPE_JSON", ()=>CONTENT_TYPE_JSON);
+parcelHelpers.export(exports, "CONTENT_TYPE_FORM", ()=>CONTENT_TYPE_FORM);
+parcelHelpers.export(exports, "API_STATUS", ()=>API_STATUS);
+parcelHelpers.export(exports, "API_GET_SETTINGS", ()=>API_GET_SETTINGS);
+parcelHelpers.export(exports, "API_GET_MEMBER_INFO", ()=>API_GET_MEMBER_INFO);
+parcelHelpers.export(exports, "API_NEW_PAGE", ()=>API_NEW_PAGE);
+parcelHelpers.export(exports, "API_EDIT_PAGE", ()=>API_EDIT_PAGE);
+parcelHelpers.export(exports, "API_DELETE_PAGE", ()=>API_DELETE_PAGE);
+parcelHelpers.export(exports, "API_SETTINGS_SYNC", ()=>API_SETTINGS_SYNC);
+parcelHelpers.export(exports, "API_PUBLISH_PAGES", ()=>API_PUBLISH_PAGES);
+parcelHelpers.export(exports, "API_NAV_SYNC", ()=>API_NAV_SYNC);
+parcelHelpers.export(exports, "API_REINDEX_PAGES", ()=>API_REINDEX_PAGES);
+parcelHelpers.export(exports, "API_SEND_MAIL", ()=>API_SEND_MAIL);
+parcelHelpers.export(exports, "API_LOGIN", ()=>API_LOGIN);
+parcelHelpers.export(exports, "AUTH_STATUS", ()=>AUTH_STATUS);
+parcelHelpers.export(exports, "TASK_SETTINGS_WRITE", ()=>TASK_SETTINGS_WRITE);
+parcelHelpers.export(exports, "TASK_PUBLISH_SITE", ()=>TASK_PUBLISH_SITE);
+parcelHelpers.export(exports, "TASK_PAGE_CREATE", ()=>TASK_PAGE_CREATE);
+parcelHelpers.export(exports, "TASK_PAGE_EDIT", ()=>TASK_PAGE_EDIT);
+parcelHelpers.export(exports, "TASK_PAGE_DELETE", ()=>TASK_PAGE_DELETE);
+parcelHelpers.export(exports, "TASK_SEND_MAIL", ()=>TASK_SEND_MAIL);
+parcelHelpers.export(exports, "TASK_REINDEX_PAGE", ()=>TASK_REINDEX_PAGE);
+parcelHelpers.export(exports, "TASK_SYNC_SETTNIGS", ()=>TASK_SYNC_SETTNIGS);
+parcelHelpers.export(exports, "TASK_SYNC_NAV", ()=>TASK_SYNC_NAV);
+parcelHelpers.export(exports, "TASK_GET_SETTINGS", ()=>TASK_GET_SETTINGS);
+parcelHelpers.export(exports, "TASK_GET_MEMBER_INFO", ()=>TASK_GET_MEMBER_INFO);
+parcelHelpers.export(exports, "API_ACCESS_GOOD", ()=>API_ACCESS_GOOD);
+parcelHelpers.export(exports, "API_ACCESS_BAD", ()=>API_ACCESS_BAD);
+parcelHelpers.export(exports, "default", ()=>FipamoAdminAPI);
const REQUEST_TYPE_POST = "POST";
const REQUEST_TYPE_GET = "GET";
const REQUEST_TYPE_PUT = "PUT";
@@ -832,7 +837,7 @@ const API_ACCESS_BAD = "apiUseNotAuthorized";
"type":"exampleType",
}
```
- */ sync(task, data1) {
+ */ sync(task, data) {
return new Promise((resolve, reject)=>{
let url = "";
switch(task){
@@ -843,7 +848,7 @@ const API_ACCESS_BAD = "apiUseNotAuthorized";
url = API_NAV_SYNC;
break;
}
- this._request(this.baseURL ? this.baseURL + url : url, TASK_SETTINGS_WRITE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data1).then((result)=>{
+ this._request(this.baseURL ? this.baseURL + url : url, TASK_SETTINGS_WRITE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data).then((result)=>{
resolve(result);
}).catch((err)=>{
reject(err);
@@ -865,9 +870,9 @@ const API_ACCESS_BAD = "apiUseNotAuthorized";
"type":"exampleType",
}
* ```
- */ publish(data2) {
+ */ publish(data) {
return new Promise((resolve, reject)=>{
- this._request(this.baseURL ? this.baseURL + API_PUBLISH_PAGES : API_PUBLISH_PAGES, TASK_PUBLISH_SITE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data2).then((result)=>{
+ this._request(this.baseURL ? this.baseURL + API_PUBLISH_PAGES : API_PUBLISH_PAGES, TASK_PUBLISH_SITE, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data).then((result)=>{
resolve(result);
}).catch((err)=>{
reject(err);
@@ -904,9 +909,9 @@ const API_ACCESS_BAD = "apiUseNotAuthorized";
"type":"exampleType",
}
```
- */ pageActions(task1, data3) {
+ */ pageActions(task, data) {
let url, event, content;
- switch(task1){
+ switch(task){
case TASK_PAGE_CREATE:
url = API_NEW_PAGE;
event = TASK_PAGE_CREATE;
@@ -926,10 +931,10 @@ const API_ACCESS_BAD = "apiUseNotAuthorized";
break;
}
if (this.baseURL) //data.key = this.key;
- data3.remote = true;
- else data3.remote = false;
+ data.remote = true;
+ else data.remote = false;
return new Promise((resolve, reject)=>{
- this._request(this.baseURL ? this.baseURL + url : url, event, REQUEST_TYPE_POST, content, data3).then((result)=>{
+ this._request(this.baseURL ? this.baseURL + url : url, event, REQUEST_TYPE_POST, content, data).then((result)=>{
resolve(result);
}).catch((err)=>{
reject(err);
@@ -1002,8 +1007,7 @@ const API_ACCESS_BAD = "apiUseNotAuthorized";
var self = this;
return new Promise(function(resolve, reject) {
var request = new XMLHttpRequest();
- request.upload.addEventListener("progress", (e)=>self.handleLoadProgress(e, self.progressBar)
- );
+ request.upload.addEventListener("progress", (e)=>self.handleLoadProgress(e, self.progressBar));
request.open(requestType, requestURL, true);
request.onload = ()=>{
if (request.status == 200) {
@@ -1033,26 +1037,26 @@ const API_ACCESS_BAD = "apiUseNotAuthorized";
}
// event handlers
//--------------------------
- handleLoadProgress(e, progressBar1) {
+ handleLoadProgress(e, progressBar) {
let percent = Math.ceil(e.loaded / e.total * 100); //if a progress bar element is present, talk to it
- if (progressBar1 != null) progressBar1.style.width = percent + "%";
+ if (progressBar != null) progressBar.style.width = percent + "%";
}
}
-},{"@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"ciiiV":[function(require,module,exports) {
+},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"gkKU3":[function(require,module,exports) {
exports.interopDefault = function(a) {
return a && a.__esModule ? a : {
default: a
};
};
exports.defineInteropFlag = function(a) {
- Object.defineProperty(a, '__esModule', {
+ Object.defineProperty(a, "__esModule", {
value: true
});
};
exports.exportAll = function(source, dest) {
Object.keys(source).forEach(function(key) {
- if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) return;
+ if (key === "default" || key === "__esModule" || dest.hasOwnProperty(key)) return;
Object.defineProperty(dest, key, {
enumerable: true,
get: function() {
@@ -1069,86 +1073,60 @@ exports.export = function(dest, destName, get) {
});
};
-},{}],"kY7L1":[function(require,module,exports) {
+},{}],"cYXLM":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
-parcelHelpers.export(exports, "REQUEST_TYPE_POST", ()=>REQUEST_TYPE_POST
-);
-parcelHelpers.export(exports, "REQUEST_TYPE_GET", ()=>REQUEST_TYPE_GET
-);
-parcelHelpers.export(exports, "REQUEST_TYPE_PUT", ()=>REQUEST_TYPE_PUT
-);
-parcelHelpers.export(exports, "REQUEST_TYPE_DELETE", ()=>REQUEST_TYPE_DELETE
-);
-parcelHelpers.export(exports, "CONTENT_TYPE_JSON", ()=>CONTENT_TYPE_JSON
-);
-parcelHelpers.export(exports, "CONTENT_TYPE_FORM", ()=>CONTENT_TYPE_FORM
-);
-parcelHelpers.export(exports, "API_STATUS", ()=>API_STATUS
-);
-parcelHelpers.export(exports, "API_INIT", ()=>API_INIT
-);
-parcelHelpers.export(exports, "API_RESTORE", ()=>API_RESTORE
-);
-parcelHelpers.export(exports, "API_GET_SECRET", ()=>API_GET_SECRET
-);
-parcelHelpers.export(exports, "API_RESET_PASS", ()=>API_RESET_PASS
-);
-parcelHelpers.export(exports, "API_CREATE_BACKUP", ()=>API_CREATE_BACKUP
-);
-parcelHelpers.export(exports, "API_DOWNLOAD_BACKUP", ()=>API_DOWNLOAD_BACKUP
-);
-parcelHelpers.export(exports, "API_RESTORE_BACKUP", ()=>API_RESTORE_BACKUP
-);
-parcelHelpers.export(exports, "API_UPLOAD_AVATAR", ()=>API_UPLOAD_AVATAR
-);
-parcelHelpers.export(exports, "API_UPLOAD_BACKGROUND", ()=>API_UPLOAD_BACKGROUND
-);
-parcelHelpers.export(exports, "API_IMAGE_UPLOAD", ()=>API_IMAGE_UPLOAD
-);
-parcelHelpers.export(exports, "TASK_SITE_INIT", ()=>TASK_SITE_INIT
-);
-parcelHelpers.export(exports, "TASK_BACKUP_RESTORE", ()=>TASK_BACKUP_RESTORE
-);
-parcelHelpers.export(exports, "TASK_BACKUP_CREATE", ()=>TASK_BACKUP_CREATE
-);
-parcelHelpers.export(exports, "TASK_GET_SECRET", ()=>TASK_GET_SECRET
-);
-parcelHelpers.export(exports, "TASK_RESET_PASS", ()=>TASK_RESET_PASS
-);
-parcelHelpers.export(exports, "TASK_UPLOAD_FILES", ()=>TASK_UPLOAD_FILES
-);
-parcelHelpers.export(exports, "API_ACCESS_GOOD", ()=>API_ACCESS_GOOD
-);
-parcelHelpers.export(exports, "API_ACCESS_BAD", ()=>API_ACCESS_BAD
-);
-parcelHelpers.export(exports, "default", ()=>MaintenanceManager
-);
-const REQUEST_TYPE_POST = 'POST';
-const REQUEST_TYPE_GET = 'GET';
-const REQUEST_TYPE_PUT = 'PUT';
-const REQUEST_TYPE_DELETE = 'DELETE'; //** POST CONTENT TYPES **//
-const CONTENT_TYPE_JSON = 'json';
-const CONTENT_TYPE_FORM = 'x-www-form-urlencoded'; //** API URLS **//
-const API_STATUS = '/api/v1/status';
-const API_INIT = '/api/v1/init';
-const API_RESTORE = '/api/v1/restore';
-const API_GET_SECRET = '/api/v1/get-secret';
-const API_RESET_PASS = '/api/v1/reset-password';
-const API_CREATE_BACKUP = '/api/v1/backup';
-const API_DOWNLOAD_BACKUP = '/api/v1/backup/download';
-const API_RESTORE_BACKUP = '/api/v1/backup/restore';
-const API_UPLOAD_AVATAR = '/api/v1/settings/add-avatar';
-const API_UPLOAD_BACKGROUND = '/api/v1/settings/add-feature-background';
-const API_IMAGE_UPLOAD = '/api/v1/page/add-entry-image'; //** API TASKS **//
-const TASK_SITE_INIT = 'blogInit';
-const TASK_BACKUP_RESTORE = 'restoreBackup';
-const TASK_BACKUP_CREATE = 'createBackup';
-const TASK_GET_SECRET = 'retrieveSecret';
-const TASK_RESET_PASS = 'resetPassword';
-const TASK_UPLOAD_FILES = 'uploadFiles'; //** API STATUS **//
-const API_ACCESS_GOOD = 'apiUseAuthorized';
-const API_ACCESS_BAD = 'apiUseNotAuthorized';
+parcelHelpers.export(exports, "REQUEST_TYPE_POST", ()=>REQUEST_TYPE_POST);
+parcelHelpers.export(exports, "REQUEST_TYPE_GET", ()=>REQUEST_TYPE_GET);
+parcelHelpers.export(exports, "REQUEST_TYPE_PUT", ()=>REQUEST_TYPE_PUT);
+parcelHelpers.export(exports, "REQUEST_TYPE_DELETE", ()=>REQUEST_TYPE_DELETE);
+parcelHelpers.export(exports, "CONTENT_TYPE_JSON", ()=>CONTENT_TYPE_JSON);
+parcelHelpers.export(exports, "CONTENT_TYPE_FORM", ()=>CONTENT_TYPE_FORM);
+parcelHelpers.export(exports, "API_STATUS", ()=>API_STATUS);
+parcelHelpers.export(exports, "API_INIT", ()=>API_INIT);
+parcelHelpers.export(exports, "API_RESTORE", ()=>API_RESTORE);
+parcelHelpers.export(exports, "API_GET_SECRET", ()=>API_GET_SECRET);
+parcelHelpers.export(exports, "API_RESET_PASS", ()=>API_RESET_PASS);
+parcelHelpers.export(exports, "API_CREATE_BACKUP", ()=>API_CREATE_BACKUP);
+parcelHelpers.export(exports, "API_DOWNLOAD_BACKUP", ()=>API_DOWNLOAD_BACKUP);
+parcelHelpers.export(exports, "API_RESTORE_BACKUP", ()=>API_RESTORE_BACKUP);
+parcelHelpers.export(exports, "API_UPLOAD_AVATAR", ()=>API_UPLOAD_AVATAR);
+parcelHelpers.export(exports, "API_UPLOAD_BACKGROUND", ()=>API_UPLOAD_BACKGROUND);
+parcelHelpers.export(exports, "API_IMAGE_UPLOAD", ()=>API_IMAGE_UPLOAD);
+parcelHelpers.export(exports, "TASK_SITE_INIT", ()=>TASK_SITE_INIT);
+parcelHelpers.export(exports, "TASK_BACKUP_RESTORE", ()=>TASK_BACKUP_RESTORE);
+parcelHelpers.export(exports, "TASK_BACKUP_CREATE", ()=>TASK_BACKUP_CREATE);
+parcelHelpers.export(exports, "TASK_GET_SECRET", ()=>TASK_GET_SECRET);
+parcelHelpers.export(exports, "TASK_RESET_PASS", ()=>TASK_RESET_PASS);
+parcelHelpers.export(exports, "TASK_UPLOAD_FILES", ()=>TASK_UPLOAD_FILES);
+parcelHelpers.export(exports, "API_ACCESS_GOOD", ()=>API_ACCESS_GOOD);
+parcelHelpers.export(exports, "API_ACCESS_BAD", ()=>API_ACCESS_BAD);
+parcelHelpers.export(exports, "default", ()=>MaintenanceManager);
+const REQUEST_TYPE_POST = "POST";
+const REQUEST_TYPE_GET = "GET";
+const REQUEST_TYPE_PUT = "PUT";
+const REQUEST_TYPE_DELETE = "DELETE"; //** POST CONTENT TYPES **//
+const CONTENT_TYPE_JSON = "json";
+const CONTENT_TYPE_FORM = "x-www-form-urlencoded"; //** API URLS **//
+const API_STATUS = "/api/v1/status";
+const API_INIT = "/api/v1/init";
+const API_RESTORE = "/api/v1/restore";
+const API_GET_SECRET = "/api/v1/get-secret";
+const API_RESET_PASS = "/api/v1/reset-password";
+const API_CREATE_BACKUP = "/api/v1/backup";
+const API_DOWNLOAD_BACKUP = "/api/v1/backup/download";
+const API_RESTORE_BACKUP = "/api/v1/backup/restore";
+const API_UPLOAD_AVATAR = "/api/v1/settings/add-avatar";
+const API_UPLOAD_BACKGROUND = "/api/v1/settings/add-feature-background";
+const API_IMAGE_UPLOAD = "/api/v1/page/add-entry-image"; //** API TASKS **//
+const TASK_SITE_INIT = "blogInit";
+const TASK_BACKUP_RESTORE = "restoreBackup";
+const TASK_BACKUP_CREATE = "createBackup";
+const TASK_GET_SECRET = "retrieveSecret";
+const TASK_RESET_PASS = "resetPassword";
+const TASK_UPLOAD_FILES = "uploadFiles"; //** API STATUS **//
+const API_ACCESS_GOOD = "apiUseAuthorized";
+const API_ACCESS_BAD = "apiUseNotAuthorized";
/**
* A tub of methods for creating/restoring installs, resetting passwords and uploading images.
*/ class MaintenanceManager {
@@ -1164,7 +1142,7 @@ const API_ACCESS_BAD = 'apiUseNotAuthorized';
this.key = null;
if (key) this.key = key;
if (baseURL) this.baseURL = baseURL; //if key is valid, checks to see if a session is active and returns
- this._request(this.baseURL ? this.baseURL + API_STATUS + '?key=' + this.key : API_STATUS + '?key=' + this.key).then((response)=>{
+ this._request(this.baseURL ? this.baseURL + API_STATUS + "?key=" + this.key : API_STATUS + "?key=" + this.key).then((response)=>{
if (response.type === API_ACCESS_GOOD) this.token = response.token;
});
}
@@ -1175,9 +1153,9 @@ const API_ACCESS_BAD = 'apiUseNotAuthorized';
* @property {string} new_member_email - email for new user
* @property {string} new_member_pass - password for new user
* @property {string} new_member_title - title for new user
- */ create(data1) {
+ */ create(data) {
return new Promise((resolve, reject)=>{
- this._request(API_INIT, TASK_SITE_INIT, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data1).then((result)=>{
+ this._request(API_INIT, TASK_SITE_INIT, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data).then((result)=>{
resolve(result);
}).catch((err)=>{
reject(err);
@@ -1215,7 +1193,7 @@ const API_ACCESS_BAD = 'apiUseNotAuthorized';
method = REQUEST_TYPE_POST;
type = CONTENT_TYPE_JSON;
data = {
- task: 'create_backup'
+ task: "create_backup"
};
this._request(url, event, method, type, data).then((result)=>{
resolve(result);
@@ -1243,9 +1221,9 @@ const API_ACCESS_BAD = 'apiUseNotAuthorized';
* @property {string} new_password - password for user
* @property {string} new_password2 - confirm password for user
* @property {string} secret - secret key for user
- */ newPass(data2) {
+ */ newPass(data) {
return new Promise((resolve, reject)=>{
- this._request(API_RESET_PASS, TASK_RESET_PASS, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data2).then((result)=>{
+ this._request(API_RESET_PASS, TASK_RESET_PASS, REQUEST_TYPE_POST, CONTENT_TYPE_JSON, data).then((result)=>{
resolve(result);
}).catch((err)=>{
reject(err);
@@ -1258,12 +1236,12 @@ const API_ACCESS_BAD = 'apiUseNotAuthorized';
* @param {input} files - form input containing files
*/ imageUpload(type, files) {
return new Promise((resolve, reject)=>{
- let url = '';
+ let url = "";
switch(type){
- case 'avatar-upload':
+ case "avatar-upload":
url = API_UPLOAD_AVATAR;
break;
- case 'background-upload':
+ case "background-upload":
url = API_UPLOAD_BACKGROUND;
break;
default:
@@ -1272,15 +1250,15 @@ const API_ACCESS_BAD = 'apiUseNotAuthorized';
}
var imageData = new FormData();
if (this.baseURL) {
- imageData.append('key', this.key);
- imageData.append('remote', true);
- } else imageData.append('remote', false);
+ imageData.append("key", this.key);
+ imageData.append("remote", true);
+ } else imageData.append("remote", false);
for(var i = 0; i < files.length; i++){
var file = files[i]; // Check the file type.
- if (!file.type.match('image.*')) continue;
- if (type === 'avatar-upload') imageData.append('avatar_upload', file, file.name);
- else if (type === 'background-upload') imageData.append('background_upload', file, file.name);
- else imageData.append('post_image', file, file.name);
+ if (!file.type.match("image.*")) continue;
+ if (type === "avatar-upload") imageData.append("avatar_upload", file, file.name);
+ else if (type === "background-upload") imageData.append("background_upload", file, file.name);
+ else imageData.append("post_image", file, file.name);
}
this._request(url, TASK_UPLOAD_FILES, REQUEST_TYPE_POST, CONTENT_TYPE_FORM, imageData).then((r)=>{
resolve(r);
@@ -1295,23 +1273,22 @@ const API_ACCESS_BAD = 'apiUseNotAuthorized';
var self = this;
return new Promise(function(resolve, reject) {
var request = new XMLHttpRequest();
- request.upload.addEventListener('progress', (e)=>self.handleLoadProgress(e, self.progressBar)
- );
+ request.upload.addEventListener("progress", (e)=>self.handleLoadProgress(e, self.progressBar));
request.open(requestType, requestURL, true);
request.onload = ()=>{
if (request.status == 200) {
- let response = JSON.parse(request['response']);
+ let response = JSON.parse(request["response"]);
resolve(response);
} else {
- let error = JSON.parse(request['response']);
+ let error = JSON.parse(request["response"]);
reject(error);
}
};
if (requestType == REQUEST_TYPE_PUT || requestType == REQUEST_TYPE_POST) {
- if (eventType === TASK_UPLOAD_FILES) request.setRequestHeader('fipamo-access-token', self.token);
+ if (eventType === TASK_UPLOAD_FILES) request.setRequestHeader("fipamo-access-token", self.token);
switch(contentType){
case CONTENT_TYPE_JSON:
- request.setRequestHeader('Content-type', 'application/' + contentType);
+ request.setRequestHeader("Content-type", "application/" + contentType);
request.send(JSON.stringify(requestData));
break;
case CONTENT_TYPE_FORM:
@@ -1323,31 +1300,30 @@ const API_ACCESS_BAD = 'apiUseNotAuthorized';
}
// event handlers
//--------------------------
- handleLoadProgress(e, progressBar1) {
+ handleLoadProgress(e, progressBar) {
let percent = Math.ceil(e.loaded / e.total * 100); //if a progress bar element is present, talk to it
- if (progressBar1 != null) progressBar1.style.width = percent + '%';
+ if (progressBar != null) progressBar.style.width = percent + "%";
}
}
-},{"@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"lpIyf":[function(require,module,exports) {
+},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"eM6UW":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
class DataUtils {
//--------------------------
// constructor
//--------------------------
- constructor(){
- }
+ constructor(){}
// methods
//--------------------------
imgLoad(url) {
- 'use strict'; // Create new promise with the Promise() constructor;
+ "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.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);
@@ -1357,18 +1333,18 @@ class DataUtils {
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.'));
+ reject(new Error("There was a network error."));
}; // Send the request
request.send();
});
}
loadImage(src) {
- 'use strict';
+ "use strict";
let self = this;
return new Promise(function(resolve, reject) {
// Get a reference to the body element, and create a new image object
var myImage = new Image();
- myImage.crossOrigin = ''; // or "anonymous"
+ 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) {
@@ -1388,8 +1364,7 @@ class DataUtils {
* @param : $('#form_example');
* @return a JSON Stringify
*/ formDataToJSON(form) {
- let object = {
- };
+ let object = {};
let formData = new FormData(form);
formData.forEach((value, key)=>{
if (!object.hasOwnProperty(key)) {
@@ -1406,93 +1381,51 @@ class DataUtils {
}
exports.default = DataUtils;
-},{"@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"edzJV":[function(require,module,exports) {
+},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"hCRFh":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
-parcelHelpers.export(exports, "AUTH_STATUS", ()=>AUTH_STATUS
-);
-parcelHelpers.export(exports, "REQUEST_GOOD", ()=>REQUEST_GOOD
-);
-parcelHelpers.export(exports, "REQUEST_LAME", ()=>REQUEST_LAME
-);
-parcelHelpers.export(exports, "API_REQUEST_GOOD", ()=>API_REQUEST_GOOD
-);
-parcelHelpers.export(exports, "API_REQUEST_LAME", ()=>API_REQUEST_LAME
-);
-parcelHelpers.export(exports, "IMG_REQUEST_GOOD", ()=>IMG_REQUEST_GOOD
-);
-parcelHelpers.export(exports, "IMG_REQUEST_LAME", ()=>IMG_REQUEST_LAME
-);
-parcelHelpers.export(exports, "SETTINGS_LOADED", ()=>SETTINGS_LOADED
-);
-parcelHelpers.export(exports, "POST_IMAGE_ADDED", ()=>POST_IMAGE_ADDED
-);
-parcelHelpers.export(exports, "FEATURE_IMAGE_ADDED", ()=>FEATURE_IMAGE_ADDED
-);
-parcelHelpers.export(exports, "PAGE_ERROR", ()=>PAGE_ERROR
-);
-parcelHelpers.export(exports, "PAGE_ADDED", ()=>PAGE_ADDED
-);
-parcelHelpers.export(exports, "PAGE_UPDATED", ()=>PAGE_UPDATED
-);
-parcelHelpers.export(exports, "PAGE_DELETED", ()=>PAGE_DELETED
-);
-parcelHelpers.export(exports, "PAGES_RENDERED", ()=>PAGES_RENDERED
-);
-parcelHelpers.export(exports, "PAGES_NOT_RENDERED", ()=>PAGES_NOT_RENDERED
-);
-parcelHelpers.export(exports, "TAG_PAGES_RENDERED", ()=>TAG_PAGES_RENDERED
-);
-parcelHelpers.export(exports, "TAG_PAGES_NOT_RENDERED", ()=>TAG_PAGES_NOT_RENDERED
-);
-parcelHelpers.export(exports, "SETTINGS_UPDATED", ()=>SETTINGS_UPDATED
-);
-parcelHelpers.export(exports, "SETTINGS_NOT_UPDATED", ()=>SETTINGS_NOT_UPDATED
-);
-parcelHelpers.export(exports, "MENU_ADD_ITEM", ()=>MENU_ADD_ITEM
-);
-parcelHelpers.export(exports, "MENU_DELETE_ITEM", ()=>MENU_DELETE_ITEM
-);
-parcelHelpers.export(exports, "MENU_UPDATED", ()=>MENU_UPDATED
-);
-parcelHelpers.export(exports, "AVATAR_UPLOADED", ()=>AVATAR_UPLOADED
-);
-parcelHelpers.export(exports, "SITE_BACKGROUND_UPLOADED", ()=>SITE_BACKGROUND_UPLOADED
-);
-parcelHelpers.export(exports, "UPLOAD_PROGRESS", ()=>UPLOAD_PROGRESS
-);
-parcelHelpers.export(exports, "API_PAGE_WRITE", ()=>API_PAGE_WRITE
-);
-parcelHelpers.export(exports, "API_PAGE_CREATE", ()=>API_PAGE_CREATE
-);
-parcelHelpers.export(exports, "API_PAGE_DELETE", ()=>API_PAGE_DELETE
-);
-parcelHelpers.export(exports, "API_SETTINGS_WRITE", ()=>API_SETTINGS_WRITE
-);
-parcelHelpers.export(exports, "API_BACKUP_CREATE", ()=>API_BACKUP_CREATE
-);
-parcelHelpers.export(exports, "API_BACKUP_DOWNLOAD", ()=>API_BACKUP_DOWNLOAD
-);
-parcelHelpers.export(exports, "API_BACKUP_RESTORE", ()=>API_BACKUP_RESTORE
-);
-parcelHelpers.export(exports, "API_IMAGES_UPLOAD", ()=>API_IMAGES_UPLOAD
-);
-parcelHelpers.export(exports, "API_RENDER_PAGES", ()=>API_RENDER_PAGES
-);
-parcelHelpers.export(exports, "API_REINDEX_PAGES", ()=>API_REINDEX_PAGES
-);
-parcelHelpers.export(exports, "API_INIT", ()=>API_INIT
-);
-parcelHelpers.export(exports, "API_INIT_GOOD", ()=>API_INIT_GOOD
-);
-parcelHelpers.export(exports, "API_INIT_LAME", ()=>API_INIT_LAME
-);
-parcelHelpers.export(exports, "API_GET_SECRET", ()=>API_GET_SECRET
-);
-parcelHelpers.export(exports, "API_RESET_PASS", ()=>API_RESET_PASS
-);
-parcelHelpers.export(exports, "SEND_MAIL", ()=>SEND_MAIL
-);
+parcelHelpers.export(exports, "AUTH_STATUS", ()=>AUTH_STATUS);
+parcelHelpers.export(exports, "REQUEST_GOOD", ()=>REQUEST_GOOD);
+parcelHelpers.export(exports, "REQUEST_LAME", ()=>REQUEST_LAME);
+parcelHelpers.export(exports, "API_REQUEST_GOOD", ()=>API_REQUEST_GOOD);
+parcelHelpers.export(exports, "API_REQUEST_LAME", ()=>API_REQUEST_LAME);
+parcelHelpers.export(exports, "IMG_REQUEST_GOOD", ()=>IMG_REQUEST_GOOD);
+parcelHelpers.export(exports, "IMG_REQUEST_LAME", ()=>IMG_REQUEST_LAME);
+parcelHelpers.export(exports, "SETTINGS_LOADED", ()=>SETTINGS_LOADED);
+parcelHelpers.export(exports, "POST_IMAGE_ADDED", ()=>POST_IMAGE_ADDED);
+parcelHelpers.export(exports, "FEATURE_IMAGE_ADDED", ()=>FEATURE_IMAGE_ADDED);
+parcelHelpers.export(exports, "PAGE_ERROR", ()=>PAGE_ERROR);
+parcelHelpers.export(exports, "PAGE_ADDED", ()=>PAGE_ADDED);
+parcelHelpers.export(exports, "PAGE_UPDATED", ()=>PAGE_UPDATED);
+parcelHelpers.export(exports, "PAGE_DELETED", ()=>PAGE_DELETED);
+parcelHelpers.export(exports, "PAGES_RENDERED", ()=>PAGES_RENDERED);
+parcelHelpers.export(exports, "PAGES_NOT_RENDERED", ()=>PAGES_NOT_RENDERED);
+parcelHelpers.export(exports, "TAG_PAGES_RENDERED", ()=>TAG_PAGES_RENDERED);
+parcelHelpers.export(exports, "TAG_PAGES_NOT_RENDERED", ()=>TAG_PAGES_NOT_RENDERED);
+parcelHelpers.export(exports, "SETTINGS_UPDATED", ()=>SETTINGS_UPDATED);
+parcelHelpers.export(exports, "SETTINGS_NOT_UPDATED", ()=>SETTINGS_NOT_UPDATED);
+parcelHelpers.export(exports, "MENU_ADD_ITEM", ()=>MENU_ADD_ITEM);
+parcelHelpers.export(exports, "MENU_DELETE_ITEM", ()=>MENU_DELETE_ITEM);
+parcelHelpers.export(exports, "MENU_UPDATED", ()=>MENU_UPDATED);
+parcelHelpers.export(exports, "AVATAR_UPLOADED", ()=>AVATAR_UPLOADED);
+parcelHelpers.export(exports, "SITE_BACKGROUND_UPLOADED", ()=>SITE_BACKGROUND_UPLOADED);
+parcelHelpers.export(exports, "UPLOAD_PROGRESS", ()=>UPLOAD_PROGRESS);
+parcelHelpers.export(exports, "API_PAGE_WRITE", ()=>API_PAGE_WRITE);
+parcelHelpers.export(exports, "API_PAGE_CREATE", ()=>API_PAGE_CREATE);
+parcelHelpers.export(exports, "API_PAGE_DELETE", ()=>API_PAGE_DELETE);
+parcelHelpers.export(exports, "API_SETTINGS_WRITE", ()=>API_SETTINGS_WRITE);
+parcelHelpers.export(exports, "API_BACKUP_CREATE", ()=>API_BACKUP_CREATE);
+parcelHelpers.export(exports, "API_BACKUP_DOWNLOAD", ()=>API_BACKUP_DOWNLOAD);
+parcelHelpers.export(exports, "API_BACKUP_RESTORE", ()=>API_BACKUP_RESTORE);
+parcelHelpers.export(exports, "API_IMAGES_UPLOAD", ()=>API_IMAGES_UPLOAD);
+parcelHelpers.export(exports, "API_RENDER_PAGES", ()=>API_RENDER_PAGES);
+parcelHelpers.export(exports, "API_REINDEX_PAGES", ()=>API_REINDEX_PAGES);
+parcelHelpers.export(exports, "API_INIT", ()=>API_INIT);
+parcelHelpers.export(exports, "API_INIT_GOOD", ()=>API_INIT_GOOD);
+parcelHelpers.export(exports, "API_INIT_LAME", ()=>API_INIT_LAME);
+parcelHelpers.export(exports, "API_GET_SECRET", ()=>API_GET_SECRET);
+parcelHelpers.export(exports, "API_RESET_PASS", ()=>API_RESET_PASS);
+parcelHelpers.export(exports, "SEND_MAIL", ()=>SEND_MAIL);
const AUTH_STATUS = "getAuthStatus";
const REQUEST_GOOD = "requestGood";
const REQUEST_LAME = "requestLame";
@@ -1539,7 +1472,7 @@ class DataEvent {
}
exports.default = new DataEvent();
-},{"@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"7hyn2":[function(require,module,exports) {
+},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"9gCOB":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
var _postIndex = require("./PostIndex");
@@ -1553,25 +1486,24 @@ class DashManager {
// constructor
//--------------------------
constructor(){
- this.currentDisplay = '';
- this.urlPieces = document.URL.split('/');
+ this.currentDisplay = "";
+ this.urlPieces = document.URL.split("/");
this.chooseDisplay(this.urlPieces[4], this.urlPieces[5]);
}
// methods
//--------------------------
- start() {
- }
+ start() {}
chooseDisplay(section, page) {
- this.currentDisplay = '';
+ this.currentDisplay = "";
switch(section){
- case 'page':
- this.currentDisplay = new _postIndexDefault.default(page);
+ case "page":
+ this.currentDisplay = new (0, _postIndexDefault.default)(page);
break;
- case 'settings':
- this.currentDisplay = new _settingsIndexDefault.default();
+ case "settings":
+ this.currentDisplay = new (0, _settingsIndexDefault.default)();
break;
- case 'navigation':
- this.currentDisplay = new _navIndexDefault.default();
+ case "navigation":
+ this.currentDisplay = new (0, _navIndexDefault.default)();
break;
default:
break;
@@ -1581,7 +1513,7 @@ class DashManager {
}
exports.default = DashManager;
-},{"./PostIndex":"k5HNa","./SettingsIndex":"js2Fi","./NavIndex":"9sqHb","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"k5HNa":[function(require,module,exports) {
+},{"./PostIndex":"gp1bn","./SettingsIndex":"4SQpj","./NavIndex":"6S99f","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"gp1bn":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
var _pageEditor = require("./PageEditor");
@@ -1597,14 +1529,13 @@ class PostIndex {
}
// methods
//--------------------------
- start() {
- }
- choosePage(page1) {
+ start() {}
+ choosePage(page) {
this.currentPage = "";
- switch(page1){
+ switch(page){
case "edit":
case "add":
- this.currentPage = new _pageEditorDefault.default();
+ this.currentPage = new (0, _pageEditorDefault.default)();
break;
default:
break;
@@ -1613,7 +1544,7 @@ class PostIndex {
}
exports.default = PostIndex;
-},{"./PageEditor":"dJ1gj","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"dJ1gj":[function(require,module,exports) {
+},{"./PageEditor":"jaapu","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"jaapu":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
//TOOLS
@@ -1631,7 +1562,7 @@ var _notifications = require("../ui/Notifications");
var _notificationsDefault = parcelHelpers.interopDefault(_notifications);
var _fileManager = require("../ui/FileManager");
var _fileManagerDefault = parcelHelpers.interopDefault(_fileManager);
-const notify = new _notificationsDefault.default();
+const notify = new (0, _notificationsDefault.default)();
class PostEditor {
//--------------------------
// constructor
@@ -1639,31 +1570,27 @@ class PostEditor {
constructor(){
this.processing = false;
let self = "this";
- this.admin = new _fipamoAdminAPIDefault.default(null, document.getElementById('notify-progress'));
- this.mm = new _maintenanceManagerDefault.default(null, null, document.getElementById('notify-progress'));
- this.urlPieces = document.URL.split('/');
+ this.admin = new (0, _fipamoAdminAPIDefault.default)(null, document.getElementById("notify-progress"));
+ this.mm = new (0, _maintenanceManagerDefault.default)(null, null, document.getElementById("notify-progress"));
+ this.urlPieces = document.URL.split("/");
this.post = [];
this.postID = null;
this.postUUID = null;
this.postLayout = null;
this.fm = null;
- if (document.getElementById('post-edit-index').getAttribute('data-index')) {
- this.postID = document.getElementById('post-edit-index').getAttribute('data-index');
- this.postUUID = document.getElementById('post-edit-index').getAttribute('data-uuid');
- this.postLayout = document.getElementById('post-edit-index').getAttribute('data-layout');
+ if (document.getElementById("post-edit-index").getAttribute("data-index")) {
+ this.postID = document.getElementById("post-edit-index").getAttribute("data-index");
+ this.postUUID = document.getElementById("post-edit-index").getAttribute("data-uuid");
+ this.postLayout = document.getElementById("post-edit-index").getAttribute("data-layout");
}
- if (document.getElementById('edit')) {
- this.editor = new _textEditorDefault.default(document.getElementById('edit'), document.getElementById('header').offsetHeight + document.getElementById('post-header').offsetHeight + document.getElementById('post-feature').offsetHeight);
- this.editor.addListener(_editorEvent.EDITOR_DELETE, ()=>this.handleEditorOptions(_editorEvent.EDITOR_DELETE)
- , false);
- this.editor.addListener(_editorEvent.EDITOR_UPLOAD_POST_IMAGE, ()=>this.handleEditorOptions(_editorEvent.EDITOR_UPLOAD_POST_IMAGE)
- , false);
- this.editor.addListener(_editorEvent.EDITOR_UPDATE, ()=>this.handleEditorOptions(_editorEvent.EDITOR_UPDATE)
- , false);
- this.editor.addListener(_editorEvent.EDITOR_SAVE, ()=>this.handleEditorOptions(_editorEvent.EDITOR_SAVE)
- , false);
- document.getElementById('post-image-upload').addEventListener('change', (e)=>{
- self.handleImageUpload(e.target.id, e.target.files);
+ if (document.getElementById("edit")) {
+ this.editor = new (0, _textEditorDefault.default)(document.getElementById("edit"), document.getElementById("header").offsetHeight + document.getElementById("post-header").offsetHeight + document.getElementById("post-feature").offsetHeight);
+ this.editor.addListener(_editorEvent.EDITOR_DELETE, ()=>this.handleEditorOptions(_editorEvent.EDITOR_DELETE), false);
+ this.editor.addListener(_editorEvent.EDITOR_UPLOAD_POST_IMAGE, ()=>this.handleEditorOptions(_editorEvent.EDITOR_UPLOAD_POST_IMAGE), false);
+ this.editor.addListener(_editorEvent.EDITOR_UPDATE, ()=>this.handleEditorOptions(_editorEvent.EDITOR_UPDATE), false);
+ this.editor.addListener(_editorEvent.EDITOR_SAVE, ()=>this.handleEditorOptions(_editorEvent.EDITOR_SAVE), false);
+ document.getElementById("post-image-upload").addEventListener("change", (e)=>{
+ this.handleImageUpload(e.target.id, e.target.files);
}, false);
/*
TinyDatePicker(document.getElementById('post-date'), {
@@ -1678,12 +1605,11 @@ class PostEditor {
// methods
//--------------------------
start() {
- if (document.getElementById('page-file-drop')) {
+ if (document.getElementById("page-file-drop")) {
//insert fileManager here
- this.fm = new _fileManagerDefault.default(document.getElementById('page-file-drop'), document.getElementById('page-files-upload'), document.getElementById('page-images-list'), document.getElementById('page-files-list'));
- var optionButtons = document.querySelectorAll('.post-option-btn');
- for(var i = 0, length = optionButtons.length; i < length; i++)optionButtons[i].addEventListener('click', (e)=>this.handlePostOptions(e)
- , false);
+ this.fm = new (0, _fileManagerDefault.default)(document.getElementById("page-file-drop"), document.getElementById("page-files-upload"), document.getElementById("page-images-list"), document.getElementById("page-files-list"));
+ var optionButtons = document.querySelectorAll(".post-option-btn");
+ for(var i = 0, length = optionButtons.length; i < length; i++)optionButtons[i].addEventListener("click", (e)=>this.handlePostOptions(e), false);
}
}
// event handlers
@@ -1691,42 +1617,42 @@ class PostEditor {
handlePostOptions(e) {
let currentOption = null;
switch(e.target.id){
- case 'option-page-icon':
- case 'option-menu-pin':
- currentOption = document.getElementById('option-menu-pin');
+ case "option-page-icon":
+ case "option-menu-pin":
+ currentOption = document.getElementById("option-menu-pin");
break;
- case 'option-feature-icon':
- case 'option-feature':
- currentOption = document.getElementById('option-feature');
+ case "option-feature-icon":
+ case "option-feature":
+ currentOption = document.getElementById("option-feature");
break;
- case 'option-published-icon':
- case 'option-published':
- currentOption = document.getElementById('option-published');
+ case "option-published-icon":
+ case "option-published":
+ currentOption = document.getElementById("option-published");
break;
}
if (currentOption != null) {
- let active = currentOption.getAttribute('data-active');
- active == 'false' ? currentOption.setAttribute('data-active', 'true') : currentOption.setAttribute('data-active', 'false');
+ let active = currentOption.getAttribute("data-active");
+ active == "false" ? currentOption.setAttribute("data-active", "true") : currentOption.setAttribute("data-active", "false");
}
}
- handleEditorOptions(e1) {
+ handleEditorOptions(e) {
if (this.processing) return;
let self = this;
- switch(e1){
+ switch(e){
case _editorEvent.EDITOR_SAVE:
case _editorEvent.EDITOR_UPDATE:
- var task = '';
- e1 === _editorEvent.EDITOR_SAVE ? task = _fipamoAdminAPI.TASK_PAGE_CREATE : task = _fipamoAdminAPI.TASK_PAGE_EDIT;
- new _pageActionsDefault.default().collectInfo(this.fm.getFiles()).then((page)=>{
+ var task = "";
+ e === _editorEvent.EDITOR_SAVE ? task = (0, _fipamoAdminAPI.TASK_PAGE_CREATE) : task = (0, _fipamoAdminAPI.TASK_PAGE_EDIT);
+ new (0, _pageActionsDefault.default)().collectInfo(this.fm.getFiles()).then((page)=>{
self.processing = true;
- notify.alert('Writing down changes', null);
+ notify.alert("Writing down changes", null);
self.admin.pageActions(task, page).then((r)=>{
self.processing = false;
if (r.type === _dataEvent.PAGE_ERROR || r.type === _dataEvent.API_REQUEST_LAME) notify.alert(r.message, false);
else if (r.type === _dataEvent.PAGE_UPDATED) notify.alert(r.message, true);
else {
notify.alert(r.message, true);
- window.location = '/dashboard/page/edit/' + r.id;
+ window.location = "/dashboard/page/edit/" + r.id;
}
}).catch((err)=>{
self.processing = false;
@@ -1735,44 +1661,43 @@ class PostEditor {
});
break;
case _editorEvent.EDITOR_DELETE:
- if (this.postLayout === 'index') {
- notify.alert('Index cannot be deleted', false);
+ if (this.postLayout === "index") {
+ notify.alert("Index cannot be deleted", false);
return;
}
- if (confirm("AYE! You know you're deleting this post, right?")) new _pageActionsDefault.default().collectInfo(document.getElementById('featured-image-upload').files[0]).then((page)=>{
+ if (confirm("AYE! You know you're deleting this post, right?")) new (0, _pageActionsDefault.default)().collectInfo(document.getElementById("featured-image-upload").files[0]).then((page)=>{
self.processing = true;
- this.admin.pageActions(_fipamoAdminAPI.TASK_PAGE_DELETE, page).then(()=>{
+ this.admin.pageActions((0, _fipamoAdminAPI.TASK_PAGE_DELETE), page).then(()=>{
self.processing = false;
- window.location = '/dashboard/pages';
+ window.location = "/dashboard/pages";
}).catch((err)=>{
self.processing = false;
notify.alert(err, false);
});
- }).catch(()=>{
- });
+ }).catch(()=>{});
break;
case _editorEvent.EDITOR_UPLOAD_POST_IMAGE:
- document.getElementById('post-image-upload').click();
+ document.getElementById("post-image-upload").click();
break;
}
}
handleImageUpload(type, files) {
let self = this;
- notify.alert('Uploading Image', null);
+ notify.alert("Uploading Image", null);
self.mm.imageUpload(type, files).then((r)=>{
if (r.type == _dataEvent.POST_IMAGE_ADDED) {
self.editor.notify(_editorEvent.EDITOR_UPLOAD_POST_IMAGE, r.url);
- notify.alert('Image Added to Entry', true);
- } else notify.alert('Uh oh. Image not added', false);
+ notify.alert("Image Added to Entry", true);
+ } else notify.alert("Uh oh. Image not added", false);
}).catch(()=>{
- notify.alert('Uh oh. Image not added', false); //console.log('ERROR', err);
+ notify.alert("Uh oh. Image not added", false); //console.log('ERROR', err);
});
}
}
exports.default = PostEditor;
PostEditor.uploadFiles = [];
-},{"../../libraries/FipamoAdminAPI":"6M96o","./MaintenanceManager":"kY7L1","../events/DataEvent":"edzJV","../actions/PageActions":"5t6eY","../events/EditorEvent":"dW8iq","../ui/TextEditor":"bMFpA","../ui/Notifications":"fmUxI","../ui/FileManager":"kp4D5","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"5t6eY":[function(require,module,exports) {
+},{"../../libraries/FipamoAdminAPI":"3dcvg","./MaintenanceManager":"cYXLM","../events/DataEvent":"hCRFh","../actions/PageActions":"aIgBQ","../events/EditorEvent":"lqMYV","../ui/TextEditor":"hpLqF","../ui/Notifications":"9GRdG","../ui/FileManager":"6B20o","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"aIgBQ":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
var _stringUtils = require("../utils/StringUtils");
@@ -1781,41 +1706,41 @@ class PostActions {
//--------------------------
// constructor
//--------------------------
- constructor(){
- }
+ constructor(){}
// methods
//--------------------------
collectInfo(files) {
return new Promise((resolve, reject)=>{
let pageInfo = new FormData();
- let txt = document.createElement('textarea');
- txt.innerHTML = document.getElementById('highlight-content').innerHTML;
+ pageInfo.enctype = "multipart/form-data";
+ let txt = document.createElement("textarea");
+ txt.innerHTML = document.getElementById("highlight-content").innerHTML;
let html = txt.value;
- html = html.replace(/<\/?span[^>]*>/g, ''); //removes prism styling
- html = html.replace(/<\/?br[^>]*>/g, '\n'); //convert back to encoded line break for storage
- pageInfo.append('id', document.getElementById('post-edit-index').getAttribute('data-index'));
- pageInfo.append('uuid', document.getElementById('post-edit-index').getAttribute('data-uuid'));
- pageInfo.append('layout', document.getElementById('post-edit-index').getAttribute('data-layout'));
- pageInfo.append('current_title', document.getElementById('post-edit-index').getAttribute('data-slug'));
- pageInfo.append('content', html);
- pageInfo.append('title', document.getElementById('post-title-text').value);
- pageInfo.append('created', document.getElementById('post-date').getAttribute('data-raw'));
- pageInfo.append('slug', new _stringUtilsDefault.default().cleanString(document.getElementById('post-title-text').value));
- pageInfo.append('tags', document.getElementById('post-tags').value);
- pageInfo.append('menu', document.getElementById('option-menu-pin').getAttribute('data-active'));
- pageInfo.append('featured', document.getElementById('option-feature').getAttribute('data-active'));
- pageInfo.append('published', document.getElementById('option-published').getAttribute('data-active'));
- pageInfo.append('layout', document.getElementById('page-templates').value);
- pageInfo.append('form_token', document.getElementById('form_token').value);
+ html = html.replace(/<\/?span[^>]*>/g, ""); //removes prism styling
+ html = html.replace(/<\/?br[^>]*>/g, "\n"); //convert back to encoded line break for storage
+ pageInfo.append("id", document.getElementById("post-edit-index").getAttribute("data-index"));
+ pageInfo.append("uuid", document.getElementById("post-edit-index").getAttribute("data-uuid"));
+ pageInfo.append("layout", document.getElementById("post-edit-index").getAttribute("data-layout"));
+ pageInfo.append("current_title", document.getElementById("post-edit-index").getAttribute("data-slug"));
+ pageInfo.append("content", html);
+ pageInfo.append("title", document.getElementById("post-title-text").value);
+ pageInfo.append("created", document.getElementById("post-date").getAttribute("data-raw"));
+ pageInfo.append("slug", new (0, _stringUtilsDefault.default)().cleanString(document.getElementById("post-title-text").value));
+ pageInfo.append("tags", document.getElementById("post-tags").value);
+ pageInfo.append("menu", document.getElementById("option-menu-pin").getAttribute("data-active"));
+ pageInfo.append("featured", document.getElementById("option-feature").getAttribute("data-active"));
+ pageInfo.append("published", document.getElementById("option-published").getAttribute("data-active"));
+ pageInfo.append("layout", document.getElementById("page-templates").value);
+ pageInfo.append("form_token", document.getElementById("form_token").value);
if (files.length > 0 && files != null) for(var i = 0; i < files.length; i++){
var file = files[i];
- if (file.type.match('image.*') || file.type.match('video.mp4') || file.type.match('audio.mpeg') || file.type.match('application.pdf') || file.type.match('text.plain') || file.type.match('text.rtf')) pageInfo.append('page_files[]', file, file.name);
- else reject('Not an image file: ' + file.type);
+ if (file.type.match("image.*") || file.type.match("video.mp4") || file.type.match("audio.mpeg") || file.type.match("application.pdf") || file.type.match("text.plain") || file.type.match("text.rtf")) pageInfo.append("page_files[]", file, file.name);
+ else reject("Not an image file: " + file.type);
}
else //check to see if image exists
- if (document.getElementById('featured-image')) {
- var imageURL = document.getElementById('featured-image').src;
- imageURL != null || imageURL != undefined ? pageInfo.append('feature_image', imageURL) : pageInfo.append('feature_image', null);
+ if (document.getElementById("featured-image")) {
+ var imageURL = document.getElementById("featured-image").src;
+ imageURL != null || imageURL != undefined ? pageInfo.append("feature_image", imageURL) : pageInfo.append("feature_image", null);
}
//console.log("FILES", files);
resolve(pageInfo);
@@ -1824,25 +1749,24 @@ class PostActions {
}
exports.default = PostActions;
-},{"../utils/StringUtils":"firFv","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"firFv":[function(require,module,exports) {
+},{"../utils/StringUtils":"3SgRC","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"3SgRC":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
class StringUtils {
//--------------------------
// constructor
//--------------------------
- constructor(){
- }
+ constructor(){}
// methods
//--------------------------
cleanString(string) {
- var clean = string.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g, '').toLowerCase().replace(/[\/_| -]+/g, '-');
+ var clean = string.replace(/(^\-+|[^a-zA-Z0-9\/_| -]+|\-+$)/g, "").toLowerCase().replace(/[\/_| -]+/g, "-");
return clean;
}
- decodeHTML(string1, quote_style) {
+ decodeHTML(string, quote_style) {
var optTemp = 0, i = 0, noquotes = false;
- if (typeof quote_style === 'undefined') quote_style = 2;
- string1 = string1.toString().replace(/</g, '<').replace(/>/g, '>');
+ if (typeof quote_style === "undefined") quote_style = 2;
+ string = string.toString().replace(/</g, "<").replace(/>/g, ">");
var OPTS = {
ENT_NOQUOTES: 0,
ENT_HTML_QUOTE_SINGLE: 1,
@@ -1852,7 +1776,7 @@ class StringUtils {
ENT_IGNORE: 4
};
if (quote_style === 0) noquotes = true;
- if (typeof quote_style !== 'number') {
+ 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++){
@@ -1862,35 +1786,31 @@ class StringUtils {
}
quote_style = optTemp;
}
- if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) string1 = string1.replace(/*39;/g, "'"); // PHP doesn't currently escape if more than one 0, but it should
- if (!noquotes) string1 = string1.replace(/"/g, '"');
+ if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) string = string.replace(/*39;/g, "'"); // PHP doesn't currently escape if more than one 0, but it should
+ if (!noquotes) string = string.replace(/"/g, '"');
// Put this in last place to avoid escape being double-decoded
- string1 = string1.replace(/&/g, '&');
- return string1;
+ string = string.replace(/&/g, "&");
+ return string;
}
}
exports.default = StringUtils;
-},{"@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"dW8iq":[function(require,module,exports) {
+},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"lqMYV":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
-parcelHelpers.export(exports, "EDITOR_DELETE", ()=>EDITOR_DELETE
-);
-parcelHelpers.export(exports, "EDITOR_UPLOAD_POST_IMAGE", ()=>EDITOR_UPLOAD_POST_IMAGE
-);
-parcelHelpers.export(exports, "EDITOR_SAVE", ()=>EDITOR_SAVE
-);
-parcelHelpers.export(exports, "EDITOR_UPDATE", ()=>EDITOR_UPDATE
-);
-const EDITOR_DELETE = 'editorDelete';
-const EDITOR_UPLOAD_POST_IMAGE = 'editorUploadImage';
-const EDITOR_SAVE = 'editorSave';
-const EDITOR_UPDATE = 'editorUpdate';
+parcelHelpers.export(exports, "EDITOR_DELETE", ()=>EDITOR_DELETE);
+parcelHelpers.export(exports, "EDITOR_UPLOAD_POST_IMAGE", ()=>EDITOR_UPLOAD_POST_IMAGE);
+parcelHelpers.export(exports, "EDITOR_SAVE", ()=>EDITOR_SAVE);
+parcelHelpers.export(exports, "EDITOR_UPDATE", ()=>EDITOR_UPDATE);
+const EDITOR_DELETE = "editorDelete";
+const EDITOR_UPLOAD_POST_IMAGE = "editorUploadImage";
+const EDITOR_SAVE = "editorSave";
+const EDITOR_UPDATE = "editorUpdate";
class EditorEvent {
}
exports.default = new EditorEvent();
-},{"@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"bMFpA":[function(require,module,exports) {
+},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"hpLqF":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
var _dataEvent = require("../events/DataEvent");
@@ -1902,7 +1822,7 @@ var _prismCore = require("prismjs/components/prism-core");
var _prismCoreDefault = parcelHelpers.interopDefault(_prismCore);
var _prismMarkup = require("prismjs/components/prism-markup");
var _prismMarkdown = require("prismjs/components/prism-markdown");
-class TextEditor extends _eventEmitterDefault.default {
+class TextEditor extends (0, _eventEmitterDefault.default) {
/**
* Text Editor UI Component
* @constructor
@@ -1922,7 +1842,7 @@ class TextEditor extends _eventEmitterDefault.default {
document.getElementById("edit-post-wrapper").style.height = editorHeight + "px";
e.target.style.height = editorHeight + 30 + "px"; //TODO: yeah, it's ugly but it works for now, fix soon
// Syntax Highlight
- _prismCoreDefault.default.highlightElement(result_element);
+ (0, _prismCoreDefault.default).highlightElement(result_element);
});
document.getElementById("edit").addEventListener("scroll", (e)=>{
/* Scroll result to scroll coords of event - sync with textarea */ let result_element = document.querySelector("#highlight"); // Get and set x and y
@@ -1941,8 +1861,7 @@ class TextEditor extends _eventEmitterDefault.default {
//--------------------------
setInputs() {
var editorButtons = document.querySelectorAll(".editor-button");
- for(var i = 0, length = editorButtons.length; i < length; i++)editorButtons[i].addEventListener("click", (e)=>this.handleEditorOption(e)
- , false);
+ for(var i = 0, length = editorButtons.length; i < length; i++)editorButtons[i].addEventListener("click", (e)=>this.handleEditorOption(e), false);
}
notify(type, data) {
switch(type){
@@ -2015,7 +1934,7 @@ class TextEditor extends _eventEmitterDefault.default {
}
break;
case "edit-image":
- this.caretPos = _caretPos.position(this.textEditor).pos;
+ this.caretPos = (0, _caretPos.position)(this.textEditor).pos;
this.emitEvent(_editorEvent.EDITOR_UPLOAD_POST_IMAGE);
break;
case "submit-save":
@@ -2037,49 +1956,46 @@ class TextEditor extends _eventEmitterDefault.default {
}
exports.default = TextEditor;
-},{"../events/DataEvent":"edzJV","caret-pos":"9lzNv","../events/EventEmitter":"cbFNs","../events/EditorEvent":"dW8iq","prismjs/components/prism-core":"cps8h","prismjs/components/prism-markup":"dIns2","prismjs/components/prism-markdown":"gqRFx","@parcel/transformer-js/src/esmodule-helpers.js":"ciiiV"}],"9lzNv":[function(require,module,exports) {
+},{"../events/DataEvent":"hCRFh","caret-pos":"eNzYQ","../events/EventEmitter":"7LyKC","../events/EditorEvent":"lqMYV","prismjs/components/prism-core":"dRApq","prismjs/components/prism-markup":"lzIPu","prismjs/components/prism-markdown":"15tfx","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"eNzYQ":[function(require,module,exports) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
-parcelHelpers.export(exports, "getOffset", ()=>getOffset1
-);
-parcelHelpers.export(exports, "offset", ()=>offset1
-);
-parcelHelpers.export(exports, "position", ()=>position1
-);
+parcelHelpers.export(exports, "getOffset", ()=>getOffset);
+parcelHelpers.export(exports, "offset", ()=>offset);
+parcelHelpers.export(exports, "position", ()=>position);
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'
+ "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
@@ -2091,19 +2007,19 @@ var attributes = [
*/ var createMirror = function createMirror(element, html1) {
/**
* The mirror element
- */ var mirror = document.createElement('div');
+ */ 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',
+ position: "absolute",
left: -9999,
top: 0,
zIndex: -2000
};
- if (element.tagName === 'TEXTAREA') attributes.push('width');
+ if (element.tagName === "TEXTAREA") attributes.push("width");
attributes.forEach(function(attr) {
css[attr] = getComputedStyle(element)[attr];
});
@@ -2128,7 +2044,7 @@ var attributes = [
*
* @return {Rect} The bounding rect
*/ var rect = function rect() {
- var marker = mirror.ownerDocument.getElementById('caret-position-marker');
+ var marker = mirror.ownerDocument.getElementById("caret-position-marker");
var boundingRect = {
left: marker.offsetLeft,
top: marker.offsetTop,
@@ -2143,6 +2059,7 @@ var attributes = [
};
};
function _typeof(obj1) {
+ "@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof = function(obj) {
return typeof obj;
};
@@ -2158,7 +2075,7 @@ function _typeof(obj1) {
*
* @return {bool} If it is content editable
*/ var isContentEditable = function isContentEditable(element) {
- return !!(element.contentEditable ? element.contentEditable === 'true' : element.getAttribute('contenteditable') === 'true');
+ return !!(element.contentEditable ? element.contentEditable === "true" : element.getAttribute("contenteditable") === "true");
};
/**
* Get the context from settings passed in
@@ -2167,8 +2084,7 @@ function _typeof(obj1) {
*
* @return {object} window and document
*/ var getContext = function getContext() {
- var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
- };
+ 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,
@@ -2191,7 +2107,7 @@ function _typeof(obj1) {
* @param {object} ctx The context
*
* @return {object} top and left
- */ var getOffset1 = function getOffset(element, ctx) {
+ */ var getOffset = function getOffset(element, ctx) {
var win = ctx && ctx.window || window;
var doc = ctx && ctx.document || document;
var rect = element.getBoundingClientRect();
@@ -2210,7 +2126,7 @@ function _typeof(obj1) {
*
* @return {bool} If it is an object
*/ var isObject = function isObject(value) {
- return _typeof(value) === 'object' && value !== null;
+ return _typeof(value) === "object" && value !== null;
};
/**
* Create a Input caret object.
@@ -2242,12 +2158,12 @@ function _typeof(obj1) {
*
* @return {object} The offset
*/ var getOffset$1 = function getOffset$1(pos) {
- var rect = getOffset1(element);
- var position = getPosition(pos);
+ var rect = getOffset(element);
+ var position1 = getPosition(pos);
return {
- top: rect.top + position.top + ctx.document.body.scrollTop,
- left: rect.left + position.left + ctx.document.body.scrollLeft,
- height: position.height
+ top: rect.top + position1.top + ctx.document.body.scrollTop,
+ left: rect.left + position1.left + ctx.document.body.scrollLeft,
+ height: position1.height
};
};
/**
@@ -2258,16 +2174,16 @@ function _typeof(obj1) {
* @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, '