-
Notifications
You must be signed in to change notification settings - Fork 0
/
prices.js
71 lines (35 loc) · 1.33 KB
/
prices.js
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
function toggler(item, item2) {
$(".prices").addClass('hidden');
$(".menu").removeClass('active');
//alert("dfd");
$("."+item).removeClass('hidden');
$("#menu"+item).addClass('active');
}
jQuery(document).ready(function($) {
String.prototype.cleanup = function() {
return this.toLowerCase().replace(/[^a-zA-Z0-9]+/g, "");
}
$.getJSON( "prices.json", function( data ) {
var items = [];
$.each( data, function( key, val ) {
var link = "<a href='#topoftable' onClick=\"toggler('"+key.cleanup()+"', '"+key+"');\" class='list-group-item menu' id='menu"+key.cleanup()+"'>"+key+"</a>";
$( link).appendTo( "#list1" );
$.each(val, function (index, value) {
var price = "<tr class='prices hidden "+key.cleanup()+"' id='"+key.cleanup()+"'>"+
// +"<td>"+this.vetement+"</td>"+
+"<td>"+this.catgorie+"</td>"+
+"<td>"+this.action+"</td>"+
+"<td><b>"+this.prix+"</b>€</td>"+
+"</tr>";
//$(price).appendTo("#priceslisttable");
var dollar = "€";
if (isNaN(this.prix))
dollar="";
if(!this.catgorie)
this.catgorie = "";
if(this.action && this.prix)
$("<tr class='prices hidden "+key.cleanup()+" ' id='"+key.cleanup()+"'><td>"+this.catgorie+"</td><td>"+this.action+"</td><td><b>"+this.prix+"</b>"+dollar+"</td></tr>").appendTo("#priceslisttable");
});
});
});
});