-
-
Save sbeckeriv/1883356 to your computer and use it in GitHub Desktop.
crow plugin
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
| plugins = [] | |
| plugins.push( | |
| description: "Creates an img tag for image urls so you can see the image inline" | |
| text_only: true | |
| match: [[ | |
| /http(s)?:\/\/.+/gi, | |
| (captures)-> | |
| iframes = "" | |
| for url in captures | |
| try | |
| logger.error(url) | |
| logger.error("<div url='#{url}'>#{url} </div>") | |
| iframes += "<div url='#{url}'>#{url} </div>" | |
| url_callback = (data)-> | |
| logger.error(url) | |
| logger.error(data.content) | |
| logger.error $("div[url='#{url}'").text() | |
| $("div[url='#{url}'").html(data.content) | |
| $.getJSON("http://viewtext.org/api/text?url=" + url+ "&callback=?", url_callback) | |
| catch e | |
| logger.error e | |
| logger.info(iframes) | |
| @append_html iframes | |
| ]] | |
| ) |
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
| window.url_text = (url)-> | |
| url_callback = (data) -> | |
| return $("div[url='" + url + "'").html(data.content) | |
| $.getJSON("http://viewtext.org/api/text?url=" + url + "&callback=?", url_callback) | |
| # plugin list | |
| plugins = [] | |
| plugins.push( | |
| description: "Creates an img tag for image urls so you can see the image inline" | |
| text_only: true | |
| match: [[ | |
| /http(s)?:\/\/.+/gi, | |
| (captures)-> | |
| iframes = "" | |
| for url in captures | |
| try | |
| iframes +="<div url='#{url}'>#{url} </div>"+'<'+'script>window.url_text("'+url+'")<'+'/script>' | |
| catch e | |
| logger.error e | |
| logger.info(iframes) | |
| @append_html iframes | |
| ]] | |
| ) |
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
| window.remove_url_text = (url)-> | |
| el = $("div[url='#{url}']") | |
| el.html("") | |
| window.url_text = (url)-> | |
| url_callback = (data) -> | |
| el = $("div[url='#{url}']") | |
| el.html("#{url}<br/><input type='button' onclick='window.remove_url_text(\"#{url}\")' value='Remove Text'>"+data.content+"<input type='button' onclick='window.remove_url_text(\"#{url}\")' value='Remove Text'>") | |
| logger.error("url text url") | |
| logger.error("http://viewtext.org/api/text?mld=.1&rl=false&url=" + url + "&callback=?") | |
| $.getJSON("http://viewtext.org/api/text?mld=.1&rl=false&url=" + url + "&callback=?", url_callback) | |
| # plugin list | |
| plugins = [] | |
| plugins.push( | |
| description: "Get url text" | |
| text_only: true | |
| match: [[ | |
| /http(s)?:\/\/.+/gi, | |
| (captures)-> | |
| counter = 0 | |
| iframes = "" | |
| for url in captures | |
| try | |
| iframes +="<div url='#{url}'>Loading Text for: #{url} <"+"script> window.url_text(\"#{url}\")</"+"script></div>" | |
| counter+=1 | |
| catch e | |
| logger.error e | |
| logger.info(iframes) | |
| @append_html iframes | |
| ]] | |
| ) |
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
| window.url_text = (url,el)-> | |
| url_callback = (data) -> | |
| return el.html(data.content) | |
| $.getJSON("http://viewtext.org/api/text?url=" + url + "&callback=?", url_callback) | |
| # plugin list | |
| plugins = [] | |
| plugins.push( | |
| description: "Creates an img tag for image urls so you can see the image inline" | |
| text_only: true | |
| match: [[ | |
| /http(s)?:\/\/.+/gi, | |
| (captures)-> | |
| iframes = "" | |
| for url in captures | |
| try | |
| iframes +="<div url='#{url}'>#{url} </div>"+'<'+'script>window.url_text(\''+url+'\',$("div[url=\''+url + '\']"))<'+'/script>' | |
| catch e | |
| logger.error e | |
| logger.info(iframes) | |
| @append_html iframes | |
| ]] | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment