Sindbad~EG File Manager
{"version":3,"file":"encryptedpassword.min.js","sources":["../src/encryptedpassword.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Encrypted password functionality.\n *\n * @module core_form/encryptedpassword\n * @copyright 2019 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * Constructor for EncryptedPassword.\n *\n * @class core_form/encryptedpassword\n * @param {String} elementId The element to apply the encrypted password JS to\n */\nexport const EncryptedPassword = function(elementId) {\n const wrapper = document.querySelector('div[data-encryptedpasswordid=\"' + elementId + '\"]');\n this.spanOrLink = wrapper.querySelector('span, a');\n this.input = wrapper.querySelector('input');\n this.editButtonOrLink = wrapper.querySelector('button[data-editbutton], a');\n this.cancelButton = wrapper.querySelector('button[data-cancelbutton]');\n\n // Edit button action.\n var editHandler = (e) => {\n e.stopImmediatePropagation();\n e.preventDefault();\n this.startEditing(true);\n };\n this.editButtonOrLink.addEventListener('click', editHandler);\n\n // When it's a link, do some magic to make the label work as well.\n if (this.editButtonOrLink.nodeName === 'A') {\n wrapper.parentElement.previousElementSibling.querySelector('label').addEventListener('click', editHandler);\n }\n\n // Cancel button action.\n this.cancelButton.addEventListener('click', (e) => {\n e.stopImmediatePropagation();\n e.preventDefault();\n this.cancelEditing();\n });\n\n // If the value is not set yet, start editing and remove the cancel option - so that\n // it saves something in the config table and doesn't keep repeat showing it as a new\n // admin setting...\n if (wrapper.dataset.novalue === 'y') {\n this.startEditing(false);\n this.cancelButton.style.display = 'none';\n }\n};\n\n/**\n * Starts editing.\n *\n * @param {Boolean} moveFocus If true, sets focus to the edit box\n */\nEncryptedPassword.prototype.startEditing = function(moveFocus) {\n this.input.style.display = 'inline';\n this.input.disabled = false;\n this.spanOrLink.style.display = 'none';\n this.editButtonOrLink.style.display = 'none';\n this.cancelButton.style.display = 'inline';\n\n // Move the id around, which changes what happens when you click the label.\n const id = this.editButtonOrLink.id;\n this.editButtonOrLink.removeAttribute('id');\n this.input.id = id;\n\n if (moveFocus) {\n this.input.focus();\n }\n};\n\n/**\n * Cancels editing.\n */\nEncryptedPassword.prototype.cancelEditing = function() {\n this.input.style.display = 'none';\n this.input.value = '';\n this.input.disabled = true;\n this.spanOrLink.style.display = 'inline';\n this.editButtonOrLink.style.display = 'inline';\n this.cancelButton.style.display = 'none';\n\n // Move the id around, which changes what happens when you click the label.\n const id = this.input.id;\n this.input.removeAttribute('id');\n this.editButtonOrLink.id = id;\n};\n"],"names":["EncryptedPassword","elementId","wrapper","document","querySelector","spanOrLink","input","editButtonOrLink","cancelButton","editHandler","e","stopImmediatePropagation","preventDefault","_this","startEditing","addEventListener","this","nodeName","parentElement","previousElementSibling","cancelEditing","dataset","novalue","style","display","prototype","moveFocus","disabled","id","removeAttribute","focus","value"],"mappings":";;;;;;;;IA6BaA,kBAAoB,SAASC,0BAChCC,QAAUC,SAASC,cAAc,iCAAmCH,UAAY,WACjFI,WAAaH,QAAQE,cAAc,gBACnCE,MAAQJ,QAAQE,cAAc,cAC9BG,iBAAmBL,QAAQE,cAAc,mCACzCI,aAAeN,QAAQE,cAAc,iCAGtCK,YAAc,SAACC,GACfA,EAAEC,2BACFD,EAAEE,iBACFC,MAAKC,cAAa,SAEjBP,iBAAiBQ,iBAAiB,QAASN,aAGT,MAAnCO,KAAKT,iBAAiBU,UACtBf,QAAQgB,cAAcC,uBAAuBf,cAAc,SAASW,iBAAiB,QAASN,kBAI7FD,aAAaO,iBAAiB,SAAS,SAACL,GACzCA,EAAEC,2BACFD,EAAEE,iBACFC,MAAKO,mBAMuB,MAA5BlB,QAAQmB,QAAQC,eACXR,cAAa,QACbN,aAAae,MAAMC,QAAU,sDAS1CxB,kBAAkByB,UAAUX,aAAe,SAASY,gBAC3CpB,MAAMiB,MAAMC,QAAU,cACtBlB,MAAMqB,UAAW,OACjBtB,WAAWkB,MAAMC,QAAU,YAC3BjB,iBAAiBgB,MAAMC,QAAU,YACjChB,aAAae,MAAMC,QAAU,aAG5BI,GAAKZ,KAAKT,iBAAiBqB,QAC5BrB,iBAAiBsB,gBAAgB,WACjCvB,MAAMsB,GAAKA,GAEZF,gBACKpB,MAAMwB,SAOnB9B,kBAAkByB,UAAUL,cAAgB,gBACnCd,MAAMiB,MAAMC,QAAU,YACtBlB,MAAMyB,MAAQ,QACdzB,MAAMqB,UAAW,OACjBtB,WAAWkB,MAAMC,QAAU,cAC3BjB,iBAAiBgB,MAAMC,QAAU,cACjChB,aAAae,MAAMC,QAAU,WAG5BI,GAAKZ,KAAKV,MAAMsB,QACjBtB,MAAMuB,gBAAgB,WACtBtB,iBAAiBqB,GAAKA"}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists