Fixes #7561 - 'No. of CPU' search URL is incorrect

I may run some performance testing, checking if I can make the Javascript run faster.

For example, most of the time `~VAL~` is being replaced, thus checking it firstly can save some time.
Another one is to separate the first `if` (the one that check if it's `~VAL1~` or `~VAL2~`) into `if-else if` form.

Unless, you think this is unnecessary...

I have tested this on my machine and it works well. 

Oh yeah, if someone specifies `~VAL2~` but the value is one word, `~VAL2~` is replaced with "". Is that fine?