-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb.js
More file actions
88 lines (76 loc) · 2.8 KB
/
Copy pathweb.js
File metadata and controls
88 lines (76 loc) · 2.8 KB
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
console.log("Extension is loaded....");
var $LITjq;
var LIT = {
waitForJqueryUI : function(){
if(typeof jQuery !== 'undefined' && typeof jQuery.fn.jquery !== 'undefined' && typeof jQuery.ui !== 'undefined'){
$LITjq = jQuery.noConflict(true);
jQuery= $ = $LITjq.noConflict(true);
LIT.main();
}
else{
console.log("jQuery UI not loaded...");
window.setTimeout(LIT.waitForJqueryUI, 500);
}
},
html : `
<div id='LITWindow' class='LIT-window'>
<div id='LITMinWindow' class='LIT-show'>
<button class="LIT-button">Open LinkedIn Tool <i class="fa fa-expand" aria-hidden="true" ></i></button>
<span class="LIT-button LIT-WindowDragHandle">
<i class="fa fa-arrows-alt" aria-hidden="true" ></i>
</span>
</div>
<div id='LITMaxWindow' class='LIT-hide'>
<p>First name: <input data-bind='value: firstName' /></p>
<p>Last name: <input data-bind='value: lastName' /></p>
<h2>Hello, <span data-bind='text: fullName'> </span>!</h2>
</div>
</div>
`,
minWindow : function(){
},
maxWindow : function(){
},
setDraggable : function(){
console.log("Jquery Version : " + $.fn.jquery);
console.log("Jquery UI Version : " + $.ui.version);
$LITjq('#LITWindow').draggable(
{
scroll: false,
containment : "window",
handle: '.LIT-WindowDragHandle'
}
);
},
addHolder : function(){
/*
// append to body
var div = document.createElement('div');
div.setAttribute("id", "LITHolder");
div.innerHTML = LIT.html;
document.body.append(div);
*/
$LITjq( "body" ).append(LIT.html);
},
getHolder : function(){
},
knockoutBind : function(){
// Here's my data model
var ViewModel = function(first, last) {
this.firstName = ko.observable(first);
this.lastName = ko.observable(last);
this.fullName = ko.computed(function() {
// Knockout tracks dependencies automatically. It knows that fullName depends on firstName and lastName, because these get called when evaluating fullName.
return this.firstName() + " " + this.lastName();
}, this);
};
ko.applyBindings(new ViewModel("Planet", "Earth")); // This makes Knockout get to work
},
main : function(){
console.log("Loading main function");
LIT.addHolder();
LIT.knockoutBind();
LIT.setDraggable();
}
}
LIT.waitForJqueryUI();