Discussions » Creation Requests
These 2 utilities exist ?
do you still need?
Yes
not all browsers have link dragging (for example, opera gx) so instead i could make it always open links instead of dragging, and always open in the background tab?
Okay but in this case what will replace the dragging function please ?
in that case it wouldnt be possible, but theres no way around that if you really want it to be compatible with all browsers, if you dont care about non-dragging browsers though, i could simply make the original idea but as a userscript so that all dragged links will just open in _blank (a new tab thats automatically set to current tab)?
It's better in a new tab if possible please :-)
first script:
// Prevent default drag behaviors
document.addEventListener('dragover', function(event) {
event.preventDefault();
});
document.addEventListener('drop', function(event) {
event.preventDefault();
// Check for URLs dropped
if (event.dataTransfer.items) {
for (let i = 0; i < event.dataTransfer.items.length; i++) {
// Check if the item is a string
if (event.dataTransfer.items[i].kind === 'string') {
// Get the string data (assuming it's a URL)
event.dataTransfer.items[i].getAsString(function(url) {
// Validate URL if needed (this can be adjusted based on requirements)
if (isValidUrl(url)) {
// Open the link in a new tab
window.open(url, '_blank');
}
});
}
}
}
});
// Function to validate if a string is a URL
function isValidUrl(urlString) {
try {
new URL(urlString);
return true;
} catch (err) {
return false;
}
}
second script:
setInterval(() => {
// Select the input element with the specified ID
let shareUrlElement = document.getElementById('share-url');
// Check if the element exists
if (shareUrlElement) {
// Set the value of the input to the current URL
shareUrlElement.value = window.location.href;
}
}, 500); // Run every 500 milliseconds (0.5 seconds)
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 2024-12-04
// @description try to take over the world!
// @author You
// @match http://*/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
What do you want me to write in this section for the 2 scripts please ?
// ==UserScript==
first script:
// @name Link-Drag
// @namespace http://tampermonkey.net/
// @version 1
// @description Open dragged links in new tab
// @author TTT
// @include *
// @grant none
// ==/UserScript==
second script:
// @name Youtube identifier-remove
// @namespace http://tampermonkey.net/
// @version 1
// @description makes the share button on youtube share the watch url, and nothing more.
// @author TTT
// @match https://youtube.com/*
// @grant none
// ==/UserScript=
Also, a userscript like Remove YouTube Tracking Parameters and Convert Share Links exists without shortening the links please ?
@Cool722 : if you use a content blocker like uBlock, you can make your own custom filters -- then no need for a script:
||www.youtube.com/watch?$document,removeparam=pp
||www.youtube.com/watch?$document,removeparam=si
first script:
// Prevent default drag behaviors
document.addEventListener('dragover', function(event) {
event.preventDefault();
});
document.addEventListener('drop', function(event) {
event.preventDefault();
// Check for URLs dropped
if (event.dataTransfer.items) {
for (let i = 0; i < event.dataTransfer.items.length; i++) {
// Check if the item is a string
if (event.dataTransfer.items[i].kind === 'string') {
// Get the string data (assuming it's a URL)
event.dataTransfer.items[i].getAsString(function(url) {
// Validate URL if needed (this can be adjusted based on requirements)
if (isValidUrl(url)) {
// Open the link in a new tab
window.open(url, '_blank');
}
});
}
}
}
});
// Function to validate if a string is a URL
function isValidUrl(urlString) {
try {
new URL(urlString);
return true;
} catch (err) {
return false;
}
}
second script:
setInterval(() => {
// Select the input element with the specified ID
let shareUrlElement = document.getElementById('share-url');
// Check if the element exists
if (shareUrlElement) {
// Set the value of the input to the current URL
shareUrlElement.value = window.location.href;
}
}, 500); // Run every 500 milliseconds (0.5 seconds)
Very sorry for my late reply.
I can't figure out how to open the links in a new tab with the 1st script and the 2nd script for YouTube doesn't work after many tests...
Also, a userscript like Remove YouTube Tracking Parameters and Convert Share Links exists without shortening the links please ?
@Cool722 : if you use a content blocker like uBlock, you can make your own custom filters -- then no need for a script:
||www.youtube.com/watch?$document,removeparam=pp
||www.youtube.com/watch?$document,removeparam=si
Very sorry for my late reply and thank you for these tips but in uBlock Origin -> My filters, nothing has worked on my side...
Hello,
I just would like to know if a userscript like this extension Super Drag For Google Chrome exists to work on all browsers please ?
Also, a userscript like Remove YouTube Tracking Parameters and Convert Share Links exists without shortening the links please ?
Thank you in advance.