Changeset 86522 in spip-zone


Ignore:
Timestamp:
Dec 6, 2014, 11:32:25 PM (5 years ago)
Author:
cedric@…
Message:

Les oembed rich qui ont une vignette et un html avec une iframe sont aussi charges de manière asynchrone, au clic. Cela concerne notamment SoundCloud?.

Location:
_plugins_/oembed
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/oembed/css/oembed.css

    r85014 r86522  
    1414
    1515/* Oembed generique */
    16 .oembed.oe-rich {display: block;background: #f8f8f8;padding: 10px;border: 1px solid #eee;margin: 1em 0;text-align: left}
     16.oembed_rich {max-width:100%;}
     17.oembed_rich .rwd-rich-container {position: relative;}
     18.oembed_rich .rwd-rich-container iframe {position: absolute;top:0;left: 0;width: 100%;height: 100%;}
     19.oembed_rich .oembed.oe-rich {display: block;background: #f8f8f8;padding: 5px;border: 1px solid #eee;text-align: left}
     20.oembed_rich .oe-rich+.spip_doc_titre {margin-top: 0.5em;}
     21.oembed_rich .spip_doc_titre+.oembed-source {display: none;}
     22
    1723.oembed.oe-link.oe-rich .oe-html {display: block;}
    1824.oe-rich > blockquote {font-style: normal;}
  • _plugins_/oembed/inc/oembed.php

    r85935 r86522  
    130130        $data_url = parametre_url($data_url,'format',$format,'&');
    131131
     132        // pre-traitement du provider si besoin
     133        $endpoint = explode("//",$provider['endpoint']);
     134        $endpoint = explode("/",$endpoint[1]);
     135        $endpoint = reset($endpoint);
     136        $endpoint = preg_replace(",\W+,","_",$endpoint);
     137        if ($oembed_endpoint_pretraite = charger_fonction("pretraite_$endpoint",'oembed/input',true)){
     138                $a = func_get_args();
     139                $args = array('url'=>array_shift($a));
     140                if (count($a)) $args['maxwidth'] = array_shift($a);
     141                if (count($a)) $args['maxheight'] = array_shift($a);
     142                if (count($a)) $args['format'] = array_shift($a);
     143                $data_url = $oembed_endpoint_pretraite($data_url,$args);
     144        }
     145
     146
    132147        if (isset($cache[$data_url]))
    133148                return $cache[$data_url];
  • _plugins_/oembed/modeles/oembed_rich.html

    r59636 r86522  
    1 [<div class="oembed oe-rich clearfix[ (#ENV{align})]">
    2         (#ENV{data}|table_valeur{html}|sinon{#ENV{url}})
    3 </div>]
     1<div class="oembed oe-rich clearfix[ (#ENV{align})]" style="max-width:#ENV{data/width}px;">
     2        #SET{async,#ENV{data/thumbnail_url}|et{#ENV*{data/html}|match{'<iframe'}}|oui}
     3        <div class="rwd-rich-container[(#GET{async}|oui)oe-play-button]"
     4             style="width:100%;[height:(#ENV{data/height})px;][background:url('(#ENV{data/thumbnail_url})') no-repeat center;background-size:cover;]"
     5                         [(#GET{async}|oui)
     6             onclick="if (jQuery(this).is('.oe-play-button')){jQuery(this).removeClass('oe-play-button').append(decodeURIComponent('[(#ENV*{data/html}|oembed_force_video_autoplay|rawurlencode|texte_script)]'));}"
     7             ]>
     8             [(#GET{async}|non) [(#ENV*{data/html}|sinon{#ENV{url}})] ]
     9        </div>
     10</div>
     11[<div class="spip_doc_titre" style="max-width:#ENV{data/width}px;"><a href="#ENV*{url}">(#ENV*{data/title})</a>[<br /><i>par <a href="#ENV*{data/author_url}">(#ENV*{data/author_name})</a></i>]</div>]
  • _plugins_/oembed/oembed_fonctions.php

    r85014 r86522  
    8383          AND $src = extraire_attribut($e,'src')){
    8484
    85                 $src_autoplay = parametre_url($src,"autoplay","1");
     85                if (strpos($src,"soundcloud")!==false)
     86                        $src_autoplay = parametre_url($src,"auto_play","1");
     87                else
     88                        $src_autoplay = parametre_url($src,"autoplay","1");
    8689                $html = str_replace($src,$src_autoplay,$html);
    8790        }
  • _plugins_/oembed/paquet.xml

    r85795 r86522  
    22        prefix="oembed"
    33        categorie="multimedia"
    4         version="1.2.3"
     4        version="1.3.0"
    55        etat="stable"
    66        compatibilite="[3.0.0;3.1.*]"
Note: See TracChangeset for help on using the changeset viewer.