Remoto - VFS: arrowMessage.js Source File
Remoto - VFS
arrowMessage.js
Go to the documentation of this file.
1 
2 define( [
3  'jquery/ui/jquery.ui.position',
4  'remoto!stdlib:js/paneManager/arrowMessage.css'
5  ],
6  function()
7  {
8  'use strict';
9 
45  function arrowMessage(message,o,at,my,offset,persistent)
46  {
47  var v = o.is(":visible");
48 
49  if (!v) return;
50 
51  var THIS = this;
52  //this._object = o;
53  var b = $('body');
54 
55  var m = $("<div class='arrowMessage'>");
56  m.text(message);
57 
58  b.append(m);
59 
60  offset = offset || {left:0, top:0};
61  offset.left = offset.left || 0;
62  offset.top = offset.top || 0;
63  //console.log(offset);
64 
65  m.position({
66  of: o,
67  my: my || "left top",
68  at: at || "left+3 bottom+6",
69  using: function(obj,info)
70  {
71  if (info.vertical !== "top") m.addClass( 'arrowMessageBottom' );
72  if (info.horizontal === "right") m.addClass( 'arrowMessageRight' );
73 
74  $(this).css({ left:(obj.left+offset.left)+"px", top:(obj.top+offset.top)+"px" });
75  },
76  });
77 
78  if (!persistent)
79  m.delay(2000).animate( {"opacity":0}, 200, THIS.complete.bind(this) );
80 
81  this._html = m;
82  this._completeCallback = null;
83  }
84 
85  arrowMessage.prototype = {
86 
94  message: function(m)
95  {
96  if (!this._html) return;
97 
98  this._html.text(m);
99  },
100 
109  goAway: function()
110  {
111  var THIS = this;
112  var mm = this._html;
113  mm.stop(true).animate( {"opacity":0}, 200, THIS.complete.bind(this) );
114  },
115 
124  complete: function()
125  {
126  //console.log("complete");
127 
128  if (this._completeCallback)
129  this._completeCallback();
130 
131  this.destroy();
132  },
133 
140  destroy: function()
141  {
142  if (this._html)
143  this._html.remove();
144 
145  this._html = null;
146  },
147  }
148 
149  return arrowMessage;
150  }
151 );
152 
153 
Create a message with an arrow pointing to a DOM element.
message(m)
Change the message of an existing arrowMessage.
arrowMessage(message, o, at, my, offset, persistent)
The arrowMessage constructor.
goAway()
Make the arrowMessage goAway.
getter complete
a getter DOCME