Création et implémentation du système de notifications en Javascript

This commit is contained in:
xdrm-brackets 2016-05-10 16:51:09 +02:00
parent 226c0c353f
commit 3e0fcc2929
22 changed files with 453 additions and 95 deletions

63
css/notif.scss Normal file
View File

@ -0,0 +1,63 @@
body > #notification-container{
display: flex;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
flex-direction: column;
flex-wrap: nowrap;
z-index: 200;
pointer-events: none;
.notification-element{
display: block;
position: relative;
margin: .2em auto;
padding: 0 1em;
border-radius: 3px;
border: 1px solid #ddd;
border-bottom: 1px solid #bbb;
box-shadow: inset 0 0 1em #eee;
background-color: #fff;
pointer-events: all;
// DIFFERENTS THEMES
strong[class]{
padding-left: 1.5em;
&:before{
content: '';
display: inline-block;
position: absolute;
top: 1.2em;
left: 1em;
width: .9em;
height: .9em;
border-radius: 50% / 50%;
box-shadow: inset -1px 1px 2px rgba(50, 50, 50, .5);
background-color: red;
}
}
// WARNING
strong.warning:before{ background-color: #dd6a45; }
// INFO
strong.info:before{ background-color: #2195da; }
// SUCCESS
strong.success:before{ background-color: #5fca4a; }
// ERROR
strong.error:before{ background-color: #d94747; }
}
}

59
css/notif/expanded.css Normal file
View File

@ -0,0 +1,59 @@
body > #notification-container {
display: flex;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
flex-direction: column;
flex-wrap: nowrap;
z-index: 200;
pointer-events: none;
}
body > #notification-container .notification-element {
display: block;
position: relative;
margin: .2em auto;
padding: 0 1em;
border-radius: 3px;
border: 1px solid #ddd;
border-bottom: 1px solid #bbb;
box-shadow: inset 0 0 1em #eee;
background-color: #fff;
pointer-events: all;
}
body > #notification-container .notification-element strong[class] {
padding-left: 1.5em;
}
body > #notification-container .notification-element strong[class]:before {
content: '';
display: inline-block;
position: absolute;
top: 1.2em;
left: 1em;
width: .9em;
height: .9em;
border-radius: 50% / 50%;
box-shadow: inset -1px 1px 2px rgba(50, 50, 50, 0.5);
background-color: red;
}
body > #notification-container .notification-element strong.warning:before {
background-color: #dd6a45;
}
body > #notification-container .notification-element strong.info:before {
background-color: #2195da;
}
body > #notification-container .notification-element strong.success:before {
background-color: #5fca4a;
}
body > #notification-container .notification-element strong.error:before {
background-color: #d94747;
}
/*# sourceMappingURL=data:application/json;base64,ewoJInZlcnNpb24iOiAzLAoJImZpbGUiOiAiZXhwYW5kZWQuY3NzIiwKCSJzb3VyY2VzIjogWwoJCSIuLi9ub3RpZi5zY3NzIgoJXSwKCSJzb3VyY2VzQ29udGVudCI6IFsKCQkiYm9keSA+ICNub3RpZmljYXRpb24tY29udGFpbmVye1xuXG4gICAgZGlzcGxheTogZmxleDtcbiAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICAgIGJvdHRvbTogMDtcbiAgICAgICAgbGVmdDogMDtcbiAgICAgICAgd2lkdGg6IDEwMCU7XG5cbiAgICBmbGV4LWRpcmVjdGlvbjogY29sdW1uO1xuICAgIGZsZXgtd3JhcDogbm93cmFwO1xuXG4gICAgei1pbmRleDogMjAwO1xuICAgIHBvaW50ZXItZXZlbnRzOiBub25lO1xuXG5cbiAgICAubm90aWZpY2F0aW9uLWVsZW1lbnR7XG4gICAgICAgIGRpc3BsYXk6IGJsb2NrO1xuICAgICAgICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gICAgICAgICAgICBtYXJnaW46IC4yZW0gYXV0bztcbiAgICAgICAgICAgIHBhZGRpbmc6IDAgMWVtO1xuXG4gICAgICAgIGJvcmRlci1yYWRpdXM6IDNweDtcbiAgICAgICAgYm9yZGVyOiAxcHggc29saWQgI2RkZDtcbiAgICAgICAgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkICNiYmI7XG4gICAgICAgIGJveC1zaGFkb3c6IGluc2V0IDAgMCAxZW0gI2VlZTtcblxuICAgICAgICBiYWNrZ3JvdW5kLWNvbG9yOiAjZmZmO1xuXG4gICAgICAgIHBvaW50ZXItZXZlbnRzOiBhbGw7XG5cblxuICAgICAgICAvLyBESUZGRVJFTlRTIFRIRU1FU1xuICAgICAgICBzdHJvbmdbY2xhc3Nde1xuXG4gICAgICAgICAgICBwYWRkaW5nLWxlZnQ6IDEuNWVtO1xuXG4gICAgICAgICAgICAmOmJlZm9yZXtcbiAgICAgICAgICAgICAgICBjb250ZW50OiAnJztcbiAgICAgICAgICAgICAgICAgICAgZGlzcGxheTogaW5saW5lLWJsb2NrO1xuICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7XG4gICAgICAgICAgICAgICAgICAgICAgICB0b3A6IDEuMmVtO1xuICAgICAgICAgICAgICAgICAgICAgICAgbGVmdDogMWVtO1xuICAgICAgICAgICAgICAgICAgICAgICAgd2lkdGg6IC45ZW07XG4gICAgICAgICAgICAgICAgICAgICAgICBoZWlnaHQ6IC45ZW07XG5cbiAgICAgICAgICAgICAgICBib3JkZXItcmFkaXVzOiA1MCUgLyA1MCU7XG4gICAgICAgICAgICAgICAgYm94LXNoYWRvdzogaW5zZXQgLTFweCAxcHggMnB4IHJnYmEoNTAsIDUwLCA1MCwgLjUpO1xuXG4gICAgICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogcmVkO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gV0FSTklOR1xuICAgICAgICBzdHJvbmcud2FybmluZzpiZWZvcmV7IGJhY2tncm91bmQtY29sb3I6ICNkZDZhNDU7IH1cbiAgICAgICAgLy8gSU5GT1xuICAgICAgICBzdHJvbmcuaW5mbzpiZWZvcmV7IGJhY2tncm91bmQtY29sb3I6ICMyMTk1ZGE7IH1cbiAgICAgICAgLy8gU1VDQ0VTU1xuICAgICAgICBzdHJvbmcuc3VjY2VzczpiZWZvcmV7IGJhY2tncm91bmQtY29sb3I6ICM1ZmNhNGE7IH1cbiAgICAgICAgLy8gRVJST1JcbiAgICAgICAgc3Ryb25nLmVycm9yOmJlZm9yZXsgYmFja2dyb3VuZC1jb2xvcjogI2Q5NDc0NzsgfVxuICAgIH1cblxufVxuIgoJXSwKCSJtYXBwaW5ncyI6ICJBQUFBLElBQUksR0FBRyx1QkFBdUIsQ0FBQTtFQUUxQixPQUFPLEVBQUUsSUFBSztFQUNkLFFBQVEsRUFBRSxRQUFTO0VBQ2YsTUFBTSxFQUFFLENBQUU7RUFDVixJQUFJLEVBQUUsQ0FBRTtFQUNSLEtBQUssRUFBRSxJQUFLO0VBRWhCLGNBQWMsRUFBRSxNQUFPO0VBQ3ZCLFNBQVMsRUFBRSxNQUFPO0VBRWxCLE9BQU8sRUFBRSxHQUFJO0VBQ2IsY0FBYyxFQUFFLElBQUs7Q0FrRHhCOztBQTlERCxJQUFJLEdBQUcsdUJBQXVCLENBZTFCLHFCQUFxQixDQUFBO0VBQ2pCLE9BQU8sRUFBRSxLQUFNO0VBQ2YsUUFBUSxFQUFFLFFBQVM7RUFDZixNQUFNLEVBQUUsU0FBVTtFQUNsQixPQUFPLEVBQUUsS0FBTTtFQUVuQixhQUFhLEVBQUUsR0FBSTtFQUNuQixNQUFNLEVBQUUsY0FBZTtFQUN2QixhQUFhLEVBQUUsY0FBZTtFQUM5QixVQUFVLEVBQUUsa0JBQW1CO0VBRS9CLGdCQUFnQixFQUFFLElBQUs7RUFFdkIsY0FBYyxFQUFFLEdBQUk7Q0FnQ3ZCOztBQTVETCxJQUFJLEdBQUcsdUJBQXVCLENBZTFCLHFCQUFxQixDQWlCakIsTUFBTSxDQUFBLEFBQUEsS0FBQyxBQUFBLEVBQU07RUFFVCxZQUFZLEVBQUUsS0FBTTtDQWdCdkI7O0FBbERULElBQUksR0FBRyx1QkFBdUIsQ0FlMUIscUJBQXFCLENBaUJqQixNQUFNLENBQUEsQUFBQSxLQUFDLEFBQUEsQ0FJRixPQUFPLENBQUE7RUFDSixPQUFPLEVBQUUsRUFBRztFQUNSLE9BQU8sRUFBRSxZQUFhO0VBQ3RCLFFBQVEsRUFBRSxRQUFTO0VBQ2YsR0FBRyxFQUFFLEtBQU07RUFDWCxJQUFJLEVBQUUsR0FBSTtFQUNWLEtBQUssRUFBRSxJQUFLO0VBQ1osTUFBTSxFQUFFLElBQUs7RUFFckIsYUFBYSxFQUFFLFNBQVU7RUFDekIsVUFBVSxFQUFFLEtBQUssQ0FBRSxJQUFHLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxxQkFBSTtFQUVuQyxnQkFBZ0IsRUFBRSxHQUFJO0NBQ3pCOztBQWpEYixJQUFJLEdBQUcsdUJBQXVCLENBZTFCLHFCQUFxQixDQXNDakIsTUFBTSxBQUFBLFFBQVEsQUFBQSxPQUFPLENBQUE7RUFBRSxnQkFBZ0IsRUFBRSxPQUFRO0NBQUk7O0FBckQ3RCxJQUFJLEdBQUcsdUJBQXVCLENBZTFCLHFCQUFxQixDQXdDakIsTUFBTSxBQUFBLEtBQUssQUFBQSxPQUFPLENBQUE7RUFBRSxnQkFBZ0IsRUFBRSxPQUFRO0NBQUk7O0FBdkQxRCxJQUFJLEdBQUcsdUJBQXVCLENBZTFCLHFCQUFxQixDQTBDakIsTUFBTSxBQUFBLFFBQVEsQUFBQSxPQUFPLENBQUE7RUFBRSxnQkFBZ0IsRUFBRSxPQUFRO0NBQUk7O0FBekQ3RCxJQUFJLEdBQUcsdUJBQXVCLENBZTFCLHFCQUFxQixDQTRDakIsTUFBTSxBQUFBLE1BQU0sQUFBQSxPQUFPLENBQUE7RUFBRSxnQkFBZ0IsRUFBRSxPQUFRO0NBQUkiLAoJIm5hbWVzIjogW10KfQ== */

View File

@ -0,0 +1,12 @@
{
"version": 3,
"file": "expanded.css",
"sources": [
"../notif.scss"
],
"sourcesContent": [
"body > #notification-container{\n\n display: flex;\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n\n flex-direction: column;\n flex-wrap: nowrap;\n\n z-index: 200;\n pointer-events: none;\n\n\n .notification-element{\n display: block;\n position: relative;\n margin: .2em auto;\n padding: 0 1em;\n\n border-radius: 3px;\n border: 1px solid #ddd;\n border-bottom: 1px solid #bbb;\n box-shadow: inset 0 0 1em #eee;\n\n background-color: #fff;\n\n pointer-events: all;\n\n\n // DIFFERENTS THEMES\n strong[class]{\n\n padding-left: 1.5em;\n\n &:before{\n content: '';\n display: inline-block;\n position: absolute;\n top: 1.2em;\n left: 1em;\n width: .9em;\n height: .9em;\n\n border-radius: 50% / 50%;\n box-shadow: inset -1px 1px 2px rgba(50, 50, 50, .5);\n\n background-color: red;\n }\n }\n\n // WARNING\n strong.warning:before{ background-color: #dd6a45; }\n // INFO\n strong.info:before{ background-color: #2195da; }\n // SUCCESS\n strong.success:before{ background-color: #5fca4a; }\n // ERROR\n strong.error:before{ background-color: #d94747; }\n }\n\n}\n"
],
"mappings": "AAAA,IAAI,GAAG,uBAAuB,CAAA;EAE1B,OAAO,EAAE,IAAK;EACd,QAAQ,EAAE,QAAS;EACf,MAAM,EAAE,CAAE;EACV,IAAI,EAAE,CAAE;EACR,KAAK,EAAE,IAAK;EAEhB,cAAc,EAAE,MAAO;EACvB,SAAS,EAAE,MAAO;EAElB,OAAO,EAAE,GAAI;EACb,cAAc,EAAE,IAAK;CAkDxB;;AA9DD,IAAI,GAAG,uBAAuB,CAe1B,qBAAqB,CAAA;EACjB,OAAO,EAAE,KAAM;EACf,QAAQ,EAAE,QAAS;EACf,MAAM,EAAE,SAAU;EAClB,OAAO,EAAE,KAAM;EAEnB,aAAa,EAAE,GAAI;EACnB,MAAM,EAAE,cAAe;EACvB,aAAa,EAAE,cAAe;EAC9B,UAAU,EAAE,kBAAmB;EAE/B,gBAAgB,EAAE,IAAK;EAEvB,cAAc,EAAE,GAAI;CAgCvB;;AA5DL,IAAI,GAAG,uBAAuB,CAe1B,qBAAqB,CAiBjB,MAAM,CAAA,AAAA,KAAC,AAAA,EAAM;EAET,YAAY,EAAE,KAAM;CAgBvB;;AAlDT,IAAI,GAAG,uBAAuB,CAe1B,qBAAqB,CAiBjB,MAAM,CAAA,AAAA,KAAC,AAAA,CAIF,OAAO,CAAA;EACJ,OAAO,EAAE,EAAG;EACR,OAAO,EAAE,YAAa;EACtB,QAAQ,EAAE,QAAS;EACf,GAAG,EAAE,KAAM;EACX,IAAI,EAAE,GAAI;EACV,KAAK,EAAE,IAAK;EACZ,MAAM,EAAE,IAAK;EAErB,aAAa,EAAE,SAAU;EACzB,UAAU,EAAE,KAAK,CAAE,IAAG,CAAC,GAAG,CAAC,GAAG,CAAC,qBAAI;EAEnC,gBAAgB,EAAE,GAAI;CACzB;;AAjDb,IAAI,GAAG,uBAAuB,CAe1B,qBAAqB,CAsCjB,MAAM,AAAA,QAAQ,AAAA,OAAO,CAAA;EAAE,gBAAgB,EAAE,OAAQ;CAAI;;AArD7D,IAAI,GAAG,uBAAuB,CAe1B,qBAAqB,CAwCjB,MAAM,AAAA,KAAK,AAAA,OAAO,CAAA;EAAE,gBAAgB,EAAE,OAAQ;CAAI;;AAvD1D,IAAI,GAAG,uBAAuB,CAe1B,qBAAqB,CA0CjB,MAAM,AAAA,QAAQ,AAAA,OAAO,CAAA;EAAE,gBAAgB,EAAE,OAAQ;CAAI;;AAzD7D,IAAI,GAAG,uBAAuB,CAe1B,qBAAqB,CA4CjB,MAAM,AAAA,MAAM,AAAA,OAAO,CAAA;EAAE,gBAAgB,EAAE,OAAQ;CAAI",
"names": []
}

3
css/notif/min.css Normal file
View File

