Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
21
Merge Requests
21
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
674bb1bc
Commit
674bb1bc
authored
Apr 19, 2012
by
Thomas Lechauve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade plugin structure to maintain chaining
parent
540e5b0b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
26 deletions
+24
-26
jQuery/static/js/slapOs.js
jQuery/static/js/slapOs.js
+24
-26
No files found.
jQuery/static/js/slapOs.js
View file @
674bb1bc
;(
function
(
$
,
window
,
document
,
undefined
)
{
var
SlapOs
=
function
(
elem
,
options
){
this
.
elem
=
elem
;
this
.
$elem
=
$
(
elem
);
this
.
options
=
options
;
this
.
metadata
=
this
.
$elem
.
data
(
'
plugin-options
'
);
};
SlapOs
.
prototype
=
{
(
function
(
$
)
{
var
methods
=
{
defaults
:
{
host
:
''
},
init
:
function
(){
this
.
config
=
$
.
extend
({},
this
.
defaults
,
this
.
options
,
this
.
metadata
);
this
.
store
=
Modernizr
.
localstorage
?
this
.
lStore
:
this
.
cStore
;
this
.
store
(
'
host
'
,
this
.
config
.
host
);
return
this
;
init
:
function
(
options
){
return
this
.
each
(
function
(){
methods
.
config
=
$
.
extend
({},
methods
.
defaults
,
methods
.
options
,
methods
.
metadata
);
methods
[
'
store
'
]
=
Modernizr
.
localstorage
?
methods
.
lStore
:
methods
.
cStore
;
methods
.
store
(
'
host
'
,
methods
.
config
.
host
);
});
},
/* Local storage method */
...
...
@@ -47,14 +41,14 @@
}
},
request
:
function
(
type
,
url
,
callback
,
statusEvent
,
data
){
request
:
function
(
context
,
type
,
url
,
callback
,
statusEvent
,
data
){
data
=
data
||
''
;
statusEvent
=
statusEvent
||
this
.
statusDefault
;
return
$
.
ajax
({
url
:
thi
s
.
store
(
'
host
'
)
+
url
,
$
.
ajax
({
url
:
method
s
.
store
(
'
host
'
)
+
url
,
dataType
:
'
json
'
,
data
:
data
,
context
:
this
.
$elem
,
context
:
context
,
type
:
type
,
statusCode
:
statusEvent
}).
done
(
callback
);
...
...
@@ -69,7 +63,9 @@
},
getInstance
:
function
(
id
,
callback
,
statusEvent
){
return
this
.
request
(
'
GET
'
,
'
/instance/
'
+
id
,
callback
,
statusEvent
);
return
this
.
each
(
function
(){
methods
.
request
(
this
,
'
GET
'
,
'
/instance/
'
+
id
,
callback
,
statusEvent
);
});
},
getInstanceCert
:
function
(
id
,
callback
,
statusEvent
){
...
...
@@ -109,12 +105,14 @@
}
};
$
.
fn
.
slapos
=
function
(
options
){
return
this
.
each
(
function
(){
new
SlapOs
(
this
,
options
).
init
();
});
$
.
fn
.
slapos
=
function
(
method
){
if
(
methods
[
method
]
)
{
return
methods
[
method
].
apply
(
this
,
Array
.
prototype
.
slice
.
call
(
arguments
,
1
));
}
else
if
(
typeof
method
===
'
object
'
||
!
method
)
{
return
methods
.
init
.
apply
(
this
,
arguments
);
}
else
{
$
.
error
(
'
Method
'
+
method
+
'
does not exist on jQuery.slapos
'
);
}
};
window
.
SlapOs
=
SlapOs
;
})(
jQuery
,
window
,
document
);
\ No newline at end of file
})(
jQuery
);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment