@@ -252,6 +252,10 @@ tmpElem1 = document.createElement("span"); // Assuming it is an HTMLSpanElement
252
252
tmpElem1 . classList . add ( "favtext" ) ;
253
253
tmpElem1 . draggable = false ; // False by default for <span>
254
254
RFolderTempl . appendChild ( tmpElem1 ) ;
255
+ tmpElem1 = document . createElement ( "span" ) ; // Assuming it is an HTMLSpanElement
256
+ tmpElem1 . classList . add ( "rfavpath" ) ;
257
+ tmpElem1 . draggable = false ; // False by default for <span>
258
+ RFolderTempl . appendChild ( tmpElem1 ) ;
255
259
/*
256
260
******* Prepare special Folder structure for node cloning
257
261
*/
@@ -288,6 +292,10 @@ tmpElem1 = document.createElement("span"); // Assuming it is an HTMLSpanElement
288
292
tmpElem1 . classList . add ( "favtext" ) ;
289
293
tmpElem1 . draggable = false ; // False by default for <span>
290
294
RSFolderTempl . appendChild ( tmpElem1 ) ;
295
+ tmpElem1 = document . createElement ( "span" ) ; // Assuming it is an HTMLSpanElement
296
+ tmpElem1 . classList . add ( "rfavpath" ) ;
297
+ tmpElem1 . draggable = false ; // False by default for <span>
298
+ RSFolderTempl . appendChild ( tmpElem1 ) ;
291
299
/*
292
300
******* Prepare Separator structure for node cloning
293
301
*/
@@ -553,13 +561,15 @@ function appendResult (BN) {
553
561
// - a <div> (class "rtwistiexx") if a folder
554
562
// - an <div>, or <img> if special folder, (class "favicon")
555
563
// - and a <span> with text (class "favtext")
564
+ // - for folder results, additionally, a <span> with path to the folder (class "rfavpath")
556
565
if ( type == "folder" ) { // Folder
557
566
// Mark that row as folder
558
567
row . dataset . type = "folder" ;
559
568
560
569
// Create elements
561
570
let div2 ;
562
571
let span ;
572
+ let pathspan ;
563
573
if ( BN . fetchedUri ) { // Special bookmark folder with special favicon
564
574
div2 = RSFolderTempl . cloneNode ( true ) ;
565
575
let img = div2 . firstElementChild . nextElementSibling ;
@@ -573,16 +583,20 @@ function appendResult (BN) {
573
583
if ( BN . inBSP2Trash ) { // Set to italics
574
584
span . style . fontStyle = "italic" ;
575
585
}
576
-
577
586
let title = BN . title ;
587
+ span . textContent = title ;
588
+ // span.draggable = false;
589
+
590
+ pathspan = span . nextElementSibling ;
591
+ let p = pathspan . textContent = BN_path ( BN . parentId ) ;
592
+ // pathspan.draggable = false;
593
+
578
594
if ( showPath_option ) {
579
- div2 . title = BN_path ( BN . parentId ) ;
595
+ div2 . title = p ;
580
596
}
581
597
else {
582
598
div2 . title = title ;
583
599
}
584
- span . textContent = title ;
585
- // span.draggable = false;
586
600
cell . appendChild ( div2 ) ;
587
601
}
588
602
else { // "bookmark"
@@ -603,7 +617,7 @@ function appendResult (BN) {
603
617
anchor = RNFBookmarkTempl . cloneNode ( true ) ;
604
618
span = anchor . firstElementChild . nextElementSibling ;
605
619
}
606
- else { // clone normal one, and fill image
620
+ else { // Clone normal one, and fill image
607
621
anchor = RBookmarkTempl . cloneNode ( true ) ;
608
622
let img = anchor . firstElementChild ;
609
623
img . src = uri ;
@@ -921,6 +935,7 @@ function displayResults (a_BTN) {
921
935
// Create search results table
922
936
// resultsFragment = document.createDocumentFragment();
923
937
resultsTable = document . createElement ( "table" ) ;
938
+ resultsTable . id = "resultstable" ;
924
939
SearchResult . appendChild ( resultsTable ) ; // Display the search results table + reflow
925
940
// resultsFragment.appendChild(resultsTable);
926
941
@@ -967,7 +982,7 @@ let searchlistTimeoutId;
967
982
function closeSearchList ( ) {
968
983
searchlistTimeoutId == undefined ;
969
984
SearchTextInput . blur ( ) ; // This closes the search list
970
- SearchTextInput . focus ( ) ; // Givz back focus to be able to type again
985
+ SearchTextInput . focus ( ) ; // Give back focus to be able to type again
971
986
let l = SearchTextInput . value . length ; // Focus is selecting all text in the input => de-select to type at end ...
972
987
SearchTextInput . setSelectionRange ( l , l ) ;
973
988
}
@@ -5366,19 +5381,39 @@ console.log("tabs length: "+len);
5366
5381
|| types . includes ( type = "text/x-moz-url" ) // Dragging the location bar URL address
5367
5382
) {
5368
5383
let url = dt . getData ( type ) ;
5369
- let title = dt . getData ( "text/x-moz-url-desc" ) ;
5370
- if ( title . length == 0 ) {
5371
- 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 ) ;
5372
5389
}
5373
5390
5374
- 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
5375
5393
if ( splitIndex > 0 ) {
5376
5394
url = url . slice ( 0 , splitIndex ) ;
5377
5395
}
5378
- 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
5379
5414
title = url ;
5380
5415
}
5381
- 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)
5382
5417
splitIndex = title . indexOf ( "\n" ) ;
5383
5418
title = title . slice ( splitIndex + 1 ) ;
5384
5419
}
@@ -7130,7 +7165,7 @@ if (traceEnabled_option) {
7130
7165
}
7131
7166
// If a show path option changed, update any open search result
7132
7167
if ( ( showPath_option_old != showPath_option )
7133
- || ( showPath_option && ( reversePath_option_old != reversePath_option ) )
7168
+ || ( reversePath_option_old != reversePath_option )
7134
7169
) {
7135
7170
// Trigger an update as results can change, if there is a search active
7136
7171
triggerUpdate ( ) ;
0 commit comments