Created
August 1, 2015 18:03
-
-
Save makevoid/dcb030cab63a53e0f04b to your computer and use it in GitHub Desktop.
Transport plugin modified - fedwiki
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| expand = (text)-> | |
| text | |
| .replace /&/g, '&' | |
| .replace /</g, '<' | |
| .replace />/g, '>' | |
| .replace /\*(.+?)\*/g, '<i>$1</i>' | |
| beam = (url) -> | |
| $.getJSON url, (page) -> | |
| resultPage = wiki.newPage(page) | |
| wiki.showResult resultPage | |
| emit = ($item, item) -> | |
| $item.append """ | |
| <p style="background-color:#eee;padding:15px;"> | |
| #{expand item.text}<br> | |
| </p> | |
| """ | |
| bind = ($item, item) -> | |
| $item.dblclick -> wiki.textEditor $item, item | |
| $item.find('button').click -> | |
| beam item.text | |
| $item.on 'drop', (e) -> | |
| e.preventDefault() | |
| e.stopPropagation() | |
| htmlDtoppedElem = e.originalEvent.dataTransfer.getData('text/html') | |
| link = $(htmlDtoppedElem).attr "href" | |
| $.getJSON item.text, { drop: link }, (page) -> | |
| resultPage = wiki.newPage(page) | |
| wiki.showResult resultPage | |
| window.plugins.transport = {emit, bind} if window? | |
| module.exports = {expand} if module? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment