mirror of https://github.com/freeCodeCamp/devdocs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
619 B
21 lines
619 B
11 years ago
|
#= require views/pages/base
|
||
|
|
||
|
class app.views.RdocPage extends app.views.BasePage
|
||
|
@events:
|
||
|
click: 'onClick'
|
||
|
|
||
|
afterRender: ->
|
||
|
@highlightCode @findAll('pre.ruby'), 'ruby'
|
||
|
@highlightCode @findAll('pre.c'), 'clike'
|
||
|
return
|
||
|
|
||
|
onClick: (event) ->
|
||
|
return unless event.target.classList.contains 'method-click-advice'
|
||
|
$.stopEvent(event)
|
||
|
|
||
|
source = $ '.method-source-code', event.target.parentNode.parentNode
|
||
|
isShown = source.style.display is 'block'
|
||
|
|
||
|
source.style.display = if isShown then 'none' else 'block'
|
||
|
event.target.textContent = if isShown then 'Show source' else 'Hide source'
|