@ -0,0 +1,3 @@
body>#notification-container{display:flex;position:absolute;bottom:0;left:0;width:100%;flex-direction:column;flex-wrap:nowrap;z-index:200;pointer-events:none}body>#notification-container .notification-element{display:block;position:relative;margin:.2em auto;padding:0 1em;border-radius:3px;border:1px solid #ddd;border-bottom:1px solid #bbb;box-shadow:inset 0 0 1em #eee;background-color:#fff;pointer-events:all}body>#notification-container .notification-element strong[class]{padding-left:1.5em}body>#notification-container .notification-element strong[class]:before{content:'';display:inline-block;position:absolute;top:1.2em;left:1em;width:.9em;height:.9em;border-radius:50% / 50%;box-shadow:inset -1px 1px 2px rgba(50,50,50,0.5);background-color:red}body>#notification-container .notification-element strong.warning:before{background-color:#dd6a45}body>#notification-container .notification-element strong.info:before{background-color:#2195da}body>#notification-container .notification-element strong.success:before{background-color:#5fca4a}body>#notification-container .notification-element strong.error:before{background-color:#d94747}
/*# sourceMappingURL=data:application/json;base64,ewoJInZlcnNpb24iOiAzLAoJImZpbGUiOiAibWluLmNzcyIsCgkic291cmNlcyI6IFsKCQkiLi4vbm90aWYuc2NzcyIKCV0sCgkic291cmNlc0NvbnRlbnQiOiBbCgkJImJvZHkgPiAjbm90aWZpY2F0aW9uLWNvbnRhaW5lcntcblxuICAgIGRpc3BsYXk6IGZsZXg7XG4gICAgcG9zaXRpb246IGFic29sdXRlO1xuICAgICAgICBib3R0b206IDA7XG4gICAgICAgIGxlZnQ6IDA7XG4gICAgICAgIHdpZHRoOiAxMDAlO1xuXG4gICAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjtcbiAgICBmbGV4LXdyYXA6IG5vd3JhcDtcblxuICAgIHotaW5kZXg6IDIwMDtcbiAgICBwb2ludGVyLWV2ZW50czogbm9uZTtcblxuXG4gICAgLm5vdGlmaWNhdGlvbi1lbGVtZW50e1xuICAgICAgICBkaXNwbGF5OiBibG9jaztcbiAgICAgICAgcG9zaXRpb246IHJlbGF0aXZlO1xuICAgICAgICAgICAgbWFyZ2luOiAuMmVtIGF1dG87XG4gICAgICAgICAgICBwYWRkaW5nOiAwIDFlbTtcblxuICAgICAgICBib3JkZXItcmFkaXVzOiAzcHg7XG4gICAgICAgIGJvcmRlcjogMXB4IHNvbGlkICNkZGQ7XG4gICAgICAgIGJvcmRlci1ib3R0b206IDFweCBzb2xpZCAjYmJiO1xuICAgICAgICBib3gtc2hhZG93OiBpbnNldCAwIDAgMWVtICNlZWU7XG5cbiAgICAgICAgYmFja2dyb3VuZC1jb2xvcjogI2ZmZjtcblxuICAgICAgICBwb2ludGVyLWV2ZW50czogYWxsO1xuXG5cbiAgICAgICAgLy8gRElGRkVSRU5UUyBUSEVNRVNcbiAgICAgICAgc3Ryb25nW2NsYXNzXXtcblxuICAgICAgICAgICAgcGFkZGluZy1sZWZ0OiAxLjVlbTtcblxuICAgICAgICAgICAgJjpiZWZvcmV7XG4gICAgICAgICAgICAgICAgY29udGVudDogJyc7XG4gICAgICAgICAgICAgICAgICAgIGRpc3BsYXk6IGlubGluZS1ibG9jaztcbiAgICAgICAgICAgICAgICAgICAgcG9zaXRpb246IGFic29sdXRlO1xuICAgICAgICAgICAgICAgICAgICAgICAgdG9wOiAxLjJlbTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6IDFlbTtcbiAgICAgICAgICAgICAgICAgICAgICAgIHdpZHRoOiAuOWVtO1xuICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OiAuOWVtO1xuXG4gICAgICAgICAgICAgICAgYm9yZGVyLXJhZGl1czogNTAlIC8gNTAlO1xuICAgICAgICAgICAgICAgIGJveC1zaGFkb3c6IGluc2V0IC0xcHggMXB4IDJweCByZ2JhKDUwLCA1MCwgNTAsIC41KTtcblxuICAgICAgICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6IHJlZDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIC8vIFdBUk5JTkdcbiAgICAgICAgc3Ryb25nLndhcm5pbmc6YmVmb3JleyBiYWNrZ3JvdW5kLWNvbG9yOiAjZGQ2YTQ1OyB9XG4gICAgICAgIC8vIElORk9cbiAgICAgICAgc3Ryb25nLmluZm86YmVmb3JleyBiYWNrZ3JvdW5kLWNvbG9yOiAjMjE5NWRhOyB9XG4gICAgICAgIC8vIFNVQ0NFU1NcbiAgICAgICAgc3Ryb25nLnN1Y2Nlc3M6YmVmb3JleyBiYWNrZ3JvdW5kLWNvbG9yOiAjNWZjYTRhOyB9XG4gICAgICAgIC8vIEVSUk9SXG4gICAgICAgIHN0cm9uZy5lcnJvcjpiZWZvcmV7IGJhY2tncm91bmQtY29sb3I6ICNkOTQ3NDc7IH1cbiAgICB9XG5cbn1cbiIKCV0sCgkibWFwcGluZ3MiOiAiQUFBQSxJQUFJLENBQUcsdUJBQXVCLEFBQUEsQ0FFMUIsT0FBTyxDQUFFLElBQUssQ0FDZCxRQUFRLENBQUUsUUFBUyxDQUNmLE1BQU0sQ0FBRSxDQUFFLENBQ1YsSUFBSSxDQUFFLENBQUUsQ0FDUixLQUFLLENBQUUsSUFBSyxDQUVoQixjQUFjLENBQUUsTUFBTyxDQUN2QixTQUFTLENBQUUsTUFBTyxDQUVsQixPQUFPLENBQUUsR0FBSSxDQUNiLGNBQWMsQ0FBRSxJQUFLLENBa0R4QixBQTlERCxJQUFJLENBQUcsdUJBQXVCLENBZTFCLHFCQUFxQixBQUFBLENBQ2pCLE9BQU8sQ0FBRSxLQUFNLENBQ2YsUUFBUSxDQUFFLFFBQVMsQ0FDZixNQUFNLENBQUUsU0FBVSxDQUNsQixPQUFPLENBQUUsS0FBTSxDQUVuQixhQUFhLENBQUUsR0FBSSxDQUNuQixNQUFNLENBQUUsY0FBZSxDQUN2QixhQUFhLENBQUUsY0FBZSxDQUM5QixVQUFVLENBQUUsa0JBQW1CLENBRS9CLGdCQUFnQixDQUFFLElBQUssQ0FFdkIsY0FBYyxDQUFFLEdBQUksQ0FnQ3ZCLEFBNURMLElBQUksQ0FBRyx1QkFBdUIsQ0FlMUIscUJBQXFCLENBaUJqQixNQUFNLENBQUEsQUFBQSxLQUFDLEFBQUEsQ0FBTSxDQUVULFlBQVksQ0FBRSxLQUFNLENBZ0J2QixBQWxEVCxJQUFJLENBQUcsdUJBQXVCLENBZTFCLHFCQUFxQixDQWlCakIsTUFBTSxDQUFBLEFBQUEsS0FBQyxBQUFBLENBSUYsT0FBTyxBQUFBLENBQ0osT0FBTyxDQUFFLEVBQUcsQ0FDUixPQUFPLENBQUUsWUFBYSxDQUN0QixRQUFRLENBQUUsUUFBUyxDQUNmLEdBQUcsQ0FBRSxLQUFNLENBQ1gsSUFBSSxDQUFFLEdBQUksQ0FDVixLQUFLLENBQUUsSUFBSyxDQUNaLE1BQU0sQ0FBRSxJQUFLLENBRXJCLGFBQWEsQ0FBRSxTQUFVLENBQ3pCLFVBQVUsQ0FBRSxLQUFLLENBQUUsSUFBRyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsa0JBQUksQ0FFbkMsZ0JBQWdCLENBQUUsR0FBSSxDQUN6QixBQWpEYixJQUFJLENBQUcsdUJBQXVCLENBZTFCLHFCQUFxQixDQXNDakIsTUFBTSxBQUFBLFFBQVEsQUFBQSxPQUFPLEFBQUEsQ0FBRSxnQkFBZ0IsQ0FBRSxPQUFRLENBQUksQUFyRDdELElBQUksQ0FBRyx1QkFBdUIsQ0FlMUIscUJBQXFCLENBd0NqQixNQUFNLEFBQUEsS0FBSyxBQUFBLE9BQU8sQUFBQSxDQUFFLGdCQUFnQixDQUFFLE9BQVEsQ0FBSSxBQXZEMUQsSUFBSSxDQUFHLHVCQUF1QixDQWUxQixxQkFBcUIsQ0EwQ2pCLE1BQU0sQUFBQSxRQUFRLEFBQUEsT0FBTyxBQUFBLENBQUUsZ0JBQWdCLENBQUUsT0FBUSxDQUFJLEFBekQ3RCxJQUFJLENBQUcsdUJBQXVCLENBZTFCLHFCQUFxQixDQTRDakIsTUFBTSxBQUFBLE1BQU0sQUFBQSxPQUFPLEFBQUEsQ0FBRSxnQkFBZ0IsQ0FBRSxPQUFRLENBQUkiLAoJIm5hbWVzIjogW10KfQ== */

12
css/notif/min.css.map Normal file
View File

@ -0,0 +1,12 @@
{
"version": 3,
"file": "min.css",
"sources": [
"../notif.scss"
],
"sourcesContent": [
"body > #notification-container{\n\n display: flex;\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n\n flex-direction: column;\n flex-wrap: nowrap;\n\n z-index: 200;\n pointer-events: none;\n\n\n .notification-element{\n display: block;\n position: relative;\n margin: .2em auto;\n padding: 0 1em;\n\n border-radius: 3px;\n border: 1px solid #ddd;\n border-bottom: 1px solid #bbb;\n box-shadow: inset 0 0 1em #eee;\n\n background-color: #fff;\n\n pointer-events: all;\n\n\n // DIFFERENTS THEMES\n strong[class]{\n\n padding-left: 1.5em;\n\n &:before{\n content: '';\n display: inline-block;\n position: absolute;\n top: 1.2em;\n left: 1em;\n width: .9em;\n height: .9em;\n\n border-radius: 50% / 50%;\n box-shadow: inset -1px 1px 2px rgba(50, 50, 50, .5);\n\n background-color: red;\n }\n }\n\n // WARNING\n strong.warning:before{ background-color: #dd6a45; }\n // INFO\n strong.info:before{ background-color: #2195da; }\n // SUCCESS\n strong.success:before{ background-color: #5fca4a; }\n // ERROR\n strong.error:before{ background-color: #d94747; }\n }\n\n}\n"
],
"mappings": "AAAA,IAAI,CAAG,uBAAuB,AAAA,CAE1B,OAAO,CAAE,IAAK,CACd,QAAQ,CAAE,QAAS,CACf,MAAM,CAAE,CAAE,CACV,IAAI,CAAE,CAAE,CACR,KAAK,CAAE,IAAK,CAEhB,cAAc,CAAE,MAAO,CACvB,SAAS,CAAE,MAAO,CAElB,OAAO,CAAE,GAAI,CACb,cAAc,CAAE,IAAK,CAkDxB,AA9DD,IAAI,CAAG,uBAAuB,CAe1B,qBAAqB,AAAA,CACjB,OAAO,CAAE,KAAM,CACf,QAAQ,CAAE,QAAS,CACf,MAAM,CAAE,SAAU,CAClB,OAAO,CAAE,KAAM,CAEnB,aAAa,CAAE,GAAI,CACnB,MAAM,CAAE,cAAe,CACvB,aAAa,CAAE,cAAe,CAC9B,UAAU,CAAE,kBAAmB,CAE/B,gBAAgB,CAAE,IAAK,CAEvB,cAAc,CAAE,GAAI,CAgCvB,AA5DL,IAAI,CAAG,uBAAuB,CAe1B,qBAAqB,CAiBjB,MAAM,CAAA,AAAA,KAAC,AAAA,CAAM,CAET,YAAY,CAAE,KAAM,CAgBvB,AAlDT,IAAI,CAAG,uBAAuB,CAe1B,qBAAqB,CAiBjB,MAAM,CAAA,AAAA,KAAC,AAAA,CAIF,OAAO,AAAA,CACJ,OAAO,CAAE,EAAG,CACR,OAAO,CAAE,YAAa,CACtB,QAAQ,CAAE,QAAS,CACf,GAAG,CAAE,KAAM,CACX,IAAI,CAAE,GAAI,CACV,KAAK,CAAE,IAAK,CACZ,MAAM,CAAE,IAAK,CAErB,aAAa,CAAE,SAAU,CACzB,UAAU,CAAE,KAAK,CAAE,IAAG,CAAC,GAAG,CAAC,GAAG,CAAC,kBAAI,CAEnC,gBAAgB,CAAE,GAAI,CACzB,AAjDb,IAAI,CAAG,uBAAuB,CAe1B,qBAAqB,CAsCjB,MAAM,AAAA,QAAQ,AAAA,OAAO,AAAA,CAAE,gBAAgB,CAAE,OAAQ,CAAI,AArD7D,IAAI,CAAG,uBAAuB,CAe1B,qBAAqB,CAwCjB,MAAM,AAAA,KAAK,AAAA,OAAO,AAAA,CAAE,gBAAgB,CAAE,OAAQ,CAAI,AAvD1D,IAAI,CAAG,uBAAuB,CAe1B,qBAAqB,CA0CjB,MAAM,AAAA,QAAQ,AAAA,OAAO,AAAA,CAAE,gBAAgB,CAAE,OAAQ,CAAI,AAzD7D,IAAI,CAAG,uBAAuB,CAe1B,qBAAqB,CA4CjB,MAAM,AAAA,MAAM,AAAA,OAAO,AAAA,CAAE,gBAAgB,CAAE,OAAQ,CAAI",
"names": []
}

View File

