Skip to main content
Topic: Twitter embed (Read 11885 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Twitter embed

Do we have a Twitter embed plugin ?


Re: Twitter embed

Reply #2

I think I wrote something a while ago, but I couldn't find anything around... maybe it was just a déjà vu... OMG The Matrix is changing!! :P
Bugs creator.
Features destroyer.
Template killer.

Re: Twitter embed

Reply #3

Hmm... at some point I'll try that as a test of the hooks in my BBC parser. You couldn't do the automatic Tweet link to embedded tweet without code edits in the current version but you can do the tag version pretty easily with a single simple hook.


 

Re: Twitter embed

Reply #5

I was looking for a twitter-embed add-on today and it looks like none exists.  Has anyone gone the bbcode route on their forums?  Have some tips on how to implement?

Re: Twitter embed

Reply #6

I had a moment of madness[1] and put together something fancy. :P

The php code could be just:
Code: [Select]
	$message = preg_replace_callback('~<a href="(http[s]?://twitter.com/\w+/status/\d+)" (.*?)>\1</a>~',
function($matches) {
$matches[2] = str_replace('class="', 'class="twitter_embed ', $matches[2]);
return '<a href="' . $matches[1] . '" ' . $matches[2] . '>' . $matches[1] . '</a>';
},
$message
);
static $load_js = true;
if ($load_is === true)
{
loadJavascriptFile('twitter_embed.jquery.js');
addInlineJavascript('
$(document).ready(function() {
$(".twitter_embed").lazyload();
});');
$load_js = false;
}
put in a function and attached to the integrate_post_parsebbc hook.
Then there is a bit of javascript that is a modified version of https://github.com/tuupola/jquery_lazyload (and is attached here).
The two will work together to embed the twitter post only when scrolling the message appears in the viewport.
And all those waiting for the 1.0.8.1 fixes will be in front of my door with torches and pitchforks... :P

Re: Twitter embed

Reply #7

Hey!! Put this in addons will ya... :P

Re: Twitter embed

Reply #8

Too lazy and too many other things to do. :P
Bugs creator.
Features destroyer.
Template killer.

Re: Twitter embed

Reply #9

Quote from: emanuele  -  I had a moment of madness[1] and put together something fancy. :P

The php code could be just:
Code: [Select]
	$message = preg_replace_callback('~<a href="(http[s]?://twitter.com/\w+/status/\d+)" (.*?)>\1</a>~',
function($matches) {
$matches[2] = str_replace('class="', 'class="twitter_embed ', $matches[2]);
return '<a href="' . $matches[1] . '" ' . $matches[2] . '>' . $matches[1] . '</a>';
},
$message
);
static $load_js = true;
if ($load_is === true)
{
loadJavascriptFile('twitter_embed.jquery.js');
addInlineJavascript('
$(document).ready(function() {
$(".twitter_embed").lazyload();
});');
$load_js = false;
}
put in a function and attached to the integrate_post_parsebbc hook.
Then there is a bit of javascript that is a modified version of https://github.com/tuupola/jquery_lazyload (and is attached here).
The two will work together to embed the twitter post only when scrolling the message appears in the viewport.

I'm too new to modifying ElkArte to make much sense of this, I'm afraid.

"put in a function"?  How do you do this? Put it in an existing php file of functions? And how do you attach to the hook?  jquery_lazyload doesn't exist currently in my installation, so I assume it's just an upload.

goddamnit I'm going to have to learn fudge nuggets, aren't I?


And all those waiting for the 1.0.8.1 fixes will be in front of my door with torches and pitchforks... :P

Re: Twitter embed

Reply #10

If nobody else will pack it before, I can have a look at it... let's say before the end of next week.
Bugs creator.
Features destroyer.
Template killer.

Re: Twitter embed

Reply #11

Candidate for default  ;D

Re: Twitter embed

Reply #12

Nice but nicer if we can also do vice versa tweet post from elkarte to tweeter. Will be great if can the same with FB as well. And instagram etc...  :D  :D  :D



Re: Twitter embed

Reply #14

Quote from: emanuele  -  If nobody else will pack it before, I can have a look at it... let's say before the end of next week.

Hello!  Wondering if you've had any time to think about this.