test/model/test.html
author veltr
Tue, 17 Apr 2012 20:19:46 +0200
branchnew-model
changeset 868 a525cc2214e7
parent 864 5e76a06b961c
child 872 d777d05a16e4
permissions -rw-r--r--
Started big refactoring
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
     2
"http://www.w3.org/TR/html4/loose.dtd">
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
     3
<html xmlns="http://www.w3.org/1999/xhtml">
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
     4
    <head>
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
     5
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
     6
        <title>Test Modèle de Données</title>
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
     7
        <script type="text/javascript" src="../../src/js/libs/jquery.min.js"></script>
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
     8
        <script type="text/javascript" src="../../src/js/libs/underscore.js"></script>
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
     9
        <script type="text/javascript">
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    10
            IriSP = {}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    11
        </script>
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    12
        <script type="text/javascript" src="../../src/js/model.js"></script>
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    13
        <script type="text/javascript" src="../../src/js/serializers/PlatformSerializer.js"></script>
864
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    14
        <script type="text/javascript" src="../../src/js/serializers/CinecastSerializer.js"></script>
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    15
        <script type="text/javascript">
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    16
            IriSP.jQuery = jQuery;
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    17
            IriSP._ = _;
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    18
            var _directory = new IriSP.Model.Directory();
860
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    19
            var _source = _directory.remoteSource({
864
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    20
                //url: "../integration/polemic_fr.json",
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    21
                url : '../integration/allocine_dossier_independant/json_examples/movie32.json',
860
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    22
                namespace: "metadataplayer",
864
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    23
                serializer: IriSP.serializers.cinecast
860
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    24
            });
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    25
            function showExport() {
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    26
                console.log(_source.serialize());
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    27
                $("body").html(JSON.stringify(_source.serialize()).replace(/(\[|\{)/g,'$1<ul><li>').replace(/(\]|\})/g,'</li></ul>$1').replace(/,/g,',</li><li>'))
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    28
            }
864
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    29
            function benchmark(name, callback) {
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    30
                document.write('<p>Running benchmark ' + name + '</p>');
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    31
                var b = new Date();
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    32
                for (var i = 0; i < 100000; i++) {
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    33
                    callback(i);
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    34
                }
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    35
                document.write('<p>Took ' + (new Date() - b) + 'ms</p>');
5e76a06b961c Added Cinecast serializer, with imports management
veltr
parents: 860
diff changeset
    36
            }
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    37
        </script>
860
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    38
        <style type="text/css">
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    39
            ul, li {
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    40
                list-style: none;
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    41
                margin: 0;
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    42
            }
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    43
        </style>
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    44
    </head>
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    45
    <body>
860
7fd843e0dc4e Implemented serialize functions
veltr
parents: 858
diff changeset
    46
        <a href="#" onclick="showExport(); return false;">Export Json</a>
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    47
    </body>
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents:
diff changeset
    48
</html>