@@ -5137,7 +5137,7 @@ console.log("dt.types : "+dt.types);
5137
5137
// Note: when the mouse is over the lifts, an HTMLDivElement is returned
5138
5138
let row = getDragToRow ( target ) ;
5139
5139
//console.log("Drop on row: "+row+" class: "+row.classList+" BN_id: "+row.dataset.id);
5140
- traceDt ( dt ) ;
5140
+ // traceDt(dt);
5141
5141
5142
5142
// Can't happen when in a dropEffect=none zone .. but in case, let's protect against it
5143
5143
let is_ctrlKey = ( isMacOS ? e . metaKey : e . ctrlKey ) ; // When Ctrl is pressed, this is a copy, no protection
@@ -5381,19 +5381,39 @@ console.log("tabs length: "+len);
5381
5381
|| types . includes ( type = "text/x-moz-url" ) // Dragging the location bar URL address
5382
5382
) {
5383
5383
let url = dt . getData ( type ) ;
5384
- let title = dt . getData ( "text/x-moz-url-desc" ) ;
5385
- if ( title . length == 0 ) {
5386
- title = dt . getData ( "text/x-moz-url" ) ;
5384
+ // Try the URL description type
5385
+ let title = dt . getData ( "text/x-moz-url-desc" ) . trim ( ) ;
5386
+ let splitIndex = title . indexOf ( "\n" ) ; // Remove any "\n" and following part if there is in title
5387
+ if ( splitIndex > 0 ) {
5388
+ title = title . slice ( 0 , splitIndex ) ;
5387
5389
}
5388
5390
5389
- let splitIndex = url . indexOf ( "\n" ) ; // Remove any "\n" and following part if there is in URL
5391
+ // Get URL
5392
+ splitIndex = url . indexOf ( "\n" ) ; // Remove any "\n" and following part if there is in URL
5390
5393
if ( splitIndex > 0 ) {
5391
5394
url = url . slice ( 0 , splitIndex ) ;
5392
5395
}
5393
- if ( title . length == 0 ) { // If title is empty, use the URL as title
5396
+ if ( url . startsWith ( "https://www.google.com/url?" ) ) { // Handle Google search result drag = simplify it
5397
+ splitIndex = url . indexOf ( "&url=" ) ; // Remove any "&url=" and parts before
5398
+ if ( splitIndex > 0 ) {
5399
+ url = url . slice ( splitIndex + 5 ) ;
5400
+ splitIndex = url . indexOf ( "&" ) ; // Remove any following "&" and parts after, to keep only the real URL
5401
+ if ( splitIndex > 0 ) {
5402
+ url = url . slice ( 0 , splitIndex ) ;
5403
+ }
5404
+ // Decode the URL
5405
+ url = decodeURIComponent ( url ) ;
5406
+ }
5407
+ }
5408
+
5409
+ // Adjust title if empty
5410
+ if ( title . length == 0 ) { // If title is empty, try the URL content (e.g. location bar drag & drop)
5411
+ title = dt . getData ( "text/x-moz-url" ) ;
5412
+ }
5413
+ if ( title . length == 0 ) { // If title is still empty, use the URL as title
5394
5414
title = url ;
5395
5415
}
5396
- else { // If there is an "\n", keep the part after
5416
+ else { // If there is an "\n", keep the part after (can only be for "text/x-moz-url", e.g. location bar drag & drop)
5397
5417
splitIndex = title . indexOf ( "\n" ) ;
5398
5418
title = title . slice ( splitIndex + 1 ) ;
5399
5419
}
0 commit comments