Skip to content

Commit 3c01461

Browse files
committed
1.2.9 - March 12, 2017
- Fix the "/>" appearing on autoembed - Fix support for gifv - Add a link to the video if JavaScript is disabled Signed-off-by: Jessica González <suki@missallsunday.com>
1 parent 1f819bb commit 3c01461

15 files changed

+54
-43
lines changed

OharaYTEmbed.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
55
<id>Suki:ohara_youtube_embed</id>
6-
<version>1.2.8</version>
6+
<version>1.2.9</version>
77

88
<file name="$sourcedir/Post.php">
99
<operation>

Sources/OharaYTEmbed.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
/*
44
* @package Ohara Youtube Embed mod
5-
* @version 1.2.8
6-
* @author Jessica González <missallsunday@simplemachines.org>
7-
* @copyright Copyright (C) 2016 Jessica González
5+
* @version 1.2.9
6+
* @author Jessica González <suki@missallsunday.com>
7+
* @copyright Copyright (C) 2017 Jessica González
88
* @license http://www.mozilla.org/MPL/ MPL 2.0
99
*/
1010

@@ -202,7 +202,7 @@ function OYTE_Main($data)
202202

203203
// Got something!
204204
else
205-
$result = '<div class="oharaEmbed youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '480' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '270' : $modSettings['OYTE_video_height']) .'px;"></div>';
205+
$result = '<div class="oharaEmbed youtube" id="oh_'. $videoID .'" style="width: '. (empty($modSettings['OYTE_video_width']) ? '480' : $modSettings['OYTE_video_width']) .'px; height: '. (empty($modSettings['OYTE_video_height']) ? '270' : $modSettings['OYTE_video_height']) .'px;"><noscript><a href="//www.youtube.com/watch?v='. $videoID .'">//www.youtube.com/watch?v='. $videoID .'</a></noscript></div>';
206206

207207
return $result;
208208
}
@@ -247,11 +247,11 @@ function OYTE_Gifv($data)
247247
$result = '';
248248

249249
if (strpos($data, 'http') === false || strpos($data, '.com') === false)
250-
return '<video class="oharaEmbed gifv" autoplay loop style="max-width: '. (empty($modSettings['OYTE_video_width']) ? '480' : $modSettings['OYTE_video_width']) .'px; max-height: '. (empty($modSettings['OYTE_video_height']) ? '270' : $modSettings['OYTE_video_height']) .'px;" src="//i.imgur.com/'. $data .'.webm"><source src="//i.imgur.com/'. $data .'.webm" type="video/webm"></source></video>';
250+
return '<video class="oharaEmbed gifv" autoplay loop style="max-width: '. (empty($modSettings['OYTE_video_width']) ? '480' : $modSettings['OYTE_video_width']) .'px; max-height: '. (empty($modSettings['OYTE_video_height']) ? '270' : $modSettings['OYTE_video_height']) .'px;"><source src="//i.imgur.com/'. $data .'.webm" type="video/webm"></source><source src="//i.imgur.com/'. $data .'.mp4" type="video/mp4"></source></video>';
251251

252252

253253
// We all love Regex.
254-
$pattern = '/^(?:https?:\/\/)?(?:www\.)?i\.imgur\.com\/([a-z0-9]+)\.(?:gifv|webm)/i';
254+
$pattern = '/^(?:https?:\/\/)?(?:www\.)?i\.imgur\.com\/([a-z0-9]+)\.(?:gif|gifv|webm|mp4)/i';
255255

256256
// First attempt, pure regex.
257257
if (empty($videoID) && preg_match($pattern, $data, $matches))
@@ -264,7 +264,7 @@ function OYTE_Gifv($data)
264264

265265
// Got something!
266266
else
267-
$result = '<video class="oharaEmbed gifv" autoplay loop style="max-width: '. (empty($modSettings['OYTE_video_width']) ? '480' : $modSettings['OYTE_video_width']) .'px; max-height: '. (empty($modSettings['OYTE_video_height']) ? '270' : $modSettings['OYTE_video_height']) .'px;" src="//i.imgur.com/'. $videoID .'.webm"><source src="//i.imgur.com/'. $videoID .'.webm" type="video/webm"></source></video>';
267+
$result = '<video class="oharaEmbed gifv" autoplay loop style="max-width: '. (empty($modSettings['OYTE_video_width']) ? '480' : $modSettings['OYTE_video_width']) .'px; max-height: '. (empty($modSettings['OYTE_video_height']) ? '270' : $modSettings['OYTE_video_height']) .'px;"><source src="//i.imgur.com/'. $videoID .'.webm" type="video/webm"></source><source src="//i.imgur.com/'. $videoID .'.mp4" type="video/mp4"></video>';
268268

269269
return $result;
270270
}
@@ -283,9 +283,9 @@ function OYTE_Preparse($message)
283283

284284
// The extremely long regex...
285285
$vimeo = '~(?<=[\s>\.(;\'"]|^)(?:https?\:\/\/)?(?:www\.)?vimeo.com\/(?:album\/|groups\/(.*?)\/|channels\/(.*?)\/)?[0-9]+\??[/\w\-_\~%@\?;=#}\\\\]?~';
286-
$youtube = '~(?<=[\s>\.(;\'"]|^)(?:http|https):\/\/[\w\-_%@:|]?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/watch\?.+&v=))([\w-]{11})(?:[^\s]+)?(?=[^\w-]|$)(?![?=&+%\w.-]*(?:[\'"][^<>]*> | <\/a> ))[?=&+%\w.-]*[\/\w\-_\~%@\?;=#}\\\\]?~ix';
286+
$youtube = '~(?<=[\s>\.(;\'"]|^)(?:http|https):\/\/[\w\-_%@:|]?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/watch\?.+&v=))([\w-]{11})(?:[^\s|\<|\[]+)?(?=[^\w-]|$)(?![?=&+%\w.-]*(?:[\'"][^<>]*>|<\/a> ))[?=&+%\w.-]*[\/\w\-_\~%@\?;=#}\\\\]?~ix';
287287

