src/js/site.js.templ
author hamidouk
Mon, 30 Jan 2012 12:30:11 +0100
branchtmp-paths-runtime
changeset 742 c0adb6674be0
parent 738 ccd571853e98
permissions -rw-r--r--
determine paths at runtime instead of at compile time
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
742
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
     1
/* site.js - all our site-dependent config : player chrome, cdn locations, etc...
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
     2
   to implement the metadataplayer on your website, you'll have to define a couple
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
     3
   global variables :
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
     4
   
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
     5
   IriSP__libdir is the directory containing our js libs.
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
     6
   IriSP__platform url is the url of teh platform
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
     7
   IriSP__player_imgs url from which the player can get the images defined in the css
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
     8
   IriSP__jwplayer_swf_path the path to the jwplayer swf.
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
     9
   
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    10
   We have to do it this way because it's no longer feasible
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    11
   to configure the mdp at compile-time and then overwrite the
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    12
   defaults.
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    13
*/
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    14
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    15
if (IriSP.null_or_undefined(IriSP__libdir)) {
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    16
  IriSP.libdir = function() { return "/mdp/src/js/libs/" };
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    17
} else {
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    18
  IriSP.libdir = function() { return IriSP__libdir };
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    19
}
681
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    20
742
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    21
if (IriSP.null_or_undefined(IriSP__platform_url)) {
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    22
  IriSP.platform_url = function() { return "http://localhost/pf"; };
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    23
} else {
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    24
  IriSP.platform_url = function() { return IriSP__platform_url };
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    25
}
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    26
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    27
if (IriSP.null_or_undefined(IriSP__jwplayer_swf_path)) {
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    28
  IriSP._jwplayer_swf_path = function() { return "/mdp/test/libs/player.swf"; };
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    29
} else {
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    30
  IriSP._jwplayer_swf_path = function() { return IriSP__jwplayer_swf_path };
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    31
}
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    32
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    33
// the rest of the code doesn't need to know that the path is computed at
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    34
// run time.
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    35
IriSP.jwplayer_swf_path = IriSP._jwplayer_swf_path();
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    36
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    37
if (IriSP.null_or_undefined(IriSP__player_imgs)) {
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    38
  IriSP._player_imgs = function() { return "/mdp/src/css/imgs"; };
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    39
} else {
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    40
  IriSP._player_imgs = function() { return IriSP__player_imgs };
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    41
}
681
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    42
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    43
IriSP.lib = { 
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    44
		jQuery : "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js",
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    45
		jQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js",
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    46
		jQueryToolTip : "http://cdn.jquerytools.org/1.2.4/all/jquery.tools.min.js",
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    47
		swfObject : "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    48
		cssjQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css",
742
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    49
    popcorn : IriSP.libdir() + "popcorn.js",
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    50
    jwplayer : IriSP.libdir() + "jwplayer.js",
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    51
    popcornReplacement: IriSP.libdir() + "pop.js",
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    52
    raphael: IriSP.libdir() + "raphael.js",
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    53
    jquery_sparkline: IriSP.libdir() + "jquery.sparkline.js",
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    54
    "popcorn.mediafragment" : IriSP.libdir() + "popcorn.mediafragment.js",
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    55
    "popcorn.code" : IriSP.libdir() + "popcorn.code.js",
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    56
    "popcorn.jwplayer": IriSP.libdir() + "popcorn.jwplayer.js",
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    57
    "popcorn.youtube": IriSP.libdir() + "popcorn.youtube.js"    
681
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    58
};
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    59
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    60
//Configuration for the player and utility functions.
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    61
IriSP.config = {};
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    62
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    63
IriSP.config.shortener = {
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    64
  // function to call to shorten an url.
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    65
  //shortening_function : IriSP.platform_shorten_url
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    66
};
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    67
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    68
IriSP.widgetsDefaults = {
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    69
  "LayoutManager" : {spacer_div_height : "0px" },
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    70
  "PlayerWidget" : {},
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    71
  "AnnotationsWidget": {
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    72
    "share_text" : "I'm watching ",     
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    73
    "fb_link" : "http://www.facebook.com/share.php?u=",
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    74
    "tw_link" : "http://twitter.com/home?status=",
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    75
    "gplus_link" : ""
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    76
    },
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    77
  "TweetsWidget" : {
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    78
      default_profile_picture : "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png",
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    79
      tweet_display_period: 10000, // how long do we show a tweet ?
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    80
      
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    81
  },
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    82
  "SliderWidget" : {
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    83
      minimize_period: 850 // how long does the slider stays maximized after the user leaves the zone ?
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    84
  },
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    85
  "createAnnotationWidget" : {
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    86
      keywords: ["#faux-raccord", "#mot-clef"],
738
ccd571853e98 update template config file.
hamidouk
parents: 718
diff changeset
    87
      polemic_mode: true, /* enable polemics ? */
742
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
    88
      polemics: {"++" : "positive", "--" : "negative", "==" : "reference", "??" : "question"},  
681
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    89
      cinecast_version: true /* put to false to enable the platform version, true for the festival cinecast one. */
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    90
  },
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    91
  "SparklineWidget" : {
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    92
      column_width: 10 // the width of a column in pixels.
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    93
  },
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    94
  "Main" : {
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    95
      autoplay: true
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    96
  },
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    97
  "AnnotationsListWidget" : {
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    98
      ajax_mode: true, /* use ajax to get information about the annotations.
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
    99
                         if set to false, only search in the annotations for the
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   100
                         current project. */
742
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
   101
      ajax_url: IriSP.platform_url() + "ldtplatform/api/ldt/segments/", /* partial
681
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   102
                                                                         url of 
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   103
                                                                         where to
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   104
                                                                         get the 
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   105
                                                                         ajax */
738
ccd571853e98 update template config file.
hamidouk
parents: 718
diff changeset
   106
      ajax_granularity: 10000, /* how much ms should we look before and after the
681
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   107
                                 current timecode */
742
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
   108
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
   109
      project_url: IriSP.platform_url() + "/ldtplatform/ldt/front/player/" /* the beginning 
718
c6660cd7bfb3 added buttons for adding polemic annotations.
hamidouk
parents: 681
diff changeset
   110
                                                                            of a link to the
c6660cd7bfb3 added buttons for adding polemic annotations.
hamidouk
parents: 681
diff changeset
   111
                                                                            new front */
681
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   112
  }, 
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   113
};
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   114
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   115
IriSP.paths = {
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   116
//  "imgs": "/tweetlive/res/metadataplayer/src/css/imgs"
742
c0adb6674be0 determine paths at runtime instead of at compile time
hamidouk
parents: 738
diff changeset
   117
  "imgs": IriSP._player_imgs;
681
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   118
};
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   119
IriSP.default_templates_vars = {
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   120
  "img_dir" : IriSP.paths.imgs 
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   121
};
9e113f912e4e replaced site.js by site.js.templ.
hamidouk
parents:
diff changeset
   122