@ -1,8 +1,8 @@
function inputPhoneContact(a,c){this.container=a;this.nav_container=c}inputPhoneContact.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null};
inputPhoneContact.prototype.fieldsToStorage=function(){console.log("CONTACTS: FIELDS TO STORAGE");for(var a=$$("article.contact-panel .new-contact"),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input"],["data-name"])).deflate(),d=0<b.number.length;if(d=d&&0<b.username.length+b.firstname.length+b.lastname.length)d={uid:parseInt(b.uid),number:b.number,username:b.username,firstname:b.firstname,lastname:b.lastname,call:parseInt(b.call),sms:parseInt(b.sms),countcall:parseInt(b.countcall),countsms:parseInt(b.countsms)},
d.hash=crc32(JSON.stringify(d)),lsi.set("contacts",parseInt(b.uid),d)}};
function inputPhoneContact(a,b){this.container=a;this.nav_container=b}inputPhoneContact.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null};inputPhoneContact.prototype.check=function(a){var b=0<a.number.length;return b=b&&0<a.username.length+a.firstname.length+a.lastname.length};
inputPhoneContact.prototype.fieldsToStorage=function(){console.log("CONTACTS: FIELDS TO STORAGE");for(var a=$$("article.contact-panel .new-contact"),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input"],["data-name"])).deflate();if(this.check(c)){var d={uid:parseInt(c.uid),number:c.number,username:c.username,firstname:c.firstname,lastname:c.lastname,call:parseInt(c.call),sms:parseInt(c.sms),countcall:parseInt(c.countcall),countsms:parseInt(c.countsms)};d.hash=crc32(JSON.stringify(d));lsi.set("contacts",
parseInt(c.uid),d)}}};
inputPhoneContact.prototype.add=function(a){console.log("CONTACTS: ADD");if(null==a||null==a.uid||isNaN(a.uid))return!1;a.number=null!=a.number?a.number:"";a.username=null!=a.username?a.username:"";a.firstname=null!=a.firstname?a.firstname:"";a.lastname=null!=a.lastname?a.lastname:"";a.call=null!=a.call?a.call:-1;a.sms=null!=a.sms?a.sms:-1;a.countcall=null!=a.countcall?a.countcall:0;a.countsms=null!=a.countsms?a.countsms:0;this.container.innerHTML+=contactBuilder.build(a);a=$$("article.contact-panel .new-contact");
for(var c=this,b=0;b<a.length;b++)a[b].removeEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1),a[b].addEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1)};inputPhoneContact.prototype.storageToFields=function(){console.log("CONTACTS: STORAGE TO FIELDS");var a=lsi.keys("contacts");this.container.innerHTML="";for(var c=this.selected+10,b=this.selected;b<c&&b<a.length;b++)this.add(lsi.get("contacts",a[b]));c>=a.length&&this.add({uid:a.length});this.updateNavBar()};
inputPhoneContact.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"nav-contact"!=a.parentNode.id)return!1;for(var c=$$("#nav-contact > span.active"),b=0;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
inputPhoneContact.prototype.updateNavBar=function(){var a=lsi.keys("contacts").length;if(this.nav_container.children.length!=a){this.nav_container.innerHTML="";for(var c=0;c<a;c+=10)this.nav_container.innerHTML+='<span data-n="'+c+'">'+(1+c/10)+"</span>"}this.nav($('#nav-contact [data-n="'+this.selected+'"]'))};
inputPhoneContact.prototype.attach=function(a){console.log("CONTACTS: ATTACH");lsi.createDataset("contacts");this.storageToFields();this.handler=a;var c=this;this.nav_container.addEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1)};
for(var b=this,c=0;c<a.length;c++)a[c].removeEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1),a[c].addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};inputPhoneContact.prototype.storageToFields=function(){console.log("CONTACTS: STORAGE TO FIELDS");var a=lsi.keys("contacts");this.container.innerHTML="";for(var b=this.selected+10,c=this.selected;c<b&&c<a.length;c++)this.add(lsi.get("contacts",a[c]));b>=a.length&&this.add({uid:a.length});this.updateNavBar()};
inputPhoneContact.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"nav-contact"!=a.parentNode.id)return!1;for(var b=$$("#nav-contact > span.active"),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
inputPhoneContact.prototype.updateNavBar=function(){var a=lsi.keys("contacts").length;if(this.nav_container.children.length!=a){this.nav_container.innerHTML="";for(var b=0;b<a;b+=10)this.nav_container.innerHTML+='<span data-n="'+b+'">'+(1+b/10)+"</span>"}this.nav($('#nav-contact [data-n="'+this.selected+'"]'))};
inputPhoneContact.prototype.attach=function(a){console.log("CONTACTS: ATTACH");lsi.createDataset("contacts");this.storageToFields();this.handler=a;var b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};

View File

@ -15,7 +15,21 @@ inputPhoneContact.prototype = {
};
/* [2] Gestion de l'enregistrement des formulaires de contact
/* [2] Vérification des données d'un contact
=========================================================*/
inputPhoneContact.prototype.check = function(deflated){
/* (1) Le numéro n'est pas vide */
var validForm = deflated.number.length > 0;
/* (2) ET le pseudo et/ou le prénom et/ou le nom n'est pas vide */
validForm = validForm && deflated.username.length+deflated.firstname.length+deflated.lastname.length > 0;
/* (3) On retourne la validité du formulaire */
return validForm
}
/* [3] Gestion de l'enregistrement des formulaires de contact
=========================================================*/
inputPhoneContact.prototype.fieldsToStorage = function(){
console.log('CONTACTS: FIELDS TO STORAGE');
@ -30,13 +44,8 @@ inputPhoneContact.prototype.fieldsToStorage = function(){
// {3} On enregistre ce contact si le numéro n'est pas vide et soit pseudo/prénom/nom //
var deflated = deflater.deflate();
// Le numéro n'est pas vide
var validForm = deflated.number.length > 0;
// ET le pseudo et/ou le prénom et/ou le nom n'est pas vide
validForm = validForm && deflated.username.length+deflated.firstname.length+deflated.lastname.length > 0;
// Si le formulaire n'est pas valide, on ne l'enregistre pas
if( !validForm ) continue;
if( !this.check(deflated) ) continue;
// {4} On récupère et met en forme les valeurs du deflater //
var obj = {
@ -71,7 +80,7 @@ inputPhoneContact.prototype.fieldsToStorage = function(){
/* [3] Gestion de l'ajout physique d'un nouveau contact
/* [4] Gestion de l'ajout physique d'un nouveau contact
=========================================================*/
/*
*
@ -120,7 +129,7 @@ inputPhoneContact.prototype.add = function(objectData){
/* [4] Gestion de l'affichage depuis le 'localStorage'
/* [5] Gestion de l'affichage depuis le 'localStorage'
=========================================================*/
inputPhoneContact.prototype.storageToFields = function(){
console.log('CONTACTS: STORAGE TO FIELDS');
@ -208,7 +217,7 @@ inputPhoneContact.prototype.updateNavBar = function(){
/* [5] Point d'amorçage de la gestion des contacts
/* [8] Point d'amorçage de la gestion des contacts
=========================================================*/
inputPhoneContact.prototype.attach = function(handler){
console.log('CONTACTS: ATTACH');

View File

@ -11,10 +11,10 @@ for(b=0;b<c.length;b++)c[b].value==a.reltype?c[b].setAttribute("checked","checke
c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="freq"]');for(b=0;b<c.length;b++)-1<a.freq.indexOf(c[b].value)?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect"]');for(b=0;b<c.length;b++)-1<a.connect.indexOf(c[b].value)?c[b].setAttribute("checked",
"checked"):c[b].removeAttribute("checked")};inputPhoneFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi["export"]("fiches");this.container.innerHTML="";for(var b in a)a[b].uid==this.selected&&this.add(a[b]);this.updateNavBar()};
inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");var a=lsi["export"]("contacts"),b=[],c;for(c in a){if(-1<a[c].call){var f=a[c].call;b.push(f);var d=lsi.get("fiches",f);null==d&&(d=this.defaultData);d.uid=f;d.contact=parseInt(c);lsi.set("fiches",f,d)}-1<a[c].sms&&(f=10+a[c].sms,b.push(f),d=lsi.get("fiches",f),null==d&&(d=this.defaultData),d.uid=f,d.contact=parseInt(c),lsi.set("fiches",f,d))}if(20>b.length)for(c in a){for(a=0;-1<b.indexOf(a)&&20>a;)a++;b.push(a);d=lsi.get("fiches",
a);null==d&&(d=this.defaultData);d.uid=a;d.contact=c;lsi.set("fiches",a,d);if(20<=b.length)break}var d=lsi["export"]("fiches"),e;for(e in d)miniData=lsi.get("mini-fiches",d[e].contact),d[e].timestamp>miniData.timestamp?(miniData.sexe=d[e].sexe,miniData.age=d[e].age,miniData.studies=d[e].studies,miniData.loc=d[e].loc,miniData.reltype=d[e].reltype,miniData.reltypeSpecial=d[e].reltypeSpecial):(d[e].sexe=miniData.sexe,d[e].age=miniData.age,d[e].studies=miniData.studies,d[e].loc=miniData.loc,d[e].reltype=
miniData.reltype,d[e].reltypeSpecial=miniData.reltypeSpecial),lsi.set("mini-fiches",d[e].contact,miniData),lsi.set("fiches",e,d[e]);for(e in d)b=lsi.get("contacts",d[e].contact),null!=b&&-1!=b.sms&&-1!=b.call&&(b=10>parseInt(e)?10+b.sms:b.call,b=d[b],b.timestamp>=d[e].timestamp||(c=d[e],c.uid=b.uid,lsi.set("fiches",b.uid,c)))};
a);null==d&&(d=this.defaultData);d.uid=a;d.contact=c;lsi.set("fiches",a,d);if(20<=b.length)break}var d=lsi["export"]("fiches"),e;for(e in d)miniData=lsi.get("mini-fiches",d[e].contact),null==miniData.timestamp||d[e].timestamp>miniData.timestamp?(miniData.sexe=d[e].sexe,miniData.age=d[e].age,miniData.studies=d[e].studies,miniData.loc=d[e].loc,miniData.reltype=d[e].reltype,miniData.reltypeSpecial=d[e].reltypeSpecial):(d[e].sexe=miniData.sexe,d[e].age=miniData.age,d[e].studies=miniData.studies,d[e].loc=
miniData.loc,d[e].reltype=miniData.reltype,d[e].reltypeSpecial=miniData.reltypeSpecial),lsi.set("mini-fiches",d[e].contact,miniData),lsi.set("fiches",e,d[e]);for(e in d)b=lsi.get("contacts",d[e].contact),null!=b&&-1!=b.sms&&-1!=b.call&&(b=10>parseInt(e)?10+b.sms:b.call,b=d[b],b.timestamp>=d[e].timestamp||(c=d[e],c.uid=b.uid,lsi.set("fiches",b.uid,c)))};
inputPhoneFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"nav-fiche"!=a.parentNode.id)return!1;for(var b=$$("#nav-fiche > span.active"),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("fiches"),b=lsi.keys("fiches").length;if($$("#nav-fiche [data-n]").length!=b){this.nav_container.innerHTML="<span>APPELS</span>";for(var c=0;c<b;c++)9==c?this.nav_container.innerHTML+='<span data-n="'+c+'" class="lc">'+(c%10+1)+"</span>&nbsp;&nbsp;":(10==c&&(this.nav_container.innerHTML+='<span class="fc">SMS</span>'),this.nav_container.innerHTML+='<span data-n="'+c+'">'+(c%10+1)+"</span>")}for(var f in a)b=$('#nav-fiche [data-n="'+
a[f].uid+'"]'),null!=b&&(!0===a[f].valid?b.addClass("done"):b.remClass("done"));this.nav($('#nav-fiche [data-n="'+this.selected+'"]'))};
inputPhoneFiche.prototype.check=function(a){if(2>a.city.length||isNaN(parseInt(a.duration[0]))&&0<a.duration[0].length||isNaN(parseInt(a.duration[1]))&&0<a.duration[1].length||0==a.duration[0].length+a.duration[1].length||"."==a.job||"."==a.studies||"."==a.age||!checkRadioValue(a.sexe)||!checkRadioValue(a.famsit)||!checkRadioValue(a.reltype)||!checkRadioValue(a.loc)||!checkRadioValue(a.context))return!1;for(var b=0;b<a.freq.length;b++)if(!checkRadioValue(a.freq[b]))return!1;for(b=0;b<a.connect.length;b++)if(!checkRadioValue(a.connect[b]))return!1;
return a.reltype[8].status&&2>a.reltypeSpecial.length||a.context[11].status&&2>a.contextSpecial[0].length||a.context[12].status&&2>a.contextSpecial[1].length||a.context[13].status&&2>a.contextSpecial[2].length?!1:!0};inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("fiches");this.storageToFields();this.handler=a;var b=this,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};
inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("fiches"),b=lsi.keys("fiches").length;if($$("#nav-fiche [data-n]").length!=b){this.nav_container.innerHTML="";for(var c=0;c<b;c++)0==c&&(this.nav_container.innerHTML+="<span>APPELS</span>"),9==c?this.nav_container.innerHTML+='<span data-n="'+c+'" class="lc">'+(c%10+1)+"</span>&nbsp;&nbsp;":(10==c&&(this.nav_container.innerHTML+='<span class="fc">SMS</span>'),this.nav_container.innerHTML+='<span data-n="'+c+'">'+(c%10+1)+"</span>")}for(var f in a)b=
$('#nav-fiche [data-n="'+a[f].uid+'"]'),null!=b&&(!0===a[f].valid?b.addClass("done"):b.remClass("done"));this.nav($('#nav-fiche [data-n="'+this.selected+'"]'))};
inputPhoneFiche.prototype.check=function(a){if(2>a.city.length||isNaN(parseInt(a.duration[0]))&&0<a.duration[0].length||isNaN(parseInt(a.duration[1]))&&0<a.duration[1].length||0==a.duration[0].length+a.duration[1].length||"."==a.job||"."==a.studies||"."==a.age||""==a.sexe||""==a.famsit||""==a.reltype||""==a.loc||""==a.context)return!1;for(var b=0;b<a.freq.length;b++)if(""==a.freq[b])return!1;for(b=0;b<a.connect.length;b++)if(""==a.connect[b])return!1;return"8"==a.reltype&&2>a.reltypeSpecial.length||
"11"==a.context&&2>a.contextSpecial[0].length||"12"==a.context&&2>a.contextSpecial[1].length||"13"==a.context&&2>a.contextSpecial[2].length?!1:!0};inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("fiches");this.storageToFields();this.handler=a;var b=this,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};

