Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/ |
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/sortable_list.min.js.map |
{"version":3,"sources":["../src/sortable_list.js"],"names":["define","$","log","autoScroll","str","ModalFactory","ModalEvents","Notification","defaultParameters","targetListSelector","moveHandlerSelector","isHorizontal","CSS","keyboardDragClass","isDraggedClass","currentPositionClass","sourceListClass","targetListClass","overElementClass","registerNotPassiveListeners","eventname","setup","x","ns","handle","includes","addEventListener","passive","eventListenerOptionsSupported","passivesupported","options","Object","defineProperty","get","document","removeEventListener","err","event","special","touchstart","touchmove","touchend","SortableList","root","config","info","proxy","proxyDelta","dragCounter","lastEvent","extend","listSelector","on","dragStartHandler","clickHandler","EVENTS","DRAGSTART","DRAG","DROP","DRAGEND","prototype","resetDraggedClasses","classes","i","removeClass","remove","calculatePositionOnPage","evt","originalEvent","touches","touch","pageX","pageY","clientX","Math","round","window","scrollLeft","clientY","scrollTop","type","moveElement","sourceList","sourceNextElement","finishDragging","which","movedElement","target","closest","currentTarget","children","length","stopPropagation","preventDefault","element","next","parent","targetNextElement","targetList","dropped","startX","startY","startTime","Date","getTime","addClass","offset","left","y","top","thisDragCounter","setTimeout","createProxy","dragHandler","dragcancelHandler","start","trigger","executeCallback","clone","append","removeAttr","css","position","keyCode","clickedElement","displayMoveDialogue","getPositionInNode","node","rect","getBoundingClientRect","scrollY","scrollX","width","height","xRatio","yRatio","isListHorizontal","elementFromPoint","mainElement","isNotSelf","current","filter","currentList","isNotProxy","find","coordinates","ratio","subList","subListEmpty","endX","endY","endTime","positionChanged","hasPositionChanged","oldinfo","parentElement","beforeElement","dragEl","insertBefore","appendChild","stop","off","eventName","getElementName","Deferred","resolve","text","getDestinationName","afterElement","get_string","then","name","getMoveDialogueTitle","handler","attr","getDestinationsList","addedLists","targets","destinations","result","when","createLink","is","contains","txt","li","appendTo","a","data","addList","inArray","push","list","each","prev","last","create","types","CANCEL","title","body","modal","quickMoveHandler","e","focus","hide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CACV,CAtBO,CAsBL,IAtBK,CAJR,EA0BUU,KA1BV,CA0BgB5M,CAAY,CAAC6M,SA1B7B,CA2BH,CA5BD,CA8BA,MAAO1K,CAAAA,CAEV,CA5rBK,CAAN","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 * A javascript module to handle list items drag and drop\n *\n * Example of usage:\n *\n * Create a list (for example <ul> or <tbody>) where each draggable element has a drag handle.\n * The best practice is to use the template core/drag_handle:\n * $OUTPUT->render_from_template('core/drag_handle', ['movetitle' => get_string('movecontent', 'moodle', ELEMENTNAME)]);\n *\n * Attach this JS module to this list:\n *\n * Space between define and ( critical in comment but not allowed in code in order to function\n * correctly with Moodle's requirejs.php\n *\n * define (['jquery', 'core/sortable_list'], function($, SortableList) {\n * var list = new SortableList('ul.my-awesome-list'); // source list (usually <ul> or <tbody>) - selector or element\n *\n * // Listen to the events when element is dragged.\n * $('ul.my-awesome-list > *').on(SortableList.EVENTS.DROP, function(evt, info) {\n * console.log(info);\n * });\n *\n * // Advanced usage. Overwrite methods getElementName, getDestinationName, moveDialogueTitle, for example:\n * list.getElementName = function(element) {\n * return $.Deferred().resolve(element.attr('data-name'));\n * }\n * }\n *\n * More details: https://docs.moodle.org/dev/Sortable_list\n *\n * For the full list of possible parameters see var defaultParameters below.\n *\n * The following jQuery events are fired:\n * - SortableList.EVENTS.DRAGSTART : when user started dragging a list element\n * - SortableList.EVENTS.DRAG : when user dragged a list element to a new position\n * - SortableList.EVENTS.DROP : when user dropped a list element\n * - SortableList.EVENTS.DROPEND : when user finished dragging - either fired right after dropping or\n * if \"Esc\" was pressed during dragging\n *\n * @module core/sortable_list\n * @class sortable_list\n * @package core\n * @copyright 2018 Marina Glancy\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/log', 'core/autoscroll', 'core/str', 'core/modal_factory', 'core/modal_events', 'core/notification'],\nfunction($, log, autoScroll, str, ModalFactory, ModalEvents, Notification) {\n\n /**\n * Default parameters\n *\n * @private\n * @type {Object}\n */\n var defaultParameters = {\n targetListSelector: null,\n moveHandlerSelector: '[data-drag-type=move]',\n isHorizontal: false,\n autoScroll: true\n };\n\n /**\n * Class names for different elements that may be changed during sorting\n *\n * @private\n * @type {Object}\n */\n var CSS = {\n keyboardDragClass: 'dragdrop-keyboard-drag',\n isDraggedClass: 'sortable-list-is-dragged',\n currentPositionClass: 'sortable-list-current-position',\n sourceListClass: 'sortable-list-source',\n targetListClass: 'sortable-list-target',\n overElementClass: 'sortable-list-over-element'\n };\n\n /**\n * Test the browser support for options objects on event listeners.\n * @return {Boolean}\n */\n var eventListenerOptionsSupported = function() {\n var passivesupported = false,\n options,\n testeventname = \"testpassiveeventoptions\";\n\n // Options support testing example from:\n // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener\n\n try {\n options = Object.defineProperty({}, \"passive\", {\n get: function() {\n passivesupported = true;\n }\n });\n\n // We use an event name that is not likely to conflict with any real event.\n document.addEventListener(testeventname, options, options);\n // We remove the event listener as we have tested the options already.\n document.removeEventListener(testeventname, options, options);\n } catch (err) {\n // It's already false.\n passivesupported = false;\n }\n return passivesupported;\n };\n\n /**\n * Allow to create non-passive touchstart listeners and prevent page scrolling when dragging\n * From: https://stackoverflow.com/a/48098097\n *\n * @type {Object}\n */\n var registerNotPassiveListeners = function(eventname) {\n return {\n setup: function(x, ns, handle) {\n if (ns.includes('notPassive')) {\n this.addEventListener(eventname, handle, {passive: false});\n return true;\n } else {\n return false;\n }\n }\n };\n };\n\n if (eventListenerOptionsSupported) {\n $.event.special.touchstart = registerNotPassiveListeners('touchstart');\n $.event.special.touchmove = registerNotPassiveListeners('touchmove');\n $.event.special.touchend = registerNotPassiveListeners('touchend');\n }\n\n /**\n * Initialise sortable list.\n *\n * @param {(String|jQuery|Element)} root JQuery/DOM element representing sortable list (i.e. <ul>, <tbody>) or CSS selector\n * @param {Object} config Parameters for the list. See defaultParameters above for examples.\n * @property {(String|jQuery|Element)} config.targetListSelector target lists, by default same as root\n * @property {String} config.moveHandlerSelector CSS selector for a drag handle. By default '[data-drag-type=move]'\n * @property {String} config.targetListSelector CSS selector for target lists. By default the same as root\n * @property {(Boolean|Function)} config.isHorizontal Set to true if the list is horizontal\n * (can also be a callback with list as an argument)\n * @property {Boolean} config.autoScroll Engages autoscroll module for automatic vertical scrolling of the\n * whole page, by default true\n */\n var SortableList = function(root, config) {\n\n this.info = null;\n this.proxy = null;\n this.proxyDelta = null;\n this.dragCounter = 0;\n this.lastEvent = null;\n\n this.config = $.extend({}, defaultParameters, config || {});\n this.config.listSelector = root;\n if (!this.config.targetListSelector) {\n this.config.targetListSelector = root;\n }\n if (typeof this.config.listSelector === 'object') {\n // The root is an element on the page. Register a listener for this element.\n $(this.config.listSelector).on('mousedown touchstart.notPassive', $.proxy(this.dragStartHandler, this));\n } else {\n // The root is a CSS selector. Register a listener that picks up the element dynamically.\n $('body').on('mousedown touchstart.notPassive', this.config.listSelector, $.proxy(this.dragStartHandler, this));\n }\n if (this.config.moveHandlerSelector !== null) {\n $('body').on('click keypress', this.config.moveHandlerSelector, $.proxy(this.clickHandler, this));\n }\n\n };\n\n /**\n * Events fired by this entity\n *\n * @public\n * @type {Object}\n */\n SortableList.EVENTS = {\n DRAGSTART: 'sortablelist-dragstart',\n DRAG: 'sortablelist-drag',\n DROP: 'sortablelist-drop',\n DRAGEND: 'sortablelist-dragend'\n };\n\n /**\n * Resets the temporary classes assigned during dragging\n * @private\n */\n SortableList.prototype.resetDraggedClasses = function() {\n var classes = [\n CSS.isDraggedClass,\n CSS.currentPositionClass,\n CSS.overElementClass,\n CSS.targetListClass,\n ];\n for (var i in classes) {\n $('.' + classes[i]).removeClass(classes[i]);\n }\n if (this.proxy) {\n this.proxy.remove();\n this.proxy = $();\n }\n };\n\n /**\n * Calculates evt.pageX, evt.pageY, evt.clientX and evt.clientY\n *\n * For touch events pageX and pageY are taken from the first touch;\n * For the emulated mousemove event they are taken from the last real event.\n *\n * @private\n * @param {Event} evt\n */\n SortableList.prototype.calculatePositionOnPage = function(evt) {\n\n if (evt.originalEvent && evt.originalEvent.touches && evt.originalEvent.touches[0] !== undefined) {\n // This is a touchmove or touchstart event, get position from the first touch position.\n var touch = evt.originalEvent.touches[0];\n evt.pageX = touch.pageX;\n evt.pageY = touch.pageY;\n }\n\n if (evt.pageX === undefined) {\n // Information is not present in case of touchend or when event was emulated by autoScroll.\n // Take the absolute mouse position from the last event.\n evt.pageX = this.lastEvent.pageX;\n evt.pageY = this.lastEvent.pageY;\n } else {\n this.lastEvent = evt;\n }\n\n if (evt.clientX === undefined) {\n // If not provided in event calculate relative mouse position.\n evt.clientX = Math.round(evt.pageX - $(window).scrollLeft());\n evt.clientY = Math.round(evt.pageY - $(window).scrollTop());\n }\n };\n\n /**\n * Handler from dragstart event\n *\n * @private\n * @param {Event} evt\n */\n SortableList.prototype.dragStartHandler = function(evt) {\n if (this.info !== null) {\n if (this.info.type === 'click' || this.info.type === 'touchend') {\n // Ignore double click.\n return;\n }\n // Mouse down or touch while already dragging, cancel previous dragging.\n this.moveElement(this.info.sourceList, this.info.sourceNextElement);\n this.finishDragging();\n }\n\n if (evt.type === 'mousedown' && evt.which !== 1) {\n // We only need left mouse click. If this is a mousedown event with right/middle click ignore it.\n return;\n }\n\n this.calculatePositionOnPage(evt);\n var movedElement = $(evt.target).closest($(evt.currentTarget).children());\n if (!movedElement.length) {\n // Can't find the element user wants to drag. They clicked on the list but outside of any element of the list.\n return;\n }\n\n // Check that we grabbed the element by the handle.\n if (this.config.moveHandlerSelector !== null) {\n if (!$(evt.target).closest(this.config.moveHandlerSelector, movedElement).length) {\n return;\n }\n }\n\n evt.stopPropagation();\n evt.preventDefault();\n\n // Information about moved element with original location.\n // This object is passed to event observers.\n this.dragCounter++;\n this.info = {\n element: movedElement,\n sourceNextElement: movedElement.next(),\n sourceList: movedElement.parent(),\n targetNextElement: movedElement.next(),\n targetList: movedElement.parent(),\n type: evt.type,\n dropped: false,\n startX: evt.pageX,\n startY: evt.pageY,\n startTime: new Date().getTime()\n };\n\n $(this.config.targetListSelector).addClass(CSS.targetListClass);\n\n var offset = movedElement.offset();\n movedElement.addClass(CSS.currentPositionClass);\n this.proxyDelta = {x: offset.left - evt.pageX, y: offset.top - evt.pageY};\n this.proxy = $();\n var thisDragCounter = this.dragCounter;\n setTimeout($.proxy(function() {\n // This mousedown event may in fact be a beginning of a 'click' event. Use timeout before showing the\n // dragged object so we can catch click event. When timeout finishes make sure that click event\n // has not happened during this half a second.\n // Verify dragcounter to make sure the user did not manage to do two very fast drag actions one after another.\n if (this.info === null || this.info.type === 'click' || this.info.type === 'keypress'\n || this.dragCounter !== thisDragCounter) {\n return;\n }\n\n // Create a proxy - the copy of the dragged element that moves together with a mouse.\n this.createProxy();\n }, this), 500);\n\n // Start drag.\n $(window).on('mousemove touchmove.notPassive mouseup touchend.notPassive', $.proxy(this.dragHandler, this));\n $(window).on('keypress', $.proxy(this.dragcancelHandler, this));\n\n // Start autoscrolling. Every time the page is scrolled emulate the mousemove event.\n if (this.config.autoScroll) {\n autoScroll.start(function() {\n $(window).trigger('mousemove');\n });\n }\n\n this.executeCallback(SortableList.EVENTS.DRAGSTART);\n };\n\n /**\n * Creates a \"proxy\" object - a copy of the element that is being moved that always follows the mouse\n * @private\n */\n SortableList.prototype.createProxy = function() {\n this.proxy = this.info.element.clone();\n this.info.sourceList.append(this.proxy);\n this.proxy.removeAttr('id').removeClass(CSS.currentPositionClass)\n .addClass(CSS.isDraggedClass).css({position: 'fixed'});\n this.proxy.offset({top: this.proxyDelta.y + this.lastEvent.pageY, left: this.proxyDelta.x + this.lastEvent.pageX});\n };\n\n /**\n * Handler for click event - when user clicks on the drag handler or presses Enter on keyboard\n *\n * @private\n * @param {Event} evt\n */\n SortableList.prototype.clickHandler = function(evt) {\n if (evt.type === 'keypress' && evt.originalEvent.keyCode !== 13 && evt.originalEvent.keyCode !== 32) {\n return;\n }\n if (this.info !== null) {\n // Ignore double click.\n return;\n }\n\n // Find the element that this draghandle belongs to.\n var clickedElement = $(evt.target).closest(this.config.moveHandlerSelector),\n sourceList = clickedElement.closest(this.config.listSelector),\n movedElement = clickedElement.closest(sourceList.children());\n if (!movedElement.length) {\n return;\n }\n\n evt.preventDefault();\n evt.stopPropagation();\n\n // Store information about moved element with original location.\n this.dragCounter++;\n this.info = {\n element: movedElement,\n sourceNextElement: movedElement.next(),\n sourceList: sourceList,\n targetNextElement: movedElement.next(),\n targetList: sourceList,\n dropped: false,\n type: evt.type,\n startTime: new Date().getTime()\n };\n\n this.executeCallback(SortableList.EVENTS.DRAGSTART);\n this.displayMoveDialogue(clickedElement);\n };\n\n /**\n * Finds the position of the mouse inside the element - on the top, on the bottom, on the right or on the left\\\n *\n * Used to determine if the moved element should be moved after or before the current element\n *\n * @private\n * @param {Number} pageX\n * @param {Number} pageY\n * @param {jQuery} element\n * @returns {(Object|null)}\n */\n SortableList.prototype.getPositionInNode = function(pageX, pageY, element) {\n if (!element.length) {\n return null;\n }\n var node = element[0],\n offset = 0,\n rect = node.getBoundingClientRect(),\n y = pageY - (rect.top + window.scrollY),\n x = pageX - (rect.left + window.scrollX);\n if (x >= -offset && x <= rect.width + offset && y >= -offset && y <= rect.height + offset) {\n return {\n x: x,\n y: y,\n xRatio: rect.width ? (x / rect.width) : 0,\n yRatio: rect.height ? (y / rect.height) : 0\n };\n }\n return null;\n };\n\n /**\n * Check if list is horizontal\n *\n * @param {jQuery} element\n * @return {Boolean}\n */\n SortableList.prototype.isListHorizontal = function(element) {\n var isHorizontal = this.config.isHorizontal;\n if (isHorizontal === true || isHorizontal === false) {\n return isHorizontal;\n }\n return isHorizontal(element);\n };\n\n /**\n * Handler for events mousemove touchmove mouseup touchend\n *\n * @private\n * @param {Event} evt\n */\n SortableList.prototype.dragHandler = function(evt) {\n\n evt.preventDefault();\n evt.stopPropagation();\n\n this.calculatePositionOnPage(evt);\n\n // We can not use evt.target here because it will most likely be our proxy.\n // Move the proxy out of the way so we can find the element at the current mouse position.\n this.proxy.offset({top: -1000, left: -1000});\n // Find the element at the current mouse position.\n var element = $(document.elementFromPoint(evt.clientX, evt.clientY));\n\n // Find the list element and the list over the mouse position.\n var mainElement = this.info.element[0],\n isNotSelf = function() {\n return this !== mainElement;\n },\n current = element.closest('.' + CSS.targetListClass + ' > :not(.' + CSS.isDraggedClass + ')').filter(isNotSelf),\n currentList = element.closest('.' + CSS.targetListClass),\n proxy = this.proxy,\n isNotProxy = function() {\n return !proxy || !proxy.length || this !== proxy[0];\n };\n\n // Add the specified class to the list element we are hovering.\n $('.' + CSS.overElementClass).removeClass(CSS.overElementClass);\n current.addClass(CSS.overElementClass);\n\n // Move proxy to the current position.\n this.proxy.offset({top: this.proxyDelta.y + evt.pageY, left: this.proxyDelta.x + evt.pageX});\n\n if (currentList.length && !currentList.children().filter(isNotProxy).length) {\n // Mouse is over an empty list.\n this.moveElement(currentList, $());\n } else if (current.length === 1 && !this.info.element.find(current[0]).length) {\n // Mouse is over an element in a list - find whether we should move the current position\n // above or below this element.\n var coordinates = this.getPositionInNode(evt.pageX, evt.pageY, current);\n if (coordinates) {\n var parent = current.parent(),\n ratio = this.isListHorizontal(parent) ? coordinates.xRatio : coordinates.yRatio,\n subList = current.find('.' + CSS.targetListClass),\n subListEmpty = !subList.children().filter(isNotProxy).filter(isNotSelf).length;\n if (subList.length && subListEmpty && ratio > 0.2 && ratio < 0.8) {\n // This is an element that is a parent of an empty list and we are around the middle of this element.\n // Treat it as if we are over this empty list.\n this.moveElement(subList, $());\n } else if (ratio > 0.5) {\n // Insert after this element.\n this.moveElement(parent, current.next().filter(isNotProxy));\n } else {\n // Insert before this element.\n this.moveElement(parent, current);\n }\n }\n }\n\n if (evt.type === 'mouseup' || evt.type === 'touchend') {\n // Drop the moved element.\n this.info.endX = evt.pageX;\n this.info.endY = evt.pageY;\n this.info.endTime = new Date().getTime();\n this.info.dropped = true;\n this.info.positionChanged = this.hasPositionChanged(this.info);\n var oldinfo = this.info;\n this.executeCallback(SortableList.EVENTS.DROP);\n this.finishDragging();\n\n if (evt.type === 'touchend'\n && this.config.moveHandlerSelector !== null\n && (oldinfo.endTime - oldinfo.startTime < 500)\n && !oldinfo.positionChanged) {\n // The click event is not triggered on touch screens because we call preventDefault in touchstart handler.\n // If the touchend quickly followed touchstart without moving, consider it a \"click\".\n this.clickHandler(evt);\n }\n }\n };\n\n /**\n * Checks if the position of the dragged element in the list has changed\n *\n * @private\n * @param {Object} info\n * @return {Boolean}\n */\n SortableList.prototype.hasPositionChanged = function(info) {\n return info.sourceList[0] !== info.targetList[0] ||\n info.sourceNextElement.length !== info.targetNextElement.length ||\n (info.sourceNextElement.length && info.sourceNextElement[0] !== info.targetNextElement[0]);\n };\n\n /**\n * Moves the current position of the dragged element\n *\n * @private\n * @param {jQuery} parentElement\n * @param {jQuery} beforeElement\n */\n SortableList.prototype.moveElement = function(parentElement, beforeElement) {\n var dragEl = this.info.element;\n if (beforeElement.length && beforeElement[0] === dragEl[0]) {\n // Insert before the current position of the dragged element - nothing to do.\n return;\n }\n if (parentElement[0] === this.info.targetList[0] &&\n beforeElement.length === this.info.targetNextElement.length &&\n beforeElement[0] === this.info.targetNextElement[0]) {\n // Insert in the same location as the current position - nothing to do.\n return;\n }\n\n if (beforeElement.length) {\n // Move the dragged element before the specified element.\n parentElement[0].insertBefore(dragEl[0], beforeElement[0]);\n } else if (this.proxy && this.proxy.parent().length && this.proxy.parent()[0] === parentElement[0]) {\n // We need to move to the end of the list but the last element in this list is a proxy.\n // Always leave the proxy in the end of the list.\n parentElement[0].insertBefore(dragEl[0], this.proxy[0]);\n } else {\n // Insert in the end of a list (when proxy is in another list).\n parentElement[0].appendChild(dragEl[0]);\n }\n\n // Save the current position of the dragged element in the list.\n this.info.targetList = parentElement;\n this.info.targetNextElement = beforeElement;\n this.executeCallback(SortableList.EVENTS.DRAG);\n };\n\n /**\n * Finish dragging (when dropped or cancelled).\n * @private\n */\n SortableList.prototype.finishDragging = function() {\n this.resetDraggedClasses();\n if (this.config.autoScroll) {\n autoScroll.stop();\n }\n $(window).off('mousemove touchmove.notPassive mouseup touchend.notPassive', $.proxy(this.dragHandler, this));\n $(window).off('keypress', $.proxy(this.dragcancelHandler, this));\n this.executeCallback(SortableList.EVENTS.DRAGEND);\n this.info = null;\n };\n\n /**\n * Executes callback specified in sortable list parameters\n *\n * @private\n * @param {String} eventName\n */\n SortableList.prototype.executeCallback = function(eventName) {\n this.info.element.trigger(eventName, this.info);\n };\n\n /**\n * Handler from keypress event (cancel dragging when Esc is pressed)\n *\n * @private\n * @param {Event} evt\n */\n SortableList.prototype.dragcancelHandler = function(evt) {\n if (evt.type !== 'keypress' || evt.originalEvent.keyCode !== 27) {\n // Only cancel dragging when Esc was pressed.\n return;\n }\n // Dragging was cancelled. Return item to the original position.\n this.moveElement(this.info.sourceList, this.info.sourceNextElement);\n this.finishDragging();\n };\n\n /**\n * Returns the name of the current element to be used in the move dialogue\n *\n * @public\n * @param {jQuery} element\n * @return {Promise}\n */\n SortableList.prototype.getElementName = function(element) {\n return $.Deferred().resolve(element.text());\n };\n\n /**\n * Returns the label for the potential move destination, i.e. \"After ElementX\" or \"To the top of the list\"\n *\n * Note that we use \"after\" in the label for better UX\n *\n * @public\n * @param {jQuery} parentElement\n * @param {jQuery} afterElement\n * @return {Promise}\n */\n SortableList.prototype.getDestinationName = function(parentElement, afterElement) {\n if (!afterElement.length) {\n return str.get_string('movecontenttothetop', 'moodle');\n } else {\n return this.getElementName(afterElement)\n .then(function(name) {\n return str.get_string('movecontentafter', 'moodle', name);\n });\n }\n };\n\n /**\n * Returns the title for the move dialogue (\"Move elementY\")\n *\n * @public\n * @param {jQuery} element\n * @param {jQuery} handler\n * @return {Promise}\n */\n SortableList.prototype.getMoveDialogueTitle = function(element, handler) {\n if (handler.attr('title')) {\n return $.Deferred().resolve(handler.attr('title'));\n }\n return this.getElementName(element).then(function(name) {\n return str.get_string('movecontent', 'moodle', name);\n });\n };\n\n /**\n * Returns the list of possible move destinations\n *\n * @private\n * @return {Promise}\n */\n SortableList.prototype.getDestinationsList = function() {\n var addedLists = [],\n targets = $(this.config.targetListSelector),\n destinations = $('<ul/>').addClass(CSS.keyboardDragClass),\n result = $.when().then(function() {\n return destinations;\n }),\n createLink = $.proxy(function(parentElement, beforeElement, afterElement) {\n if (beforeElement.is(this.info.element) || afterElement.is(this.info.element)) {\n // Can not move before or after itself.\n return;\n }\n if ($.contains(this.info.element[0], parentElement[0])) {\n // Can not move to its own child.\n return;\n }\n result = result\n .then($.proxy(function() {\n return this.getDestinationName(parentElement, afterElement);\n }, this))\n .then(function(txt) {\n var li = $('<li/>').appendTo(destinations);\n var a = $('<a href=\"#\"/>').attr('data-core_sortable_list-quickmove', 1).appendTo(li);\n a.data('parent-element', parentElement).data('before-element', beforeElement).text(txt);\n return destinations;\n });\n }, this),\n addList = function() {\n // Destination lists may be nested. We want to add all move destinations in the same\n // order they appear on the screen for the user.\n if ($.inArray(this, addedLists) !== -1) {\n return;\n }\n addedLists.push(this);\n var list = $(this),\n children = list.children();\n children.each(function() {\n var element = $(this);\n createLink(list, element, element.prev());\n // Add all nested lists.\n element.find(targets).each(addList);\n });\n createLink(list, $(), children.last());\n };\n targets.each(addList);\n return result;\n };\n\n /**\n * Displays the dialogue to move element.\n * @param {jQuery} clickedElement element to return focus to after the modal is closed\n * @private\n */\n SortableList.prototype.displayMoveDialogue = function(clickedElement) {\n ModalFactory.create({\n type: ModalFactory.types.CANCEL,\n title: this.getMoveDialogueTitle(this.info.element, clickedElement),\n body: this.getDestinationsList()\n }).then($.proxy(function(modal) {\n var quickMoveHandler = $.proxy(function(e) {\n e.preventDefault();\n e.stopPropagation();\n this.moveElement($(e.currentTarget).data('parent-element'), $(e.currentTarget).data('before-element'));\n this.info.endTime = new Date().getTime();\n this.info.positionChanged = this.hasPositionChanged(this.info);\n this.info.dropped = true;\n clickedElement.focus();\n this.executeCallback(SortableList.EVENTS.DROP);\n modal.hide();\n }, this);\n modal.getRoot().on('click', '[data-core_sortable_list-quickmove]', quickMoveHandler);\n modal.getRoot().on(ModalEvents.hidden, $.proxy(function() {\n // Always destroy when hidden, it is generated dynamically each time.\n modal.getRoot().off('click', '[data-core_sortable_list-quickmove]', quickMoveHandler);\n modal.destroy();\n this.finishDragging();\n }, this));\n modal.setLarge();\n modal.show();\n return modal;\n }, this)).catch(Notification.exception);\n };\n\n return SortableList;\n\n});\n"],"file":"sortable_list.min.js"}