Attaches global drag & drop handlers to this window. This enables dropping files/folders to open them, and also
protects the Brackets app from being replaced by the browser trying to load the dropped file in its place.
190201
function attachHandlers() {

        function handleDragOver(event) {
            event = event.originalEvent || event;

            var files = event.dataTransfer.files;

            stopURIListPropagation(files, event);

            if (files && files.length) {
                event.stopPropagation();
                event.preventDefault();

                var dropEffect = "none";

                // Don't allow drag-and-drop of files/folders when a modal dialog is showing.
                if ($(".modal.instance").length === 0 && isValidDrop(event.dataTransfer.items)) {
                    dropEffect = "copy";
                }
                event.dataTransfer.dropEffect = dropEffect;
            }
        }

        function handleDrop(event) {
            event = event.originalEvent || event;

            var files = event.dataTransfer.files;

            stopURIListPropagation(files, event);

            if (files && files.length) {
                event.stopPropagation();
                event.preventDefault();

                brackets.app.getDroppedFiles(function (err, paths) {
                    if (!err) {
                        openDroppedFiles(paths);
                    }
                });
            }
        }

        // For most of the window, only respond if nothing more specific in the UI has already grabbed the event (e.g.
        // the Extension Manager drop-to-install zone, or an extension with a drop-to-upload zone in its panel)
        $(window.document.body)
            .on("dragover", handleDragOver)
            .on("drop", handleDrop);

        // Over CodeMirror specifically, always pre-empt CodeMirror's drag event handling if files are being dragged - CM stops
        // propagation on any drag event it sees, even when it's not a text drag/drop. But allow CM to handle all non-file drag
        // events. See bug #10617.
        window.document.body.addEventListener("dragover", function (event) {
            if ($(event.target).closest(".CodeMirror").length) {
                handleDragOver(event);
            }
        }, true);
        window.document.body.addEventListener("drop", function (event) {
            if ($(event.target).closest(".CodeMirror").length) {
                handleDrop(event);
            }
        }, true);
    }
1025626
function() {
			var self = this;

			self._frame.on( 'insert', function() {
				var selection   = self._frame.state().get( 'selection' );
				var attachments = selection.models.map( function( model ) {
					return _.extend( {}, model.toJSON() );
				});
				var attachment  = _.extend( {}, selection.first().toJSON() );

				self._setAttachment( attachment );

				$( document ).trigger( 'wpMediaPicker.insert', [ attachments, self ] );
			});

			self._open_button.on( 'click', function() {
				var selection = self._frame.state( 'insert' ).get( 'selection' );
				selection.reset( self._attachment ? [ self._attachment ] : [] );

				self.open();
			});

			self._remove_button.on( 'click', function() {
				self._setAttachment( null );
			});
		}
199141
def __handle_dropped_content(self, event):
        

        if not event.mimeData().hasUrls():
            return

        urls = event.mimeData().urls()

        self.__engine.start_processing("Loading Files ...", len(urls))
        for url in event.mimeData().urls():
            path = foundations.strings.to_string(url.path())
            LOGGER.debug("> Handling dropped '{0}' file.".format(path))
            path = (platform.system() == "Windows" or platform.system() == "Microsoft") and \
                   re.search(r"^\/[A-Z]:", path) and path[1:] or path
            self.load_path(path) and self.restore_development_layout()
            self.__engine.step_processing()
        self.__engine.stop_processing()
173180
function _handleRemoveFromPaneView(e, removedFiles) {
        var handleFileRemoved = function (file) {
            var doc = DocumentManager.getOpenDocumentForPath(file.fullPath);

            if (doc) {
                MainViewManager._destroyEditorIfNotNeeded(doc);
            }
        };

        // when files are removed from a pane then
        //    we should destroy any unnecssary views
        if ($.isArray(removedFiles)) {
            removedFiles.forEach(function (removedFile) {
                handleFileRemoved(removedFile);
            });
        } else {
            handleFileRemoved(removedFiles);
        }
    }
872052
function addFakeDragHandlers() {
            if (!supportsDragAndDrop) {
                if (supportsTouch) {
                    element.addEventListener("touchmove", handleTouchMove, false);
                }
                else {
                    element.addEventListener('mouseover', handleDragEnter, false);
                    element.addEventListener('mouseout', handleDragLeave, false);
                }

                element.addEventListener(supportsTouch ? 'touchend' : 'mouseup', handleDrop, false);
                document.addEventListener(supportsTouch ? 'touchend' : 'mouseup', handleDragEnd, false);
                document.addEventListener("selectstart", prevent, false);

            }

        }
955716
function draggable(e) {
			e.preventDefault();
			previousEvent = e;
			document.addEventListener('mousemove', drag);
			document.addEventListener('mouseup', removeDrag);
		}
1235406
function addLoadEvent(fn) {
		if (typeof win.addEventListener != UNDEF) {
			win.addEventListener("load", fn, false);
		}
		else if (typeof doc.addEventListener != UNDEF) {
			doc.addEventListener("load", fn, false);
		}
		else if (typeof win.attachEvent != UNDEF) {
			addListener(win, "onload", fn);
		}
		else if (typeof win.onload == "function") {
			var fnOld = win.onload;
			win.onload = function() {
				fnOld();
				fn();
			};
		}
		else {
			win.onload = fn;
		}
	}
1160854
function previewOnLoad() {
    pwindow = iframe.contentWindow;
    var p$ = pwindow && pwindow.$;        // preview jquery object
    if (!p$ || p$.editorLoaded) return;   // not ready || already initialized

    var pdoc = pwindow.document;

    // handle pane adjust event over preview
    pdoc.addEventListener('dragover', function(e) {
      adjustPanes(e.clientX, e.clientY, true); // handle over preview
      e.preventDefault();
    });

    // handle pane adjuster drop event over preview
    // (firefox will try to navigate to the url if text is dropped on it)
    pdoc.addEventListener('drop', function(e) {
      e.preventDefault();
    });

    pRef = pwindow.pubRef || {};
    var relPath = pRef.relPath || '';

    $css = p$('<link rel="stylesheet" href="' + relPath + '/pub/css/pub-preview.css">');
    p$('head').append($css);
    $css.get(0).disabled = true;
    toggleFragments();

    var $script = p$('<script src="' + relPath + '/pub/js/pub-preview.js"></script>');
    p$('body').append($script);

    p$.editorLoaded = true;
    clearInterval(previewPoller);
  }
375870
function installDragBox(L) {
  L.Map.mergeOptions({
    dragBox: false // enabled/disabled as needed
  });

  L.Map.DragBox = L.Handler.extend({
    initialize: function(map) {
      this._map = map;
      this._container = map._container;
      this._pane = map._panes.overlayPane;
      this._moved = false;
      this._dragging = map.dragging.enabled();
    },

    addHooks: function() {
      // disable dragging as it blocks all events on mousedown, create our own mousedown handler and add it
      // before re-enabling dragging - is there an issue with ordering here? We rely on our mousedown handler
      // getting executed before the dragging mousedown handler
      if (this._dragging) {
        this._map.dragging.disable();
      }
      this._map.boxZoom.disable();
      L.DomEvent.on(this._container, "mousedown", this._onMouseDown, this);
      if (this._dragging) {
        this._map.dragging.enable();
      }
      this._map.boxZoom.enable();
    },

    removeHooks: function() {
      if (this._dragging) {
        this._map.dragging.enable();
      }
      L.DomEvent.off(this._container, "mousedown", this._onMouseDown, this);
      this._moved = false;
    },

    _onMouseDown: function(e) {
      this._moved = false;

      // enable using shift-mousedown
      if (!e.shiftKey || (e.which !== 1 && e.button !== 1)) {
        return false;
      }

      if (this._dragging) {
        this._map.dragging.disable();
      }
      this._map.boxZoom.disable();
      L.DomUtil.disableTextSelection();
      L.DomUtil.disableImageDrag();

      this._startLayerPoint = this._map.mouseEventToLayerPoint(e);

      L.DomEvent.on(document, "mousemove", this._onMouseMove, this)
        .on(document, "mouseup", this._onMouseUp, this)
        .on(document, "keydown", this._onKeyDown, this);
    },

    _onMouseMove: function(e) {
      if (!this._moved) {
        this._box = L.DomUtil.create("div", "leaflet-zoom-box", this._pane);
        L.DomUtil.setPosition(this._box, this._startLayerPoint);

        //TODO refactor: move cursor to styles
        this._container.style.cursor = "crosshair";
        this._map.fire("dragboxstart");
      }

      var startPoint = this._startLayerPoint,
        box = this._box,
        layerPoint = this._map.mouseEventToLayerPoint(e),
        offset = layerPoint.subtract(startPoint),
        newPos = new L.Point(
          Math.min(layerPoint.x, startPoint.x),
          Math.min(layerPoint.y, startPoint.y)
        );

      L.DomUtil.setPosition(box, newPos);

      this._moved = true;

      // TODO refactor: remove hardcoded 4 pixels
      box.style.width = Math.abs(offset.x) - 4 + "px";
      box.style.height = Math.abs(offset.y) - 4 + "px";
    },

    _finish: function() {
      if (this._moved) {
        this._pane.removeChild(this._box);
        this._container.style.cursor = "";
      }

      if (this._dragging) {
        this._map.dragging.enable();
      }
      this._map.boxZoom.enable();
      L.DomUtil.enableTextSelection();
      L.DomUtil.enableImageDrag();

      L.DomEvent.off(document, "mousemove", this._onMouseMove, this)
        .off(document, "mouseup", this._onMouseUp, this)
        .off(document, "keydown", this._onKeyDown, this);
    },

    _onMouseUp: function(e) {
      this._finish();

      var map = this._map,
        layerPoint = map.mouseEventToLayerPoint(e);

      if (this._startLayerPoint.equals(layerPoint)) {
        return;
      }

      var bounds = new L.LatLngBounds(
        map.layerPointToLatLng(this._startLayerPoint),
        map.layerPointToLatLng(layerPoint)
      );

      map.fire("dragboxend", {
        dragBoxBounds: bounds
      });
    },

    _onKeyDown: function(e) {
      if (e.keyCode === 27) {
        this._finish();
      }
    }
  });

  L.Map.addInitHook("addHandler", "dragBox", L.Map.DragBox);
}
881307
function() {

     	var modules = this.modules;
     	for(var i = 0 ; i < modules.length ; i++) {
		  	this.addModuleToList(modules[i]);
     	}

     	// Make the layer a drag drop target
     	if(!this.ddTarget) {
       	this.ddTarget = new YAHOO.util.DDTarget(this.layer.el, "module");
       	this.ddTarget._layer = this.layer;
     	}
 	}