View File

@ -25,8 +25,8 @@ inputPhoneFiche.prototype = {
duration: ['', ''],
context: '0', // Choix 1 à 14
contextSpecial: ['', '', ''],
freq: ['0', '4', '8', '12', '16'],
connect: ['1', '3', '5', '7', '9', '11'],
freq: ['0', '4', '8', '12', '16'], // 1er choix des 4 pour chaque question
connect: ['1', '3', '5', '7', '9', '11'], // Le deuxième choix (Oui/Non) donc 'Non' par défaut pour chaque question
connectSpecial: ['', ''],
timestamp: 0,
valid: false
@ -401,7 +401,7 @@ inputPhoneFiche.prototype.sync = function(){
for( var key in ficheData ){
miniData = lsi.get('mini-fiches', ficheData[key].contact);
var ficheModifiedLast = ficheData[key].timestamp > miniData.timestamp;
var ficheModifiedLast = miniData.timestamp == null || ficheData[key].timestamp > miniData.timestamp;
/* (3) Si la FICHE a été modifiée en dernier, on utilise ses données */
if( ficheModifiedLast ){
@ -509,9 +509,13 @@ inputPhoneFiche.prototype.updateNavBar = function(){
/* (2) On vide et remplit la barre de nav, si elle n'est pas à jour */
if( !navBarUpToDate ){
this.nav_container.innerHTML = '<span>APPELS</span>';
this.nav_container.innerHTML = '';
for( var i = 0 ; i < len ; i++ ){
// Si 1ère valeur du top 10 des APPELS, on ajoute le bandeau "APPELS"
if( i == 0 )
this.nav_container.innerHTML += '<span>APPELS</span>';
for( var i = 0 ; i < len ; i++ )
// Si fin du top 10 des APPELS, on met un espace et un border-right
if( i == 9 )
this.nav_container.innerHTML += '<span data-n="'+i+'" class="lc">'+(i%10 + 1)+'</span>&nbsp;&nbsp;';
@ -524,6 +528,7 @@ inputPhoneFiche.prototype.updateNavBar = function(){
// Sinon, on ajoute juste le bouton
}else
this.nav_container.innerHTML += '<span data-n="'+i+'">'+(i%10 + 1)+'</span>';
}
}
/* (3) On montre les FICHES qui sont correctes */
@ -581,43 +586,43 @@ inputPhoneFiche.prototype.check = function(ficheData){
// {3} Vérification des <input> radio //
// 8. Le SEXE a un et un seul choix
if( !checkRadioValue(ficheData.sexe) )
if( ficheData.sexe == '' )
return false;
// 9. La SITUATION FAMILIALE a un et un seul choix
if( !checkRadioValue(ficheData.famsit) )
if( ficheData.famsit == '' )
return false;
// 10. Le TYPE DE RELATION a un et un seul choix
if( !checkRadioValue(ficheData.reltype) )
if( ficheData.reltype == '' )
return false;
// 11. La DISTANCE DE DOMICILE (location) a un et un seul choix
if( !checkRadioValue(ficheData.loc) )
if( ficheData.loc == '' )
return false;
// 12. Le CONTEXTE DE RENCONTRE a un et un seul choix
if( !checkRadioValue(ficheData.context) )
if( ficheData.context == '' )
return false;
// 13. Les FRÉQUENCES ont un et un seul choix (par question de fréquence)
for( var i = 0 ; i < ficheData.freq.length ; i++ )
if( !checkRadioValue( ficheData.freq[i] ) )
if( ficheData.freq[i] == '' )
return false;
// 14. Les CONNECTION ont un et un seul choix (par question de connection)
for( var i = 0 ; i < ficheData.connect.length ; i++ )
if( !checkRadioValue( ficheData.connect[i] ) )
if( ficheData.connect[i] == '' )
return false;
// {4} <input> dépendant d'un choix d'un <input> radio //
// 15. TYPE DE RELATION si autre est coché (indice 8), reltypeSpecial doit avoir au moins 2 caractère
if( ficheData.reltype[8].status && ficheData.reltypeSpecial.length < 2 )
if( ficheData.reltype == '8' && ficheData.reltypeSpecial.length < 2 )
return false;
// 16. CONTEXTE DE RELATION si est coché indice 11, contactSpecial[0] doit avoir au moins 2 caractères
if( ficheData.context[11].status && ficheData.contextSpecial[0].length < 2 )
if( ficheData.context == '11' && ficheData.contextSpecial[0].length < 2 )
return false;
// 17. CONTEXTE DE RELATION si est coché indice 12, contextSpecial[1] doit avoir au moins 2 caractères
if( ficheData.context[12].status && ficheData.contextSpecial[1].length < 2 )
if( ficheData.context == '12' && ficheData.contextSpecial[1].length < 2 )
return false;
// 18. CONTEXTE DE RELATION si est coché indice 13, contextSpecial[2] doit avoir au moins 2 caractères
if( ficheData.context[13].status && ficheData.contextSpecial[2].length < 2 )
if( ficheData.context == '13' && ficheData.contextSpecial[2].length < 2 )
return false;

View File

@ -1,5 +1,5 @@
function inputPhoneMatrice(a){this.container=a}inputPhoneMatrice.prototype={container:this.container};
inputPhoneMatrice.prototype.fieldsToStorage=function(){console.log("MATRICE: FIELDS TO STORAGE");var a=(new FormDeflater(this.container,["input"],["data-name"])).deflate();crc32(JSON.stringify(a));console.log(a);var d={},b;for(b in a)if(a[b]instanceof Array)for(var g in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][g]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("matrice",0,d)};
inputPhoneMatrice.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 g in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][g]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("matrice",0,d)};
inputPhoneMatrice.prototype.storageToFields=function(){console.log("MATRICE: STORAGE TO FIELDS");var a=lsi["export"]("fiches"),d=lsi.get("matrice",0),b=lsi["export"]("contacts"),g=[],c;for(c in a)-1==g.indexOf(a[c].contact)&&g.push(a[c].contact);a="<table class='line'>";for(c=0;c<g.length;c++){var e=b[c],a=a+"<tr>";0<c?(a+='<td style="text-align: right;">',a+=e.firstname+" "+e.lastname,a+=0<e.username.length?" ("+e.username+")":"",a+="</td>"):a+="<td></td>";for(var h=0;h<g.length;h++)if(h<g.length-
1){var f=b[h];0==c?(a+="<td>",a+='<span style="writing-mode: vertical-lr; text-align: right;">',a+=f.firstname+" "+f.lastname,a+=0<f.username.length?" ("+f.username+")":"",a+="</span>"):h<c?(a+="<td>",a+="<input type='checkbox' name='matrice_"+e.uid+"_"+f.uid+"' data-name='"+e.uid+"' value='"+f.uid+"' id='matrice_"+e.uid+"_"+f.uid+"'",null!=d[c]&&-1<d[c].indexOf(h)&&(a+=" checked"),a+=" >",a+="<label for='matrice_"+e.uid+"_"+f.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=
a+"</table>"};inputPhoneMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();a.storageToFields()},!1)};

View File

@ -26,7 +26,7 @@ inputPhoneMatrice.prototype.fieldsToStorage = function(){
var deflatedHash = crc32(JSON.stringify(deflated));
console.log(deflated);
// console.log(deflated);
/* (3) On crée l'objet et on le remplit avec les relations */
var obj = {};
@ -45,12 +45,12 @@ inputPhoneMatrice.prototype.fieldsToStorage = function(){
}
// {2} Si il n'y a qu'un sujet //
}else if( deflated[i] !== null ){
if( obj[i] == null )
obj[i] = [];
}else if( deflated[i] !== null ){
if( obj[i] == null )
obj[i] = [];
obj[i].push( parseInt(deflated[i]) );
}
obj[i].push( parseInt(deflated[i]) );
}
lsi.set( 'matrice', 0, obj );
// Objet de la forme

View File

@ -7,4 +7,4 @@ a.age+'"]');null!=b&&b.setAttribute("selected","selected");for(var c=$$('article
c[b].removeAttribute("checked");c=$$('article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(b=0;b<c.length;b++)c[b].value==a.loc?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked")};inputPhoneMini.prototype.storageToFields=function(){console.log("MINI FICHE: STORAGE TO FIELDS");var a=lsi.get("mini-fiches",this.selected);this.container.innerHTML="";this.add(a);this.updateNavBar()};
inputPhoneMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");var a=lsi["export"]("contacts"),b;for(b in a){var c=lsi.get("mini-fiches",b);null==c&&(c=this.defaultData,c.valid=!1);c.uid=a[b].uid;lsi.set("mini-fiches",b,c)}};inputPhoneMini.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"nav-mini"!=a.parentNode.id)return!1;for(var b=$$("#nav-mini > span.active"),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
inputPhoneMini.prototype.updateNavBar=function(){var a=lsi["export"]("mini-fiches"),b=Object.keys(a).length;if($$("#nav-mini [data-n]").length!=b){this.nav_container.innerHTML="";for(var c=0;c<b;c++)this.nav_container.innerHTML+='<span data-n="'+c+'">'+(c+1)+"</span>"}for(var e in a)b=$('#nav-mini [data-n="'+a[e].uid+'"]'),null!=b&&(!0===a[e].valid?b.addClass("done"):b.remClass("done"));this.nav($('#nav-mini [data-n="'+this.selected+'"]'))};
inputPhoneMini.prototype.check=function(a){return!checkRadioValue(a.sexe)||"."==a.studies||"."==a.age||!checkRadioValue(a.loc)||!checkRadioValue(a.reltype)||a.reltype[8].status&&2>a.reltypeSpecial.length?!1:!0};inputPhoneMini.prototype.attach=function(a){console.log("MINI FICHE: ATTACH");lsi.createDataset("mini-fiches");this.storageToFields();this.handler=a;var b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};
inputPhoneMini.prototype.check=function(a){return""==a.sexe||"."==a.studies||"."==a.age||""==a.loc||""==a.reltype||"8"==a.reltype&&2>a.reltypeSpecial.length?!1:!0};inputPhoneMini.prototype.attach=function(a){console.log("MINI FICHE: ATTACH");lsi.createDataset("mini-fiches");this.storageToFields();this.handler=a;var b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};

View File

@ -327,7 +327,7 @@ inputPhoneMini.prototype.updateNavBar = function(){
inputPhoneMini.prototype.check = function(miniData){
// 1. Le sexe est défini
if( !checkRadioValue(miniData.sexe) )
if( miniData.sexe == '' )
return false;
// 2. Le métier est défini
if( miniData.studies == '.' )
@ -336,13 +336,13 @@ inputPhoneMini.prototype.check = function(miniData){
if( miniData.age == '.' )
return false;
// 4. La distance de localisation est définie
if( !checkRadioValue(miniData.loc) )
if( miniData.loc == '' )
return false;
// 5. Le TYPE DE RELATION a un et un seul choix
if( !checkRadioValue(miniData.reltype) )
if( miniData.reltype == '' )
return false;
// 6. TYPE DE RELATION si autre est coché (indice 8), reltypeSpecial doit avoir au moins 2 caractère
if( miniData.reltype[8].status && miniData.reltypeSpecial.length < 2 )
if( miniData.reltype == '8' && miniData.reltypeSpecial.length < 2 )
return false;

View File

@ -1,4 +1,4 @@
function inputPhoneSubject(a,b,c,d,e){this.number=a;this.username=b;this.firstname=c;this.lastname=d;this.store_button=e}inputPhoneSubject.prototype={store_button:this.store_button,number:this.number,username:this.username,firstname:this.firstname,lastname:this.lastname};
inputPhoneSubject.prototype.fieldsToStorage=function(){console.log("SUBJECT: FIELDS TO STORAGE");var a=0<this.number.value.length,a=a&&0<this.username.value.length+this.firstname.value.length+this.lastname.value.length;if(!a)return!1;lsi.set("subject",0,{number:this.number.value,username:this.username.value,firstname:this.firstname.value,lastname:this.lastname.value})};
function inputPhoneSubject(a,b,c,d,e){this.number=a;this.username=b;this.firstname=c;this.lastname=d;this.store_button=e}inputPhoneSubject.prototype={store_button:this.store_button,number:this.number,username:this.username,firstname:this.firstname,lastname:this.lastname};inputPhoneSubject.prototype.check=function(){var a=0<this.number.value.length;return a=a&&0<this.username.value.length+this.firstname.value.length+this.lastname.value.length};
inputPhoneSubject.prototype.fieldsToStorage=function(){console.log("SUBJECT: FIELDS TO STORAGE");if(!this.check())return!1;lsi.set("subject",0,{number:this.number.value,username:this.username.value,firstname:this.firstname.value,lastname:this.lastname.value})};
inputPhoneSubject.prototype.storageToFields=function(){console.log("SUBJECT: STORAGE TO FIELDS");var a=lsi.get("subject",0);null==a&&(a={number:"",username:"",firstname:"",lastname:""});this.number.value=a.number;this.username.value=a.username;this.firstname.value=a.firstname;this.lastname.value=a.lastname};
inputPhoneSubject.prototype.attach=function(){console.log("SUBJECT: ATTACH");lsi.createDataset("subject");var a=this;this.store_button.addEventListener("click",function(b){a.fieldsToStorage()},!1);this.storageToFields()};
inputPhoneSubject.prototype.attach=function(){function a(a){b.fieldsToStorage()&&b.storageToFields()}console.log("SUBJECT: ATTACH");lsi.createDataset("subject");var b=this;this.store_button.addEventListener("click",a,!1);this.number.addEventListener("blur",a,!1);this.username.addEventListener("blur",a,!1);this.firstname.addEventListener("blur",a,!1);this.lastname.addEventListener("blur",a,!1);this.storageToFields()};

View File

@ -20,19 +20,26 @@ inputPhoneSubject.prototype = {
};
/* [2] Gestion de l'enregistrement des formulaires de contact
/* [2] Vérification d'un formulaire
=========================================================*/
inputPhoneSubject.prototype.check = function(){
/* (1) Le numéro n'est pas vide */
var validForm = this.number.value.length > 0;
/* (2) ET le pseudo et/ou le prénom et/ou le nom n'est pas vide */
validForm = validForm && this.username.value.length+this.firstname.value.length+this.lastname.value.length > 0;
// On renvoie la validité du formulaire
return validForm;
};
/* [3] Gestion de l'enregistrement des formulaires de contact
=========================================================*/
inputPhoneSubject.prototype.fieldsToStorage = function(){
console.log('SUBJECT: FIELDS TO STORAGE');
// {1} Vérification des champs //
// Le numéro n'est pas vide
var validForm = this.number.value.length > 0;
// ET le pseudo et/ou le prénom et/ou le nom n'est pas vide
validForm = validForm && this.username.value.length+this.firstname.value.length+this.lastname.value.length > 0;
// Si le formulaire n'est pas valide, on ne l'enregistre pas
if( !validForm ) return false;
// {1} Si le formulaire n'est pas valide, on ne l'enregistre pas //
if( !this.check() ) return false;
// {2} On récupère et met en forme les valeurs du deflater //
var obj = {
@ -52,7 +59,7 @@ inputPhoneSubject.prototype.fieldsToStorage = function(){
/* [3] Gestion de l'affichage depuis le 'localStorage'
/* [4] Gestion de l'affichage depuis le 'localStorage'
=========================================================*/
inputPhoneSubject.prototype.storageToFields = function(){
console.log('SUBJECT: STORAGE TO FIELDS');
@ -72,7 +79,7 @@ inputPhoneSubject.prototype.storageToFields = function(){
/* [4] Point d'amorçage de la gestion des contacts
/* [5] Point d'amorçage de la gestion des contacts
=========================================================*/
inputPhoneSubject.prototype.attach = function(){
console.log('SUBJECT: ATTACH');
@ -80,10 +87,21 @@ inputPhoneSubject.prototype.attach = function(){
/* (1) On initialise le jeu de données */
lsi.createDataset('subject');
/* (2) On attache l'évènement sur le bouton d'ajout de contact */
// Pointeur pour les scopes des addEventListener()
var ptr = this;
this.store_button.addEventListener('click', function(e){ ptr.fieldsToStorage(); }, false);
// Handler de mise à jour quand les champs sont bons
function fts(e){ if( ptr.fieldsToStorage() ) ptr.storageToFields(); }
/* (3) On charge le sujet depuis la mémoire ('localStorage') */
/* (2) On attache l'évènement sur le bouton d'enregistrement */
this.store_button.addEventListener('click', fts, false);
/* (3) On attache un évènement de 'blur' sur chaque '<input type="text">' */
this.number.addEventListener( 'blur', fts, false);
this.username.addEventListener( 'blur', fts, false);
this.firstname.addEventListener( 'blur', fts, false);
this.lastname.addEventListener( 'blur', fts, false);
/* (4) On charge le sujet depuis la mémoire ('localStorage') */
this.storageToFields();
};

4
js/lib/notif-min.js vendored Normal file
View File

@ -0,0 +1,4 @@
var NotificationClass=function(a){this.container=a};NotificationClass.prototype={container:this.container,stack:[],types:["warning","info","success","error"]};NotificationClass.prototype.pushStack=function(a,d,e){if(!(a instanceof Array&&e instanceof Array))return null;var c=-1,b;for(b in a)if(-1<e.indexOf(a[b])){c=b;break}if(-1==c)return a.push(d)-1;a[c]=d;return c};
NotificationClass.prototype.hide=function(a){if(isNaN(a))return!1;a=parseInt(a);this.container.removeChild(this.stack[a].element);this.stack[a]=null};
NotificationClass.prototype.show=function(a,d,e,c){a=-1<this.types.indexOf(a)?a:this.types[0];d="string"==typeof d?d:"";e="string"==typeof e?e:"...";c="number"==typeof c?c:400;var b={element:document.createElement("div"),type:a,title:d,message:e,timeout:null};b.element.className="notification-element";b.element.innerHTML='<p><strong class="'+a+'">'+d+"</strong>: "+e+"<p>";this.container.appendChild(b.element);var f=this.pushStack(this.stack,b,[null]);b.element.id=f;var g=this;b.timeout=setTimeout(function(){g.hide(f)},
c)};

142
js/lib/notif.js Normal file
View File

@ -0,0 +1,142 @@
/* [0] CONSTRUCTEUR
=========================================================*/
var NotificationClass = function(container){
this.container = container;
};
/* [1] PROTOTYPE ET ATTRIBUTS
=========================================================*/
NotificationClass.prototype = {
container: this.container, // Parent de la page à notifier
stack: [], // Contiendra les données de toutes les notifications actives
types: [ // Définition des différents types
'warning',
'info',
'success',
'error'
]
};
/* [2] AJOUT D'UN ELEMENT DANS LA PILE
=========================================================*/
/*
*
* @stack<Array> Pile dans laquelle on veut ajouter un élément
* @element<Mixed> Elément que l'on veut ajouter à la pile
* @emptyValues<Array> Liste des valeurs à considérer comme 'vides'
*
*/
NotificationClass.prototype.pushStack = function(stack, element, emptyValues){
/* (0) Vérification des INPUT
---------------------------------------------------------*/
/* (1) Vérification de @stack */
if( !(stack instanceof Array) )
return null;
/* (2) Vérification de @emptyValues */
if( !(emptyValues instanceof Array) )
return null;
/* (1) On cherche la première valeur vide dans @stack
---------------------------------------------------------*/
var index = -1;
for( var i in stack )
if( emptyValues.indexOf(stack[i]) > -1 ){
index = i;
break;
}
/* (2) Insertion et résultat
---------------------------------------------------------*/
/* (1) Si on a rien trouvé, on fait un push normal */
if( index == -1 )
return stack.push(element) - 1;
/* (2) Si on a trouvé, on enregistre @element et on renvoie @index */
stack[index] = element;
return index;
};
/* [3] SUPPRESSION D'UNE NOTIFICATION
=========================================================*/
/*
*
* @id<int> Id de la notification dans la pile
*
*/
NotificationClass.prototype.hide = function(id){
/* (0) Vérification de @id */
if( isNaN(id) )
return false;
id = parseInt(id);
/* (1) Suppression de l'élément */
this.container.removeChild( this.stack[id].element );
/* (2) On supprime la notification de la pile */
this.stack[id] = null;
};
/* [4] AFFICHAGE D'UNE NOTIFICATION
=========================================================*/
/*
*
* @type<String> Type de notification parmi 'warning', 'info', 'success', 'error'
* @title<String> Titre de la notification
* @message<String> Message de la notification
* @timeout<int> Temps d'apparition de la notification en ms (millisecondes)
*
*/
NotificationClass.prototype.show = function(type, title, message, timeout){
/* (0) Vérification des INPUT
---------------------------------------------------------*/
/* (1) Vérification de @type */
type = this.types.indexOf(type) > -1 ? type : this.types[0];
/* (2) Vérification de @title */
title = typeof title == 'string' ? title : '';
/* (3) Vérification de @message */
message = typeof message == 'string' ? message : '...';
/* (4) Vérification de @timeout */
timeout = typeof timeout == 'number' ? timeout : 400;
/* (1) Construction de l'élément
---------------------------------------------------------*/
/* (1) Création du set de données */
var stackItem = {
element: document.createElement('div'),
type: type,
title: title,
message: message,
timeout: null
};
/* (2) Construction de l'élément */
stackItem.element.className = 'notification-element';
stackItem.element.innerHTML = '<p><strong class="'+type+'">'+title+'</strong>: '+message+'<p>';
/* (2) Ajout à la pile et au DOM
---------------------------------------------------------*/
this.container.appendChild(stackItem.element);
var id = this.pushStack( this.stack, stackItem, [null] );
stackItem.element.id = id;
/* (3) Gestion du temps d'apparition
---------------------------------------------------------*/
var ptr = this;
stackItem.timeout = setTimeout(function(){
ptr.hide(id);
}, timeout);
};

View File

@ -22,6 +22,7 @@
<link type='text/css' rel='stylesheet' href='/f/css/min/css/menu-side' /> <!-- Gestion du menu -->
<link type='text/css' rel='stylesheet' href='/f/css/min/css/container' /> <!-- Gestion du container -->
<link type='text/css' rel='stylesheet' href='/f/css/min/css/global' /> <!-- Style global -->
<link type='text/css' rel='stylesheet' href='/f/css/min/css/notif' /> <!-- Inclusion du system de notifs -->
<!-- Dépendences Javascript -->
@ -33,6 +34,8 @@
<script type='text/javascript' src='/f/js/reset-min/js/lib' ></script> <!-- Corrections Javascript natif (ajouts) -->
<script type='text/javascript' src='/f/js/api-min/js/lib' ></script> <!-- Gestion des transactions avec le serveur -->
<script type='text/javascript' src='/f/js/page-manager-min/js/lib' ></script> <!-- Gestion réseau/chargement/liens/URL -->
<!-- TODO: Mettre la version min -->
<script type='text/javascript' src='/f/js/notif/js/lib' ></script> <!-- Gestion des notifications -->
<!-- Dépendences Spéficiques pré-chargeables -->
<script type='text/javascript' src='/f/js/input-html-data-min/js/includes' ></script> <!-- Gestion du constructeur HTML pour la page d'acquisition -->
@ -70,6 +73,29 @@
</div>
<!-- CONTENEUR DES NOTIFICATIONS -->
<div id='notification-container'>
<!-- <div class='notification-element'>
<p><strong class='warning'>Warning</strong> : Some warning test</p>
</div>
<div class='notification-element'>
<p><strong class='success'>Success</strong> : Some success test</p>
</div>
<div class='notification-element'>
<p><strong class='info'>Info</strong> : Some info test</p>
</div>
<div class='notification-element'>
<p><strong class='error'>Error</strong> : Some error test</p>
</div> -->
</div>
<!-- CORPS DE LA PAGE -->
<div id='WRAPPER'>

View File

@ -1 +1 @@
var instance=new FormDeflater(document.getElementById("myform"),["input"],["name","data-name"]);console.log(instance.deflate());
var instance=new FormDeflater(document.getElementById("myform"),["input"],["name","data-name"]);console.log(instance.deflate());Notification=new NotificationClass($("#notification-container"));

View File

@ -6,3 +6,6 @@ var instance = new FormDeflater(
/* (2) On récupère l'objet */
console.log( instance.deflate() );
Notification = new NotificationClass( $('#notification-container') );

17
view/js/input-min.js vendored
View File

@ -1,13 +1,14 @@
var subjectManager,contactManager,miniManager,ficheManager,matriceManager;
function dynamicUpdate(a){var f=a instanceof Element,b=f&&"SPAN"==a.tagName&&"switch-left"==a.className,e=f&&"SPAN"==a.tagName&&"switch-both"==a.className,c=f&&"INPUT"==a.tagName&&"submit"==a.type,d=f&&"SPAN"==a.tagName&&("nav-mini"==a.parentNode.id||"nav-fiche"==a.parentNode.id),f=f&&"SPAN"==a.tagName&&"nav-contact"==a.parentNode.id;if(!(e||b||c||d||f)&&!0!==a)return!1;if(e)console.log("> switch firstname <-> lastname"),b=a.parentNode,a=b.children[8],b=b.children[10],e=a.value,a.value=b.value,b.value=
e;else if(b){console.log("> switch firstname+lastname -> username");b=a.parentNode;e=b.children[6];a=b.children[8];b=b.children[10];if(0<e.value.length||0==a.value.length&&0==b.value.length)return!1;e.value=a.value+" "+b.value;a.value="";b.value=""}else console.log("> dynamic update"),miniManager.fieldsToStorage(),ficheManager.fieldsToStorage(),contactManager.fieldsToStorage(),matriceManager.fieldsToStorage(),miniManager.sync(),ficheManager.sync(),miniManager.storageToFields(),ficheManager.storageToFields(),
matriceManager.storageToFields(),(c||f)&&contactManager.storageToFields()}function checkRadioValue(a){for(var f=0,b=0;b<a.length;b++)!0===a[b].status&&f++;return 1!=f?!1:!0}
function dynamicUpdate(a){var e=a instanceof Element,c=e&&"SPAN"==a.tagName&&"switch-left"==a.className,f=e&&"SPAN"==a.tagName&&"switch-both"==a.className,b=e&&"INPUT"==a.tagName&&"submit"==a.type,d=e&&"SPAN"==a.tagName&&("nav-mini"==a.parentNode.id||"nav-fiche"==a.parentNode.id),e=e&&"SPAN"==a.tagName&&"nav-contact"==a.parentNode.id;if(!(f||c||b||d||e)&&!0!==a)return!1;if(f)console.log("> switch firstname <-> lastname"),c=a.parentNode,a=c.children[8],c=c.children[10],f=a.value,a.value=c.value,c.value=
f;else if(c){console.log("> switch firstname+lastname -> username");c=a.parentNode;f=c.children[6];a=c.children[8];c=c.children[10];if(0<f.value.length||0==a.value.length&&0==c.value.length)return!1;f.value=a.value+" "+c.value;a.value="";c.value=""}else console.log("> dynamic update"),miniManager.fieldsToStorage(),ficheManager.fieldsToStorage(),contactManager.fieldsToStorage(),matriceManager.fieldsToStorage(),miniManager.sync(),ficheManager.sync(),miniManager.storageToFields(),ficheManager.storageToFields(),
matriceManager.storageToFields(),(b||e)&&contactManager.storageToFields()}
include("/js/includes/input-phone-subject.js",function(){include("/js/includes/input-phone-contact.js",function(){include("/js/includes/input-phone-mini.js",function(){include("/js/includes/input-phone-fiche.js",function(){include("/js/includes/input-phone-matrice.js",function(){subjectManager=new inputPhoneSubject($('article.subject-panel [data-name="number"]'),$('article.subject-panel [data-name="username"]'),$('article.subject-panel [data-name="firstname"]'),$('article.subject-panel [data-name="lastname"]'),
$('article.subject-panel [data-name="submit"]'));subjectManager.attach();contactManager=new inputPhoneContact($("article.contact-panel"),$("#nav-contact"));contactManager.attach(dynamicUpdate);miniManager=new inputPhoneMini($("article.mini-relation-panel"),$("#nav-mini"));miniManager.attach(dynamicUpdate);ficheManager=new inputPhoneFiche($("article.relation-panel"),$("#nav-fiche"));ficheManager.attach(dynamicUpdate);matriceManager=new inputPhoneMatrice($("article.matrice-panel"));matriceManager.attach(dynamicUpdate);
$('input#call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('input#call_log-import[type="file"]').addEventListener("change",function(a){a={path:"upload/call_log",phone_number:$("#subject_phone_number").value,file:a.target.files[0]};api.send(a,function(a){console.log(a);if(0==a.ModuleError){for(var b=0,e=[],c=0;c<a.calls.length&&10>c;c++)e.push(a.calls[c].number);for(c=0;c<e.length;c++){var d=a.directory[e[c]].name.split(" ");lsi.set("contacts",b,{uid:b,
number:e[c],username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[e[c]].sms,countcall:a.directory[e[c]].calls,call:c,sms:-1});b++}for(var g=[],c=0;c<a.sms.length&&10>c;c++)g.push(a.sms[c].number);for(c=0;c<g.length;c++)if(d=e.indexOf(g[c]),-1<d){var k=lsi.get("contacts",d);k.sms=c;lsi.set("contacts",d,k)}else d=a.directory[g[c]].name.split(" "),lsi.set("contacts",b,{uid:b,number:g[c],username:1==d.length?d[0]:"",firstname:1<d.length?
d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[g[c]].sms,countcall:a.directory[g[c]].calls,call:-1,sms:c}),b++;for(var h in a.directory)-1<e.indexOf(h)||-1<g.indexOf(h)||(d=(null===a.directory[h].name?"":a.directory[h].name).split(" "),lsi.set("contacts",b,{uid:b,number:h,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[h].sms,countcall:a.directory[h].calls,call:-1,sms:-1}),b++);contactManager.storageToFields();
$('input#call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('input#call_log-import[type="file"]').addEventListener("change",function(a){a={path:"upload/call_log",phone_number:$("#subject_phone_number").value,file:a.target.files[0]};api.send(a,function(a){console.log(a);if(0==a.ModuleError){for(var c=0,f=[],b=0;b<a.calls.length&&10>b;b++)f.push(a.calls[b].number);for(b=0;b<f.length;b++){var d=a.directory[f[b]].name.split(" ");lsi.set("contacts",c,{uid:c,
number:f[b],username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[f[b]].sms,countcall:a.directory[f[b]].calls,call:b,sms:-1});c++}for(var g=[],b=0;b<a.sms.length&&10>b;b++)g.push(a.sms[b].number);for(b=0;b<g.length;b++)if(d=f.indexOf(g[b]),-1<d){var k=lsi.get("contacts",d);k.sms=b;lsi.set("contacts",d,k)}else d=a.directory[g[b]].name.split(" "),lsi.set("contacts",c,{uid:c,number:g[b],username:1==d.length?d[0]:"",firstname:1<d.length?
d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[g[b]].sms,countcall:a.directory[g[b]].calls,call:-1,sms:b}),c++;for(var h in a.directory)-1<f.indexOf(h)||-1<g.indexOf(h)||(d=(null===a.directory[h].name?"":a.directory[h].name).split(" "),lsi.set("contacts",c,{uid:c,number:h,username:1==d.length?d[0]:"",firstname:1<d.length?d[0]:"",lastname:1<d.length?d.splice(1).join(" "):"",countsms:a.directory[h].sms,countcall:a.directory[h].calls,call:-1,sms:-1}),c++);contactManager.storageToFields();
dynamicUpdate(!0)}})},!1);$("#clear-all").addEventListener("click",function(a){lsi.clear("subject");lsi.clear("contacts");lsi.clear("mini-fiches");lsi.clear("fiches");lsi.clear("matrice");subjectManager.storageToFields();contactManager.storageToFields();miniManager.storageToFields();ficheManager.storageToFields();matriceManager.storageToFields()},!1);$("#export-all").addEventListener("click",function(a){a={subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),
fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};var f=$("#download-target");f.download="local-data.json";f.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));f.click()},!1);$("#import-all").addEventListener("click",function(a){$("#local-upload").click()},!1);$("#local-upload").addEventListener("click",function(a){a.target.value=null},!1);$("#local-upload").addEventListener("change",function(a){a={path:"upload/local_data",file:$("#local-upload").files[0]};
fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};var e=$("#download-target");e.download="local-data.json";e.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));e.click()},!1);$("#import-all").addEventListener("click",function(a){$("#local-upload").click()},!1);$("#local-upload").addEventListener("click",function(a){a.target.value=null},!1);$("#local-upload").addEventListener("change",function(a){a={path:"upload/local_data",file:$("#local-upload").files[0]};
api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return!1;console.log(a.local_data.matrice);lsi.set("subject",0,a.local_data.subject);lsi["import"]("contacts",a.local_data.contacts);lsi["import"]("mini-fiches",a.local_data.mini);lsi["import"]("fiches",a.local_data.fiches);lsi.set("matrice",0,a.local_data.matrice);subjectManager.storageToFields();contactManager.storageToFields();matriceManager.storageToFields();dynamicUpdate(!0)})},!1);$("#submit-all").addEventListener("click",function(a){console.log("> GATHERING ALL DATA");
subjectManager.fieldsToStorage();contactManager.fieldsToStorage();miniManager.fieldsToStorage();ficheManager.fieldsToStorage();a={path:"input/phone",subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};api.send(a,function(a){console.log(a)},!1)},!1)})})})})});
subjectManager.fieldsToStorage();contactManager.fieldsToStorage();miniManager.fieldsToStorage();ficheManager.fieldsToStorage();if(!subjectManager.check())return!1;a=lsi["export"]("mini-fiches");for(var e in a)if(!a[e].valid)return!1;a=lsi["export"]("fiches");for(e in a)if(!a[e].valid)return!1;e={path:"input/phone",subject:lsi["export"]("subject")[0],contacts:lsi["export"]("contacts"),mini:lsi["export"]("mini-fiches"),fiches:lsi["export"]("fiches"),matrice:lsi["export"]("matrice")[0]};api.send(e,function(a){console.log(a)},
!1)},!1)})})})})});

