src/js/ui.js
author hamidouk
Mon, 14 Nov 2011 17:19:26 +0100
branchrequire-js
changeset 238 6008172a0592
parent 72 c4a36ea700d4
permissions -rw-r--r--
converted all the source files to use the require.js syntax.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
     1
/* ui.js - ui related functions */
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
     2
define("ui.js", function() {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
     3
  /* FIXME: use an sharing library */
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
     4
  IriSP.LdtShareTool = IriSP.share_template; /* the contents come from share.html */
38
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
     5
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
     6
  IriSP.createPlayerChrome = function(){
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
     7
    var width = IriSP.config.gui.width;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
     8
    var height = IriSP.config.gui.height;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
     9
    var heightS = IriSP.config.gui.height-20;
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    10
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    11
    // AUDIO  */
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    12
    // PB dans le html : ; 
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    13
    IriSP.trace( "__IriSP.createMyHtml",IriSP.config.gui.container );
38
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    14
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    15
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    16
    /* FIXME : factor this in another file */
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    17
    if( IriSP.config.gui.mode=="radio" ){
38
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    18
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    19
      IriSP.jQuery( "#"+IriSP.config.gui.container ).before(IriSP.search_template);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    20
      var radioPlayer = Mustache.to_html(IriSP.radio_template, {"share_template" : IriSP.share_template});
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    21
      IriSP.jQuery(radioPlayer).appendTo("#"+IriSP.config.gui.container);
38
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    22
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    23
      // special tricks for IE 7
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    24
      if (IriSP.jQuery.browser.msie==true && IriSP.jQuery.browser.version=="7.0"){
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    25
        //LdtSearchContainer
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    26
        //__IriSP.jQuery("#LdtPlayer").attr("margin-top","50px");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    27
        IriSP.jQuery("#Ldt-Root").css("padding-top","25px");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    28
        IriSP.trace("__IriSP.createHtml","IE7 SPECIAL ");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    29
      }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    30
    } else if(IriSP.config.gui.mode=="video") {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    31
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    32
      var videoPlayer = Mustache.to_html(IriSP.video_template, {"share_template" : IriSP.share_template, "heightS" : heightS});
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    33
      IriSP.jQuery(videoPlayer).appendTo("#"+IriSP.config.gui.container);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    34
    }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    35
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    36
    IriSP.jQuery("#Ldt-Annotations").width(width-(75*2));
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    37
    IriSP.jQuery("#Ldt-Show-Arrow-container").width(width-(75*2));
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    38
    IriSP.jQuery("#Ldt-ShowAnnotation-audio").width(width-10);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    39
    IriSP.jQuery("#Ldt-ShowAnnotation-video").width(width-10);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    40
    IriSP.jQuery("#Ldt-SaKeyword").width(width-10);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    41
    IriSP.jQuery("#Ldt-controler").width(width-10);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    42
    IriSP.jQuery("#Ldt-Control").attr("z-index","100");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    43
    IriSP.jQuery("#Ldt-controler").hide();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    44
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    45
    IriSP.jQuery(IriSP.annotation_loading_template).appendTo("#Ldt-ShowAnnotation-audio");
38
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    46
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    47
    if(IriSP.config.gui.mode=='radio'){
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    48
      IriSP.jQuery("#Ldt-load-container").attr("width",IriSP.config.gui.width);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    49
    }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    50
    // Show or not the output
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    51
    if(IriSP.config.gui.debug===true){
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    52
      IriSP.jQuery("#Ldt-output").show();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    53
    } else {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    54
      IriSP.jQuery("#Ldt-output").hide();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    55
    }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    56
    
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    57
  };
38
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    58
94899a565089 moving ui-specific code from site.js to ui.js
hamidouk
parents: 31
diff changeset
    59
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    60
  /* create the buttons and the slider   */
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    61
  IriSP.createInterface = function( width, height, duration ) {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    62
      
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    63
      IriSP.jQuery( "#Ldt-controler" ).show();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    64
      //__IriSP.jQuery("#Ldt-Root").css('display','visible');
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    65
      IriSP.trace( "__IriSP.createInterface" , width+","+height+","+duration+"," );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    66
      
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    67
      IriSP.jQuery( "#Ldt-ShowAnnotation").click( function () { 
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    68
         //__IriSP.jQuery(this).slideUp(); 
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    69
      } );
31
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
    70
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    71
      var LdtpPlayerY = IriSP.jQuery("#Ldt-PlaceHolder").attr("top");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    72
      var LdtpPlayerX = IriSP.jQuery("#Ldt-PlaceHolder").attr("left");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    73
      
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    74
      IriSP.jQuery( "#slider-range-min" ).slider( { //range: "min",
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    75
        value: 0,
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    76
        min: 1,
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    77
        max: duration/1000,//1:54:52.66 = 3600+3240+
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    78
        step: 0.1,
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    79
        slide: function(event, ui) {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    80
          
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    81
          //__IriSP.jQuery("#amount").val(ui.value+" s");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    82
          //player.sendEvent('SEEK', ui.value)
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    83
          IriSP.MyApiPlayer.seek(ui.value);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    84
          //changePageUrlOffset(ui.value);
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    85
          //player.sendEvent('PAUSE')
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    86
        }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    87
      } );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    88
      
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    89
      IriSP.trace("__IriSP.createInterface","ICI");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    90
      IriSP.jQuery("#amount").val(IriSP.jQuery("#slider-range-min").slider("value")+" s");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    91
      IriSP.jQuery(".Ldt-Control1 button:first").button({
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    92
        icons: {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    93
          primary: 'ui-icon-play'
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    94
        },
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    95
        text: false
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    96
      }).next().button({
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    97
        icons: {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    98
          primary: 'ui-icon-seek-next'
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
    99
        },
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   100
         text: false
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   101
      });
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   102
      IriSP.jQuery(".Ldt-Control2 button:first").button({
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   103
        icons: {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   104
          primary: 'ui-icon-search'//,
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   105
          //secondary: 'ui-icon-volume-off'
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   106
        },
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   107
        text: false
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   108
      }).next().button({
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   109
        icons: {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   110
          primary: 'ui-icon-volume-on'
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   111
        },
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   112
         text: false
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   113
      });
31
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   114
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   115
      // /!\ PB A MODIFIER 
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   116
      //__IriSP.MyTags.draw();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   117
      IriSP.trace("__IriSP.createInterface","ICI2");
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   118
      IriSP.jQuery( "#ldt-CtrlPlay" ).attr( "style", "background-color:#CD21C24;" );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   119
      
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   120
      IriSP.jQuery( "#Ldt-load-container" ).hide();
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   121
      
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   122
      if( IriSP.config.gui.mode=="radio" & IriSP.jQuery.browser.msie != true ) {
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   123
        IriSP.jQuery( "#Ldtplayer1" ).attr( "height", "0" );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   124
      }
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   125
      IriSP.trace( "__IriSP.createInterface" , "3" );
31
cbb1425bc769 begun breaking the code across multiple files.
hamidouk
parents:
diff changeset
   126
238
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   127
      IriSP.trace( "__IriSP.createInterface", "END" );
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   128
      
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   129
    };
6008172a0592 converted all the source files to use the require.js syntax.
hamidouk
parents: 72
diff changeset
   130
});