Download
User Rating: 0/5 ( 0 votes)
Linky is a jQuery plugin for linkifying URLs, mentions (for Twitter, Instagram or GitHub) and hashtags (for Twitter); that is, taking plain text references of URLs, mentions and hashtags and turning them to the appropriate links. Existing linkified URLs are kept untouched.
Source: github.com
1. INCLUDE JS FILES
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="jquery.linky.js"></script>
2. HTML
<div class="url">
https://github.com/AnSavvides should turn into a link, while <a href="https://twitter.com/andreassavvides">this link should stay untouched</a>.
</div>
<div class="twitter-mentions">
@andreassavvides should get highlighted! Not an e-mail such as [email protected] though.
</div>
<div class="instagram-mentions">
We do instagram too! Check out @instagram!
</div>
<div class="hashtags">
Need hashtags linkified? Don't worry - #wegotyoucovered!
</div>
<div class="github-mentions">
You can find @AnSavvides on GitHub!
</div>
3. JAVASCRIPT
$(".url").linky();
$(".twitter-mentions").linky({
mentions: true,
urls: false,
linkTo: "twitter"
});
$(".instagram-mentions").linky({
mentions: true,
urls: false,
linkTo: "instagram"
});
$(".hashtags").linky({
hashtags: true,
urls: false,
linkTo: "twitter"
});
$(".github-mentions").linky({
mentions: true,
linkTo: "github"
});
4. OPTIONS
Option |
Default |
Type |
Description |
mentions |
false |
boolean |
Identify if mentions should be linkified. |
hashtags |
false |
boolean |
Identify if hashtags should be linkified. |
urls |
true |
boolean |
Identify if URLs should be linkified. |
linkTo |
"twitter" |
string |
Identify location mentions and hashtags should link to |