Minor js hotfixes

Updating the script and the html to call the new file name, which is
called 'dash.js'
beta b2.6.0
Ro 2 years ago
commit 8622ba5941
Signed by: are0h
GPG Key ID: 29B551CDBD4D3B50

4
.gitignore vendored

@ -15,10 +15,14 @@ public/assets/css/*
!public/assets/css/dash !public/assets/css/dash
!public/assets/scripts !public/assets/scripts
public/assets/scripts/* public/assets/scripts/*
<<<<<<< HEAD
!public/assets/scripts/Start.js !public/assets/scripts/Start.js
/public/assets/images/global/rikc-logo.svg /public/assets/images/global/rikc-logo.svg
=======
!public/assets/scripts/dash.js
>>>>>>> develop
!public/assets/images !public/assets/images
public/assets/images/* public/assets/images/*
!public/assets/images/global/ !public/assets/images/global/

@ -43,6 +43,6 @@
{% endapply %} {% endapply %}
</main> </main>
<footer></footer> <footer></footer>
<script type="module" src="/assets/scripts/start.js?=dfdfdfse"></script> <script type="module" src="/assets/scripts/dash.js"></script>
</body> </body>
</html> </html>

15
package-lock.json generated

@ -1,15 +1,14 @@
{ {
"name": "fipamo-dash", "name": "fipamo-dash",
"version": "2.5.1-beta", "version": "2.6.0-beta",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "fipamo-dash", "name": "fipamo-dash",
"version": "2.5.1-beta", "version": "2.6.0-beta",
"dependencies": { "dependencies": {
"animejs": "^3.2.1", "animejs": "^3.2.1",
"caret-pos": "^2.0.0",
"prismjs": "^1.29.0", "prismjs": "^1.29.0",
"sortablejs": "^1.15.0" "sortablejs": "^1.15.0"
}, },
@ -2098,11 +2097,6 @@
} }
] ]
}, },
"node_modules/caret-pos": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/caret-pos/-/caret-pos-2.0.0.tgz",
"integrity": "sha512-cOIiBS1SjzXg+LXSiQAzGg89dHDKq/y4c30+tB5hkVN7GbtXh1BNypOmjti4LwAWQrvP4y+bNG7RJFxLGoL3bA=="
},
"node_modules/chalk": { "node_modules/chalk": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@ -6154,11 +6148,6 @@
"integrity": "sha512-cEdN/5e+RPikvl9AHm4uuLXxeCNq8rFsQ+lPHTfe/OtypP3WwnVVbjn+6uBV7PaFL6xUFzTh+sSCOz1rKhcO+Q==", "integrity": "sha512-cEdN/5e+RPikvl9AHm4uuLXxeCNq8rFsQ+lPHTfe/OtypP3WwnVVbjn+6uBV7PaFL6xUFzTh+sSCOz1rKhcO+Q==",
"dev": true "dev": true
}, },
"caret-pos": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/caret-pos/-/caret-pos-2.0.0.tgz",
"integrity": "sha512-cOIiBS1SjzXg+LXSiQAzGg89dHDKq/y4c30+tB5hkVN7GbtXh1BNypOmjti4LwAWQrvP4y+bNG7RJFxLGoL3bA=="
},
"chalk": { "chalk": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",

@ -7,8 +7,8 @@
"version": "1.0.0", "version": "1.0.0",
"description": "The most chill API for the most chill blog framework" "description": "The most chill API for the most chill blog framework"
}, },
"source": "src/com/Start.js", "source": "src/com/start.js",
"main": "public/assets/scripts/start.js", "main": "public/assets/scripts/dash.js",
"targets": { "targets": {
"main": { "main": {
"includeNodeModules": true "includeNodeModules": true
@ -28,7 +28,6 @@
}, },
"dependencies": { "dependencies": {
"animejs": "^3.2.1", "animejs": "^3.2.1",
"caret-pos": "^2.0.0",
"prismjs": "^1.29.0", "prismjs": "^1.29.0",
"sortablejs": "^1.15.0" "sortablejs": "^1.15.0"
} }

@ -767,407 +767,6 @@ var $0d6abf40542266b3$export$2e2bcd8739ae039 = new $0d6abf40542266b3$var$EditorE
var $bba420c8ea874359$var$attributes = [
"borderBottomWidth",
"borderLeftWidth",
"borderRightWidth",
"borderTopStyle",
"borderRightStyle",
"borderBottomStyle",
"borderLeftStyle",
"borderTopWidth",
"boxSizing",
"fontFamily",
"fontSize",
"fontWeight",
"height",
"letterSpacing",
"lineHeight",
"marginBottom",
"marginLeft",
"marginRight",
"marginTop",
"outlineWidth",
"overflow",
"overflowX",
"overflowY",
"paddingBottom",
"paddingLeft",
"paddingRight",
"paddingTop",
"textAlign",
"textOverflow",
"textTransform",
"whiteSpace",
"wordBreak",
"wordWrap"
];
/**
* Create a mirror
*
* @param {Element} element The element
* @param {string} html The html
*
* @return {object} The mirror object
*/ var $bba420c8ea874359$var$createMirror = function createMirror(element, html) {
/**
* The mirror element
*/ var mirror = document.createElement("div");
/**
* Create the CSS for the mirror object
*
* @return {object} The style object
*/ var mirrorCss = function mirrorCss() {
var css = {
position: "absolute",
left: -9999,
top: 0,
zIndex: -2000
};
if (element.tagName === "TEXTAREA") $bba420c8ea874359$var$attributes.push("width");
$bba420c8ea874359$var$attributes.forEach(function(attr) {
css[attr] = getComputedStyle(element)[attr];
});
return css;
};
/**
* Initialize the mirror
*
* @param {string} html The html
*
* @return {void}
*/ var initialize = function initialize(html) {
var styles = mirrorCss();
Object.keys(styles).forEach(function(key) {
mirror.style[key] = styles[key];
});
mirror.innerHTML = html;
element.parentNode.insertBefore(mirror, element.nextSibling);
};
/**
* Get the rect
*
* @return {Rect} The bounding rect
*/ var rect = function rect() {
var marker = mirror.ownerDocument.getElementById("caret-position-marker");
var boundingRect = {
left: marker.offsetLeft,
top: marker.offsetTop,
height: marker.offsetHeight
};
mirror.parentNode.removeChild(mirror);
return boundingRect;
};
initialize(html);
return {
rect: rect
};
};
function $bba420c8ea874359$var$_typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") $bba420c8ea874359$var$_typeof = function(obj) {
return typeof obj;
};
else $bba420c8ea874359$var$_typeof = function(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
return $bba420c8ea874359$var$_typeof(obj);
}
/**
* Check if a DOM Element is content editable
*
* @param {Element} element The DOM element
*
* @return {bool} If it is content editable
*/ var $bba420c8ea874359$var$isContentEditable = function isContentEditable(element) {
return !!(element.contentEditable ? element.contentEditable === "true" : element.getAttribute("contenteditable") === "true");
};
/**
* Get the context from settings passed in
*
* @param {object} settings The settings object
*
* @return {object} window and document
*/ var $bba420c8ea874359$var$getContext = function getContext() {
var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var customPos = settings.customPos, iframe = settings.iframe, noShadowCaret = settings.noShadowCaret;
if (iframe) return {
iframe: iframe,
window: iframe.contentWindow,
document: iframe.contentDocument || iframe.contentWindow.document,
noShadowCaret: noShadowCaret,
customPos: customPos
};
return {
window: window,
document: document,
noShadowCaret: noShadowCaret,
customPos: customPos
};
};
/**
* Get the offset of an element
*
* @param {Element} element The DOM element
* @param {object} ctx The context
*
* @return {object} top and left
*/ var $bba420c8ea874359$export$622cea445a1c5b7d = function getOffset(element, ctx) {
var win = ctx && ctx.window || window;
var doc = ctx && ctx.document || document;
var rect = element.getBoundingClientRect();
var docEl = doc.documentElement;
var scrollLeft = win.pageXOffset || docEl.scrollLeft;
var scrollTop = win.pageYOffset || docEl.scrollTop;
return {
top: rect.top + scrollTop,
left: rect.left + scrollLeft
};
};
/**
* Check if a value is an object
*
* @param {any} value The value to check
*
* @return {bool} If it is an object
*/ var $bba420c8ea874359$var$isObject = function isObject(value) {
return $bba420c8ea874359$var$_typeof(value) === "object" && value !== null;
};
/**
* Create a Input caret object.
*
* @param {Element} element The element
* @param {Object} ctx The context
*/ var $bba420c8ea874359$var$createInputCaret = function createInputCaret(element, ctx) {
/**
* Get the current position
*
* @returns {int} The caret position
*/ var getPos = function getPos() {
return element.selectionStart;
};
/**
* Set the position
*
* @param {int} pos The position
*
* @return {Element} The element
*/ var setPos = function setPos(pos) {
element.setSelectionRange(pos, pos);
return element;
};
/**
* The offset
*
* @param {int} pos The position
*
* @return {object} The offset
*/ var getOffset$1 = function getOffset$1(pos) {
var rect = $bba420c8ea874359$export$622cea445a1c5b7d(element);
var position = getPosition(pos);
return {
top: rect.top + position.top + ctx.document.body.scrollTop,
left: rect.left + position.left + ctx.document.body.scrollLeft,
height: position.height
};
};
/**
* Get the current position
*
* @param {int} pos The position
*
* @return {object} The position
*/ var getPosition = function getPosition(pos) {
var format = function format(val) {
var value = val.replace(/<|>|`|"|&/g, "?").replace(/\r\n|\r|\n/g, "<br/>");
return value;
};
if (ctx.customPos || ctx.customPos === 0) pos = ctx.customPos;
var position = pos === undefined ? getPos() : pos;
var startRange = element.value.slice(0, position);
var endRange = element.value.slice(position);
var html = '<span style="position: relative; display: inline;">'.concat(format(startRange), "</span>");
html += '<span id="caret-position-marker" style="position: relative; display: inline;">|</span>';
html += '<span style="position: relative; display: inline;">'.concat(format(endRange), "</span>");
var mirror = $bba420c8ea874359$var$createMirror(element, html);
var rect = mirror.rect();
rect.pos = getPos();
return rect;
};
return {
getPos: getPos,
setPos: setPos,
getOffset: getOffset$1,
getPosition: getPosition
};
};
/**
* Create an Editable Caret
* @param {Element} element The editable element
* @param {object|null} ctx The context
*
* @return {EditableCaret}
*/ var $bba420c8ea874359$var$createEditableCaret = function createEditableCaret(element, ctx) {
/**
* Set the caret position
*
* @param {int} pos The position to se
*
* @return {Element} The element
*/ var setPos = function setPos(pos) {
var sel = ctx.window.getSelection();
if (sel) {
var offset = 0;
var found = false;
var find = function find(position, parent) {
for(var i = 0; i < parent.childNodes.length; i++){
var node = parent.childNodes[i];
if (found) break;
if (node.nodeType === 3) {
if (offset + node.length >= position) {
found = true;
var range = ctx.document.createRange();
range.setStart(node, position - offset);
sel.removeAllRanges();
sel.addRange(range);
break;
} else offset += node.length;
} else find(pos, node);
}
};
find(pos, element);
}
return element;
};
/**
* Get the offset
*
* @return {object} The offset
*/ var getOffset = function getOffset() {
var range = getRange();
var offset = {
height: 0,
left: 0,
right: 0
};
if (!range) return offset;
var hasCustomPos = ctx.customPos || ctx.customPos === 0; // endContainer in Firefox would be the element at the start of
// the line
if (range.endOffset - 1 > 0 && range.endContainer !== element || hasCustomPos) {
var clonedRange = range.cloneRange();
var fixedPosition = hasCustomPos ? ctx.customPos : range.endOffset;
clonedRange.setStart(range.endContainer, fixedPosition - 1 < 0 ? 0 : fixedPosition - 1);
clonedRange.setEnd(range.endContainer, fixedPosition);
var rect = clonedRange.getBoundingClientRect();
offset = {
height: rect.height,
left: rect.left + rect.width,
top: rect.top
};
clonedRange.detach();
}
if ((!offset || offset && offset.height === 0) && !ctx.noShadowCaret) {
var _clonedRange = range.cloneRange();
var shadowCaret = ctx.document.createTextNode("|");
_clonedRange.insertNode(shadowCaret);
_clonedRange.selectNode(shadowCaret);
var _rect = _clonedRange.getBoundingClientRect();
offset = {
height: _rect.height,
left: _rect.left,
top: _rect.top
};
shadowCaret.parentNode.removeChild(shadowCaret);
_clonedRange.detach();
}
if (offset) {
var doc = ctx.document.documentElement;
offset.top += ctx.window.pageYOffset - (doc.clientTop || 0);
offset.left += ctx.window.pageXOffset - (doc.clientLeft || 0);
}
return offset;
};
/**
* Get the position
*
* @return {object} The position
*/ var getPosition = function getPosition() {
var offset = getOffset();
var pos = getPos();
var rect = element.getBoundingClientRect();
var inputOffset = {
top: rect.top + ctx.document.body.scrollTop,
left: rect.left + ctx.document.body.scrollLeft
};
offset.left -= inputOffset.left;
offset.top -= inputOffset.top;
offset.pos = pos;
return offset;
};
/**
* Get the range
*
* @return {Range|null}
*/ var getRange = function getRange() {
if (!ctx.window.getSelection) return;
var sel = ctx.window.getSelection();
return sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
};
/**
* Get the caret position
*
* @return {int} The position
*/ var getPos = function getPos() {
var range = getRange();
var clonedRange = range.cloneRange();
clonedRange.selectNodeContents(element);
clonedRange.setEnd(range.endContainer, range.endOffset);
var pos = clonedRange.toString().length;
clonedRange.detach();
return pos;
};
return {
getPos: getPos,
setPos: setPos,
getPosition: getPosition,
getOffset: getOffset,
getRange: getRange
};
};
var $bba420c8ea874359$var$createCaret = function createCaret(element, ctx) {
if ($bba420c8ea874359$var$isContentEditable(element)) return $bba420c8ea874359$var$createEditableCaret(element, ctx);
return $bba420c8ea874359$var$createInputCaret(element, ctx);
};
var $bba420c8ea874359$export$5880b8b5730aff45 = function position(element, value) {
var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var options = settings;
if ($bba420c8ea874359$var$isObject(value)) {
options = value;
value = null;
}
var ctx = $bba420c8ea874359$var$getContext(options);
var caret = $bba420c8ea874359$var$createCaret(element, ctx);
if (value || value === 0) return caret.setPos(value);
return caret.getPosition();
};
/**
*
* @param {Element} element The DOM element
* @param {number|undefined} value The value to set
* @param {object} settings Any settings for context
*/ var $bba420c8ea874359$export$cc800923e997bb8 = function offset(element, value) {
var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var options = settings;
if ($bba420c8ea874359$var$isObject(value)) {
options = value;
value = null;
}
var ctx = $bba420c8ea874359$var$getContext(options);
var caret = $bba420c8ea874359$var$createCaret(element, ctx);
return caret.getOffset(value);
};
class $68b475f2a0292491$var$EventEmitter { class $68b475f2a0292491$var$EventEmitter {
//-------------------------- //--------------------------
// constructor // constructor
@ -7824,4 +7423,4 @@ document.addEventListener("DOMContentLoaded", function() {
}, false); }, false);
//# sourceMappingURL=start.js.map //# sourceMappingURL=dash.js.map
Loading…
Cancel
Save