I use a Userscript to change certain features of YouTube and I'm trying to block the "select all" in thetext field
share link, where it puts the video address:
the reason is that i don't need it https://
and i do that copy/paste often
The text field only appears in the DOM after clicking the button Share. I have managed to remove the property focus
with the script below, but the "select all" is still active:
// Botón "Share"
$('button[data-trigger-for="action-panel-share"]').on('click', function() {
window.setTimeout (function(){
// Input field con la URL - no hay onclick, pero por si acaso
$("input[name=share_url]").prop('onclick',null).prop('focus',null);
},300);
});
I've tried looking for share_url
it in the Firefox JavaScript Debugger but I haven't found the property that I need to remove to get the desired behavior...
As a workaround, I just tried to replace the content of the input
, but it automatically returns to its original value (!!!).
var nueva_url = $("input[name=share_url]").val();
nueva_url = nueva_url.replace('https://','');
$("input[name=share_url]").val(nueva_url);
PS: The YT page does not come with jQuery by default, but for testing it is possible to inject it through the console using the following script :
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = "//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
head.appendChild(script);