Advertisement:

Author Topic: Ohara YouTube Embed  (Read 199222 times)

Offline SDMiller

  • Semi-Newbie
  • *
  • Posts: 62
Re: Ohara YouTube Embed
« Reply #400 on: May 09, 2015, 12:51:20 AM »
Try the solution IU gave a couple of messages ago.

Hi Suki,

I tried the solution you gave, specifically:
Replace the entire  Themes/default/scripts/ohyoutube.js with this:

and also I did this:

Make sure that your Sources/OharaYTEmbed.php file has this exactly line of code:

... and I still get the same black box which doesn't play on posts using the ohara button, as seen in this example.

Note: the top video box is embedded by admin allowing for html and then using the youtube's embed iframe.
         the bottom black non-working video box is embedded using the ohara button. It's there so you can see it.

In case you're curious, it doesn't matter if ohara is used alone, or following html code, iframe, and cutoff. Its there now at the bottom of that post so that you can take a look at how your code is working (or not working).

The raw code for that post is as follows:

Code: [Select]
[html]
<p> <iframe width="560" height="315" src="https://www.youtube.com/embed/lbG4ryrsb6w?showinfo=0" frameborder="0" allowfullscreen></iframe> </p>
<p>HUNG HOM, Hong Kong - Hiding under the stairs in the shopping district, in a venue actually called Under the Staircase Shop, works Sister May, who carries on her family's tradition of hand making mahjong tiles in her nestled workshop Kam Fat Mahjong at 2 Bulkeley Street.</p>
<!-- <p><a href="http://www.womenofchina.cn/womenofchina/html1/news/newsmakers/1504/1476-1.htm"><em><img style="float: left;" src="images/stories/various/readmore.png" alt="readmore" /></em></a></p>
<p> </p> -->



[/html][cutoff]

[youtube]https://youtu.be/lbG4ryrsb6w[/youtube]


Any help?

Thanks a bunch. This mod used to work for me, not sure what smf/ohara update broke it.

Thanks again.

^_^

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #401 on: May 09, 2015, 01:59:46 PM »
@SDMiller  Do you have a link where I can see this behavior?


@rtil What  do you mean by blank page?  does it happens on install or any time you access your admin pages?  what php version are you using?
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline SDMiller

  • Semi-Newbie
  • *
  • Posts: 62
Re: Ohara YouTube Embed
« Reply #402 on: May 10, 2015, 03:02:57 PM »
@SDMiller  Do you have a link where I can see this behavior?

... and I still get the same black box which doesn't play on posts using the ohara button, as seen in this example.

Any help?

Thanks a bunch. This mod used to work for me, not sure what smf/ohara update broke it.

Thanks again.

^_^

Offline FLEXjs

  • Semi-Newbie
  • *
  • Posts: 51
  • Gender: Male
    • @@FLEXjs on Twitter
    • The Iron Sanctuary
Re: Ohara YouTube Embed
« Reply #403 on: May 10, 2015, 05:24:08 PM »
I tried to install this mod and broke my forum.

This is the error I get when I try to access it:

Parse error: syntax error, unexpected T_FUNCTION in /home/content/53/9126953/html/forums/Sources/OharaYTEmbed.php on line 28

I uploaded the "removeHooks" file but when I try to access it I get the same error.

How can I fix it please?

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: Ohara YouTube Embed
« Reply #404 on: May 10, 2015, 05:46:18 PM »
Your PHP version is probably too low to run this MOD.
The best way is to remove the file. Not being there, the hook will fail to load but your forum should load, thus allowing you to finish the removal ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline FLEXjs

  • Semi-Newbie
  • *
  • Posts: 51
  • Gender: Male
    • @@FLEXjs on Twitter
    • The Iron Sanctuary
Re: Ohara YouTube Embed
« Reply #405 on: May 10, 2015, 05:53:11 PM »
OK, I downloaded the "repair_settings.php" and was able to use it to remove all hooks, revert everyone to the default SMF theme, log in, and change it back and uninstall the mod.

Everything seems to be OK now except when I click on the "Admin" button I get this error:

Fatal error: Call to undefined function OYTE_Who() in /home/content/53/9126953/html/forums/Sources/Who.php on line 766

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: Ohara YouTube Embed
« Reply #406 on: May 10, 2015, 06:12:14 PM »
Edit your Who.php and remove the function call to OYTE_Who ;)

Or attach the file ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #407 on: May 10, 2015, 10:22:33 PM »
@SDMiller  Try the solution listed here:


