📜 ⬆️ ⬇️

Normal values ​​title on habrahabr

Crosspost with Convenient JS (Dedicated to Habr-Opera)

Here they took a pancake and came up with headings to put slashes ...

I’m losing my mind: I want to save the name, and the opera stumbles from the title “bla / bla / Habrahabr” comes up with a name for saving “Habrahabr”, while “/” takes it as an address and as a result of the error goes into the home directory. It got me in order and I wrote a little UserJS that corrects this misunderstanding, replacing the slash and ~ on the minus sign.
var back='';
while(back!=document.title){
back=document.title;
document.title =document.title.replace('/','-');
document.title =document.title.replace('~','-');
}

Or like this (by lenar ):
document.title = document.title.replace(/\/|~/g, '-');

Which is naturally more elegant and shorter :)
Simple and tasteful, and, most importantly - WORKS

')

Source: https://habr.com/ru/post/38223/


All Articles