Skip to content

Commit

Permalink
resolve #9 - Wrap tweetParser and the jQuery compatibility file in th…
Browse files Browse the repository at this point in the history
…e same file
  • Loading branch information
VincentLoy committed Jul 5, 2015
1 parent 42d62bf commit 9de617a
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 35 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Vincent Loy
Copyright (c) 2015 Vincent Loy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ you can customize your tweet with css classes used in parameters


#### Changelog

+ v2.1.1
* resolve [issue #9](https://github.com/VincentLoy/tweetParser.js/issues/9) - Wrap tweetParser and the jQuery compatibility file in the same file.

+ v2.1.0
* Add a jQuery compatibility file.
* You can now use Both VanillaJS or jQuery.
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tweetparser.js",
"version": "2.1.0",
"version": "2.1.1",
"homepage": "https://github.com/VincentLoy/tweetParser.js",
"authors": [
"VincentLoy <vincent.loy1@gmail.com>"
Expand Down
21 changes: 0 additions & 21 deletions dev/jquery.tweetParser.js

This file was deleted.

19 changes: 17 additions & 2 deletions dev/tweetParser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* tweetParser.js v2.1.0
* Small Javascript Library that parse an element containing a tweet and turn URLS, @user & #hashtags into urls
* tweetParser.js v2.1.1
* Small Javascript Library that parse an element containing a tweet and turn URLS, @user & #hashtags into working urls
* License : MIT
* author Vincent Loy <vincent.loy1@gmail.com>
* http://vincent-loy.fr
Expand Down Expand Up @@ -117,3 +117,18 @@

exports.tweetParser = tweetParser;
}(window));

/*global $, jQuery, tweetParser*/
if (window.jQuery) {
(function ($, tweetParser) {
'use strict';

function tweetParserify(el, options) {
tweetParser(el, options);
}

$.fn.tweetParser = function (options) {
return tweetParserify(this.selector, options);
};
}(jQuery, tweetParser));
}
8 changes: 4 additions & 4 deletions dist/tweetParser.min.js

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1>tweetParser.js</h1>

<h2>Small Javascript Library easy-to-use that parse Twitter Usernames, Hashtags and URLs</h2>

<h3>V2.1.0</h3>
<h3>V2.1.1</h3>

<div class="social-box">
<a href="https://github.com/VincentLoy/jquery.tweetParser" class="social-link">
Expand Down Expand Up @@ -213,15 +213,14 @@ <h4 class="text-center">Made with &hearts; by <a href="http://vincent-loy.fr">Vi
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.1.0/mustache.min.js"></script>
<script src="demo/mustacheRender.js"></script>
<script src="dev/tweetParser.js"></script>
<!--<script src="dev/jquery.tweetParser.js"></script>-->

<!-- only for demo -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/0.0.1/prism.min.js"></script>
<script>
// Old jQuery dependent tweetParser.js call
//$('.tweet').tweetParser();
// jQuery tweetParser.js call example
// $('.tweet').tweetParser();

//New way to call tweetParser.js
//tweetParser.js example
tweetParser('.tweet');
</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tweetparser.js",
"description": "Small javascript library that parse an element containing a tweet and turn URLS, @user & #hashtags into working urls",
"version": "2.1.0",
"version": "2.1.1",
"homepage": "http://vincentloy.github.io/tweetParser.js",
"author": {
"name": "Vincent Loy",
Expand Down

0 comments on commit 9de617a

Please sign in to comment.