News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Ohara YouTube Embed

Started by Suki, December 21, 2011, 03:04:59 PM

Previous topic - Next topic

-Rock Lee-

Quote from: Suki on July 19, 2016, 12:20:51 PM
@coltp45, @Rock Lee  theres seems to be an issue with non-responsive themes, can you replace your /Themes/default/scripts/ohyoutube.min.js file with the one I'm attaching to see if the changes I made fixes this issues?

Be sure to clean your browsers cache or do a hard refresh (Control + F5)

@Suki Perfectirijillo've ;) tried it with multiple browsers and apparently this solved the problem plays smoothly now!


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Coon

I've installed the mod and enabled it but my old posts are not converting from link to embedded video. I just did an upgrade from 1.1 to 2.0 and installed the 2.0 mod - I'm using the default theme.

Screenshots attached of what it looks like.

Suki

Make sure the install was successful, it seems the file edits didn't get applied, check the mod's parser and make sure the edits were done.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Suki

New version available.

1.2.7 - Aug 12, 2016,
- Set basedWidth and basedHeight to prevent weird behavior on non responsive themes.

To upgrade uninstall any previous versions and install the new one, if using a custom theme make sure to check its corresponding checkbox under "Install in Other Themes" when installing.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

ninik


Hi Suki,

I installed the mod and although the vimeo video does play unfortunately the youtube window remains black and does not play at all???!!!

Could you please take a look and see what is wrong? the to a post link is: http:www.ancientgreecereloaded.com/files/ancient_greece_reloaded_website/forum/index.php/topic,232.0.html

From what I understood while looking at it, there was something wrong with your ohyoutube.min.js (in line 7); I guess...

I did also PM you...

I am looking forward to your reply, thanks in advance  :)


Suki

Topics aren't visible for guests.

The blank window is a result of a JavaScript issue on your site, use your browser develop tools to see where the error is.  Most of the time is an old mod using old code or multiple mods trying to load Jquery multiple times.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

ninik



Hi Suki thanks for your reply.

OK the problem appears to be this line here in the ohtoutube.min.js :




var _oh=function(){this.masterDiv=$(".oharaEmbed");this.basedElement=this.masterDiv.parent();this.defaultWidth="undefined"!==typeof _ohWidth?_ohWidth:480;this.defaultHeight="undefined"!==typeof _ohHeight?_ohHeight:270;this.aspectRatio=this.defaultHeight/this.defaultWidth;this.basedWidth=this.basedElement.width()>=this.defaultWidth?this.defaultWidth:this.basedElement.width();this.basedHeight=this.basedElement.height()>=this.defaultHeight?this.defaultHeight:this.basedElement.height();this.main();this.responsive()};




It says: ohyoutube.min.js:7 Uncaught TypeError: $ is not a function


Sorry if I am novice in that department...

Could you help me out with this code?

Thank you

Suki

Its a side effect. Theres probably another mod that already loaded jquery and its not using $, instead it uses jQuery.

Open your /Sources/OharaYTEmbed.php

find this:

<script type="text/javascript" src="'. $settings['default_theme_url'] .'/scripts/ohyoutube.min.js"></script>

change it to this:

<script type="text/javascript" src="'. $settings['default_theme_url'] .'/scripts/ohyoutube.js"></script>


find your /Themes/default/scripts/ohyoutube.js  file

replace all instances of $ with jQuery.


Thats just a general approach, I don't know what other mods you are currently using.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

ninik



Hi Suki, I did the first think asked.

In regards to the second,

you say "replace all instances of $ with jQuery."

What do you mean exactly, to replace the "$" with the word "jQuery"?

Sorry for the stupid question...  :-\


Suki

Open that file with a code editor (notepadd++ is free and works well)  search for $ and replace with with jQuery, notepad++ has a feature to replace all instances of a word.  Save it, upload the file to the same location, clean your forums and browser cache.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

ninik



Hi Suki, sorry for the delayed reply.

I did all the changes that you requested me to do, uploaded the files back to the server and had to wait for propagation to do its thing...

and... IT IS WORKING!!!  ;D

You are a genius Suki and I honestly thaaaaaaaaaaaaaank you!!!  :laugh:


oldcopy

SMF 2.1 beta 2 - not work.

Log:

The callable OharaYTEmbed::runTimeHooks could not be called.

d3vcho

This Mod (and almost every mod) is not meant to work with 2.1 yet (one of the reasons because SMF 2.1 has not been released). You'll have to wait for a future release.

Regards :)
"Greeting Death as an old friend, they departed this life as equals"

oldcopy

I tried:

Quote from: Suki on November 13, 2015, 04:07:45 PM
For those of you interested, I've been updating this mod to work and use some of the new features SMF 2.1 offers, so far this is the result. Attached is a beta of this mod for SMF 2.1, the new features include:

Installed mod without error, but does not work.

d3vcho

Oops! My bad. You should wait for Suki's answer then.

Have a nice day :)
"Greeting Death as an old friend, they departed this life as equals"

Suki

@oldcopy  What package are you trying to install?

Make sure all files this mod needs are properly copied to their respective SMF folders.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

FishingManMatt

Hi Suki, hi guys!

While browsing files on my server I stumbled upon the following code in the Post.php file:

// Let's see if there's still some content left without the tags.
if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img><iframe><div><iframe><div>')) === '' && (!allowedTo('admin_forum') || strpos($_POST['message'], '[html]') === false))
$post_errors[] = 'no_message';


It turned out that the img tag was modified by the following mod's xml instructions:

<file name="$sourcedir/Post.php">
<operation>
<search position="replace"><![CDATA[<img>]]></search>
<add><![CDATA[<img><iframe><div>]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[<img>]]></search>
<add><![CDATA[<img><iframe><div>]]></add>
</operation>
</file>


In my Post.php file it looks like the img tag was replaced twice.

And the other img tag in this file (there are only two) is untouched:

if ($smcFunc['htmltrim'](strip_tags(parse_bbc($_POST['message'], false), '<img>')) === '')
{
$post_errors[] = 'no_message';
unset($_POST['message']);


I'm wondering if this is an installation bug or... maybe something went wrong during an update?

Suki

Its a bug on the mod, I believe I fixed it by having a wider search for code and make sure both places got covered. I dunno if I released that, I will have to check.  In the mean time, you can manually apply the change to both places or leave it as it is. This only affects you is you post a video and nothing more.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

FishingManMatt

Many thanks Suki!
I've just can manually applied the change to both img tags.

lahmfan

this mod doesnt seems to convert links that start with https://m.youtube.com. how can i add that?

Advertisement: