Skip to content

jQuery plugin for transforming URLs to appropriate resource (image, link, YouTube, Vimeo video,...)

Notifications You must be signed in to change notification settings

AndreiBujenitsa/jquery-auto_html

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

jquery.auto_html.js

jQuery port of Rails' extension auto_html

Example usage

Given this comment div:

<div class="comment">
http://gogreece2014.com/wp-content/uploads/2013/09/mykonos8.jpg

And you will go to Mykonos
With a vision of a gentle coast
And a sun to maybe dissipate
Shadows of the mess you made

http://www.youtube.com/watch?v=DT-dxG4WWf4
</div>

and this script:

<script type="text/javascript">
  $('.comment')
    .simpleFormat()
    .image()
    .youtube({width:500, height:400})
    .link();
</script>

The comment div will be transformed to this:

<p><img src="http://gogreece2014.com/wp-content/uploads/2013/09/mykonos8.jpg" alt="" width="500px"></p><p>And you will go to Mykonos<br>With a vision of a gentle coast<br>And a sun to maybe dissipate<br>Shadows of the mess you made</p><p><iframe class="youtube-player" type="text/html" width="500" height="400" src="http://www.youtube.com/embed/DT-dxG4WWf4" frameborder="0"></iframe>

Credits

Author: Dejan Simic

About

jQuery plugin for transforming URLs to appropriate resource (image, link, YouTube, Vimeo video,...)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published