33 if (typeof(
Ci) ==
"undefined")
34 var
Ci = Components.interfaces;
35 if (typeof(
Cc) ==
"undefined")
36 var
Cc = Components.classes;
37 if (typeof(
Cr) ==
"undefined")
38 var
Cr = Components.results;
40 if (typeof(ExternalDropHandler) ==
"undefined")
41 Components.utils.import(
"resource://app/jsmodules/DropHelper.jsm");
45 var dndDefaultHandler_module = {};
46 dndDefaultHandler_module.init_once = 0;
47 dndDefaultHandler_module.deinit_once = 0;
51 dndDefaultHandler_module.onLoad =
function(
event)
53 if (dndDefaultHandler_module.init_once++) { dump(
"WARNING: dndDefaultHandler_module double init!!\n");
return; }
55 document.addEventListener(
"dragover", dndDefaultHandler_module.onDragOver,
false );
56 document.addEventListener(
"dragdrop", dndDefaultHandler_module.onDragDrop,
false );
59 dndDefaultHandler_module.onUnload =
function()
61 if (dndDefaultHandler_module.deinit_once++) { dump(
"WARNING: dndDefaultHandler_module double deinit!!\n");
return; }
62 document.removeEventListener(
"dragover", dndDefaultHandler_module.onDragOver,
false );
63 document.removeEventListener(
"dragdrop", dndDefaultHandler_module.onDragDrop,
false );
64 window.removeEventListener(
"load", dndDefaultHandler_module.onLoad,
false);
65 window.removeEventListener(
"unload", dndDefaultHandler_module.onUnload,
false);
68 window.addEventListener(
"load", dndDefaultHandler_module.onLoad,
false);
69 window.addEventListener(
"unload", dndDefaultHandler_module.onUnload,
false);
73 canHandleMultipleItems:
true,
75 getSupportedFlavours :
function ()
77 var flavours =
new FlavourSet();
78 ExternalDropHandler.addFlavours(flavours);
83 onDrop:
function ( evt, dropdata,
session )
85 var dropHandlerListener = {
87 onDropComplete:
function(aTargetList,
95 onFirstMediaItem:
function(aTargetList, aFirstMediaItem) {
96 this.
observer.playFirstDrop(aFirstMediaItem);
99 ExternalDropHandler.drop(
window,
session, dropHandlerListener);
102 playFirstDrop:
function(firstDrop) {
105 var index = view.getIndexForItem(firstDrop);
109 gBrowser.showIndexInView(view, index);
113 gMM.sequencer.playView(view, index);
dndDefaultHandler_module onDragOver
Javascript wrappers for common library tasks.