8
2
This is a simple one: create the shortest browser script to change every appearance of force on a web page into horse. This script needs to be able to be pasted into the console and work on most modern browsers.
You must replace all occurences of the word force and conjugates of the word force (forcing, forced, reinforce). The cases must also be preserved.
You must not change any occurences which are not visible when the page is displayed in a browser. For example, meta tags or comments.
Example
This is a fOrcE log
. It makes people who touch it very forceful. Don't try forcing it.
This is a hOrsE log
. It makes people who touch it very horseful. Don't try horsing it.
Unfortunately this is a Javascript only challenge. The shortest code wins.
@BetaDecay I added an answer. Am I too late to play? – rojo – 2014-12-27T01:45:28.760
Can we use LiveScript?
– nyuszika7h – 2014-12-27T14:29:02.740@nyuszika7h only if you add the size of livescript.js to your byte count. :) – rojo – 2014-12-28T17:01:56.863
2Lol for xkcd XD – ThreeFx – 2014-09-08T21:06:19.637
9forcing doesn't contain the word force. – Dennis – 2014-09-08T22:53:31.460
2Either the question allows replacement of
forc
intohors
- or it is the replacement of all the different conjugations offorce
into their horse versions. In the former case, we get things like "Reinhorsing", etc. In the latter, onlyforcing
would be an exception. OP should clarify. – absinthe – 2014-09-08T22:59:44.0632What about the equine equivalents of forcing, forcibly, forceps...? – Sean Latham – 2014-09-08T23:03:55.833
2"...any occurrences which are not visible when the page is displayed in a browser." is far too general. In particular, there are dozens or even hundreds of different ways to insert non-visible content into web pages. Perhaps you should just limit the exclusion to one or two specific types of tag. This prevents
.innerHTML
replace-all solutions, which I'm guessing is why you want the exceptions in the first place. – COTO – 2014-09-09T01:01:02.177@COTO: Visibility as JavaScript understands it is easily achievable. Of course, that doesn't cover white text on white background, etc. – Dennis – 2014-09-09T01:15:30.643
@Dennis: I'm just saying that there are numerous non-visible tags, several CSS properties that can render elements invisible, numerous attributes whose values are never seen (and numerous other attributes whose values are seen), elements whose visibility is conditional, etc., etc. If you want to write code detecting the 101 different possibilities, more power to you. – COTO – 2014-09-09T01:53:16.187
I don't think "reinforce" is a conjugate of "force". – Ypnypn – 2014-09-09T19:25:58.803
@Ypnypn What would the right word be? – Beta Decay – 2014-09-09T19:42:49.367