I see where the error is, the .css file only gets uploaded to the default theme but the code is using $settings['theme_url'] which will try to use the current installed theme and not the default one :(

I'll release a fix for this later.  In the meantime you can try this:

Open your Sources/OharaYTEmbed.php and find this:

Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['theme_url'] .'/css/oharaEmbed.css" />
And replace it with this:

Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url'] .'/css/oharaEmbed.css" />

Its a bug in the mod but I haven't have time to release a new version with the fix.


@FLEXjs  Funny, that function OYTE_Who() is form an old Ohara version, the current version doesn't use that function anymore. That indicates that you might have multiple installs of different versions of this mod.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline SDMiller

  • Semi-Newbie
  • *
  • Posts: 62
Re: Ohara YouTube Embed
« Reply #408 on: May 11, 2015, 01:47:53 AM »
@SDMiller  Try the solution listed here:

Open your Sources/OharaYTEmbed.php and find this:

Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['theme_url'] .'/css/oharaEmbed.css" />
And replace it with this:

Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url'] .'/css/oharaEmbed.css" />


I did that... still doesn't work.

Don't forget I previously did this:

Replace the entire  Themes/default/scripts/ohyoutube.js with this:

and I also previously did this:

Make sure that your Sources/OharaYTEmbed.php file has this exactly line of code:

Was I supposed to do the new fix on top of the other two, so ALL THREE manual fixes, or just this latest one all by itself:
Code: [Select]
<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url'] .'/css/oharaEmbed.css" />[/quote]

Thanks for trying to get it working with me.

=)

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #409 on: May 11, 2015, 10:06:48 AM »
Yes, do all those steps.

Now it looks like some other mod added jquery and its using its "no conflict" features which means that the var this mod uses to reference jquery no longer works: $

Can you do another manual fix? besides all the other fixes, open your Themes/default/scripts/ohyoutube.js

find all instances of this: 

