Skip to content

Commit

Permalink
MediaEmbed: updated JSFiddle
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed May 16, 2024
1 parent 7b7c14b commit 3a31a34
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 6 deletions.
12 changes: 12 additions & 0 deletions docs/testdox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2659,6 +2659,10 @@ PHP (s9e\TextFormatter\Tests\Configurator\RendererGenerators\PHP)
[x] Tests from plugins with data set #297
[x] Tests from plugins with data set #298
[x] Tests from plugins with data set #299
[x] Tests from plugins with data set #300
[x] Tests from plugins with data set #301
[x] Tests from plugins with data set #302
[x] Tests from plugins with data set #303
[x] Tests from plugins (Quick renderer) with data set #0
[x] Tests from plugins (Quick renderer) with data set #1
[x] Tests from plugins (Quick renderer) with data set #2
Expand Down Expand Up @@ -2959,6 +2963,10 @@ PHP (s9e\TextFormatter\Tests\Configurator\RendererGenerators\PHP)
[x] Tests from plugins (Quick renderer) with data set #297
[x] Tests from plugins (Quick renderer) with data set #298
[x] Tests from plugins (Quick renderer) with data set #299
[x] Tests from plugins (Quick renderer) with data set #300
[x] Tests from plugins (Quick renderer) with data set #301
[x] Tests from plugins (Quick renderer) with data set #302
[x] Tests from plugins (Quick renderer) with data set #303
[x] Creates a Quick renderer if $enableQuickRenderer is true
[x] Does not create a Quick renderer if $enableQuickRenderer is false

Expand Down Expand Up @@ -7687,6 +7695,10 @@ Parser (s9e\TextFormatter\Tests\Plugins\MediaEmbed\Parser)
[x] Parsing+rendering tests with data set #89
[x] Parsing+rendering tests with data set #90
[x] Parsing+rendering tests with data set #91
[x] Parsing+rendering tests with data set #92
[x] Parsing+rendering tests with data set #93
[x] Parsing+rendering tests with data set #94
[x] Parsing+rendering tests with data set #95