633889
function handleReload(loadWithoutExtensions) {
        var href    = window.location.href,
            params  = new UrlParams();

        // Make sure the Reload Without User Extensions parameter is removed
        params.parse();

        if (loadWithoutExtensions) {
            if (!params.get("reloadWithoutUserExts")) {
                params.put("reloadWithoutUserExts", true);
            }
        } else {
            if (params.get("reloadWithoutUserExts")) {
                params.remove("reloadWithoutUserExts");
            }
        }

        if (href.indexOf("?") !== -1) {
            href = href.substring(0, href.indexOf("?"));
        }

        if (!params.isEmpty()) {
            href += "?" + params.toString();
        }

        // Give Mac native menus extra time to update shortcut highlighting.
        // Prevents the menu highlighting from getting messed up after reload.
        window.setTimeout(function () {
            browserReload(href);
        }, 100);
    }
685761
function initAppHandlers (cfg = {}) {
	_.each(handlers, (handler, name) => App[name] = _.partial(handler, _, (_.isFunction(cfg[name])) ? cfg[name] : _.noop));
}
349887
function(){
        var self = this,
            list = this._listElement;            
        
        qq.attach(list, 'click', function(e){            
            e = e || window.event;
            var target = e.target || e.srcElement;
            
            if (qq.hasClass(target, self._classes.cancel)){                
                qq.preventDefault(e);
               
                var item = target.parentNode;
                self._handler.cancel(item.qqFileId);
                qq.remove(item);
            }
        });
    }
884877
function () {
            if (!this._popup || !this._popup.isOpen || this._draggable) {
                // maybe the popup was closed while loading aria.utils.dragdrop.Drag,
                // or it was closed and re-opened very quickly (and we should avoid
                // creating the _draggable object twice)
                return;
            }
            this._draggable = new aria.utils.dragdrop.Drag(this._domElt, {
                handle : this._titleBarDomElt,
                cursor : "move",
                proxy : this._cfg.movableProxy,
                constrainTo : this._popupContainer.getContainerRef(),
                dragOverIFrame : true
            });
            this._draggable.$on({
                "dragstart" : {
                    fn : this._onDragStart,
                    scope : this
                },
                "move" : {
                    fn : this._onDragMove,
                    scope : this
                },
                "dragend" : {
                    fn : this._onDragEnd,
                    scope : this
                }
            });
        }
351961
function attachBrowserEvents(self) {
  if (isChromeApp()) {
    chrome.storage.onChanged.addListener(function (e) {
      // make sure it's event addressed to us
      if (e.db_name != null) {
        //object only has oldValue, newValue members
        self.emit(e.dbName.newValue);
      }
    });
  } else if (hasLocalStorage()) {
    if (typeof addEventListener !== 'undefined') {
      addEventListener("storage", function (e) {
        self.emit(e.key);
      });
    } else { // old IE
      window.attachEvent("storage", function (e) {
        self.emit(e.key);
      });
    }
  }
}
317712
def dropEvent(self, ev):
        """"""
        # use function above to accept event if it contains a file URL
        files = self._checkDragDropEvent(ev)
        if files:
            pos = ev.pos()
            dropitem = self.itemAt(pos)
            dprint(1, "dropped on", pos.x(), pos.y(), dropitem and str(dropitem.text(1)))
            # if event originated with ourselves, reorder items
            if ev.source() is self:
                self.reorderItems(dropitem, *files)
            # else event is from someone else, accept the dropped files
            else:
                self._dropped_on = dropitem
                self.emit(SIGNAL("droppedFiles"), *files)
                # if event originated with another DPTreeWidget, emit a draggedAwayFiles() signal on its behalf
                if isinstance(ev.source(), DPTreeWidget):
                    ev.source().emit(SIGNAL("draggedAwayFiles"), *files)
976257
function () {
            if (aria.utils.dragdrop && aria.utils.dragdrop.Drag) {
                this._createDraggable();
            } else {
                Aria.load({
                    classes : ["aria.utils.dragdrop.Drag"],
                    oncomplete : {
                        fn : this._createDraggable,
                        scope : this
                    }
                });
            }
        }