View File

@ -111,22 +111,6 @@ function dynamicUpdate(target){
}
}
// Vérifie qu'une seule valeur vaut TRUE et les autres false (objet deflated de type <radio> )
function checkRadioValue(selectData){
var nbTrue = 0;
for( var i = 0 ; i < selectData.length ; i++ )
if( selectData[i].status === true )
nbTrue++;
if( nbTrue != 1 ) return false;
else return true;
}
@ -465,7 +449,24 @@ include('/js/includes/input-phone-matrice.js', function(){
miniManager.fieldsToStorage();
ficheManager.fieldsToStorage();
/* (2) On prépare la requête avec toutes les données */
/* (2) Vérification de la validité de toutes les données */
// {1} Vérification du sujet //
if( !subjectManager.check() )
return false;
// {2} Vérification des mini-fiches //
var mini = lsi.export('mini-fiches');
for( var id in mini )
if( !mini[id].valid )
return false;
// {3} Vérification des fiches //
var fiches = lsi.export('fiches');
for( var id in fiches )
if( !fiches[id].valid )
return false;
/* (3) On prépare la requête avec toutes les données */
var request = {
path: 'input/phone',
@ -476,7 +477,7 @@ include('/js/includes/input-phone-matrice.js', function(){
matrice: lsi.export('matrice')[0]
};
/* (3) On envoie la requête et traite la réponse */
/* (4) On envoie la requête et traite la réponse */
api.send(request, function(response){
console.log(response);
}, false);