288-
$gifv = '~(?<=[\s>\.(;\'"]|^)(?:http|https):\/\/[\w\-_%@:|]?(?:www\.)?i\.imgur\.com\/([a-z0-9]+)\.(?:gifv|webm)(?=[^\w-]|$)(?![?=&+%\w.-]*(?:[\'"][^<>]*> | <\/a> ))[?=&+%\w.-]*[\/\w\-_\~%@\?;=#}\\\\]?~ix';
288+
$gifv = '~(?<=[\s>\.(;\'"]|^)(?:http|https):\/\/[\w\-_%@:|]?(?:www\.)?i\.imgur\.com\/([a-z0-9]+)\.(?:gif|gifv|webm|mp4)(?=[^\w-]|$)(?![?=&+%\w.-]*(?:[\'"][^<>]*> | <\/a> ))[?=&+%\w.-]*[\/\w\-_\~%@\?;=#}\\\\]?~ix';
289289

290290
// Is this a YouTube video url?
291291
$message = preg_replace_callback(

Themes/default/css/oharaEmbed.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
transition: all 200ms ease-out;
1111
cursor: pointer;
1212
}
13-
13+
.oharaEmbed a{
14+
color: #fff;
15+
font-size: 16px;
16+
margin: auto;
17+
padding: 10px 0;
18+
display: block;
19+
}
1420

1521
/* You Tube play button */
1622
.youtube .youtube_play {

Themes/default/languages/OharaYTEmbed.english-utf8.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
/*
44
* @package Ohara Youtube Embed mod
5-
* @version 1.2.8
6-
* @author Jessica González <missallsunday@simplemachines.org>
7-
* @copyright Copyright (C) 2016 Jessica González
5+
* @version 1.2.9
6+
* @author Jessica González <suki@missallsunday.com>
7+
* @copyright Copyright (C) 2017 Jessica González
88
* @license http://www.mozilla.org/MPL/ MPL 2.0
99
*/
1010

Themes/default/languages/OharaYTEmbed.english.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
/*
44
* @package Ohara Youtube Embed mod
5-
* @version 1.2.8
6-
* @author Jessica Gonzalez <missallsunday@simplemachines.org>
7-
* @copyright Copyright (C) 2016 Jessica Gonzalez
5+
* @version 1.2.9
6+
* @author Jessica Gonzalez <suki@missallsunday.com>
7+
* @copyright Copyright (C) 2017 Jessica Gonzalez
88
* @license http://www.mozilla.org/MPL/ MPL 2.0
99
*/
1010

Themes/default/languages/OharaYTEmbed.spanish_es-utf8.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
/*
44
* @package Ohara Youtube Embed mod
5-
* @version 1.2.8
6-
* @author Jessica González <missallsunday@simplemachines.org>
7-
* @copyright Copyright (C) 2016 Jessica González
5+
* @version 1.2.9
6+
* @author Jessica González <suki@missallsunday.com>
7+
* @copyright Copyright (C) 2017 Jessica González
88
* @license http://www.mozilla.org/MPL/ MPL 2.0
99
*/
1010

Themes/default/languages/OharaYTEmbed.spanish_es.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
/*
44
* @package Ohara Youtube Embed mod
5-
* @version 1.2.8
6-
* @author Jessica Gonzalez <missallsunday@simplemachines.org>
7-
* @copyright Copyright (C) 2016 Jessica Gonzalez
5+
* @version 1.2.9
6+
* @author Jessica Gonzalez <suki@missallsunday.com>
7+
* @copyright Copyright (C) 2017 Jessica Gonzalez
88
* @license http://www.mozilla.org/MPL/ MPL 2.0
99
*/
1010

Themes/default/languages/OharaYTEmbed.spanish_latin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
/*
44
* @package Ohara Youtube Embed mod
5-
* @version 1.2.8
6-
* @author Jessica Gonz&aacute;lez <missallsunday@simplemachines.org>
7-
* @copyright Copyright (C) 2016 Jessica Gonz&aacute;lez
5+
* @version 1.2.9
6+
* @author Jessica Gonz&aacute;lez <suki@missallsunday.com>
7+
* @copyright Copyright (C) 2017 Jessica Gonz&aacute;lez
88
* @license http://www.mozilla.org/MPL/ MPL 2.0
99
*/
1010

Themes/default/languages/OharaYTEmbed.spanish_latin_utf8.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
/*
44
* @package Ohara Youtube Embed mod
5-
* @version 1.2.8
6-
* @author Jessica González <missallsunday@simplemachines.org>
7-
* @copyright Copyright (C) 2016 Jessica González
5+
* @version 1.2.9
6+
* @author Jessica González <suki@missallsunday.com>
7+
* @copyright Copyright (C) 2017 Jessica González
88
* @license http://www.mozilla.org/MPL/ MPL 2.0
99
*/
1010

Themes/default/scripts/ohyoutube.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
Copyright (C) 2016 Jessica González
2+
Copyright (C) 2017 Jessica González
33
@license http://www.mozilla.org/MPL/ MPL 2.0
4-
@version 1.2.8
4+
@version 1.2.9
55
*/
66

77
var _oh = function(){
@@ -120,4 +120,4 @@ _oh.prototype.getImage = function(youtubeID)
120120
_ohObject.refresh();
121121
});
122122
});
123-
})(jQuery);
123+
})(jQuery);

0 commit comments

Comments
 (0)