DirectLink

By Richard H. Tingstad Last update Jan 24, 2010 — Installed 4,101 times.

Tweak to reduce false positives with various script extensions

in
Subscribe to Tweak to reduce false positives with various script extensions 5 posts, 2 voices



ns4tne Scriptwright

I've noticed a lot of times DirectLink will see a link that ends in .py or .do or what have you and, because these are valid ccTLDs, add a direct link to them -- which of course usually goes nowhere, and is merely confusing. Ideally, this wouldn't happen, as webmasters wouldn't use extensions on there pages at all. In practice, of course, a different solution must be found.
On the one hand, any decent script that manipulates URLs should handle all valid TLDs, even rare ones. On the other hand, many users have no need to link to certain rare ccTLDs, especially as such sites are likely to be in a different language even if valid. And, of course, as previously mentioned, most such direct links are false positives anyway.
That being the case, I suggest allowing customization of which TLDs are valid -- likely only ccTLDs would be necessary, as I have never seen a page name that conflicts with the registered gTLDs. Now obviously, it is not all that hard to simply edit the script source directly to customize which names are valid, but then every time the script is updated, changes are lost and must be carried forward; also, it's poor style to rely on such hacking, as a general rule.
It would probably be sufficient to maintain a (pre-populated) blacklist in prefs of ccTLDs that will not be recognized, along with a simple option to turn the blacklist on or off (defaulting, likely, to off). This would make hiding those false positives a simple matter of flipping a single pref in about:config.

 
Richard H. T... Script's Author

Well resonated. That is absolutely a possibility. An alternative could be to (optionally) ignore URLs that do not begin with "foo://". But perhaps that will exclude too many real cases, I'm not sure. How often do you see those? For example, on reddit there are links like "http://www.reddit.com/domain/cnn.com" which are correctly guessed to be http://cnn.com. But is that link really that useful?

 
ns4tne Scriptwright

Well, I actually do see links that have no protocol at times, and I do occasionally find those useful -- not, perhaps, quite often enough, but certainly at least as often as I find .py links.

P.S. Sorry for not responding sooner; I forgot to check back, and userscripts.org doesn't do so hot at reminding me.

 
Richard H. T... Script's Author

Sorry for the late reply. I just updated the script. You can now alter a TLD black list in about:config. They will however only be black listed if they miss foo:// and something like /foo.html. Thank you for the tip! I agree that .do and .py often are annoying, and also that using about:config is a good thing. Unfortunately, Opera users will not get the about:config functionality.

 
ns4tne Scriptwright

Ah, thanks. The update is looking good so far (I'm using Firefox, and had temporarily forgotten about Opera).

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel