First of all, I don't know javascript and my rudimentary coding skills are only related to Python 3. Now... as a budding researcher I would like to go to a site such as this:
https://link.springer.com/article/10.1007%2Fs11695-017-2963-4
and using a bookmarklet change it to:
https://link-springer-com.libproxy.helsinki.fi/article/10.1007%2Fs11695-017-2963-4
Now.. I had a handy bookmarklet previously:
javascript:(function(d,u){d.domain.indexOf(u)<0&&(location.href=d.URL.replace(d.domain,d.domain+u))})(document,'.libproxy.helsinki.fi')
But since the powers of be decided to change the way the libproxy is used and now requires substituting the dots in the original address to dashes, it won't clearly be sufficient. I understand that the final result would include something like:
.replace(/./g,'-')
in it, but I have no idea on where to plug it into this script, so I come to your help.
(Damnit Jim, I'm a doctor, not a software engineer)
There’s a better way to write the overall bookmarklet:
javascript:void(location.host=location.host.replace(/\./g,'-')+'.libproxy.helsinki.fi')
It changes the current address’s host by assigning to it directly, which should make the replacement much easier to understand. You need to escape .
in a regular expression literal (which is what /\./g
is), note.