JS DEBUG page

class InjectHandle

  injectMethod = null
  callCount = 0
  constructor:()->
    codeTempl = """
      <style media="screen">
      html, body {
        height: 100%;
        margin: 0px;
        padding: 0px;
      }
      .debug_code{
        position: fixed;
        left: 0px;
        top: 0px;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.3);
        color: #FF0000;
        overflow: auto;
        padding: 20px;
        pointer-events: none;
      }
      </style>
      <div id="debug_code" class="debug_code">
      debug_code
      </div>
    """
    $('body').append(codeTempl)

    injectMethod= window.onChange
    window.onChange = handle

  handle = ()->
    injectMethod()
    $('#debug_code').html("callCount:#{callCount++}")

new InjectHandle();
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章