Parser Base (s9e\TextFormatter\Tests\Plugins\ParserBase)
[x] Has a default empty setUp() method
Expand Down
4 changes: 2 additions & 2 deletions src/Bundles/MediaPack.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/Bundles/MediaPack/Renderer.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class CachedDefinitionCollection extends SiteDefinitionCollection
'instagram'=>['amp'=>['custom-element'=>'amp-instagram','src'=>'https://cdn.ampproject.org/v0/amp-instagram-0.1.js','template'=>'<amp-instagram layout="responsive" width="540" height="540" data-captioned="" data-shortcode="{@id}"/>'],'attributes'=>[],'example'=>['https://instagram.com/p/gbGaIXBQbn/','https://www.instagram.com/tv/BkQjCfsBIzi/'],'extract'=>['!instagram\\.com/(?:p|reel|tv)/(?\'id\'[-\\w]+)!'],'homepage'=>'https://instagram.com/','host'=>['instagram.com'],'iframe'=>['data-s9e-livepreview-ignore-attrs'=>'style','height'=>542,'onload'=>'let c=new MessageChannel;c.port1.onmessage=e=>this.style.height=e.data+\'px\';this.contentWindow.postMessage(\'s9e:init\',\'*\',[c.port2])','src'=>'https://s9e.github.io/iframe/2/instagram.min.html#<xsl:value-of select="@id"/><xsl:if test="$MEDIAEMBED_THEME">#theme=<xsl:value-of select="$MEDIAEMBED_THEME"/></xsl:if>','width'=>542],'name'=>'Instagram','scrape'=>[],'source'=>'http://help.instagram.com/513918941996087','tags'=>['social'],'tracking_policy'=>'https://help.instagram.com/1896641480634370'],
'internetarchive'=>['attributes'=>['height'=>['defaultValue'=>360,'filterChain'=>['#uint']],'id'=>['filterChain'=>['htmlspecialchars_decode']],'width'=>['defaultValue'=>640,'filterChain'=>['#uint']]],'choose'=>['otherwise'=>['iframe'=>['height'=>'{@height}','src'=>'https://archive.org/embed/{@id}','width'=>'{@width}']],'when'=>['iframe'=>['height'=>170,'max-width'=>640,'src'=>'https://archive.org/embed/{@id}&list_height=150','width'=>'100%'],'test'=>'contains(@id,\'playlist=1\')']],'example'=>['https://archive.org/details/BillGate99','https://archive.org/details/DFTS2014-05-30'],'extract'=>[],'homepage'=>'https://archive.org/','host'=>['archive.org'],'name'=>'Internet Archive','scrape'=>[['extract'=>['!meta property="twitter:player" content="https://archive.org/embed/(?\'id\'[^/"]+)!','!meta property="og:video:width" content="(?\'width\'\\d+)!','!meta property="og:video:height" content="(?\'height\'\\d+)!'],'match'=>['!archive\\.org/(?:details|embed)/!']]]],
'izlesene'=>['amp'=>['custom-element'=>'amp-izlesene','src'=>'https://cdn.ampproject.org/v0/amp-izlesene-0.1.js','template'=>'<amp-izlesene layout="responsive" width="640" height="360" data-videoid="{@id}"/>'],'attributes'=>[],'example'=>'https://www.izlesene.com/video/kardan-adamin-salincak-keyfi/10553555','extract'=>['!izlesene\\.com/video/[-\\w]+/(?\'id\'\\d+)!'],'homepage'=>'https://www.izlesene.com/','host'=>['izlesene.com'],'iframe'=>['src'=>'//www.izlesene.com/embedplayer/{@id}?autoplay=0'],'name'=>'İzlesene','scrape'=>[],'tags'=>['.tr']],
'jsfiddle'=>['attributes'=>[],'example'=>'https://jsfiddle.net/1v03Lqnu/','extract'=>['@jsfiddle.net/(?:(?\'user\'\\w+)/)?(?!\\d+\\b|embedded\\b|show\\b)(?\'id\'\\w+)\\b(?:/(?\'revision\'\\d+)\\b)?@'],'homepage'=>'https://jsfiddle.net/','host'=>['jsfiddle.net'],'iframe'=>['height'=>400,'src'=>'//jsfiddle.net/{@id}/{@revision}/embedded/{$MEDIAEMBED_THEME}/','width'=>'100%'],'name'=>'JSFiddle','scrape'=>[],'tags'=>['programming']],
'jsfiddle'=>['attributes'=>[],'example'=>'https://jsfiddle.net/1v03Lqnu/','extract'=>['@jsfiddle.net/(?:(?\'user\'\\w+)/)?(?!\\d+\\b|embedded\\b|show\\b)(?\'id\'\\w+)\\b(?:/(?\'revision\'\\d+)\\b)?@'],'homepage'=>'https://jsfiddle.net/','host'=>['jsfiddle.net'],'iframe'=>['height'=>400,'src'=>'//jsfiddle.net/<xsl:value-of select="@id"/>/<xsl:value-of select="@revision"/>/embedded/<xsl:if test="$MEDIAEMBED_THEME=\'light\'or$MEDIAEMBED_THEME=\'dark\'"><xsl:value-of select="$MEDIAEMBED_THEME"/>/</xsl:if>','width'=>'100%'],'name'=>'JSFiddle','scrape'=>[],'tags'=>['programming']],
'jwplatform'=>['attributes'=>[],'example'=>['https://content.jwplatform.com/players/X6tRZpKj-7Y21S9TB.html','https://content.jwplatform.com/previews/YfTSAegE-L0l35Tsd'],'extract'=>['!jwplatform\\.com/\\w+/(?\'id\'[-\\w]+)!'],'homepage'=>'https://www.jwplayer.com/products/jwplatform/','host'=>['jwplatform.com'],'iframe'=>['src'=>'//content.jwplatform.com/players/{@id}.html'],'name'=>'JW Platform','scrape'=>[],'tags'=>['videos']],
'kaltura'=>['amp'=>['custom-element'=>'amp-kaltura-player','src'=>'https://cdn.ampproject.org/v0/amp-kaltura-player-0.1.js','template'=>'<amp-kaltura-player layout="responsive" width="640" height="360" data-service-url="cdnapisec.kaltura.com" data-uiconf="{@uiconf_id}" data-partner="{@partner_id}" data-entryid="{@entry_id}" data-param-streamertype="auto"/>'],'attributes'=>['entry_id'=>['required'=>true],'partner_id'=>['required'=>true],'uiconf_id'=>['required'=>true]],'example'=>['https://www.kaltura.com/tiny/p8a9z','https://videos.kaltura.com/media/1_Kaltura+Video+Tips+-+Preparation/1_p59fv7ur'],'extract'=>['@/p(?:artner_id)?/(?\'partner_id\'\\d+)/@','@/sp/(?\'sp\'\\d+)/@','@/uiconf_id/(?\'uiconf_id\'\\d+)/@','@\\bentry_id[=/](?\'entry_id\'\\w+)@'],'homepage'=>'https://corp.kaltura.com/','host'=>['kaltura.com'],'iframe'=>['src'=>'https://cdnapisec.kaltura.com/p/<xsl:value-of select="@partner_id"/>/sp/<xsl:choose><xsl:when test="@sp"><xsl:value-of select="@sp"/></xsl:when><xsl:otherwise><xsl:value-of select="@partner_id"/>00</xsl:otherwise></xsl:choose>/embedIframeJs/uiconf_id/<xsl:value-of select="@uiconf_id"/>/partner_id/<xsl:value-of select="@partner_id"/>?iframeembed=true&amp;entry_id=<xsl:value-of select="@entry_id"/>'],'name'=>'Kaltura','scrape'=>[['extract'=>['@kaltura\\.com/p/(?\'partner_id\'\\d+)/sp/(?\'sp\'\\d+)/\\w*/uiconf_id/(?\'uiconf_id\'\\d+)(?:/.*?\\bentry_id=(?\'entry_id\'\\w+))?@','@/entry_id/(?\'entry_id\'\\w+)@'],'match'=>['@kaltura\\.com/(?:media|tiny)/.@']]],'tags'=>['videos']],
'khl'=>['attributes'=>[],'example'=>['https://video.khl.ru/events/233677','https://video.khl.ru/quotes/251237'],'extract'=>[],'homepage'=>'https://www.khl.ru/','host'=>['video.khl.ru'],'iframe'=>['src'=>'//video.khl.ru/iframe/feed/start/{@id}?type_id=18&width=560&height=315'],'name'=>'Kontinental Hockey League (КХЛ)','scrape'=>[['extract'=>['!/feed/start/(?\'id\'[/\\w]+)!'],'match'=>['!video\\.khl\\.ru/(?:event|quote)s/\\d!']]],'tags'=>['.ru','sports']],
Expand Down
14 changes: 13 additions & 1 deletion src/Plugins/MediaEmbed/Configurator/sites/jsfiddle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,17 @@

