Plugins
Plugins - Import
The "Import" plugin does just what the name suggests - helps you import data into your menu.
Dependencies
To make this plugin work, you must include one JavaScript libary found in the js/ directory. Your code should look something like this if you need to use this plugin:

    <script src="../js/core.WebDDM.compressed.js"></script>
    <script src="../js/import.WebDDM.compressed.js">
    	<!-- For WebDDM "import" plugin -->
    </script>

Why?
Consider this code:

    // Menu starts here
    var menu = {
    	//...
    	'items':{
    		//...
    		1:{
    			'content':'Alert Box',
    			'cursor': 'hand',
    			'width':130, 'height':20, 'offsetLeft':3, 'offsetTop':3,
    			'class':'mainmenu_off',
    			'class_rollover':'mainmenu_rollover',
    			'class_rollover_pressed':'mainmenu_rollover_pressed'
    		},
    		2:{
    			'content':'Confirm Box',
    			'cursor': 'hand',
    			'width':130, 'height':20, 'offsetLeft':0, 'offsetTop':22,
    			'class':'mainmenu_off',
    			'class_rollover':'mainmenu_rollover',
    			'class_rollover_pressed':'mainmenu_rollover_pressed'
    		},
    		3:{
    			'content':'Open Window',
    			'cursor': 'hand',
    			'width':130, 'height':20, 'offsetLeft':0, 'offsetTop':22,
    			'class':'mainmenu_off',
    			'class_rollover':'mainmenu_rollover',
    			'class_rollover_pressed':'mainmenu_rollover_pressed'
    		}
    	}
    };

Notice how much code is found in all three items! This produces long code, and it can take a very long time to make changes to all these items (if you need to modify, say, the class name or other attributes that are found in several items).
What's the solution?
The "Import" plugin allows you to define common data in one place, and use it in several items. Here is what the code above looks like, when using the Import plugin:

    // Common data defined here
    var common_data = {
    	'cursor': 'hand',
    	'width':130, 'height':20, 'offsetLeft':0, 'offsetTop':22,
    	'class':'mainmenu_off',
    	'class_rollover':'mainmenu_rollover',
    	'class_rollover_pressed':'mainmenu_rollover_pressed'
    };

    // Menu starts here
    var menu = {
    	//...
    	'items':{
    		//...
    		1:{
    			'content':'Alert Box',
    			'import':[common_data],
    			'offsetLeft':3, 'offsetTop':3
    		},
    		2:{
    			'content':'Confirm Box',
    			'import':[common_data]
    		},
    		3:{
    			'content':'Open Window',
    			'import':[common_data]
    		}
    	}
    };

That looks much better now, doesn't it?
How does it work?
If you have any knowledge of Javascript arrays, this will be simple to you. If you don't know how Javascript arrays work, learn now! It's incredibly simple. Try searching Google.
Basically, the Import plugin looks at the "import" attribute and places data from outside arrays into the item that the "import" attribute is in.
Two things to note:

- You can import data from any number of sources, like this:
  'import':[common_data,more_data]
  'import':[common_data,more_data,more_common_data,fourth_array]
- Attributes in the item array take precedence over attributes in imported arrays; in other words, attributes in imported arrays will never replace attributes in the item array.

View Source
View CSS file - View JavaScript file.
Plugins
Plugins: Last - Next