content.tpl 2.78 KB
Newer Older
1
<div class="mediaplayer-container text-center">
Naomi Guyer's avatar
Naomi Guyer committed
2
3
4
  <div id="vid_{$blockid}" class="mediaplayer" style="margin: 0 auto;">
    {$html|clean_html|safe}
    {if $jsurl}
5
        <script>
Naomi Guyer's avatar
Naomi Guyer committed
6
        var blockinstance_{$blockid}_loaded = false;
7
        $j('#blockinstance_{$blockid} .js-heading a[data-toggle="collapse"]').on("click", function() {
Naomi Guyer's avatar
Naomi Guyer committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
            if (blockinstance_{$blockid}_loaded === false) {
                {if $jsflashvars}
                var embedobj = $j('<object />').attr('width', '{$width}')
                                               .attr('height', '{$height}');
                $j('<param />').attr('name', 'movie')
                               .attr('value', '{$jsurl}')
                               .appendTo(embedobj);
                $j('<param />').attr('name', 'allowfullscreen')
                               .attr('value', 'true')
                               .appendTo(embedobj);
                $j('<param />').attr('name', 'allowscriptaccess')
                               .attr('value', 'always')
                               .appendTo(embedobj);
                $j('<param />').attr('name', 'wmode')
                               .attr('value', 'transparent')
                               .appendTo(embedobj);
                $j('<param />').attr('name', 'flashvars')
                               .attr('value', '{$jsflashvars}')
                               .appendTo(embedobj);
                $j('<embed />').attr('src', '{$jsurl}')
28
                               .attr('allow', 'fullscreen')
Naomi Guyer's avatar
Naomi Guyer committed
29
30
31
32
33
34
35
36
37
38
                               .attr('wmode', 'transparent')
                               .attr('allowscriptaccess', 'always')
                               .attr('width', '{$width}')
                               .attr('height', '{$height}')
                               .attr('flashvars', '{$jsflashvars}')
                               .appendTo(embedobj);
                embedobj.appendTo($j('#vid_{$blockid}'));
                blockinstance_{$blockid}_loaded = true;
                $j('#user_block_{$blockid}_waiting').css('display','none');
                {else}
39
40
                var jsurl = '{$jsurl}'.replace(/&amp;/g,'&');
                $j('<iframe />').attr('src', jsurl)
Naomi Guyer's avatar
Naomi Guyer committed
41
42
                                .attr('width', '{$width}')
                                .attr('height', '{$height}')
43
                                .attr('allowfullscreen', '')
Naomi Guyer's avatar
Naomi Guyer committed
44
                                .appendTo($j('#vid_{$blockid}'))
45
                                .on("load", function() {
Naomi Guyer's avatar
Naomi Guyer committed
46
47
48
49
50
51
52
53
54
55
                                    blockinstance_{$blockid}_loaded = true;
                                    $j('#user_block_{$blockid}_waiting').css('display','none');
                                });
                {/if}
            }
        });
        </script>
    {/if}
  </div>
</div>