[mochikit] Re: Facing error using MochiKit.Color

2008-05-13 Thread Per Cederberg

I suspect that the error stems from the fact that you are using two
animations/effects from MochiKit.Visual in paralell. If you try using
just one of them  I suspect that everything should work, right?

I don't have the time to debug or try to reproduce this right now, but
perhaps you could dig into this a bit deeper yourself? Use the
uncompressed version of MochiKit and Firebug. JavaScript breakpoints
is an extremely powerful debugging tool.

Cheers,

/Per

On Mon, May 12, 2008 at 1:53 PM, Pearl [EMAIL PROTECTED] wrote:

  Hi,

  I want some text to appear  onload of a page. This text should be
  highlighted (yellow fading technique). For this, I am using
  combination of Highlight and fade methods gievn in Mochikit.
  The method is described as

  function display_message(msg)
  {
 var test = Highlight(msg);
 var test = fade(msg,{ duration:5.0, from:1, to:0.0 });

  }

  and on the kid page it is described as 
  script
  window.onload = function() {
 msg = getElement('message_element');
 display_message(msg);
 }
  /script

  body
  div id=result-area class=msgparea 
 span py:if=msg id=message_element class=flashmsgb$
  {msg}/b/span

  /body

  It is giving an error in the firefox error console which keep on
  incrementing. The error message is :
  this._base has no properties.
  [Break on this error] m
  +=MochiKit.Color.toColorPart(Math.round(this._base[i]
  +this._delta[i]*_663));

  I am using mochikit 1.4.

  Please help

  Thanks and Regards
  Roopesh
  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: Django doXHR Headers and Guidance

2008-05-13 Thread Szaijan

Thanks Bob, the combination of using MochiKit's eval and the correct
name for responseText (as opposed to response_text) fixed the issue.
Here's the final code, as a working example of a MochiKit AJAX fn
calling a Django view function:

selectEntity : function (entity)
{
try
{
var url = '/' + ['visionary', this.model.url ?
this.model.url : this.cn, 'select', '?xhr'].join('/');
var q = [this.app, this.cn, 'id'].join('_') + '=' +
entity.pk;
var r = {method: 'POST',
mimeType: 'application/javascript',
headers: [['Content-Type', 'application/x-www-
form-urlencoded']],
sendContent: q};
var d = MochiKit.Async.doXHR(url, r);
d.addCallback(MochiKit.Base.bind(function (result) {
try
{
var r =
MochiKit.Async.evalJSONRequest(result);
var response = r;
if(typeof(r) != 'undefined')
{
var consoleMessage =
r.initial_console_message;
 
MochiKit.Base.map(MochiKit.Base.bind(function (index) {
consoleMessage += br+ index +
:  + r[index];
var rowId = [this.app, this.cn,
r[index], 'row'].join('_');
 
this.setRowHighlight(MochiKit.DOM.getElement(rowId),
 index ==
'newId' ? true : false);
}, this), ['newId', 'oldId']);
this.updateConsole(consoleMessage);
}
else
{
throw new Error('Failed to resolve XHR
Response. Result: ' + result);
}
}
catch(e)
{
MochiKit.Logging.logError('selectEntity
Callback fn ' + e);
}
}, this));
d.addErrback(MochiKit.Base.bind(function (result) {
MochiKit.Logging.log('Callback Request: ' +
result);
}, this));
}
catch(e)
{
MochiKit.Logging.logError('selectEntity(' + entity + ') '
+ e);
}
return false;
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] InsertChildNodes

2008-05-13 Thread Szaijan

Is there a MochiKit method similar to appendChildNodes that will
insert the list of children at the beginning of the list of child
elements, or at an arbitrary index, rather than at the end?

I am rewriting an existing JS object using MochiKit and find myself
using:

parent.insertBefore(child, parent.firstChild)

rather than any MochiKit function.  What I'd really like is an
insertChildNodes(parent, index, [child, ...]), where index = 'null'
would append to the end, index = '0' would insert at the beginning,
and any other index would insert at that point in the child list if
the index exists and append to the end if it does not.

Is there some other functionality in MochiKit that makes this
operation trivial and thus not worthy of it's own function?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: InsertChildNodes

2008-05-13 Thread Per Cederberg

MochiKit.DOM.insertSiblingNodesBefore(node[, siblingNode[, ...]]):

http://www.mochikit.com/doc/html/MochiKit/DOM.html#fn-insertsiblingnodesbefore

/Per

On Tue, May 13, 2008 at 8:27 PM, Szaijan [EMAIL PROTECTED] wrote:

  Is there a MochiKit method similar to appendChildNodes that will
  insert the list of children at the beginning of the list of child
  elements, or at an arbitrary index, rather than at the end?

  I am rewriting an existing JS object using MochiKit and find myself
  using:

  parent.insertBefore(child, parent.firstChild)

  rather than any MochiKit function.  What I'd really like is an
  insertChildNodes(parent, index, [child, ...]), where index = 'null'
  would append to the end, index = '0' would insert at the beginning,
  and any other index would insert at that point in the child list if
  the index exists and append to the end if it does not.

  Is there some other functionality in MochiKit that makes this
  operation trivial and thus not worthy of it's own function?

  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Opinions for fixing ticket #302

2008-05-13 Thread Per Cederberg

I stumbled across an issue with value attributes in input nodes
about a month ago. It seems the behavior is different when using
node.value vs. node.setAttribute(value..):

http://trac.mochikit.com/ticket/302

So the question now it whether or not to patch
MochiKit.DOM.updateNodeAttribute(). Or if I should just update the
docs with a short note and link to the relevant page at MDC:

http://developer.mozilla.org/en/docs/DOM:element.setAttribute  (see the Notes)

Opinions?

Cheers,

/Per

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: InsertChildNodes

2008-05-13 Thread Szaijan

Thanks for the response.

insertSiblingNodesBefore is only useful if you already know and have
an ID or reference to another child of the parent element.  If the
parent element has no children when you go to insert, you can't get a
reference to a sibling and the function cannot be called or it fails
on a null sibling lookup.  In the arbitrary case, where the parent
will sometimes have children and sometimes not,
insertSiblingNodesBefore is not useful.

Any other candidates?

MJ

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---