<host>jsfiddle.net</host>
<extract>@jsfiddle.net/(?:(?'user'\w+)/)?(?!\d+\b|embedded\b|show\b)(?'id'\w+)\b(?:/(?'revision'\d+)\b)?@</extract>
<iframe height="400" width="100%" src="//jsfiddle.net/{@id}/{@revision}/embedded/{$MEDIAEMBED_THEME}/"/>
<iframe height="400" width="100%">
<src><![CDATA[
<xsl:text>//jsfiddle.net/</xsl:text>
<xsl:value-of select="@id"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="@revision"/>
<xsl:text>/embedded/</xsl:text>
<xsl:if test="$MEDIAEMBED_THEME = 'light' or $MEDIAEMBED_THEME = 'dark'">
<xsl:value-of select="$MEDIAEMBED_THEME"/>
<xsl:text>/</xsl:text>
</xsl:if>
]]></src>
</iframe>
</site>
41 changes: 41 additions & 0 deletions tests/Plugins/MediaEmbed/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4596,6 +4596,47 @@ function ($configurator)
$configurator->MediaEmbed->add('indiegogo');
}
],
[
'https://jsfiddle.net/1v03Lqnu/11/',
'<iframe data-s9e-mediaembed="jsfiddle" allowfullscreen="" loading="lazy" scrolling="no" style="border:0;height:400px;width:100%" src="//jsfiddle.net/1v03Lqnu/11/embedded/"></iframe>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('jsfiddle');
}
],
[
'https://jsfiddle.net/1v03Lqnu/11/',
'<iframe data-s9e-mediaembed="jsfiddle" allowfullscreen="" loading="lazy" scrolling="no" style="border:0;height:400px;width:100%" src="//jsfiddle.net/1v03Lqnu/11/embedded/dark/"></iframe>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('jsfiddle');
$configurator->rendering->parameters['MEDIAEMBED_THEME'] = 'dark';
}
],
[
'https://jsfiddle.net/1v03Lqnu/11/',
'<iframe data-s9e-mediaembed="jsfiddle" allowfullscreen="" loading="lazy" scrolling="no" style="border:0;height:400px;width:100%" src="//jsfiddle.net/1v03Lqnu/11/embedded/light/"></iframe>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('jsfiddle');
$configurator->rendering->parameters['MEDIAEMBED_THEME'] = 'light';
}
],
[
'https://jsfiddle.net/1v03Lqnu/11/',
'<iframe data-s9e-mediaembed="jsfiddle" allowfullscreen="" loading="lazy" scrolling="no" style="border:0;height:400px;width:100%" src="//jsfiddle.net/1v03Lqnu/11/embedded/"></iframe>',
[],
function ($configurator)
{
$configurator->MediaEmbed->add('jsfiddle');

// JSFiddle returns a 404 for anything that's not "light" or "dark"
$configurator->rendering->parameters['MEDIAEMBED_THEME'] = 'auto';
}
],
[
'https://cdnapisec.kaltura.com/html5/html5lib/v2.73.2/mwEmbedFrame.php/p/1674401/uiconf_id/23435151/entry_id/1_dtmilkcn?wid=_1674401&iframeembed=true&playerId=kaltura_player&entry_id=1_dtmilkcn',
'<span data-s9e-mediaembed="kaltura" style="display:inline-block;width:100%;max-width:640px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:56.25%"><iframe allowfullscreen="" loading="lazy" scrolling="no" style="border:0;height:100%;left:0;position:absolute;width:100%" src="https://cdnapisec.kaltura.com/p/1674401/sp/167440100/embedIframeJs/uiconf_id/23435151/partner_id/1674401?iframeembed=true&amp;entry_id=1_dtmilkcn"></iframe></span></span>',
Expand Down

0 comments on commit 3a31a34

Please sign in to comment.