Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

simplified main loop & merged action() into Melon

  • Loading branch information...
commit a97efa7d4651b5284d03e2c8223787ab2c2b5615 1 parent 32eb29e
cloudhead authored
Showing with 8 additions and 12 deletions.
  1. +8 −12 htdocs/js/melon.js
View
20 htdocs/js/melon.js
@@ -12,14 +12,10 @@ $( document ).ready( function() {
if( route.page ) $("body").attr("id", route.page ); // Set the body id
$.each( route.path, function( id, uri ) {
Melon.get( uri, function( json ) {
- if( $.isArray( json ) ) {
- $.each( json, function() {
- Pages[ route.page ]( Melon.clone( id, this ), this );
- });
- }
- else {
- Pages[ route.page ]( Melon.clone( id, json ), json );
- }
+ if( ! $.isArray( json ) ) json = [ json ]; // Convert to array
+ $.each( json, function() {
+ Pages[ route.page ]( Melon.clone( id, this ), this );
+ });
Melon.cleanup( id );
});
});
@@ -104,12 +100,12 @@ var Melon = {
cleanup: function( id )
{
return $("#" + id + " ul > li:first").remove();
+ },
+ action: function( caption, module, action, key )
+ {
+ return "<a href='/" + module + "/" + action + "/'>" + caption + "</a>";
}
};
-function action( caption, module, action, key )
-{
- return "<a href='/" + module + "/" + action + "/'>" + caption + "</a>";
-}
Please sign in to comment.
Something went wrong with that request. Please try again.