Merge branch 'master' of github.com:piroor/treestyletab
This commit is contained in:
commit
213aa81361
@ -1268,8 +1268,10 @@ AutoHideBrowser.prototype = {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var draggedTabs = this.window['piro.sakura.ne.jp'].tabsDragUtils.getSelectedTabs(aEvent);
|
var draggedTabs = this.window['piro.sakura.ne.jp'].tabsDragUtils.getSelectedTabs(aEvent);
|
||||||
if (draggedTabs.length ||
|
if (
|
||||||
this.treeStyleTab.tabbarDNDObserver.retrieveURLFromDataTransfer(aEvent.dataTransfer)) {
|
draggedTabs.length ||
|
||||||
|
this.treeStyleTab.tabbarDNDObserver.retrieveURLsFromDataTransfer(aEvent.dataTransfer).length
|
||||||
|
) {
|
||||||
this.show(this.kSHOWN_BY_MOUSEMOVE);
|
this.show(this.kSHOWN_BY_MOUSEMOVE);
|
||||||
|
|
||||||
if (this._autoHideOnDragLeaveTimer) {
|
if (this._autoHideOnDragLeaveTimer) {
|
||||||
|
@ -1054,7 +1054,8 @@ catch(e) {
|
|||||||
if (!draggedTab) {
|
if (!draggedTab) {
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
|
|
||||||
let url = this.retrieveURLFromDataTransfer(dt);
|
let urls = this.retrieveURLFromDataTransfer(dt);
|
||||||
|
let url = urls.length ? urls[0] : '' ;
|
||||||
|
|
||||||
if (!url || !url.length || url.indexOf(' ', 0) != -1 || /^\s*(javascript|data):/.test(url))
|
if (!url || !url.length || url.indexOf(' ', 0) != -1 || /^\s*(javascript|data):/.test(url))
|
||||||
return;
|
return;
|
||||||
@ -1106,40 +1107,55 @@ catch(e) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
retrieveURLFromDataTransfer : function TSTService_retrieveURLFromDataTransfer(aDataTransfer)
|
retrieveURLsFromDataTransfer : function TSTService_retrieveURLsFromDataTransfer(aDataTransfer)
|
||||||
{
|
{
|
||||||
let url;
|
var urls = [];
|
||||||
let types = ['text/x-moz-url', 'text/uri-list', 'text/plain', 'application/x-moz-file'];
|
var types = [
|
||||||
|
'text/uri-list',
|
||||||
|
'text/x-moz-text-internal',
|
||||||
|
'text/x-moz-url',
|
||||||
|
'text/plain',
|
||||||
|
'application/x-moz-file'
|
||||||
|
];
|
||||||
for (let i = 0; i < types.length; i++) {
|
for (let i = 0; i < types.length; i++) {
|
||||||
let dataType = types[i];
|
let dataType = types[i];
|
||||||
let isURLList = dataType == 'text/uri-list';
|
for (let i = 0, maxi = aDataTransfer.mozItemCount; i < maxi; i++)
|
||||||
let urlData = aDataTransfer.mozGetDataAt(isURLList ? 'URL' : dataType , 0);
|
{
|
||||||
if (urlData) {
|
let urlData = aDataTransfer.mozGetDataAt(dataType, i);
|
||||||
url = this.retrieveURLFromData(urlData, isURLList ? 'text/plain' : dataType);
|
if (urlData) {
|
||||||
break;
|
urls = urls.concat(this.retrieveURLsFromData(urlData, dataType));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (urls.length)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return url;
|
return urls;
|
||||||
},
|
},
|
||||||
retrieveURLFromData : function TSTService_retrieveURLFromData(aData, aType)
|
retrieveURLsFromData : function TSTService_retrieveURLsFromData(aData, aType)
|
||||||
{
|
{
|
||||||
switch (aType)
|
switch (aType)
|
||||||
{
|
{
|
||||||
|
case 'text/uri-list':
|
||||||
|
return aData.replace(/\r/g, '\n')
|
||||||
|
.replace(/^\#.+$/gim, '')
|
||||||
|
.replace(/\n\n+/g, '\n')
|
||||||
|
.split('\n');
|
||||||
|
|
||||||
case 'text/unicode':
|
case 'text/unicode':
|
||||||
case 'text/plain':
|
case 'text/plain':
|
||||||
case 'text/x-moz-text-internal':
|
case 'text/x-moz-text-internal':
|
||||||
return aData.replace(/^\s+|\s+$/g, '');
|
return [aData.replace(/^\s+|\s+$/g, '')];
|
||||||
|
|
||||||
case 'text/x-moz-url':
|
case 'text/x-moz-url':
|
||||||
return ((aData instanceof Ci.nsISupportsString) ? aData.toString() : aData)
|
return [((aData instanceof Ci.nsISupportsString) ? aData.toString() : aData)
|
||||||
.split('\n')[0];
|
.split('\n')[0]];
|
||||||
|
|
||||||
case 'application/x-moz-file':
|
case 'application/x-moz-file':
|
||||||
let fileHandler = IOService.getProtocolHandler('file')
|
let fileHandler = IOService.getProtocolHandler('file')
|
||||||
.QueryInterface(Ci.nsIFileProtocolHandler);
|
.QueryInterface(Ci.nsIFileProtocolHandler);
|
||||||
return fileHandler.getURLSpecFromFile(aData);
|
return [fileHandler.getURLSpecFromFile(aData)];
|
||||||
}
|
}
|
||||||
return null;
|
return [];
|
||||||
},
|
},
|
||||||
|
|
||||||
init : function TabbarDND_init(aTabBrowser)
|
init : function TabbarDND_init(aTabBrowser)
|
||||||
|
@ -414,6 +414,7 @@ TreeStyleTabWindow.prototype = {
|
|||||||
// rap('window/init start');
|
// rap('window/init start');
|
||||||
var w = this.window;
|
var w = this.window;
|
||||||
w.removeEventListener('load', this, false);
|
w.removeEventListener('load', this, false);
|
||||||
|
|
||||||
w.addEventListener('unload', this, false);
|
w.addEventListener('unload', this, false);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user