Skip to content

Commit

Permalink
new version, targeting modern browsers
Browse files Browse the repository at this point in the history
Rewrite to ES6 class, added Typescript typings
  • Loading branch information
Fred Heusschen committed Nov 21, 2018
1 parent 210244a commit e247689
Show file tree
Hide file tree
Showing 112 changed files with 5,663 additions and 6,159 deletions.
8 changes: 5 additions & 3 deletions bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ $output .= '
}
';


file_put_contents( getDist() . '/_build.json' , $output );

$result = file_put_contents( getDist() . '/_build.json' , $output );
if ( $result )
{
echo '_build.json created.';
}
142 changes: 64 additions & 78 deletions bin/jquery.mmenu.addon-template.ts
Original file line number Diff line number Diff line change
@@ -1,82 +1,68 @@
/*
* jQuery mmenu {ADDON} add-on
* mmenu.frebsite.nl
*
* Copyright (c) Fred Heusschen
*/

(function( $ ) {

const _PLUGIN_ = 'mmenu';
const _ADDON_ = '{ADDON}';


$[ _PLUGIN_ ].addons[ _ADDON_ ] = {

// setup: fired once per menu
setup: function()
{
var that = this,
opts = this.opts[ _ADDON_ ],
conf = this.conf[ _ADDON_ ];

glbl = $[ _PLUGIN_ ].glbl;

// Extend shorthand options
if ( typeof opts != 'object' )
{
opts = {};
}
opts = this.opts[ _ADDON_ ] = $.extend( true, {}, $[ _PLUGIN_ ].defaults[ _ADDON_ ], opts );

// Extend shorthand configuration
if ( typeof conf != 'object' )
{
conf = {};
}
conf = this.conf[ _ADDON_ ] = $.extend( true, {}, $[ _PLUGIN_ ].configuration[ _ADDON_ ], conf );

// Add methods to api
// this._api = $.merge( this._api, [ 'fn1', 'fn2' ] );

// Bind functions to update
// this.bind( 'updateListview', function() {} );
// this.bind( 'initPanels', function() {} );
// this.bind( 'initPage', function() {} );

},

// add: fired once per page load
add: function()
{
_c = $[ _PLUGIN_ ]._c;
_d = $[ _PLUGIN_ ]._d;
_e = $[ _PLUGIN_ ]._e;

// ...Add classnames, data and events
},

// clickAnchor: prevents default behavior when clicking an anchor
clickAnchor: function( $a, inMenu )
{
// if ( $a.is( '.CLASSNAME' ) )
// {
// return true;
// }
// return false;
Mmenu.addons.ADDON = function(
this: Mmenu
) {
var opts = this.opts.ADDON,
conf = this.conf.ADDON;


// Extend shorthand options
if ( typeof opts != 'object' )
{
opts = {};
}
opts = this.opts.ADDON = jQuery.extend( true, {}, Mmenu.options.ADDON, opts );

// Extend shorthand configuration
if ( typeof conf != 'object' )
{
conf = {};
}
conf = this.conf.ADDON = jQuery.extend( true, {}, Mmenu.configs.ADDON, conf );

// Add methods to api
this._api.push( 'fn1', 'fn2' );

// Bind functions to update
this.bind( 'updateListview',
function(
this : Mmenu
) {
console.log( 'The listviews were updated.' );
}
};


// Default options and configuration
$[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
// ...
};
$[ _PLUGIN_ ].configuration[ _ADDON_ ] = {
// ...
};
);


// Add click behavior.
// Prevents default behavior when clicking an anchor
this.clck.push(
function(
this : Mmenu,
$a : JQuery,
args : iLooseObject
) {

// Return undefined if the add-on does not need to add behavior for the clicked anchor.
return;

// Return true if the add-on added behavior and no other behavior should be added.
return true;

// Return an object if the add-on only alters the default behavior for the clicked anchor.
return {
setSelected : true,
preventDefault : true,
close : true
};
}
);

};

var _c, _d, _e, glbl;

})( jQuery );
// Default options and configuration
Mmenu.options.ADDON = {
// ...
};
Mmenu.configs.ADDON = {
// ...
};
6 changes: 5 additions & 1 deletion bin/variables
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ $output .= '

';

file_put_contents( getDist() . '/_variables.custom.scss' , $output );
$result = file_put_contents( getDist() . '/_variables.custom.scss' , $output );
if ( $result )
{
echo '_variables.custom.scss created.';
}
2 changes: 1 addition & 1 deletion dist/addons/autoheight/jquery.mmenu.autoheight.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/addons/backbutton/jquery.mmenu.backbutton.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/addons/columns/jquery.mmenu.columns.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/addons/counters/jquery.mmenu.counters.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/addons/dividers/jquery.mmenu.dividers.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/addons/drag/jquery.mmenu.drag.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e247689

Please sign in to comment.