.
675 |
--------------------------------------------------------------------------------
/dist/esheep.min.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"sources":["esheep.js"],"names":["_typeof","o","Symbol","iterator","constructor","prototype","_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","_toPropertyKey","key","_createClass","protoProps","staticProps","arg","_toPrimitive","String","input","hint","prim","toPrimitive","undefined","res","call","Number","VERSION","ACTIVATE_DEBUG","DEFAULT_XML","COLLISION_WITH","eSheep","options","isChild","this","userOptions","allowPets","allowPopup","animationFile","id","Date","now","Math","random","DOMdiv","document","createElement","setAttribute","DOMimg","DOMinfo","parser","DOMParser","xmlDoc","prepareToDie","tilesX","tilesY","imageW","imageH","imageX","imageY","flipped","dragging","infobox","animationId","animationStep","animationNode","sprite","Image","HTMLelement","randS","screenW","window","innerWidth","documentElement","clientWidth","body","screenH","innerHeight","clientHeight","value","animation","ajax","XMLHttpRequest","sheepClass","open","addEventListener","readyState","status","_parseXML","responseText","console","error","statusText","send","_this","Hide","setTimeout","getElementById","outerHTML","text","_this2","parseFromString","image","getElementsByTagName","textContent","log","attribute","width","height","e","preventDefault","appendChild","_spawnChild","_spawnESheep","src","buttons","button","childs","k","getAttribute","parseInt","clientX","clientY","style","left","top","min","max","Show","headerNode","htmlT","createTextNode","htmlV","htmlL","htmlP","_loadPetList","display","transform","x","y","absolute","spawns","prob","rand","_setPosition","_parseKeyWords","j","eSheepChild","Start","_nextESheepStep","replace","ret","eval","err","message","parentNode","baseNode","nodeFound","removeChild","index","rect","margin","els","getBoundingClientRect","right","getComputedStyle","borderTopStyle","nodeName","valueName","defaultValue","x1","_getNodeValue","y1","del1","x2","y2","del2","repeat","repeatfrom","gravity","border","steps","bind","_getNextRandomNode","setNext","_checkOverlapping","ceil","element","_this3","fetch","credentials","cache","then","response","json","pets","stopPropagation","div","pet","_loop","folder","remove"],"mappings":"AAAA,aAEA,SAASA,QAAQC,GAAgC,OAAOD,QAAU,m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C,KAAK7E,GAAGkF,SACrDF,EAAIjH,iBAAiB,QAAS,WACpB,IAAItD,OAAO6J,EAAOzJ,aACxBiH,MAAM,kDAAoD8C,EAAKC,KAAK7E,GAAGkF,OAAS,mBAClFZ,EAAOa,WAETJ,EAAItF,YAAYuF,IAGpB,IAAK,IAAIhF,KAAK4E,EAAKC,KACjBI,EAAMjF,GAER+E,EAAIhH,iBAAiB,QAAS,SAAUwB,GACtC8E,EAAQhC,WAAWG,YAAYuC,aAOpCtK,OAhnBiB","sourcesContent":["\"use strict\";\n\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/*\r\n * Project:\r\n * eSheep - Webpage\r\n *\r\n * Date:\r\n * 04.april 2018\r\n *\r\n * Author:\r\n * Adriano Petrucci (http://esheep.petrucci.ch)\r\n *\r\n * Version: 0.9.2\r\n *\r\n * Introduction:\r\n * As \"wrapper\" for the OpenSource C# project\r\n * (see https://github.com/Adrianotiger/desktopPet),\r\n * this javascript \"class\" was written to get the animations also inside your\r\n * webpage. It doesn't work like the Windows version, but show much animations from it.\r\n *\r\n * Description:\r\n * Add a walking pet (sheep to your home page) with just a few lines of code!\r\n * Will add a lovely sheep (stray sheep) and this will walk around your page and over\r\n * all
s and s with a border. You can also select another animation, using your\r\n * personal XML file or one from the database.\r\n *\r\n * How to use:\r\n * Add this line in your :\r\n * \r\n * Add this lines in your (at the end if possible):\r\n * \r\n * That's all!\r\n *\r\n * Requirement:\r\n * Tested on IE11, Edge and Opera\r\n *\r\n * Changelog:\r\n * Version 0.9.2 - 30.08.2021:\r\n * - crispy stylesheet (pixel image and not antialiased)\r\n * Version 0.9.0 - 11.07.2019:\r\n * - Updated animation link to the main project animation\r\n * - Recompiled with new Yarn version (security vulnerability)\r\n * Version 0.8.0 - 29.05.2018:\r\n * - Moved animation files to github\r\n * - Added options to the script \r\n * - Load an animation from the GitHub animations from the popup window\r\n * Version 0.7.1 - 04.04.2018:\r\n * - Add max-width: none to ensure the image is properly shown\r\n * Version 0.7 - 13.11.2017:\r\n * - better Javascript structure\r\n * - GitHub version (https://github.com/Adrianotiger/web-esheep)\r\n * - Childs animations added\r\n * - Better comments\r\n * - Replaced alerts with console.error\r\n * Version 0.5 - 12.07.2017:\r\n * - animations starts only once the image was loaded (thanks RedSparr0w)\r\n * Version 0.x:\r\n * - still beta versions...\r\n */\n\nvar VERSION = '0.9.2'; // web eSheep version\nvar ACTIVATE_DEBUG = false; // show log on console\nvar DEFAULT_XML = \"https://adrianotiger.github.io/desktopPet/Pets/esheep64/animations.xml\"; // default XML animation\nvar COLLISION_WITH = [\"div\", \"hr\"]; // elements on page to detect for collisions\n\n/*\r\n * eSheep class.\r\n * Create a new class of this type if you want a new pet. Will create the components for the pet.\r\n * Once created, you can call [variableName].Start() to start the animation with your desired pet.\r\n */\nvar eSheep = /*#__PURE__*/function () {\n /* Parameters for options [default]:\r\n * - allowPets: [none], all\r\n * - allowPopup: [yes], no\r\n */\n function eSheep(options, isChild) {\n _classCallCheck(this, eSheep);\n this.userOptions = options ? options : {\n allowPets: \"none\",\n allowPopup: \"yes\"\n };\n if (!this.userOptions.allowPopup) this.userOptions.allowPopup = \"yes\";\n if (!this.userOptions.allowPets) this.userOptions.allowPets = \"none\";\n\n // CORS: Cross calls are not accepted by new browsers.\n this.animationFile = DEFAULT_XML;\n this.id = Date.now() + Math.random();\n this.DOMdiv = document.createElement(\"div\"); // Div added to webpage, containing the sheep\n this.DOMdiv.setAttribute(\"id\", this.id);\n this.DOMimg = document.createElement(\"img\"); // Tile image, will be positioned inside the div\n this.DOMinfo = document.createElement(\"div\"); // about dialog, if you press on the sheep\n\n this.parser = new DOMParser(); // XML parser\n this.xmlDoc = null; // parsed XML Document\n this.prepareToDie = false; // when removed, animations should be stopped\n\n this.isChild = isChild != null; // Child will be removed once they reached the end\n\n this.tilesX = 1; // Quantity of images inside Tile\n this.tilesY = 1; // Quantity of images inside Tile\n this.imageW = 1; // Width of the sprite image\n this.imageH = 1; // Height of the sprite image\n this.imageX = 1; // Position of sprite inside webpage\n this.imageY = 1; // Position of sprite inside webpage\n this.flipped = false; // if sprite is flipped\n this.dragging = false; // if user is dragging the sheep\n this.infobox = false; // if infobox is visible\n this.animationId = 0; // current animation ID\n this.animationStep = 0; // current animation step\n this.animationNode = null; // current animation DOM node\n this.sprite = new Image(); // sprite image (Tiles)\n this.HTMLelement = null; // the HTML element where the pet is walking on\n this.randS = Math.random() * 100; // random value, will change when page is reloaded\n\n this.screenW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; // window width\n\n this.screenH = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; // window height\n }\n\n /*\r\n * Start new animation on the page.\r\n * if animation is not set, the default sheep will be taken\r\n */\n _createClass(eSheep, [{\n key: \"Start\",\n value: function Start(animation) {\n if (typeof animation !== 'undefined' && animation != null) {\n this.animationFile = animation;\n }\n var ajax = new XMLHttpRequest();\n var sheepClass = this;\n ajax.open(\"GET\", this.animationFile, true);\n ajax.addEventListener(\"readystatechange\", function () {\n if (this.readyState == 4) {\n if (this.status == 200)\n // successfully loaded XML, parse it and create first esheep.\n sheepClass._parseXML(this.responseText);else console.error(\"XML not available:\" + this.statusText + \"\\n\" + this.responseText);\n }\n });\n ajax.send(null);\n }\n }, {\n key: \"remove\",\n value: function remove() {\n var _this = this;\n this.prepareToDie = true;\n this.DOMinfo.Hide();\n setTimeout(function () {\n _this.DOMdiv = _this.DOMimg = _this.DOMinfo = null;\n document.getElementById(_this.id).outerHTML = '';\n }, 500);\n }\n\n /*\r\n * Parse loaded XML, contains spawn, animations and childs\r\n */\n }, {\n key: \"_parseXML\",\n value: function _parseXML(text) {\n var _this2 = this;\n this.xmlDoc = this.parser.parseFromString(text, 'text/xml');\n var image = this.xmlDoc.getElementsByTagName('image')[0];\n this.tilesX = image.getElementsByTagName(\"tilesx\")[0].textContent;\n this.tilesY = image.getElementsByTagName(\"tilesy\")[0].textContent;\n // Event listener: Sprite was loaded =>\n // play animation only when the sprite is loaded\n this.sprite.addEventListener(\"load\", function () {\n if (ACTIVATE_DEBUG) console.log(\"Sprite image loaded\");\n var attribute = \"width:\" + _this2.sprite.width + \"px;\" + \"height:\" + _this2.sprite.height + \"px;\" + \"position:absolute;\" + \"top:0px;\" + \"left:0px;\" + \"max-width: none;\";\n _this2.DOMimg.setAttribute(\"style\", attribute);\n // prevent to move image (will show the entire sprite sheet if not catched)\n _this2.DOMimg.addEventListener(\"dragstart\", function (e) {\n e.preventDefault();\n return false;\n });\n _this2.imageW = _this2.sprite.width / _this2.tilesX;\n _this2.imageH = _this2.sprite.height / _this2.tilesY;\n attribute = \"width:\" + _this2.imageW + \"px;\" + \"height:\" + _this2.imageH + \"px;\" + \"position:fixed;\" + \"top:\" + _this2.imageY + \"px;\" + \"left:\" + _this2.imageX + \"px;\" + \"transform:rotatey(0deg);\" + \"cursor:move;\" + \"z-index:2000;\" + \"overflow:hidden;\" + \"image-rendering: crisp-edges;\";\n _this2.DOMdiv.setAttribute(\"style\", attribute);\n _this2.DOMdiv.appendChild(_this2.DOMimg);\n if (_this2.isChild) _this2._spawnChild();else _this2._spawnESheep();\n });\n this.sprite.src = 'data:image/png;base64,' + image.getElementsByTagName(\"png\")[0].textContent;\n this.DOMimg.setAttribute(\"src\", this.sprite.src);\n\n // Mouse move over eSheep, check if eSheep should be moved over the screen\n this.DOMdiv.addEventListener(\"mousemove\", function (e) {\n if (!_this2.dragging && e.buttons == 1 && e.button == 0) {\n _this2.dragging = true;\n _this2.HTMLelement = null;\n var childsRoot = _this2.xmlDoc.getElementsByTagName('animations')[0];\n var childs = childsRoot.getElementsByTagName('animation');\n for (var k = 0; k < childs.length; k++) {\n if (childs[k].getElementsByTagName('name')[0].textContent == \"drag\") {\n _this2.animationId = childs[k].getAttribute(\"id\");\n _this2.animationStep = 0;\n _this2.animationNode = childs[k];\n break;\n }\n }\n }\n });\n // Add event listener to body, if mouse moved too fast over the dragging eSheep\n document.body.addEventListener(\"mousemove\", function (e) {\n if (_this2.dragging) {\n _this2.imageX = parseInt(e.clientX) - _this2.imageW / 2;\n _this2.imageY = parseInt(e.clientY) - _this2.imageH / 2;\n _this2.DOMdiv.style.left = _this2.imageX + \"px\";\n _this2.DOMdiv.style.top = _this2.imageY + \"px\";\n _this2.DOMinfo.style.left = parseInt(_this2.imageX + _this2.imageW / 2) + \"px\";\n _this2.DOMinfo.style.top = _this2.imageY + \"px\";\n }\n });\n // Window resized, recalculate eSheep bounds\n document.body.addEventListener(\"resize\", function () {\n _this2.screenW = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\n _this2.screenH = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\n if (_this2.imageY + _this2.imageH > _this2.screenH) {\n _this2.imageY = _this2.screenH - _this2.imageH;\n _this2.DOMdiv.style.top = _this2.imageY + \"px\";\n }\n if (_this2.imageX + _this2.imageW > _this2.screenW) {\n _this2.imageX = _this2.screenW - _this2.imageW;\n _this2.DOMdiv.style.left = _this2.imageX + \"px\";\n }\n });\n // Don't allow contextmenu over the sheep\n this.DOMdiv.addEventListener(\"contextmenu\", function (e) {\n e.preventDefault();\n return false;\n });\n // Mouse released\n this.DOMdiv.addEventListener(\"mouseup\", function (e) {\n if (_this2.dragging) {\n _this2.dragging = false;\n } else if (_this2.infobox) {\n _this2.DOMinfo.Hide();\n _this2.infobox = false;\n } else {\n if (_this2.userOptions.allowPopup === \"yes\") {\n _this2.DOMinfo.style.left = Math.min(_this2.screenW - _this2.imageW, Math.max(_this2.imageW, parseInt(_this2.imageX + _this2.imageW / 2))) + \"px\";\n _this2.DOMinfo.style.top = parseInt(_this2.imageY) + \"px\";\n _this2.DOMinfo.Show();\n _this2.infobox = true;\n }\n }\n });\n // Mouse released over the info box\n this.DOMinfo.addEventListener(\"mouseup\", function (e) {\n _this2.DOMinfo.Hide();\n _this2.infobox = false;\n });\n // Create About box\n var attribute = \"width:200px;\" + \"height:100px;\" + \"transform:translate(-50%, -50%) scale(0.1);\" + \"position:fixed;\" + \"top:100px;left:10px;\" + \"display:none;\" + \"border-width:2px;\" + \"border-radius:5px;\" + \"border-style:ridge;\" + \"border-color:#0000ab;\" + \"text-align:center;\" + \"text-shadow: 1px 1px 3px #ffff88;\" + \"box-shadow: 3px 3px 10px #888888;\" + \"color:black;\" + \"opacity:0.9;\" + \"z-index:9999;\" + \"overflow:auto;\" + \"transition:transform 0.3s ease;\" + \"background: linear-gradient(to bottom right, rgba(128,128,255,0.7), rgba(200,200,255,0.4));\";\n this.DOMinfo.setAttribute(\"style\", attribute);\n var headerNode = this.xmlDoc.getElementsByTagName('header')[0];\n var htmlT = document.createElement(\"b\").appendChild(document.createTextNode(headerNode.getElementsByTagName('title')[0].textContent));\n var htmlV = document.createElement(\"sup\");\n var htmlL = document.createElement(\"a\");\n var htmlP = document.createElement(\"p\");\n htmlV.appendChild(document.createTextNode(\"App v.\" + VERSION));\n htmlV.appendChild(document.createElement(\"br\"));\n htmlV.appendChild(document.createTextNode(\"Pet v.\" + headerNode.getElementsByTagName('version')[0].textContent));\n htmlV.setAttribute(\"style\", \"float:right;text-align:right;\");\n htmlL.appendChild(document.createTextNode(\"\\uD83C\\uDFE0\"));\n htmlL.setAttribute(\"href\", \"https://github.com/Adrianotiger/web-esheep\");\n htmlL.setAttribute(\"target\", \"_blank\");\n htmlL.setAttribute(\"style\", \"float:left\");\n htmlP.appendChild(document.createTextNode(headerNode.getElementsByTagName('info')[0].textContent));\n htmlP.setAttribute(\"style\", \"font-size:\" + (100 - parseInt(headerNode.getElementsByTagName('info')[0].textContent.length / 10)) + \"%;\");\n this.DOMinfo.appendChild(htmlV);\n this.DOMinfo.appendChild(htmlL);\n if (this.userOptions.allowPets !== \"none\") {\n htmlL = document.createElement(\"a\");\n htmlL.appendChild(document.createTextNode(\"\\u2699\"));\n htmlL.setAttribute(\"href\", \"javascript:;\");\n htmlL.setAttribute(\"style\", \"float:left\");\n this.DOMinfo.appendChild(htmlL);\n setTimeout(function () {\n _this2._loadPetList(htmlL);\n }, 100);\n }\n this.DOMinfo.appendChild(htmlT);\n this.DOMinfo.appendChild(document.createElement(\"br\"));\n this.DOMinfo.appendChild(document.createElement(\"hr\"));\n this.DOMinfo.appendChild(htmlP);\n // Add about and sheep elements to the body\n document.body.appendChild(this.DOMinfo);\n document.body.appendChild(this.DOMdiv);\n this.DOMinfo.Show = function () {\n _this2.DOMinfo.style.display = \"block\";\n _this2.DOMinfo.style.transform = \"translate(-50%, -100%) scale(1.0)\";\n };\n this.DOMinfo.Hide = function () {\n _this2.DOMinfo.style.transform = \"translate(-50%, -50%) scale(0.1)\";\n setTimeout(function () {\n _this2.DOMinfo.style.display = \"none\";\n }, 300);\n };\n }\n }, {\n key: \"_setPosition\",\n value:\n /*\r\n * Set new position for the pet\r\n * If absolute is true, the x and y coordinates are used as absolute values.\r\n * If false, x and y are added to the current position\r\n */\n function _setPosition(x, y, absolute) {\n if (this.DOMdiv) {\n if (absolute) {\n this.imageX = parseInt(x);\n this.imageY = parseInt(y);\n } else {\n this.imageX = parseInt(this.imageX) + parseInt(x);\n this.imageY = parseInt(this.imageY) + parseInt(y);\n }\n this.DOMdiv.style.left = this.imageX + \"px\";\n this.DOMdiv.style.top = this.imageY + \"px\";\n }\n }\n\n /*\r\n * Spawn new esheep, this is called if the XML was loaded successfully\r\n */\n }, {\n key: \"_spawnESheep\",\n value: function _spawnESheep() {\n var spawnsRoot = this.xmlDoc.getElementsByTagName('spawns')[0];\n var spawns = spawnsRoot.getElementsByTagName('spawn');\n var prob = 0;\n for (var i = 0; i < spawns.length; i++) prob += parseInt(spawns[0].getAttribute(\"probability\"));\n var rand = Math.random() * prob;\n prob = 0;\n for (i = 0; i < spawns.length; i++) {\n prob += parseInt(spawns[i].getAttribute(\"probability\"));\n if (prob >= rand || i == spawns.length - 1) {\n this._setPosition(this._parseKeyWords(spawns[i].getElementsByTagName('x')[0].textContent), this._parseKeyWords(spawns[i].getElementsByTagName('y')[0].textContent), true);\n if (ACTIVATE_DEBUG) console.log(\"Spawn: \" + this.imageX + \", \" + this.imageY);\n this.animationId = spawns[i].getElementsByTagName('next')[0].textContent;\n this.animationStep = 0;\n var childsRoot = this.xmlDoc.getElementsByTagName('animations')[0];\n var childs = childsRoot.getElementsByTagName('animation');\n for (var k = 0; k < childs.length; k++) {\n if (childs[k].getAttribute(\"id\") == this.animationId) {\n this.animationNode = childs[k];\n\n // Check if child should be loaded toghether with this animation\n var childsRoot = this.xmlDoc.getElementsByTagName('childs')[0];\n var childs = childsRoot.getElementsByTagName('child');\n for (var j = 0; j < childs.length; j++) {\n if (childs[j].getAttribute(\"animationid\") == this.animationId) {\n if (ACTIVATE_DEBUG) console.log(\"Child from Spawn\");\n var eSheepChild = new eSheep(null, true);\n eSheepChild.animationId = childs[j].getElementsByTagName('next')[0].textContent;\n var x = childs[j].getElementsByTagName('x')[0].textContent; //\n var y = childs[j].getElementsByTagName('y')[0].textContent;\n eSheepChild._setPosition(this._parseKeyWords(x), this._parseKeyWords(y), true);\n // Start animation\n eSheepChild.Start(this.animationFile);\n break;\n }\n }\n break;\n }\n }\n break;\n }\n }\n // Play next step\n this._nextESheepStep();\n }\n\n /*\r\n * Like spawnESheep, but for Childs\r\n */\n }, {\n key: \"_spawnChild\",\n value: function _spawnChild() {\n var childsRoot = this.xmlDoc.getElementsByTagName('animations')[0];\n var childs = childsRoot.getElementsByTagName('animation');\n for (var k = 0; k < childs.length; k++) {\n if (childs[k].getAttribute(\"id\") == this.animationId) {\n this.animationNode = childs[k];\n break;\n }\n }\n this._nextESheepStep();\n }\n\n // Parse the human readable expression from XML to a computer readable expression\n }, {\n key: \"_parseKeyWords\",\n value: function _parseKeyWords(value) {\n value = value.replace(/screenW/g, this.screenW);\n value = value.replace(/screenH/g, this.screenH);\n value = value.replace(/areaW/g, this.screenH);\n value = value.replace(/areaH/g, this.screenH);\n value = value.replace(/imageW/g, this.imageW);\n value = value.replace(/imageH/g, this.imageH);\n value = value.replace(/random/g, Math.random() * 100);\n value = value.replace(/randS/g, this.randS);\n value = value.replace(/imageX/g, this.imageX);\n value = value.replace(/imageY/g, this.imageY);\n var ret = 0;\n try {\n ret = eval(value);\n } catch (err) {\n console.error(\"Unable to parse this position: \\n'\" + value + \"'\\n Error message: \\n\" + err.message);\n }\n return ret;\n }\n\n /*\r\n * Once the animation is over, get the next animation to play\r\n */\n }, {\n key: \"_getNextRandomNode\",\n value: function _getNextRandomNode(parentNode) {\n var baseNode = parentNode.getElementsByTagName('next');\n var childsRoot = this.xmlDoc.getElementsByTagName('animations')[0];\n var childs = childsRoot.getElementsByTagName('animation');\n var prob = 0;\n var nodeFound = false;\n\n // no more animations (it was the last one)\n if (baseNode.length == 0) {\n // If it is a child, remove the child from document\n if (this.isChild) {\n // remove child\n if (ACTIVATE_DEBUG) console.log(\"Remove child\");\n document.body.removeChild(this.DOMinfo);\n document.body.removeChild(this.DOMdiv);\n delete this;\n }\n // else, spawn sheep again\n else {\n this._spawnESheep();\n }\n return false;\n }\n for (var k = 0; k < baseNode.length; k++) {\n prob += parseInt(baseNode[k].getAttribute(\"probability\"));\n }\n var rand = Math.random() * prob;\n var index = 0;\n prob = 0;\n for (k = 0; k < baseNode.length; k++) {\n prob += parseInt(baseNode[k].getAttribute(\"probability\"));\n if (prob >= rand) {\n index = k;\n break;\n }\n }\n for (k = 0; k < childs.length; k++) {\n if (childs[k].getAttribute(\"id\") == baseNode[index].textContent) {\n this.animationId = childs[k].getAttribute(\"id\");\n this.animationStep = 0;\n this.animationNode = childs[k];\n nodeFound = true;\n break;\n }\n }\n if (nodeFound)\n // create Child, if present\n {\n var childsRoot = this.xmlDoc.getElementsByTagName('childs')[0];\n var childs = childsRoot.getElementsByTagName('child');\n for (k = 0; k < childs.length; k++) {\n if (childs[k].getAttribute(\"animationid\") == this.animationId) {\n if (ACTIVATE_DEBUG) console.log(\"Child from Animation\");\n var eSheepChild = new eSheep(null, true);\n eSheepChild.animationId = childs[k].getElementsByTagName('next')[0].textContent;\n var x = childs[k].getElementsByTagName('x')[0].textContent; //\n var y = childs[k].getElementsByTagName('y')[0].textContent;\n eSheepChild._setPosition(this._parseKeyWords(x), this._parseKeyWords(y), true);\n eSheepChild.Start(this.animationFile);\n break;\n }\n }\n }\n return nodeFound;\n }\n\n /*\r\n * Check if sheep is walking over a defined HTML TAG-element\r\n */\n }, {\n key: \"_checkOverlapping\",\n value: function _checkOverlapping() {\n var x = this.imageX;\n var y = this.imageY + this.imageH;\n var rect;\n var margin = 20;\n if (this.HTMLelement) margin = 5;\n for (var index in COLLISION_WITH) {\n var els = document.body.getElementsByTagName(COLLISION_WITH[index]);\n for (var i = 0; i < els.length; i++) {\n rect = els[i].getBoundingClientRect();\n if (y > rect.top - 2 && y < rect.top + margin) {\n if (x > rect.left && x < rect.right - this.imageW) {\n var style = window.getComputedStyle(els[i]);\n if (style.borderTopStyle != \"\" && style.borderTopStyle != \"none\" && style.display != \"none\") {\n return els[i];\n }\n }\n }\n }\n }\n return false;\n }\n\n /*\r\n * Try to get the value of a node (from the current animationNode), if it is not possible returns the defaultValue\r\n */\n }, {\n key: \"_getNodeValue\",\n value: function _getNodeValue(nodeName, valueName, defaultValue) {\n if (!this.animationNode || !this.animationNode.getElementsByTagName(nodeName)) return;\n if (this.animationNode.getElementsByTagName(nodeName)[0].getElementsByTagName(valueName)[0]) {\n var value = this.animationNode.getElementsByTagName(nodeName)[0].getElementsByTagName(valueName)[0].textContent;\n return this._parseKeyWords(value);\n } else {\n return defaultValue;\n }\n }\n\n /*\r\n * Next step (each frame is a step)\r\n */\n }, {\n key: \"_nextESheepStep\",\n value: function _nextESheepStep() {\n if (this.prepareToDie) return;\n var x1 = this._getNodeValue('start', 'x', 0);\n var y1 = this._getNodeValue('start', 'y', 0);\n var off1 = this._getNodeValue('start', 'offsety', 0);\n var opa1 = this._getNodeValue('start', 'opacity', 1);\n var del1 = this._getNodeValue('start', 'interval', 1000);\n var x2 = this._getNodeValue('end', 'x', 0);\n var y2 = this._getNodeValue('end', 'y', 0);\n var off2 = this._getNodeValue('end', 'offsety', 0);\n var opa2 = this._getNodeValue('end', 'interval', 1);\n var del2 = this._getNodeValue('end', 'interval', 1000);\n var repeat = this._parseKeyWords(this.animationNode.getElementsByTagName('sequence')[0].getAttribute('repeat'));\n var repeatfrom = this.animationNode.getElementsByTagName('sequence')[0].getAttribute('repeatfrom');\n var gravity = this.animationNode.getElementsByTagName('gravity');\n var border = this.animationNode.getElementsByTagName('border');\n var steps = this.animationNode.getElementsByTagName('frame').length + (this.animationNode.getElementsByTagName('frame').length - repeatfrom) * repeat;\n var index;\n if (this.animationStep < this.animationNode.getElementsByTagName('frame').length) index = this.animationNode.getElementsByTagName('frame')[this.animationStep].textContent;else if (repeatfrom == 0) index = this.animationNode.getElementsByTagName('frame')[this.animationStep % this.animationNode.getElementsByTagName('frame').length].textContent;else index = this.animationNode.getElementsByTagName('frame')[parseInt(repeatfrom) + parseInt((this.animationStep - repeatfrom) % (this.animationNode.getElementsByTagName('frame').length - repeatfrom))].textContent;\n this.DOMimg.style.left = -this.imageW * (index % this.tilesX) + \"px\";\n this.DOMimg.style.top = -this.imageH * parseInt(index / this.tilesX) + \"px\";\n if (this.dragging || this.infobox) {\n this.animationStep++;\n setTimeout(this._nextESheepStep.bind(this), 50);\n return;\n }\n if (this.flipped) {\n x1 = -x1;\n x2 = -x2;\n }\n if (this.animationStep == 0) this._setPosition(x1, y1, false);else this._setPosition(parseInt(x1) + parseInt((x2 - x1) * this.animationStep / steps), parseInt(y1) + parseInt((y2 - y1) * this.animationStep / steps), false);\n this.animationStep++;\n if (this.animationStep >= steps) {\n if (this.animationNode.getElementsByTagName('action')[0]) {\n switch (this.animationNode.getElementsByTagName('action')[0].textContent) {\n case \"flip\":\n if (this.DOMdiv.style.transform == \"rotateY(0deg)\") {\n this.DOMdiv.style.transform = \"rotateY(180deg)\";\n this.flipped = true;\n } else {\n this.DOMdiv.style.transform = \"rotateY(0deg)\";\n this.flipped = false;\n }\n break;\n default:\n break;\n }\n }\n if (!this._getNextRandomNode(this.animationNode.getElementsByTagName('sequence')[0])) return;\n }\n var setNext = false;\n if (border && border[0] && border[0].getElementsByTagName('next')) {\n if (x2 < 0 && this.imageX < 0) {\n this.imageX = 0;\n setNext = true;\n } else if (x2 > 0 && this.imageX > this.screenW - this.imageW) {\n this.imageX = this.screenW - this.imageW;\n this.DOMdiv.style.left = parseInt(this.imageX) + \"px\";\n setNext = true;\n } else if (y2 < 0 && this.imageY < 0) {\n this.imageY = 0;\n setNext = true;\n } else if (y2 > 0 && this.imageY > this.screenH - this.imageH) {\n this.imageY = this.screenH - this.imageH;\n setNext = true;\n } else if (y2 > 0) {\n if (this._checkOverlapping()) {\n if (this.imageY > this.imageH) {\n this.HTMLelement = this._checkOverlapping();\n this.imageY = Math.ceil(this.HTMLelement.getBoundingClientRect().top) - this.imageH;\n setNext = true;\n }\n }\n } else if (this.HTMLelement) {\n if (!this._checkOverlapping()) {\n if (this.imageY + this.imageH > this.HTMLelement.getBoundingClientRect().top + 3 || this.imageY + this.imageH < this.HTMLelement.getBoundingClientRect().top - 3) {\n this.HTMLelement = null;\n } else if (this.imageX < this.HTMLelement.getBoundingClientRect().left) {\n this.imageX = parseInt(this.imageX + 3);\n setNext = true;\n } else {\n this.imageX = parseInt(this.imageX - 3);\n setNext = true;\n }\n this.DOMdiv.style.left = parseInt(this.imageX) + \"px\";\n }\n }\n if (setNext) {\n if (!this._getNextRandomNode(border[0])) return;\n }\n }\n if (!setNext && gravity && gravity[0] && gravity[0].getElementsByTagName('next')) {\n if (this.imageY < this.screenH - this.imageH - 2) {\n if (this.HTMLelement == null) {\n setNext = true;\n } else {\n if (!this._checkOverlapping()) {\n setNext = true;\n this.HTMLelement = null;\n }\n }\n if (setNext) {\n if (!this._getNextRandomNode(gravity[0])) return;\n }\n }\n }\n if (!setNext) {\n if (this.imageX < -this.imageW && x2 < 0 || this.imageX > this.screenW && x2 > 0 || this.imageY < -this.imageH && y1 < 0 || this.imageY > this.screenH && y2 > 0) {\n setNext = true;\n if (!this.isChild) {\n this._spawnESheep();\n }\n return;\n }\n }\n setTimeout(this._nextESheepStep.bind(this), parseInt(del1) + parseInt((del2 - del1) * this.animationStep / steps));\n }\n\n /*\r\n * Load Pet List from GitHub, so user can change it\r\n */\n }, {\n key: \"_loadPetList\",\n value: function _loadPetList(element) {\n var _this3 = this;\n fetch(\"https://adrianotiger.github.io/desktopPet/Pets/pets.json\", {\n credentials: 'same-origin',\n cache: \"force-cache\"\n }).then(function (response) {\n return response.json();\n }).then(function (json) {\n console.log(json);\n if (json.pets) {\n element.addEventListener(\"mouseup\", function (e) {\n e.preventDefault();\n e.stopPropagation();\n var div = document.createElement(\"div\");\n div.setAttribute(\"style\", \"position:absolute;left:0px;top:20px;width:183px;min-height:100px;background:linear-gradient(to bottom, #8080ff, #3030a1);color:yellow;\");\n element.parentNode.appendChild(div);\n var _loop = function _loop(k) {\n pet = document.createElement(\"b\");\n pet.setAttribute(\"style\", \"cursor:pointer;display:block;\");\n pet.appendChild(document.createTextNode(json.pets[k].folder));\n pet.addEventListener(\"click\", function () {\n var x = new eSheep(_this3.userOptions);\n x.Start(\"https://adrianotiger.github.io/desktopPet/Pets/\" + json.pets[k].folder + \"/animations.xml\");\n _this3.remove();\n });\n div.appendChild(pet);\n },\n pet;\n for (var k in json.pets) {\n _loop(k);\n }\n div.addEventListener(\"click\", function (e) {\n element.parentNode.removeChild(div);\n });\n });\n }\n });\n }\n }]);\n return eSheep;\n}();\n;"],"file":"../src/esheep.min.js"}
--------------------------------------------------------------------------------