Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Belgian Biodiversity Platform
yeti
Commits
9575a92a
Commit
9575a92a
authored
Jan 05, 2012
by
Julien Cigar
Browse files
Merge branch 'master' of
ssh://home.bebif.be/usr/local/repos/git/yeti
parents
c6b0b4d9
d1cd291e
Changes
1
Hide whitespace changes
Inline
Side-by-side
core.js
View file @
9575a92a
/*
Yeti, a simple Javascript library
*/
;(
function
(
ns
)
{
var
Yeti
=
ns
.
Yeti
=
new
Object
();
/* Simple URL cleaner */
Yeti
.
url_for
=
function
()
{
return
Array
.
prototype
.
slice
.
call
(
arguments
).
join
(
'
/
'
).
replace
(
/
\/{2,}
/
,
'
/
'
);
}
/* Shortcut to document.getElementById */
Yeti
.
Element
=
function
(
src
)
{
...
...
@@ -115,6 +125,8 @@
Yeti
.
AjaxResponse
=
function
(
req
)
{
this
.
o
=
req
;
this
.
readyStates
=
[
'
uninitialized
'
,
'
loading
'
,
'
loaded
'
,
'
interactive
'
,
'
complete
'
];
}
Yeti
.
AjaxResponse
.
prototype
.
get_status
=
function
()
{
...
...
@@ -130,8 +142,7 @@
}
Yeti
.
AjaxResponse
.
prototype
.
get_state
=
function
()
{
return
[
'
uninitialized
'
,
'
loading
'
,
'
loaded
'
,
'
interactive
'
,
'
complete
'
][
this
.
o
.
readyState
]
||
'
unknown
'
;
return
this
.
readyStates
[
this
.
o
.
readyState
]
||
'
unknown
'
;
}
Yeti
.
AjaxResponse
.
prototype
.
success
=
function
()
{
...
...
@@ -188,13 +199,13 @@
}
else
if
(
el
.
attachEvent
)
{
/* In IE events always bubble, no capturing possibility. */
//el.attachEvent('on' + type, listener);
var
_type
=
'
on
'
+
type
;
if
(
el
[
'
on
'
+
type
]
==
null
)
{
el
[
'
on
'
+
type
]
=
listener
;
if
(
el
[
_
type
]
==
=
null
)
{
el
[
_
type
]
=
listener
;
}
else
{
var
_e
=
el
[
'
on
'
+
type
];
el
[
'
on
'
+
type
]
=
function
()
{
_e
();
listener
();
el
[
_type
]
=
function
()
{
el
[
_type
]();
listener
();
}
}
}
else
{
...
...
@@ -316,16 +327,17 @@
src
.
getElementsByClassName
(
name
)
:
(
function
(
name
,
src
)
{
var
class_pattern
=
new
RegExp
(
"
(?:^|
\\
s)
"
+
name
+
"
(?:
\\
s|$)
"
),
class_elems
=
[],
selection
=
src
.
getElementsByTagName
(
'
*
'
);
elems
=
[],
selection
=
src
.
getElementsByTagName
(
'
*
'
)
;
for
(
var
i
=
0
,
_len
=
selection
.
length
;
i
<
_len
;
i
++
)
{
if
(
class_pattern
.
test
(
selection
[
i
].
className
))
{
class_
elems
.
push
(
selection
[
i
]);
elems
.
push
(
selection
[
i
]);
}
}
return
class_
elems
;
return
elems
;
})(
name
,
src
);
}
...
...
@@ -344,6 +356,17 @@
return
removed
;
}
/* Yeti.DOM.appendClone
* Append a cloned node to an element. Needed because elem.appendChild()
* on an imported node (document.importNode) is broken under IE
*/
Yeti
.
DOM
.
appendClone
=
function
(
node
,
cloned_node
)
{
document
.
importNode
?
node
.
appendChild
(
cloned_node
)
:
node
.
appendChild
(
cloned_node
).
innerHTML
=
cloned_node
.
innerHTML
;
}
/***********************************************************************
Tools
...
...
@@ -351,11 +374,11 @@
Yeti
.
Tools
=
new
Object
();
/* Yeti.Tools.
text_
proto
_s
tr
/* Yeti.Tools.proto
S
tr
* Returns a detailed text of the constructor
*/
Yeti
.
Tools
.
proto
_s
tr
=
function
(
obj
)
{
Yeti
.
Tools
.
proto
S
tr
=
function
(
obj
)
{
return
Object
().
toString
.
call
(
obj
);
}
...
...
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