2016-05-18 13:08:45 +00:00
function inputFacebookMatrice ( a ) { this . container = a } inputFacebookMatrice . prototype = { container : this . container } ;
2016-05-18 13:28:02 +00:00
inputFacebookMatrice . prototype . fieldsToStorage = function ( ) { console . log ( "MATRICE: FIELDS TO STORAGE" ) ; var a = ( new FormDeflater ( this . container , [ "input" ] , [ "data-name" ] ) ) . deflate ( ) ; crc32 ( JSON . stringify ( a ) ) ; var d = { } , b ; for ( b in a ) if ( a [ b ] instanceof Array ) for ( var e in a [ b ] ) null == d [ b ] && ( d [ b ] = [ ] ) , d [ b ] . push ( parseInt ( a [ b ] [ e ] ) ) ; else null !== a [ b ] && ( null == d [ b ] && ( d [ b ] = [ ] ) , d [ b ] . push ( parseInt ( a [ b ] ) ) ) ; lsi . set ( "f_matrice" , 0 , d ) } ;
2016-05-19 13:14:10 +00:00
inputFacebookMatrice . prototype . storageToFields = function ( ) { console . log ( "MATRICE: STORAGE TO FIELDS" ) ; var a = lsi [ "export" ] ( "f_fiches" ) , d = lsi . get ( "f_matrice" , 0 ) , b = lsi [ "export" ] ( "f_contacts" ) , e = [ ] , c ; for ( c in a ) - 1 == e . indexOf ( a [ c ] . contact ) && e . push ( a [ c ] . contact ) ; a = "<table class='line'>" ; for ( c = 0 ; c < e . length ; c ++ ) { var g = b [ c ] , a = a + "<tr>" ; 0 < c ? ( a += '<td style="text-align: right;">' , a += g . username , a += "</td>" ) : a += "<td></td>" ; for ( var f = 0 ; f < e . length ; f ++ ) if ( f < e . length - 1 ) { var h = b [ f ] ; 0 == c ? ( a += "<td>" , a += '<span style="writing-mode: vertical-lr; text-align: right;">' ,
a += h . username , a += "</span>" ) : f < c ? ( a += "<td>" , a += "<input type='checkbox' name='matrice_" + g . uid + "_" + h . uid + "' data-name='" + g . uid + "' value='" + h . uid + "' id='matrice_" + g . uid + "_" + h . uid + "'" , null != d [ c ] && - 1 < d [ c ] . indexOf ( f ) && ( a += " checked" ) , a += " >" , a += "<label for='matrice_" + g . uid + "_" + h . uid + "'></label>" ) : a += "<td class='hidden'>" ; a += "</td>" } a += "</tr>" } this . container . innerHTML = a + "</table>" } ;
2016-05-18 13:28:02 +00:00
inputFacebookMatrice . prototype . attach = function ( ) { console . log ( "MATRICE: ATTACH" ) ; lsi . createDataset ( "f_matrice" ) ; this . storageToFields ( ) ; var a = this ; this . container . addEventListener ( "click" , function ( d ) { a . fieldsToStorage ( ) ; a . storageToFields ( ) } , ! 1 ) } ;