In my opinion its not the actual javascript implementation thats would be patented but the idea of applying adverts in that specific way. Taht seems ok to me.
And this a point a lot of people skip over about patents, obviousness, and hindsight analysis. There are a lot of really simple ideas, that once you hear them, you can come up with easy ways to implement them - but the initial idea itself required an inventive leap to conceive of.
Consider the history of expanding bullets like
the Minie ball. We developed rifled muskets only a short time after smooth bore muskets, but it took a couple of hundred years before anyone came up with a bullet that would let a rifle be loaded as fast as a smooth bore. And yet, once the idea of a conical-shaped bullet that expands upon firing is even mentioned, everyone who has the skill to mold bullets in the first place knows just about everything they need to know to reproduce those bullets.
But it took
hundreds of years for someone to have that first, very simple idea. Hundreds of years in which lots of people were working very hard to improve the state of the art of firearms. So why did such a simple idea not arise for so long? Because as simple as it was, it was obvious only in hindsight.
Now, compare that to this Apple Patent, using these gestures in a manner that so many people claim are "obvious". We've seen two prior art documents about other touch screen devices, one going back to 1985, neither of which mention anything like the methods as were patented by Apple. One of them actually teaches
away from the patented method. We've had such screens since at least 1985, and yet, no one has been able to cite anyone, anywhere, who described this method prior to the filing date of the patent. That's about 20 years of people who had everything they needed to express the same idea, in which none of them ever actually expressed it.
So, "obvious", or obvious
only in hindsight? I can tell you what the courts would say about it.