ModuleBuilder/dist/modules/sticky_notes.js
2021-01-23 14:19:51 +00:00

3 lines
No EOL
9.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"index.js":[function(require,module,exports) {
"use strict";function e(e,r){return i(e)||o(e,r)||n(e,r)||t()}function t(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(c){o=!0,i=c}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}}function i(e){if(Array.isArray(e))return e}function a(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(u){return void n(u)}s.done?t(c):Promise.resolve(c).then(r,o)}function s(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){a(i,r,o,s,c,"next",e)}function c(e){a(i,r,o,s,c,"throw",e)}s(void 0)})}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var c,u="2.2.0",l={settings:{openNoteOnLoad:!0}};function d(){l.setSetting=function(e,t){l.settings[e]&&(l.settings[e]=t)};var e=0;l.newSticky=function(){var t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=[0,0],o=!1,i=document.createElement("div");i.classList.add("goosemod-sticky-note","goosemod-sticky-note-asset","goosemod-sticky-note-number-".concat(e)),i.style.position="absolute",i.style.left="0px",i.style.top="0px",i.style.width="100px",i.style.height="100px";var a=document.createElement("div");a.classList.add("layerContainer-yqaFcK");var s=document.createElement("div");s.classList.add("layer-2KE1M9");var c=document.createElement("div");c.classList.add("focusLock-Ns3yie"),c.setAttribute("role","dialog"),c.setAttribute("aria-label","Sticky Note"),c.setAttribute("tabindex","-1"),c.setAttribute("aria-model","true");var u=document.createElement("div");u.classList.add("root-1gCeng","small-3iVZYw","fullscreenOnMobile-1bD22y"),u.style.opacity="1",u.style.transform="scale(1)";var d=document.createElement("div");d.classList.add("flex-1xMQg5","flex-1O1GKY","horizontal-1ae9ci","horizontal-2EEEnY","flex-1O1GKY","directionRow-3v3tfG","justifyStart-2NDFzi","alignCenter-1dQNNs","noWrap-3jynv6","header-1TKi98"),d.style.flex="0 0 auto";var f=document.createElement("h4");f.classList.add("colorStandard-2KCXvj","size14-e6ZScH","h4-AQvcAz","title-3sZWYQ","defaultColor-1_ajX0","defaultMarginh4-2vWMG5"),f.textContent="Sticky Note";var m=document.createElement("h2");m.classList.add("colorStandard-2KCXvj","size14-e6ZScH","h4-AQvcAz","defaultColor-1_ajX0","defaultMarginh4-2vWMG5","clickable-3rdHwn"),m.textContent="🞣",m.setAttribute("style","display: flex; font-size: 25px; color: #B9BBBE; align-items: center; margin-right: 5px;");var p=document.createElement("h2");p.classList.add("colorStandard-2KCXvj","size14-e6ZScH","h4-AQvcAz","defaultColor-1_ajX0","defaultMarginh4-2vWMG5","clickable-3rdHwn"),p.textContent="",p.setAttribute("style","display: flex; font-size: 29px; color: #B9BBBE; align-items: center");var v=document.createElement("div");v.classList.add("content-1LAB8Z","content-mK72R6","thin-1ybCId","scrollerBase-289Jih"),v.setAttribute("dir","ltr"),v.style.overflow="hidden scroll",v.style.paddingRight="8px";var y=document.createElement("div");function g(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];function t(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i;return e.classList.value===t.classList.value}var n=document.getElementById("active-sticky");n&&!t(n,i)?(e&&"active-sticky"!=i.getAttribute("id")&&document.body.insertBefore(i,n.nextElementSibling),n.removeAttribute("id"),i.setAttribute("id","active-sticky")):Array.from(document.getElementsByClassName("goosemod-sticky-note")).filter(function(e){return!t(e,i)}).length<=0&&i.setAttribute("id","active-sticky")}return y.classList.add("markup-2BOw-j","scrollableContainer-2NUZem","webkit-HjD9Er"),y.setAttribute("aria-multiline","true"),y.setAttribute("data-can-focus","true"),y.setAttribute("data-slate-editor","true"),y.setAttribute("contenteditable","true"),y.setAttribute("autocorrect","off"),y.setAttribute("spellcheck","true"),y.setAttribute("role","textbox"),y.setAttribute("data-gramm","true"),y.setAttribute("style","outline: none; white-space: pre-wrap; overflow-wrap: break-word; -webkit-user-modify: read-write-plaintext-only; padding: 5px;"),a.appendChild(s),s.appendChild(c),c.appendChild(u),u.appendChild(d),d.appendChild(f),d.appendChild(m),d.appendChild(p),u.appendChild(v),v.appendChild(y),i.appendChild(a),document.body.appendChild(i),n&&g(),d.addEventListener("mousedown",function(e){o=!0,g(!0),r=[i.offsetLeft-e.clientX,i.offsetTop-e.clientY]},!0),v.addEventListener("click",function(e){"active-sticky"==i.getAttribute("id")||o||(e.preventDefault(),g(!0))}),document.addEventListener("mouseup",function(){o=!1},!0),document.addEventListener("mousemove",function(e){o&&(e.preventDefault(),t={x:e.clientX,y:e.clientY},i.style.left=t.x+r[0]+"px",i.style.top=t.y+r[1]+"px")},!0),p.addEventListener("mouseenter",function(e){p.style.color="white"}),p.addEventListener("mouseleave",function(e){p.style.color="#B9BBBE"}),p.addEventListener("click",function(e){e.preventDefault();var t=i.previousElementSibling;null!=t&&t.classList.contains("goosemod-sticky-note")&&(i.removeAttribute("id"),t.setAttribute("id","active-sticky")),i.remove()}),m.addEventListener("mouseenter",function(e){m.style.color="white"}),m.addEventListener("mouseleave",function(e){m.style.color="#B9BBBE"}),m.addEventListener("click",function(e){e.preventDefault(),l.newSticky(!1)}),e++,i},c=function(e){"KeyD"===e.code&&e.ctrlKey&&(e.preventDefault(),l.newSticky())},document.addEventListener("keydown",c)}function f(){Array.from(document.getElementsByClassName("goosemod-sticky-note-asset")).forEach(function(e){return e.remove()}),document.removeEventListener("keydown",c)}var m={gooseModHandlers:{onImport:function(){var e=s(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:goosemodScope.logger.debug("Sticky Notes","Starting..."),d();case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),onRemove:function(){var e=s(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:goosemodScope.logger.debug("Sticky Notes","Stopping..."),goosemod.settings.removeItem("Sticky Notes"),f();case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),onLoadingFinished:function(){var e=s(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:goosemodScope.settings.createItem("Sticky Notes",["(v".concat(u,")"),{type:"header",text:"Sticky Notes Settings"},{type:"toggle",text:"Launch Note on Load",subtext:"Open a sticky note automatically once the module is loaded in.",onToggle:function(e){l.setSetting("openNoteOnLoad",e)},isToggled:function(){return l.settings.openNoteOnLoad}}]);case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),getSettings:function(){var e=s(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",[l.settings]);case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),loadSettings:function(){var t=s(regeneratorRuntime.mark(function t(n){var r,o;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r=e(n,1),o=r[0],l.settings=o,l.settings.openNoteOnLoad&&l.newSticky();case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()}};exports.default=m;
},{}]},{},["index.js"], null);parcelRequire('index.js').default