Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{"version":3,"file":"settingsblock.min.js","sources":["../src/settingsblock.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 * Load the settings block tree javscript\n *\n * @module     block_settings/settingsblock\n * @copyright  2015 John Okely <john@moodle.com>\n * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {notifyBlockContentUpdated} from 'core_block/events';\nimport Tree from 'core/tree';\n\nexport const init = (instanceId, siteAdminNodeId) => {\n    const adminTree = new Tree(\".block_settings .block_tree\");\n    const blockNode = document.querySelector(`[data-instance-id=\"${instanceId}\"]`);\n\n    if (siteAdminNodeId) {\n        const siteAdminLink = adminTree.treeRoot.get(0).querySelector(`#${siteAdminNodeId} a`);\n        const newContainer = document.createElement('span');\n        newContainer.setAttribute('tabindex', '0');\n        siteAdminLink.childNodes.forEach(node => newContainer.appendChild(node));\n        siteAdminLink.replaceWith(newContainer);\n    }\n\n    /**\n     * The method to call when then the navtree finishes expanding a group.\n     *\n     * @method finishExpandingGroup\n     * @param {Object} item\n     * @fires event:blockContentUpdated\n     */\n    adminTree.finishExpandingGroup = function(item) {\n        Tree.prototype.finishExpandingGroup.call(adminTree, item);\n        notifyBlockContentUpdated(blockNode);\n    };\n\n    /**\n     * The method to call whe then the navtree collapses a group\n     *\n     * @method collapseGroup\n     * @param {Object} item\n     * @fires event:blockContentUpdated\n     */\n    adminTree.collapseGroup = function(item) {\n        Tree.prototype.collapseGroup.call(adminTree, item);\n        notifyBlockContentUpdated(blockNode);\n    };\n};\n"],"names":["instanceId","siteAdminNodeId","adminTree","Tree","blockNode","document","querySelector","siteAdminLink","treeRoot","get","newContainer","createElement","setAttribute","childNodes","forEach","node","appendChild","replaceWith","finishExpandingGroup","item","prototype","call","collapseGroup"],"mappings":";;;;;;;oJAyBoB,CAACA,WAAYC,yBACvBC,UAAY,IAAIC,cAAK,+BACrBC,UAAYC,SAASC,2CAAoCN,qBAE3DC,gBAAiB,OACXM,cAAgBL,UAAUM,SAASC,IAAI,GAAGH,yBAAkBL,uBAC5DS,aAAeL,SAASM,cAAc,QAC5CD,aAAaE,aAAa,WAAY,KACtCL,cAAcM,WAAWC,SAAQC,MAAQL,aAAaM,YAAYD,QAClER,cAAcU,YAAYP,cAU9BR,UAAUgB,qBAAuB,SAASC,oBACjCC,UAAUF,qBAAqBG,KAAKnB,UAAWiB,4CAC1Bf,YAU9BF,UAAUoB,cAAgB,SAASH,oBAC1BC,UAAUE,cAAcD,KAAKnB,UAAWiB,4CACnBf"}