~jstys-z/helioviewer.org/client5

« back to all changes in this revision

Viewing changes to lib/shadowbox-2.0/src/player/shadowbox-swf.js

Restructured Helioviewer.org project layout. Custom code for both client- and server-side now resides in src/ folders, images/css in resources/. Removed legacy libraries and code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * The Shadowbox SWF movie player class.
3
 
 *
4
 
 * This file is part of Shadowbox.
5
 
 *
6
 
 * Shadowbox is an online media viewer application that supports all of the
7
 
 * web's most popular media publishing formats. Shadowbox is written entirely
8
 
 * in JavaScript and CSS and is highly customizable. Using Shadowbox, website
9
 
 * authors can showcase a wide assortment of media in all major browsers without
10
 
 * navigating users away from the linking page.
11
 
 *
12
 
 * Shadowbox is released under version 3.0 of the Creative Commons Attribution-
13
 
 * Noncommercial-Share Alike license. This means that it is absolutely free
14
 
 * for personal, noncommercial use provided that you 1) make attribution to the
15
 
 * author and 2) release any derivative work under the same or a similar
16
 
 * license.
17
 
 *
18
 
 * If you wish to use Shadowbox for commercial purposes, licensing information
19
 
 * can be found at http://mjijackson.com/shadowbox/.
20
 
 *
21
 
 * @author      Michael J. I. Jackson <mjijackson@gmail.com>
22
 
 * @copyright   2007-2008 Michael J. I. Jackson
23
 
 * @license     http://creativecommons.org/licenses/by-nc-sa/3.0/
24
 
 * @version     SVN: $Id: shadowbox-swf.js 99 2008-05-11 16:22:43Z mjijackson $
25
 
 */
26
 
 
27
 
(function(){
28
 
 
29
 
    // shorthand
30
 
    var SB = Shadowbox;
31
 
    var SL = SB.lib;
32
 
 
33
 
    /**
34
 
     * Constructor. This class is used to display SWF movies.
35
 
     *
36
 
     * @param   {String}    id      The id to use for this content
37
 
     * @param   {Object}    obj     The content object
38
 
     * @public
39
 
     */
40
 
    Shadowbox.swf = function(id, obj){
41
 
        this.id = id;
42
 
        this.obj = obj;
43
 
 
44
 
        // SWF's are resizable
45
 
        this.resizable = true;
46
 
 
47
 
        // height defaults to 300 pixels
48
 
        this.height = this.obj.height ? parseInt(this.obj.height, 10) : 300;
49
 
 
50
 
        // width defaults to 300 pixels
51
 
        this.width = this.obj.width ? parseInt(this.obj.width, 10) : 300;
52
 
    };
53
 
 
54
 
    Shadowbox.swf.prototype = {
55
 
 
56
 
        /**
57
 
         * Returns an object containing the markup for this content, suitable
58
 
         * to pass to Shadowbox.lib.createHTML().
59
 
         *
60
 
         * @param   {Object}    dims    The current Shadowbox dimensions
61
 
         * @return  {Object}            The markup for this content item
62
 
         * @public
63
 
         */
64
 
        markup: function(dims){
65
 
            var bgcolor = SB.getOptions().flashBgColor;
66
 
            return {
67
 
                tag:        'object',
68
 
                id:         this.id,
69
 
                name:       this.id,
70
 
                type:       'application/x-shockwave-flash',
71
 
                data:       this.obj.content,
72
 
                children:   [
73
 
                    { tag: 'param', name: 'movie', value: this.obj.content },
74
 
                    { tag: 'param', name: 'bgcolor', value: bgcolor }
75
 
                ],
76
 
                height:     dims.resize_h, // use resized dimensions
77
 
                width:      dims.resize_w
78
 
            };
79
 
        },
80
 
 
81
 
        /**
82
 
         * Removes this SWF from the document.
83
 
         *
84
 
         * @return  void
85
 
         * @public
86
 
         */
87
 
        remove: function(){
88
 
            var el = SL.get(this.id);
89
 
            if(el) SL.remove(el);
90
 
        }
91
 
 
92
 
    };
93
 
 
94
 
})();