JSON and OOP in JavaScript

Alexey Luchkovsky's picture

Walking on JavaScript objects trees.

Walking on JavaScript objects trees. Can we do it with JSON or JavaScript like we can while we work with XML?

Alexey Luchkovsky's picture

JavaScript Lazy Inheritance

Alternative Lazy JavaScript Inheritance

Lazy Inheritance is an approach intended to simplify writing OOP and provides support of prototype-based classes hierarhies, automatic resolving and optimizing classes dependencies.

JSINER (originated from JavaScript INheritance supportER) is a lazy inheritance implementation in JavaScript. JSINER page on SoftAMIS

Yahoo Drag and Drop Panels Implementation.

Today I want to share my project. Implementation of Panels like was in My Yahoo page. Now this page updated to new look.

To create Layout like this:

Here is example: www.ajaxline.com/JS/Panels/PanelsTest.htm

Context right mouse click menu

Today I want to share my javascript Context Menu control built with prototype.js.

It's pretty simple to use it :

In the head section of page add such code:

<link href="style/style.css" rel="stylesheet" type="text/css" />

<script type ="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/domutils.js"></script>
<script type="text/javascript" src="js/menu.js"></script>
<script type="text/javascript">

window.onload=function(){

var items = [
{ text: "Choose address", onclick:function(){alert("item0");} },
{ type: "divider"},
{ text: "Copy", onclick:function(){alert("item1");} }
];

var menu =new ContextMenu("table_body",items);

// menu.onBeforeShow =function(menu){ alert("on before show");};
// menu.onClose = function(menu){alert("on close");}

}

</script>

 

Where:

A Base Class for JavaScript Inheritance

NB. I???"?ve amended the code samples below to reflect recent changes in this class.

I???"?m an OO programmer at heart and JavaScript supports prototype based inheritance. Unfortunatley this leads to verbose class definitions:

function Animal(name) {};
Animal.prototype.eat = function() {};
Animal.prototype.say = function(message) {};

I want a nice base class for JavaScript OO:

  • I want to easily create classes without the MyClass.prototype cruft
  • I want method overriding with intuitive access to the overridden method (like Java???"?s super)
  • I want to avoid calling a class???"? constructor function during the prototyping phase
  • I want to easily add static (class) properties and methods
  • I want to achieve the above without resorting to global functions to build prototype chains
  • I want to achieve the above without affecting Object.prototype

Avoiding Bloat in Widgets - OOP for Prototype.js

Widgets walk a fine line between abstractions and implementations. Implementation, in this case, is a practical solution chosen to perform a given function. The problems with widgets occur when the widget author walks too far in one direction, or worse, walks an outward spiral covering both directions. Both choices lead to script bloat and complexity thats hard to manage. You no longer have a simple solution for a defined problem, you have a complex solution for a variety of problems. The good news is there are ways to avoid both the bloat and complexity.

GrowImage like in live image search

I'd like to present my new JavaScript control similar to http://search.msn.com/images/results.aspx?q=ajax&FORM=BIIR Also you can find my implementation of control on NaikonSoft


Now I want to show you how it works

Ajax Stars Rating script(control)

Example with linked Rating controls







Example with single Rating control





















































Syndicate content