Permalink
Browse files

Fix debug view issues in Safari

  • Loading branch information...
Koen Bok
Koen Bok committed Mar 1, 2013
1 parent 6d0c7c9 commit d0106fb195e52e9f32a0b56e947d2973935fb02d
Showing with 45 additions and 33 deletions.
  1. +44 −31 src/debug.coffee
  2. +1 −2 src/init.coffee
@@ -1,45 +1,58 @@
utils = require "./utils"
window.document.onkeydown = (event) ->
exports.debug = ->
if event.keyCode == 27 # Escape
for view in View.Views
# Safari bug: https://bugs.webkit.org/show_bug.cgi?id=78206
if document._togglingDebug is true
return
document._togglingDebug = true
View.Views.map (view, i) ->
if view._debug
view._element.removeChild view._debug.node
view.style = view._debug.style
# view.clip = view._debug.clip
if view._debug
view._element.removeChild view._debug.node
view.style = view._debug.style
# view.clip = view._debug.clip
delete view._debug
delete view._debug
else
else
color = "rgba(50,150,200,.35)"
# color = utils.randomColor(.2)
color = "rgba(50,150,200,.35)"
# color = utils.randomColor(.2)
node = document.createElement "div"
node.innerHTML = "#{view.name or view.id}"
node.innerHTML += " <span style='opacity:.5'>in #{view.superView.name or view.superView.id}</span>" if view.superView
node = document.createElement "div"
node.innerHTML = "#{view.name or view.id}"
node.innerHTML += " <span style='opacity:.5'>in #{view.superView.name or view.superView.id}</span>" if view.superView
node.style.position = "absolute"
node.style.padding = "3px"
node.style.position = "absolute"
node.style.padding = "3px"
view._debug =
style: utils.extend {}, view.style
node: node
# clip: view.clip
view._debug =
style: utils.extend {}, view.style
node: node
# clip: view.clip
view._element.appendChild node
view.style =
color: "white"
margin: "-1px"
font: "10px/1em Monaco"
backgroundColor: "#{color}"
# boxShadow: "inset 0 0 1px rgba(50,150,200,.8)";
border: "1px solid #{color}"
backgroundImage: null
# view.clip = false
view._element.appendChild node
view.style =
color: "white"
margin: "-1px"
font: "10px/1em Monaco"
backgroundColor: "#{color}"
# boxShadow: "inset 0 0 1px rgba(50,150,200,.8)";
border: "1px solid #{color}"
backgroundImage: null
# view.clip = false
document._togglingDebug = false
window.document.onkeydown = (event) ->
if event.keyCode == 27 # Escape
exports.debug()
window.onerror = (e) ->
@@ -26,15 +26,14 @@ Global.Spring = Spring
Global.utils = utils
Global.ViewList = ViewList
Global.debug = debug.debug
if window
window.Framer = Global
for k, v of Global
window[k] = v
console.log "Webkit", utils.isWebKit()
# Alert if not WebKit
if not utils.isWebKit()
alert "Sorry, only WebKit browsers are currently supported. \

0 comments on commit d0106fb

Please sign in to comment.