" use strict " ;
|
|
var dvjh = ( function ( $ ){
|
|
|
|
|
|
|
|
|
|
|
|
|
var dvjhSqueletteMethods = Object . create ( { } , {
|
" _copyright " : {
|
|
|
|
|
|
|
|
value : Object . create ( { } , {
|
" objMethodsName " : {
|
value : " dvjhSqueletteMethods " ,
|
enumerate : true
|
} ,
|
" auteur " : {
|
value : " Daniel Hagnoul " ,
|
enumerate : true
|
} ,
|
" version " : {
|
value : " 1.0.0 " ,
|
enumerate : true
|
} ,
|
" date " : {
|
value : " 2012-01-13T02:15:29.000+01:00 " ,
|
enumerate : true
|
} ,
|
" licence " : {
|
value : " libre de tous droits " ,
|
enumerate : true
|
}
|
} )
|
} ,
|
|
" _options " : {
|
|
|
|
|
|
|
value : {
|
" boolDebug " : true ,
|
" class " : " dvjhClass "
|
} ,
|
writable : true ,
|
configurable : true
|
} ,
|
|
|
|
|
|
|
|
|
|
|
|
" jObj " : {
|
value : null ,
|
writable : true
|
} ,
|
|
" options " : {
|
value : { } ,
|
writable : true ,
|
configurable : true
|
} ,
|
|
" init " : {
|
value : function (){
|
|
|
|
|
var args = Array . prototype. slice. call ( arguments ),
|
param1 = args. shift (),
|
param2 = args. shift ();
|
|
|
|
|
|
|
|
if ( $. isPlainObject ( param1 ) & & ! $. isEmptyObject ( param1 ) ){
|
|
if ( this . options. boolDebug ){
|
console. log ( " init, options de l'utilisateur : " , Object . dvjhClone ( param1 ) );
|
}
|
|
this . options = Object . dvjhExtend ( this . options, param1 );
|
}
|
|
|
|
|
|
|
|
|
var dataOptions = this . jObj. data ( " pluginOptions " );
|
|
if ( $. isPlainObject ( dataOptions ) & & ! $. isEmptyObject ( dataOptions ) ){
|
|
if ( this . options. boolDebug ){
|
console. log ( " init, options de l'utilisateur : " , Object . dvjhClone ( dataOptions ) );
|
}
|
|
|
this . options = Object . dvjhExtend ( this . options, dataOptions );
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var mesArguments = [ ] ;
|
|
if ( $. isArray ( param1 ) ){
|
mesArguments = param1. concat ();
|
} else if ( $. isArray ( param2 ) ){
|
mesArguments = param2. concat ();
|
}
|
|
if ( this . options. boolDebug ){
|
console. log ( " init, this.jObj : " , this . jObj );
|
console. log ( " init, mesArguments : " , mesArguments. concat () );
|
}
|
|
|
|
|
|
|
this . _setClass ( this . options. class );
|
} ,
|
enumerable : true
|
} ,
|
|
" destroy " : {
|
value : function ( params ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} ,
|
enumerable : true
|
} ,
|
|
" exemple " : {
|
value : function ( params ){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} ,
|
enumerable : true
|
} ,
|
|
" setOption " : {
|
value : function ( params ){
|
|
|
|
|
var option = params. shift (),
|
value = params. shift ();
|
|
if ( ! option | | ! value ){
|
$. error ( " Les paramètres ne sont pas conformes : ( " +
|
option + " , " + value + " ). " );
|
}
|
|
if ( option in this . options ){
|
switch ( option ){
|
case " boolDebug " :
|
this . _setBoolDebug ( value );
|
break ;
|
case " class " :
|
this . _setClass ( value );
|
break ;
|
default :
|
$. error ( " Cette option existe mais elle n'est pas publique ! " );
|
} ;
|
|
} else {
|
$. error ( " Cette option n'existe pas ! " );
|
}
|
} ,
|
enumerable : true
|
} ,
|
|
" _setBoolDebug " : {
|
value : function ( value ){
|
|
if ( typeof value = = = " boolean " ){
|
this . options. boolDebug = value;
|
}
|
}
|
} ,
|
|
|
" _setClass " : {
|
value : function ( value ){
|
|
if ( typeof value = = = ' string ' ){
|
|
if ( this . jObj. hasClass ( this . options. class ) ){
|
|
this . jObj. removeClass ( this . options. class );
|
}
|
|
this . options. class = value;
|
|
this . jObj. addClass ( value );
|
}
|
}
|
} ,
|
|
" getOption " : {
|
value : function ( params ){
|
|
|
|
|
var option = params. shift (),
|
callback = params. shift () | | function (){ } ,
|
name = " getOption. " + this . _copyright. objMethodsName;
|
|
if ( ! option ){
|
$. error ( " getOption : le paramètre n'est pas conforme : ( " +
|
option + " ). " );
|
}
|
|
|
|
|
|
if ( option in this . options ){
|
switch ( option ){
|
case " boolDebug " :
|
var value = this . options. boolDebug;
|
this . jObj. data ( name, value );
|
callback ( option, value );
|
break ;
|
case " class " :
|
var value = this . options. class ;
|
this . jObj. data ( name, value );
|
callback ( option, value );
|
break ;
|
default :
|
$. error ( " getOption : cette option existe mais elle n'est pas publique ! " );
|
} ;
|
|
} else {
|
$. error ( " getOption : cette option n'existe pas ! " );
|
}
|
} ,
|
enumerable : true
|
}
|
} );
|
|
Object . preventExtensions ( dvjhSqueletteMethods. _copyright );
|
Object . freeze ( dvjhSqueletteMethods. _copyright );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$. extend ( $. fn, {
|
" dvjhSquelette " : function (){
|
return dvjhPluginCreate. call ( this , dvjhSqueletteMethods, arguments );
|
}
|
} );
|
|
return Object . create ( { } , {
|
" $ " : {
|
value : $,
|
enumerable : true
|
} ,
|
" squeletteObjMethodsName " : {
|
value : dvjhSqueletteMethods. _copyright. objMethodsName,
|
enumerable : true
|
} ,
|
" squeletteObjMethodsDefaultOptions " : {
|
value : function ( objOptions ){
|
|
|
|
|
|
if ( $. isPlainObject ( objOptions ) & & ! $. isEmptyObject ( objOptions ) ){
|
dvjhSqueletteMethods. _options = Object . dvjhExtend ( dvjhSqueletteMethods. _options, objOptions );
|
}
|
} ,
|
enumerable : true
|
} ,
|
" debugfn " : {
|
value : function (){
|
console. log ( Object . getOwnPropertyNames ( $. fn ) );
|
}
|
} ,
|
" debugObjMethods " : {
|
value : function (){
|
console. log ( dvjhSqueletteMethods );
|
console. log ( Object . keys ( dvjhSqueletteMethods ) );
|
|
Object . getOwnPropertyNames ( dvjhSqueletteMethods ). forEach ( function ( key ){
|
var props = Object . getOwnPropertyDescriptor ( dvjhSqueletteMethods, key );
|
|
console. log ( " dvjhSqueletteMethods : key = " , key, " , value = " , props. value,
|
" , writable = " , props. writable,
|
" , enumerable = " , props. enumerable,
|
" , configurable = " , props. configurable );
|
} );
|
|
Object . getOwnPropertyNames ( dvjhSqueletteMethods. _copyright ). forEach ( function ( key ){
|
var props = Object . getOwnPropertyDescriptor ( dvjhSqueletteMethods. _copyright, key );
|
|
console. log ( " dvjhSqueletteMethods._copyright : key = " , key, " , value = " , props. value,
|
" , writable = " , props. writable,
|
" , enumerable = " , props. enumerable,
|
" , configurable = " , props. configurable );
|
} );
|
|
Object . getOwnPropertyNames ( dvjhSqueletteMethods. _options ). forEach ( function ( key ){
|
var props = Object . getOwnPropertyDescriptor ( dvjhSqueletteMethods. _options, key );
|
|
console. log ( " dvjhSqueletteMethods._options : key = " , key, " , value = " , props. value,
|
" , writable = " , props. writable,
|
" , enumerable = " , props. enumerable,
|
" , configurable = " , props. configurable );
|
} );
|
}
|
}
|
} );
|
|
} )( jQuery. sub () );
|