src/cm/media/js/client/f_message.js
author Simon Descarpentries <sid@sopinspace.com>
Mon, 21 Oct 2013 16:37:07 +0200
changeset 553 bf26fb47a14c
parent 341 053551f213fb
permissions -rw-r--r--
To allow scrolling in Safari mobile, we set the content of text_view_comments frame in a jQuery UI layout. So the automated scrolling operations in c_sync.js must be adjustable to the right part to scroll. Also, if a comment have to be shown outside of the current viewport, we scroll the correct part to that viewport and then set the comment top Y offset to juste what it needs to avoid the "Add comment" button after scrolling operation. If not in Safari mobile, we add an offset here to avoid comment to display under the "Add comment" button.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     1
//// unique id generator.
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     2
//$.extend($.fn, {
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     3
//  id : function () {
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     4
//    return this.each(function () {
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     5
//      $(this).attr("id", "f-" + $.data(this));
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     6
//    });
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     7
//  }
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     8
//}); 
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     9
//
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    10
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    11
// this == dom element
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    12
onFadeEnd = function () {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    13
  $(this).remove() ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    14
} ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    15
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    16
gLoadingMsg = null ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    17
enqueueLoadingMsg = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    18
  gLoadingMsg = _enqueueMsg (gettext("loading..."), "", null) ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    19
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    20
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    21
removeLoadingMsg = function() {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    22
  if (gLoadingMsg != null) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    23
    gLoadingMsg.remove() ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    24
    gLoadingMsg = null ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    25
  }
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    26
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    27
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    28
_enqueueMsg = function(msg, cls, remainVisibleTime) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    29
  var m = $('<span>' + msg + '</span>').appendTo("#c-msg-wrapper").addClass("f-msg-cls").addClass(cls) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    30
  if (remainVisibleTime)
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    31
    m.animate({'opacity':.95}, remainVisibleTime).fadeOut(2000, onFadeEnd) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    32
  return m ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    33
  
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    34
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    35
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    36
enqueueMsg = function(msg) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    37
//  while ($("#c-msg-wrapper .f-msg-cls").children().size() > 1) {
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    38
//    $("#c-msg-wrapper .f-msg-cls:first").stop(false, true) ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    39
//  }
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    40
//  
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    41
  var cls = "f-msg" ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    42
  var remainVisibleTime = 8000 ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    43
  _enqueueMsg(msg, cls, remainVisibleTime) ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    44
}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    45
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    46
enqueueErrorMsg = function(msg) {
341
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    47
  var cls = "f-msg-e" ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    48
  var remainVisibleTime = 4000 ;
053551f213fb Coding style for js: expand tabs
gibus
parents: 0
diff changeset
    49
  _enqueueMsg(msg, cls, remainVisibleTime) ;  
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    50
}