forked from joaool/MotherGithub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
class.html
43 lines (39 loc) · 1.62 KB
/
class.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Classes v1.0</title>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js" type="text/javascript"></script>
</head>
<body>
<script>
var FL = FL || {};
FL["clone"] = function(obj) {
return JSON.parse(JSON.stringify(obj));
};
FL["menu"] = function(menuSettings) { //{jsonMenu:null,initialMenu:null,editable:false}
this.settings = menuSettings;
this.displayInitialMenu = function() {
console.log("displayInitialMenu -->"+this.settings.initialMenu);
};
};
oMenu={a:1,b:2};
var myMenu1 = new FL.menu({jsonMenu:oMenu,initialMenu:"_home",editable:false});
myMenu1.displayInitialMenu();
console.log("1-myMenu1.settings.jsonMenu.b="+myMenu1.settings.jsonMenu.b);//2 OK
myMenu1.settings.jsonMenu.b = 22;
console.log("2-myMenu1.settings.jsonMenu.b="+myMenu1.settings.jsonMenu.b);//22 OK
oMenu.b=33;
console.log("3-myMenu1.settings.jsonMenu.b="+myMenu1.settings.jsonMenu.b);//33 ok
oMenu2={a:3,b:4};
var myMenu2 = new FL.menu({jsonMenu:FL.clone(oMenu2),initialMenu:"_SweetHome",editable:false});
myMenu2.displayInitialMenu();
myMenu1.settings.initialMenu = "Joaquim Manuel";
myMenu1.displayInitialMenu();
console.log("myMenu2 1-myMenu2.settings.jsonMenu.b="+myMenu2.settings.jsonMenu.b);//4 OK
oMenu.b=44;
console.log("myMenu2 2-myMenu2.settings.jsonMenu.b="+myMenu2.settings.jsonMenu.b);//4 OK
console.log(document.title+"...... END..");
</script>
</body>
</html>