Да пусть заспамит все ПСы, так им и надо. )))
<!DOCTYPE html><html lang="ru" dir="ltr"><head><meta charset="utf-8"></head><body>
<p id="original">With a dedicated photo button and the ability to shoot wide-angle 12 megapixel photos at speeds up to 30 frames per second, VIRB XE is designed to get the image. You can even capture photos while recording video. VIRB XE can also be set to automatically capture photos over long periods of time at customizable intervals up to 120 seconds. With Extended timelapse, VIRB XE will sleep between shots, allowing you to maximize your battery life for exceptionally long captures.</p><p id="result"></p><script>
var text = document.getElementById('original').textContent;
keys=[
'buy action camera',
'action camera price',
'action camera feature'
],
tag='<b>',
etag='</b>',
len=text.length,
length=keys.length,
start = 0,
dist = distance = 120,
result='';
for(var cnt=0; cnt<length; cnt++){
for(var ptr=dist; ptr<len; ptr++){
if(ptr>dist && text.charAt(ptr)==' ' && text.charAt(ptr-1)!='.'){
result+=text.substring(start,ptr) + tag + ' ' + keys[cnt] + etag + ' ';
start = ptr;
dist+=distance;
break;
}
}
}
result+=text.substring(start,len);
document.getElementById('result').innerHTML=result;
</script>
</body>
</html>