Comments (5)
Hi miguel ! Can you tell me how did you initialized tweetParser in your webpage and which version of tweetParser are you using with ?
However, would this may be caused because tweetParser is loaded before that your template is generated ?
If it's the case, you may try to load tweetParser once everything is loaded into your page like so 👍
<!-- some code here -->
<p class="tweet"> this is a nice tweet #chido </p>
<!-- some code here -->
(function () {
// your js logic stuff
window.setTimeout(function () {
tweetParser('.tweet');
}, 0);
}());
Hope it'll help.
from tweetparser.js.
Thanks, @VincentLoy. I have tried your solution, but it is still not working. Tweetparser is loaded after everything is loaded. The handlebars template that I am using is this one:
<div id="content"></div>
<script id="cat-template" type="text/x-handlebars-template">
<p class="tweet">This is my awesome text only tweet ! #web #twitter @twitter http://www.twitter.com/ !!</p>
<p class="tweet">{{Status}}</p>
</script>
None of the tweets work under the cat-template
from Handlebarjs. If I put them outside, the do work.
I am using this tweetParser.js v2.2.0
with your code above and the one in the example. Both seem to work under html but not under this handlebars template:
<script type="text/javascript">
var public_spreadsheet_url = 'https://docs.google.com/spreadsheets/d/1_uOy7-BLbB3AE5qTxnU_Z6zIKnwzN88iq_wPCP4NLmA/pubhtml';
$(document).ready( function() {
Tabletop.init( { key: public_spreadsheet_url,
callback: showInfo,
parseNumbers: true } );
});
function showInfo(data, tabletop) {
var source = $("#cat-template").html();
var template = Handlebars.compile(source);
$.each( tabletop.sheets("Cats").all(), function(i, cat) {
var html = template(cat);
$("#content").append(html);
});
}
</script>
And finally this is the tweetParser set up:
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/0.0.1/prism.min.js"></script>
<script src="tweetparser.js"></script>
<script>
window.setTimeout(function () {
tweetParser('.tweet');
}, 0);
</script>
Thanks for your help.
from tweetparser.js.
mmmh ok, I made some tests with mustache.js that provide similar stuff like handlebars (for templates rendering) and I reproduce the same bug.
So, does handlebars provide a callback function on template rendering end ? I think that is the solution. Because When I run this code :
window.setTimeout(function () {
tweetParser('.tweet');
}, 1500);
it work perfectly. I really think that you have to wait the template rendering end before calling tweetParser :)
from tweetparser.js.
Wow! It works! Thank you very much. This is really saving me a lot of time!
Best regards!
from tweetparser.js.
Nice ! Saludos !
from tweetparser.js.
Related Issues (10)
- Feature request: Eclipses on urls HOT 5
- Space between text and url gets "eaten" HOT 4
- Make vanillaJS version HOT 1
- Issue when there is anchor tags which follow each other
- innerText incompatible with FireFox
- Wrap tweetParser and the jQuery compatibility file in the same file
- target parameter doesn't work properly
- Screenshot in README no longer available HOT 1
- How to hide a specific symbol? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tweetparser.js.