Skip to content

Instantly share code, notes, and snippets.

@arbales
Created August 25, 2011 19:08
Show Gist options
  • Select an option

  • Save arbales/1171513 to your computer and use it in GitHub Desktop.

Select an option

Save arbales/1171513 to your computer and use it in GitHub Desktop.
vwo is dumb.
_vwo_code = do ->
account_id = 0000
settings_tolerance = 1500
library_tolerance = 3000
use_existing_jquery = false
# DO NOT EDIT BELOW THIS LINE
f = false
d = document
{
use_existing_jquery: ->
use_existing_jquery
library_tolerance: ->
library_tolerance
finish: ->
unless f
f = true
a = d.getElementById '_vis_opt_path_hides'
if a
a.parentNode.removeChild(a)
finished: ->
return f
load: (a) ->
b = d.createElement 'script'
b.src = a
b.type = 'text/javascript'
b.innerText
b.onerror = ->
_vwo_code.finish()
d.getElementsByTagName('head')[0].appendChild(b)
init: ->
settings_timer = setTimeout '_vwo_code.finish()', settings_tolerance
@load "//dev.visualwebsiteoptimizer.com/j.php?a=#{account_id}&u=#{encodeURIComponent(d.URL)}&r=#{Math.random()}"
a = d.createElement 'style'
b = 'body{display:none;}'
h = d.getElementsByTagName('head')[0]
a.setAttribute 'id', '_vis_opt_path_hides'
a.setAttribute 'type', 'text/css'
if (a.styleSheet)
a.styleSheet.cssText = b
else
a.appendChild d.createTextNode(b)
h.appendChild a
settings_timer
}
_vwo_settings_timer = _vwo_code.init()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment