Commit 1ccdde1bf5a07202d4a9825e64ee81fa9b88354b

Authored by Carlos Vieira
1 parent 669471c3
Exists in master

Barra asset

Showing 1 changed file with 29 additions and 0 deletions   Show diff stats
recipes/default/assets/barra.coffee 0 → 100755
... ... @@ -0,0 +1,29 @@
  1 + d = document
  2 + divBarra = d.getElementById("barra-brasil")
  3 + if divBarra
  4 + divBarra.removeAttribute "style"
  5 + # conteudoBarra definido no barra-brasil-1.yaml e atribuido pelo assetgen
  6 + divBarra.innerHTML = conteudoBarra
  7 + head = d.getElementsByTagName("head")[0]
  8 +
  9 + getOrgaoContent = ->
  10 + metas = d.getElementsByTagName('meta')
  11 + i = 0
  12 + while i < metas.length
  13 + if metas[i].getAttribute('property') == 'creator.productor'
  14 + return '&orgao='+ metas[i].getAttribute('content')
  15 + i++
  16 + ''
  17 +
  18 + link = d.getElementById('barra-brasil-orgao')
  19 + link.setAttribute 'href', 'http://www.servicos.gov.br/?pk_campaign=barrabrasil'+getOrgaoContent()
  20 +
  21 +
  22 + window._barrabrasil =
  23 + insere_css: (css) ->
  24 + style = document.createElement("style")
  25 + style.setAttribute "type","text/css"
  26 + style.setAttribute "media","all"
  27 + style.appendChild d.createTextNode(css)
  28 +
  29 + head.appendChild style
... ...