Skip to content

Commit 8e42b8a

Browse files
authored
Small adjustments
1 parent f38d384 commit 8e42b8a

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

sidebar/panel.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ tbody {
437437
text-align: end;
438438
font-style: italic;
439439
font-size: 90%;
440-
padding-left: 10%;
440+
padding-left: 10px;
441441
opacity: 0.6;
442442
overflow-x: hidden;
443443
text-overflow: ellipsis;

sidebar/panel.js

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5137,7 +5137,7 @@ console.log("dt.types : "+dt.types);
51375137
// Note: when the mouse is over the lifts, an HTMLDivElement is returned
51385138
let row = getDragToRow(target);
51395139
//console.log("Drop on row: "+row+" class: "+row.classList+" BN_id: "+row.dataset.id);
5140-
traceDt(dt);
5140+
//traceDt(dt);
51415141

51425142
// Can't happen when in a dropEffect=none zone .. but in case, let's protect against it
51435143
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);
53815381
|| types.includes(type = "text/x-moz-url") // Dragging the location bar URL address
53825382
) {
53835383
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);
53875389
}
53885390

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
53905393
if (splitIndex > 0) {
53915394
url = url.slice(0, splitIndex);
53925395
}
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
53945414
title = url;
53955415
}
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)
53975417
splitIndex = title.indexOf("\n");
53985418
title = title.slice(splitIndex+1);
53995419
}

0 commit comments

Comments
 (0)