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

Re: Twitter embed

Reply #15

In the last few days I barely had time to look at the bug reports. xD
Next week. ;)
Bugs creator.
Features destroyer.
Template killer.

Re: Twitter embed

Reply #16

 I feel like such a pest!

Re: Twitter embed

Reply #17

Not tested at all.
I have not even idea if it installs. O:-)

Re: Twitter embed

Reply #18

Thank you!  I'll install it on a test system tonight and let you know how it goes!

Re: Twitter embed

Reply #19

Sorry for the delay in feedback.

The package throws a "Modification parse error" in the preinstall check.  Is the package complete?

Re: Twitter embed

Reply #20

Some more detail: the parse error is nothing to do with existing files. It's related to the extraction of /themes/default/scripts/nofollow.twitter_embed.bbcode.js from the package.

The problem is that there is no such file in the package, which makes it a bit difficult to extract the thing. The only js file in the package is twitter_embed.jquery.js, and when I looked at the code in that file it turned out to be a jQuery plug-in for lazy loading images.

Code: [Select]
/*!
 * Lazy Load - jQuery plugin for lazy loading images
 *
 * Copyright (c) 2007-2015 Mika Tuupola
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Project home:
 *   http://www.appelsiini.net/projects/lazyload
 *
 * Version:  1.9.7
 *
 */
Methinks the package has a minor bug or two. :D
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Twitter embed

Reply #21

Yes, I used the lazyloading plugin in order to fetch twitter only when it's needed (i.e. when the potential embed enters the visible screen).
Sooo... yes, I guess I didn't pay much attention to the renaming, you can unzip, rename "nofollow.twitter_embed.bbcode.js" to "twitter_embed.bbcode.js", zip again and upload. :)
Bugs creator.
Features destroyer.
Template killer.

Re: Twitter embed

Reply #22

Since @emanuele‍  is being lazy  :P I repacked it with the js name correction.   

There were also a couple of other little things that I updated, without which you may have gotten a white screen after you installed it.

Re: Twitter embed

Reply #23

Bonzer. I'll give it a whirl and see what else it kills. :D

Edit: Seems to be fine. Tweets work. No errors in log. Throw the deranged on the add-ons site.

Cheers.
Last Edit: March 08, 2017, 12:39:21 am by Antechinus
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Twitter embed

Reply #24

Thank you!!!

Re: Twitter embed

Reply #25

Quote from: Spuds – There were also a couple of other little things that I updated, without which you may have gotten a white screen after you installed it.
If it was just a couple I consider myself pretty lucky! xD
Bugs creator.
Features destroyer.
Template killer.

Re: Twitter embed

Reply #26

Ok, next question: can we haz hard working load? As is not lazy? :D

Coz although I understand the idea of lazy load, and although it's a good one as far as it goes, in practice the jumpy flashing tweets are not exactly the thing to soothe savage beasts. So if they weren't all lazy they would be easier to get along with, and I don't think the number of them per page is likely to be a serious issue.

So AFAICT simply killing this in TwitterEmbedder.integrate.php should do the trick, yes?

Code: (Nuke it from orbit) [Select]
	protected static $load_js = true;

Code: (Exterminate) [Select]
		if (self::$load_js === true)
{
loadJavascriptFile('twitter_embed.jquery.js', array('defer' => true));
addInlineJavascript('
$(document).ready(function() {
$(".twitter_embed").lazyload();
});', true);
self::$load_js = false;
}
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

 

Re: Twitter embed

Reply #27

Ok so that doesn't work. However this gets rid of most of the annoying behaviour.

Code: [Select]
		if (self::$load_js === true)
{
loadJavascriptFile('twitter_embed.jquery.js', array('defer' => true));
addInlineJavascript('
$(document).ready(function() {
$(".twitter_embed").lazyload({
threshold : 800
});
});', true);
self::$load_js = false;
}
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Twitter embed

Reply #28

Quote from: Antechinus – Ok, next question: can we haz hard working load? As is not lazy? :D

Coz although I understand the idea of lazy load, and although it's a good one as far as it goes, in practice the jumpy flashing tweets are not exactly the thing to soothe savage beasts. So if they weren't all lazy they would be easier to get along with, and I don't think the number of them per page is likely to be a serious issue.
It's not that I did them thinking about loading time or some performances issues, just because I had the plugin handy and it seemed easy to make it work that way. :P
Bugs creator.
Features destroyer.
Template killer.

Re: Twitter embed

Reply #29

Hey Ema, there has been a little bit of grumbling about the add-on. Yes, I know, it's amazing. Who would have thought that users would grumble about results of someone's coding? Ungrateful mongrels, the lot of them.

Anyway, the first catch is the ?ref_src=twsrc%5Etfw suffix that is added when tweets are linked via social media. Copying the complete url, including suffix, breaks embedding. So as an example this is fine:

Code: [Select]
https://twitter.com/Shareblue/status/842491578191110146

But this breaks the add-on:

Code: [Select]
https://twitter.com/Shareblue/status/842491578191110146?ref_src=twsrc%5Etfw

We have told the grumblers that all they have to do is remove the suffix, but apparently this is a gross infringement of their sacred human rights and there should be a law against it. It's the first step on the road to fascism and will undoubtedly result in kittens having sex with warthogs.

The other catch is if someone is browsing on a phone. In that case Twitter will send them to this:

Code: [Select]
https://mobile.twitter.com/Shareblue/status/842491578191110146

or this:

Code: [Select]
https://.mobile.twitter.com/Shareblue/status/842491578191110146?ref_src=twsrc%5Etfw

Both of those will break the add-on.

So, how hard would it be to tweak the PHP so that it can handle both the mobile prefix (if it exists) and/or the bafflecrud suffix (if that exists) as well as the basic url that it can deal with now?
Last Edit: March 17, 2017, 02:10:20 am by Antechinus
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P