-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathindex.html
385 lines (322 loc) · 10 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>FieldsLinker</title>
<link rel="icon" href="pi.ico" /> <meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- external css -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,500">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" SameSite="Lax" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<link rel="stylesheet" href="./fieldsLinker.css">
<!-- internal css -->
<style>
body{
font-family: "Roboto,Helvetica Neue",Helvetica,Arial,sans-serif;
}
#container{
padding-top: 0px;
padding-left:50px;
width:90%;
}
@media screen and (max-width: 600px) {
#container{
padding-top: -10px;
padding-left:10px;
width:98%;
}
}
h5 {
color: #2e44b9;
font-weight: bold;
font-size: 24px;;
}
/* ---------- */
label{
font-weight:300;
display:inline-block;
}
label input[type='radio']{
vertical-align: top;
}
label.active{
font-weight:600;
color: #2e44b9;
}
.bonds{
min-width:400px;
width : 50%;
min-height:410px;
}
.radio-zone{
padding: 0px 8px 0px 8px;
border-radius:2px;
min-width:300px;
}
.presentation{
line-height : 14px;
font-size : 12px;
}
hr{
margin-bottom : 10px;
margin-top:10px;
}
.fieldLinkerSave {
display:inline-block;
}
input[type=radio] {
font-size: 11px;
cursor: pointer;
}
input[type=checkbox]::before{
content: "";
display: inline-block;
font-size: inherit;
float:left;
font-weight:bold;
margin-left:0;
margin-right:2px;
border: 2px solid #337ab7;
border-radius : 3px;
padding : 5px;
margin-top:0px;
color:black;
background: white;
}
input[type=checkbox].active::after {
content: "";
display: inline-block;
font-size: inherit;
float: left;
transform: rotate(45deg);
margin-left: 6px;
margin-top:-13px;
height: 10px;
width: 5px;
color: #337ab7;
border-bottom: 2px solid #337ab7;
border-right: 2px solid #337ab7;
}
div.action-check.off {
color: silver;
}
div.action-check {
color: black;
cursor: pointer;
font-size: 18px;
}
input[type=radio]:before {
background: white;
border: 2px solid #337ab7;
border-radius: 50%;
margin-top: -2px;
margin-right: 6px;
display: inline-block;
vertical-align: middle;
content: '';
width: 14px;
height: 14px;
}
input[type=radio]:checked:before {
background: #337ab7;
border-color: #337ab7;
box-shadow: inset 0px 0px 0px 2px #fff;
}
.choices{
display:inline-block;
margin-right:40px;
}
.choices label{
margin-left:4px;
margin-right:4px;
vertical-align:8%;
}
.choices label.group{
font-weight:bold;
}
.nice-group{
width:680px;
line-height: 16px;
padding:10px;
border:1px solid #ccc;
background-color:#fff
border-radius:5px;
}
.nice-group legend {
color: #337ab7;
width:120px;
font-size:14px !important;
border-bottom:none;
}
</style>
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<div class="btn-group" style="margin-top: 8px;margin-right:10px;">
</div>
<a class="navbar-brand" href="#">
Experiments with jquery
</a>
</div>
<ul class="nav navbar-nav">
<li id="fieldLinker" class="active"><a href="#fieldLinker">Field Linker</a></li>
<li id="blog"><a href="https://philippemarcmeyer.github.io#jquery">Github Blog</a></li>
<li id="repos"><a href="https://github.com/PhilippeMarcMeyer/FieldsLinker">Github repos</a></li>
</ul>
</div>
</nav>
<div id="container">
<div id="fieldLinkerZone" style="max-width:800px;width:800px;" >
<h5 style="display:inline-block">FieldsLinker</h5> v 1.03
<br/>New option for touch devices {"mobileClickIt":true} : idea by Norman Tomlins , make links more easily on touch devices just by clicking
<p>Allows to link elements of list A to elements of list B and returns the links in a js object</p>
<ul class="presentation">
<li>The elements of a list are sortable by drag and drop for a better lisibility</li>
<li>Colours can be re-defined and links come in 2 flavours</li>
<ol>
<li>Straight lines</li>
<li>Lines with squares at the ends</li>
</ol>
<li>You may input somme links from a previous session</li>
<li>Mandatory fields (optional array)</li>
<li>Works in Chrome, Chromium, Opera, Firefox and IE (9+)</li>
<li>Result in an object with error true/false plus an array of links</li>
<li><b>Actions are </b>: init, eraseLinks, getLinks, changeParameters, disable, enable</li>
</ul>
<hr/>
<div class="row" >
<div>
<fieldset class="nice-group">
<legend>Change options :</legend>
<div class="choices">
<input name="associationMode" type="radio" value="oneToOne" /><label>oneToOne</label>
<input name="associationMode" type="radio" value="manyToMany" checked="checked" /><label>manyToMany</label>
</div>
<div class="choices">
<input name="enable" type="radio" value="enable" checked="checked" /><label>Enable</label>
<input name="enable" type="radio" value="disable" /><label>Disable</label>
</div>
<div class="choices">
<input name="lineStyle" type="radio" value="straight" /><label>straight</label>
<input name="lineStyle" type="radio" value="square-ends" checked="checked" /><label>square-ends</label>
</div>
<div class="choices">
<input name="mobileClickIt" type="checkbox"/><label>mobileClickIt</label>
</div>
<div class="choices">
<label class="group">whiteSpace :</label>
<input name="whiteSpace" type="radio" value="normal" /><label>normal</label>
<input name="whiteSpace" type="radio" value="nowrap" checked="checked" /><label>nowrap</label>
</div>
</fieldset>
</div>
</div>
</div>
<hr/>
<div class="bonds" id="original" style="display:block;">
</div>
<hr/>
<button type="button" class="btn fieldLinkerSave btn-sm btn-primary">Save links</button>
<span id="output"></span>
<br /><br />
<div id="input"></div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"></script>
<!--<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>-->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="./fieldsLinker.js?v1.03"></script>
<script>
var fieldLinks;
var inputOri;
$(document).ready(function () {
inputOri = {
"localization": {
},
"options": {
"associationMode": "manyToMany", // oneToOne,manyToMany
"lineStyle": "square-ends",
"buttonErase": "Erase Links",
"displayMode": "original",
"whiteSpace": $("input[name='whiteSpace']:checked").val(), //normal,nowrap,pre,pre-wrap,pre-line,break-spaces default => nowrap
"mobileClickIt": false
},
"Lists": [
{
"name": "Columns in files",
"list": [
"firstName",
"lastName",
"phone",
"email",
"role",
"Birthday",
"Adress",
"[Main-stats][Global-sales-stats][European-region][France]",
"City"
]
},
{
"name": "Available Fields",
"list": [
"Company",
"jobTitle",
"adress",
"adress",
"adress",
"first_name",
"last_name",
"email_adress",
"Phone number",
"Pourcentage of france in the global market",
],
"mandatories": [
"last_name",
"email_adress"
]
}
],
"existingLinks": [{ "from": "lastName", "to": "last_name" }, { "from": "firstName", "to": "first_name" }, { "from": "role", "to": "jobTitle" }]
};
$(".fieldLinkerSave").on("click",function(){
var results = fieldLinks.fieldsLinker("getLinks");
$("#output").html("output => " + JSON.stringify(results));
});
fieldLinks=$("#original").fieldsLinker("init",inputOri);
});
$("input[name='associationMode']").on("click", function () {
let choice = $(this).val();
fieldLinks.fieldsLinker("changeParameters",{"associationMode":choice});
});
$("input[name='enable']").on("click", function () {
let choice = $(this).val();
fieldLinks.fieldsLinker(choice);
});
$("input[name='lineStyle']").on("click", function () {
let choice = $(this).val();
fieldLinks.fieldsLinker("changeParameters",{"lineStyle":choice});
});
$("input[name='whiteSpace']").on("click", function () {
let choice = $(this).val();
fieldLinks.fieldsLinker("changeParameters",{"whiteSpace":choice});
});
$("input[name='mobileClickIt']").on("click", function () {
let isCheck = $(this).prop("checked");
if(isCheck)
$(this).addClass("active");
else
$(this).removeClass("active");
$("#original").html="";
inputOri.options.mobileClickIt = isCheck;
fieldLinks=$("#original").fieldsLinker("init",inputOri);
});
</script>
</html>