$(

and change it for this:

jQuery(

You can do it pretty easily with a code editor like notepad++ actually it will be better to do it with a code editor since doing it manually may result in some instances missed and a single $( missed will prevent the script from working.


Also, the "glossary" mod is using a very outdated version of jquery, that may also be part of the issue.  Might be useful if that mod uses a more recent version.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline FLEXjs

  • Semi-Newbie
  • *
  • Posts: 51
  • Gender: Male
    • @@FLEXjs on Twitter
    • The Iron Sanctuary
Re: Ohara YouTube Embed
« Reply #410 on: May 11, 2015, 11:16:33 AM »

@FLEXjs  Funny, that function OYTE_Who() is form an old Ohara version, the current version doesn't use that function anymore. That indicates that you might have multiple installs of different versions of this mod.

I did have 2 versions installed.  I uninstalled them both and deleted them both but I am still getting that error.

Any idea how to fix?

Thanks.

Offline margarett

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,761
  • Gender: Male
Re: Ohara YouTube Embed
« Reply #411 on: May 11, 2015, 11:41:21 AM »
Ouch, you should never have 2 versions installed :o

Your best possibility is to check each version's manual installation instructions backwards and make sure that everything is removed...
Manual Installation of Mods
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

Quote
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline SDMiller

  • Semi-Newbie
  • *
  • Posts: 62
Re: Ohara YouTube Embed
« Reply #412 on: May 16, 2015, 12:01:56 PM »
find all instances of this: 

$(

and change it for this:

jQuery(

I did that. Still no worky. :(

Code: [Select]
/*
╩Copyright (c) 2015 Jessica Gonzçlez
╩@license http://www.mozilla.org/MPL/MPL-1.1.html
*/

function oh_main(){

jQuery('.youtube').each(function() {

var videoID = this.id.replace('oh_',''),
imgsrc = oh_getImage(videoID),
imgHeight = jQuery(this).height(),
imgWidth = jQuery(this).width();

if (typeof imgsrc !== 'undefined'){
jQuery(this).css({'background-image': 'url('+ imgsrc +')', 'background-size': 'cover'});
}

jQuery(this).append(jQuery('<div/>', {'class': 'youtube_play'}));

jQuery('#oh_'+videoID).on('click', function() {
var iframe_url = 'https://www.youtube.com/embed/' + videoID + '?autoplay=1&autohide=1';
if (jQuery(this).data('params')) iframe_url+='&'+jQuery(this).data('params');

// The height and width of the iFrame should be the same as parent
var iframe = jQuery('<iframe/>', {'frameborder': '0', 'src': iframe_url, 'width': imgWidth, 'height': imgHeight })

// Replace the YouTube thumbnail with YouTube HTML5 Player
jQuery(this).replaceWith(iframe);
});
});
};

function oh_getImage(youtubeID)
{
var imgsrc = '',
index, len,
imageTypes = ['hqdefault', 'mqdefault', 'sddefault', 'maxresdefault'];
for (index = 0, len = imageTypes.length; index < len; ++index) {
imgsrc = 'http://i.ytimg.com/vi/'+ youtubeID +'/'+ imageTypes[index] +'.jpg';

if (imgsrc.width !=0){
break;
}
}

// Still no image, show the default one
if (imgsrc.width ==0){
imgsrc = 'http://i.ytimg.com/vi/'+ youtubeID +'/default.jpg';
}

return imgsrc;
};

function oh_getUrl(sParam)
{
var sPageURL = window.location.search.substring(1);

// SimpleSEF or pretty urls?
if (sPageURL.indexOf(sParam) > -1) {
return true;
}

var sURLVariables = sPageURL.split(';');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return true;
}
}

return false;
}

function oh_refresh()
{
setTimeout(function(){oh_main()},3E3);
}

jQuery(function(){
oh_main();

if (oh_getUrl('post'))
jQuery('input[name=preview]').on('click',function(){
oh_refresh();
});
});

Offline FLEXjs

  • Semi-Newbie
  • *
  • Posts: 51
  • Gender: Male
    • @@FLEXjs on Twitter
    • The Iron Sanctuary
Re: Ohara YouTube Embed
« Reply #413 on: May 16, 2015, 01:32:34 PM »
@FLEXjs  Funny, that function OYTE_Who() is form an old Ohara version, the current version doesn't use that function anymore. That indicates that you might have multiple installs of different versions of this mod.

So how can I fix because in the package manager it doesn't show any versions as being installed anymore.

Here is the who.php file....

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #414 on: May 16, 2015, 01:36:07 PM »
@SDMiller the glossary mod you have has a very outdated version of jquery that may prevent this mod form working properly.

@FLEXjs  heres the file without the call to that function.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline FLEXjs

  • Semi-Newbie
  • *
  • Posts: 51
  • Gender: Male
    • @@FLEXjs on Twitter
    • The Iron Sanctuary
Re: Ohara YouTube Embed
« Reply #415 on: May 16, 2015, 01:46:19 PM »
Thank you.  :)

Offline SDMiller

  • Semi-Newbie
  • *
  • Posts: 62
Re: Ohara YouTube Embed
« Reply #416 on: May 17, 2015, 10:44:07 PM »
@SDMiller the glossary mod you have has a very outdated version of jquery that may prevent this mod form working properly.

Yes, you were quite right. I uninstalled glossary mod (which had to be carefully done manually because it failed almost every test it ran before uninstalling) and now your embed button works as it should.

Which now raises the question.... should I undo this step of your fixes now?
Now it looks like some other mod added jquery and its using its "no conflict" features which means that the var this mod uses to reference jquery no longer works: $

Can you do another manual fix? besides all the other fixes, open your Themes/default/scripts/ohyoutube.js

find all instances of this: 

$(

and change it for this:

jQuery(

I wonder if that step is not only no longer necessary, but may interfere with future checks/find functions.

Thanks for all your support with your mod.

 :laugh:

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #417 on: May 18, 2015, 01:50:03 PM »
Well, there was a chance that the glossary mod will have worked with an updated version of jquery, so there was no need to fully uninstall it, just remove the call to the outdated jquery version :P

As for undoing that las change, there is no harm if you leave it as it is or revert it back, that was just a safe call to prevent possible library conflicts.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline FragaCampos

  • Sophist Member
  • *****
  • Posts: 1,306
  • Gender: Male
    • docsPT
Re: Ohara YouTube Embed
« Reply #418 on: May 21, 2015, 05:59:34 PM »
Hi there.
I've tested this mod in localhost and although vimeo videos appear correctly, youtube videos don't. The topic stays normal, but the video doesn't appear (with and without tags).
What may be wrong?

Regards.

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,558
  • Oh, wouldn't it be great if I *was* crazy?
    • MissAllSunday on GitHub
    • SMF mods
Re: Ohara YouTube Embed
« Reply #419 on: June 16, 2015, 07:21:37 PM »
Can you check this new release? https://github.com/MissAllSunday/OharaYouTubeEmbed/releases/tag/v1.2.2

It should solve all the recent issues, the first zip is a ready to load package.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.