2016-04-04 21:31:15 -04:00
( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports : { } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ? n : e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 : [ function ( require , module , exports ) {
'use strict' ;
var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ; /* jshint esnext: true */
var _modules = require ( './modules' ) ;
var modules = _interopRequireWildcard ( _modules ) ;
function _interopRequireWildcard ( obj ) { if ( obj && obj . _ _esModule ) { return obj ; } else { var newObj = { } ; if ( obj != null ) { for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) newObj [ key ] = obj [ key ] ; } } newObj . default = obj ; return newObj ; } }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
var App = function ( ) {
function App ( options ) {
_classCallCheck ( this , App ) ;
this . modules = modules ;
this . currentModules = [ ] ;
}
/ * *
* Execute global functions and settings
* @ return { Object }
* /
_createClass ( App , [ {
key : 'initGlobals' ,
value : function initGlobals ( ) {
this . globals = new this . modules . Globals ( ) ;
return this ;
}
/ * *
* Find modules and initialize them
* @ return { Object } this Allows chaining
* /
} , {
key : 'initModules' ,
value : function initModules ( ) {
// Elements with module
var moduleEls = document . querySelectorAll ( '[data-module]' ) ;
// Loop through elements
var i = 0 ;
var elsLen = moduleEls . length ;
for ( ; i < elsLen ; i ++ ) {
// Current element
var el = moduleEls [ i ] ;
// All data- attributes considered as options
var options = this . getElemData ( el ) ;
// Add current DOM element and jQuery element
options . el = el ;
options . $el = $ ( el ) ;
// Module does exist at this point
var attr = options . module ;
// Splitting modules found in the data-attribute
var moduleIdents = attr . replace ( /\s/g , '' ) . split ( ',' ) ;
// Loop modules
var j = 0 ;
var modulesLen = moduleIdents . length ;
for ( ; j < modulesLen ; j ++ ) {
var moduleAttr = moduleIdents [ j ] ;
if ( typeof this . modules [ moduleAttr ] === 'function' ) {
var module = new this . modules [ moduleAttr ] ( options ) ;
this . currentModules . push ( module ) ;
}
}
}
return this ;
}
/ * *
* Get element data attributes
* @ param { DOMElement } el
* @ return { Array } data
* /
} , {
key : 'getElemData' ,
value : function getElemData ( el ) {
// All attributes
var attributes = el . attributes ;
// Regex Pattern
var pattern = /^data\-(.+)$/ ;
// Output
var data = { } ;
for ( var i in attributes ) {
// Attributes name (ex: data-module)
var name = attributes [ i ] . name ;
// This happens.
if ( ! name ) {
continue ;
}
var match = name . match ( pattern ) ;
if ( ! match ) {
continue ;
}
// If this throws an error, you have some
// serious problems in your HTML.
data [ match [ 1 ] ] = el . getAttribute ( name ) ;
}
return data ;
}
/ * *
* Initialize app after document ready
* /
} , {
key : 'init' ,
value : function init ( ) {
this . initGlobals ( ) . initModules ( ) ;
}
} ] ) ;
return App ;
} ( ) ;
// Document ready
// =========================================================================
$ ( function ( ) {
window . app = new App ( ) ;
window . app . init ( ) ;
} ) ;
} , { "./modules" : 2 } ] , 2 : [ function ( require , module , exports ) {
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
var _Globals = require ( './modules/Globals' ) ;
Object . defineProperty ( exports , 'Globals' , {
enumerable : true ,
get : function get ( ) {
return _interopRequireDefault ( _Globals ) . default ;
}
} ) ;
var _Button = require ( './modules/Button' ) ;
Object . defineProperty ( exports , 'Button' , {
enumerable : true ,
get : function get ( ) {
return _interopRequireDefault ( _Button ) . default ;
}
} ) ;
var _Title = require ( './modules/Title' ) ;
Object . defineProperty ( exports , 'Title' , {
enumerable : true ,
get : function get ( ) {
return _interopRequireDefault ( _Title ) . default ;
}
} ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
} , { "./modules/Button" : 3 , "./modules/Globals" : 4 , "./modules/Title" : 7 } ] , 3 : [ function ( require , module , exports ) {
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
var _Module2 = require ( './Module' ) ;
var _Module3 = _interopRequireDefault ( _Module2 ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; } /* jshint esnext: true */
var Generic = function ( _Module ) {
_inherits ( Generic , _Module ) ;
function Generic ( options ) {
_classCallCheck ( this , Generic ) ;
var _this = _possibleConstructorReturn ( this , Object . getPrototypeOf ( Generic ) . call ( this ) ) ;
_this . $el = options . $el ;
_this . $el . on ( 'click' , function ( event ) {
_this . $document . trigger ( 'title.changeLabel' , [ $ ( event . currentTarget ) . val ( ) ] ) ;
} ) ;
return _this ;
}
// Destroy
// ==========================================================================
_createClass ( Generic , [ {
key : 'destroy' ,
value : function destroy ( ) {
this . $el . off ( ) ;
}
} ] ) ;
return Generic ;
} ( _Module3 . default ) ;
exports . default = Generic ;
} , { "./Module" : 5 } ] , 4 : [ function ( require , module , exports ) {
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
var _Svg = require ( './Svg' ) ;
var _Svg2 = _interopRequireDefault ( _Svg ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } } // ==========================================================================
// Globals module
// ==========================================================================
var Globals = function Globals ( ) {
_classCallCheck ( this , Globals ) ;
new _Svg2 . default ( ) ;
} ;
exports . default = Globals ;
} , { "./Svg" : 6 } ] , 5 : [ function ( require , module , exports ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
// ==========================================================================
// Module
// ==========================================================================
var Module = function Module ( ) {
_classCallCheck ( this , Module ) ;
this . $document = $ ( document ) ;
this . $window = $ ( window ) ;
this . $html = $ ( document . documentElement ) ;
this . $body = $ ( document . body ) ;
} ;
exports . default = Module ;
} , { } ] , 6 : [ function ( require , module , exports ) {
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
var _Module2 = require ( './Module' ) ;
var _Module3 = _interopRequireDefault ( _Module2 ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; } // ==========================================================================
// Svg module
// ==========================================================================
var Svg = function ( _Module ) {
_inherits ( Svg , _Module ) ;
function Svg ( ) {
_classCallCheck ( this , Svg ) ;
var _this = _possibleConstructorReturn ( this , Object . getPrototypeOf ( Svg ) . call ( this ) ) ;
svg4everybody ( ) ;
return _this ;
}
return Svg ;
} ( _Module3 . default ) ;
exports . default = Svg ;
} , { "./Module" : 5 } ] , 7 : [ function ( require , module , exports ) {
'use strict' ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
var _Module2 = require ( './Module' ) ;
var _Module3 = _interopRequireDefault ( _Module2 ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; } /* jshint esnext: true */
var Title = function ( _Module ) {
_inherits ( Title , _Module ) ;
function Title ( options ) {
_classCallCheck ( this , Title ) ;
var _this = _possibleConstructorReturn ( this , Object . getPrototypeOf ( Title ) . call ( this ) ) ;
_this . $el = options . $el ;
_this . $label = _this . $el . find ( '.js-label' ) ;
_this . $document . on ( 'title.changeLabel' , function ( event , value ) {
_this . changeLabel ( value ) ;
} ) ;
return _this ;
}
_createClass ( Title , [ {
key : 'changeLabel' ,
value : function changeLabel ( value ) {
this . $label . text ( value ) ;
}
// Destroy
// ==========================================================================
} , {
key : 'destroy' ,
value : function destroy ( ) {
this . $document . off ( 'title.changeLabel' ) ;
this . $el . off ( ) ;
}
} ] ) ;
return Title ;
} ( _Module3 . default ) ;
exports . default = Title ;
} , { "./Module" : 5 } ] } , { } , [ 1 , 2 , 3 , 4 , 5 , 6 , 7 ] )
//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfb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