Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bootstrap
bootstrap
Commits
a91a407b
Commit
a91a407b
authored
13 years ago
by
Jacob Thornton
Browse files
Options
Download
Email Patches
Plain Diff
start updating to data- driven js
parent
913338f9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
js/bootstrap-alerts.js
+4
-2
js/bootstrap-alerts.js
js/bootstrap-dropdown.js
+15
-12
js/bootstrap-dropdown.js
js/bootstrap-modal.js
+44
-27
js/bootstrap-modal.js
js/bootstrap-popover.js
+3
-3
js/bootstrap-popover.js
js/bootstrap-tabs.js
+12
-6
js/bootstrap-tabs.js
js/bootstrap-twipsy.js
+2
-2
js/bootstrap-twipsy.js
with
80 additions
and
52 deletions
+80
-52
js/bootstrap-alerts.js
+
4
-
2
View file @
a91a407b
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
var
Alert
=
function
(
content
,
selector
)
{
var
Alert
=
function
(
content
,
selector
)
{
this
.
$element
=
$
(
content
)
this
.
$element
=
$
(
content
)
.
delegate
(
selector
||
'
.close
'
,
'
click
'
,
this
.
close
)
.
delegate
(
'
[data-alert-dismiss]
'
,
'
click
'
,
this
.
close
)
}
}
Alert
.
prototype
=
{
Alert
.
prototype
=
{
...
@@ -62,6 +62,8 @@
...
@@ -62,6 +62,8 @@
var
$element
=
$
(
this
).
parent
(
'
.alert-message
'
)
var
$element
=
$
(
this
).
parent
(
'
.alert-message
'
)
e
&&
e
.
preventDefault
()
e
&&
e
.
preventDefault
()
e
&&
e
.
stopPropagation
()
$element
.
removeClass
(
'
in
'
)
$element
.
removeClass
(
'
in
'
)
function
removeElement
()
{
function
removeElement
()
{
...
@@ -98,7 +100,7 @@
...
@@ -98,7 +100,7 @@
}
}
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
new
Alert
(
$
(
'
body
'
)
,
'
.alert-message[data-alert] .close
'
)
new
Alert
(
$
(
'
body
'
))
})
})
})(
window
.
jQuery
||
window
.
ender
)
})(
window
.
jQuery
||
window
.
ender
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
js/bootstrap-dropdown.js
+
15
-
12
View file @
a91a407b
...
@@ -20,23 +20,14 @@
...
@@ -20,23 +20,14 @@
(
function
(
$
){
(
function
(
$
){
var
d
=
'
.dropdown-toggle
'
var
d
=
'
[data-dropdown]
'
function
clearMenus
()
{
$
(
d
).
parent
(
'
li
'
).
removeClass
(
'
open
'
)
}
$
(
function
()
{
$
(
'
html
'
).
bind
(
"
click
"
,
clearMenus
)
$
(
'
body
'
).
dropdown
(
'
[data-dropdown] .dropdown-toggle
'
)
})
/* DROPDOWN PLUGIN DEFINITION
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
* ========================== */
$
.
fn
.
dropdown
=
function
(
selector
)
{
$
.
fn
.
dropdown
=
function
()
{
return
this
.
each
(
function
()
{
return
this
.
each
(
function
()
{
$
(
this
).
delegate
(
selector
||
d
,
'
click
'
,
function
(
e
)
{
$
(
this
).
delegate
(
d
,
'
click
'
,
function
(
e
)
{
var
li
=
$
(
this
).
parent
(
'
li
'
)
var
li
=
$
(
this
).
parent
(
'
li
'
)
,
isActive
=
li
.
hasClass
(
'
open
'
)
,
isActive
=
li
.
hasClass
(
'
open
'
)
...
@@ -47,4 +38,16 @@
...
@@ -47,4 +38,16 @@
})
})
}
}
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
function
clearMenus
()
{
$
(
d
).
parent
(
'
li
'
).
removeClass
(
'
open
'
)
}
$
(
function
()
{
$
(
'
html
'
).
bind
(
"
click
"
,
clearMenus
)
$
(
'
body
'
).
dropdown
()
})
})(
window
.
jQuery
||
window
.
ender
)
})(
window
.
jQuery
||
window
.
ender
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
js/bootstrap-modal.js
+
44
-
27
View file @
a91a407b
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
* ========================================================= */
* ========================================================= */
(
function
(
$
){
!
function
(
$
){
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
* ======================================================= */
...
@@ -53,16 +53,12 @@
...
@@ -53,16 +53,12 @@
* ============================= */
* ============================= */
var
Modal
=
function
(
content
,
options
)
{
var
Modal
=
function
(
content
,
options
)
{
this
.
settings
=
$
.
extend
({},
$
.
fn
.
modal
.
defaults
)
this
.
settings
=
$
.
extend
({},
$
.
fn
.
modal
.
defaults
,
options
)
this
.
$element
=
$
(
content
)
this
.
$element
=
$
(
content
)
.
delegate
(
'
.js-dismiss
'
,
'
click.modal
'
,
$
.
proxy
(
this
.
hide
,
this
))
.
delegate
(
'
[data-modal-dismiss]
'
,
$
.
proxy
(
this
.
hide
,
this
))
if
(
options
)
{
if
(
this
.
settings
.
show
)
{
$
.
extend
(
this
.
settings
,
options
)
this
.
show
()
if
(
options
.
show
)
{
this
.
show
()
}
}
}
return
this
return
this
...
@@ -81,15 +77,23 @@
...
@@ -81,15 +77,23 @@
escape
.
call
(
this
)
escape
.
call
(
this
)
backdrop
.
call
(
this
,
function
()
{
backdrop
.
call
(
this
,
function
()
{
var
transition
=
$
.
support
.
transition
&&
that
.
$element
.
hasClass
(
'
fade
'
)
that
.
$element
that
.
$element
.
appendTo
(
document
.
body
)
.
appendTo
(
document
.
body
)
.
show
()
.
show
()
setTimeout
(
function
()
{
if
(
transition
)
{
that
.
$element
that
.
$element
[
0
].
offsetWidth
// force reflow
.
addClass
(
'
in
'
)
}
.
trigger
(
'
shown
'
)
},
1
)
that
.
$element
.
addClass
(
'
in
'
)
transition
?
that
.
$element
.
one
(
transitionEnd
,
function
()
{
that
.
$element
.
trigger
(
'
shown
'
)
})
:
that
.
$element
.
trigger
(
'
shown
'
)
})
})
return
this
return
this
...
@@ -98,6 +102,10 @@
...
@@ -98,6 +102,10 @@
,
hide
:
function
(
e
)
{
,
hide
:
function
(
e
)
{
e
&&
e
.
preventDefault
()
e
&&
e
.
preventDefault
()
if
(
!
this
.
isShown
)
{
return
this
}
var
that
=
this
var
that
=
this
this
.
isShown
=
false
this
.
isShown
=
false
...
@@ -132,16 +140,25 @@
...
@@ -132,16 +140,25 @@
var
that
=
this
var
that
=
this
,
animate
=
this
.
$element
.
hasClass
(
'
fade
'
)
?
'
fade
'
:
''
,
animate
=
this
.
$element
.
hasClass
(
'
fade
'
)
?
'
fade
'
:
''
if
(
this
.
isShown
&&
this
.
settings
.
backdrop
)
{
if
(
this
.
isShown
&&
this
.
settings
.
backdrop
)
{
var
doAnimate
=
$
.
support
.
transition
&&
animate
this
.
$backdrop
=
$
(
'
<div class="modal-backdrop
'
+
animate
+
'
" />
'
)
this
.
$backdrop
=
$
(
'
<div class="modal-backdrop
'
+
animate
+
'
" />
'
)
.
click
(
$
.
proxy
(
this
.
hide
,
this
))
.
appendTo
(
document
.
body
)
.
appendTo
(
document
.
body
)
setTimeout
(
function
()
{
if
(
this
.
settings
.
backdrop
!=
'
static
'
)
{
that
.
$backdrop
&&
that
.
$backdrop
.
addClass
(
'
in
'
)
this
.
$backdrop
.
click
(
$
.
proxy
(
this
.
hide
,
this
))
$
.
support
.
transition
&&
that
.
$backdrop
.
hasClass
(
'
fade
'
)
?
}
that
.
$backdrop
.
one
(
transitionEnd
,
callback
)
:
callback
()
if
(
doAnimate
)
{
})
this
.
$backdrop
[
0
].
offsetWidth
// force reflow
}
this
.
$backdrop
.
addClass
(
'
in
'
)
doAnimate
?
this
.
$backdrop
.
one
(
transitionEnd
,
callback
)
:
callback
()
}
else
if
(
!
this
.
isShown
&&
this
.
$backdrop
)
{
}
else
if
(
!
this
.
isShown
&&
this
.
$backdrop
)
{
this
.
$backdrop
.
removeClass
(
'
in
'
)
this
.
$backdrop
.
removeClass
(
'
in
'
)
...
@@ -161,13 +178,13 @@
...
@@ -161,13 +178,13 @@
function
escape
()
{
function
escape
()
{
var
that
=
this
var
that
=
this
if
(
this
.
isShown
&&
this
.
settings
.
keyboard
)
{
if
(
this
.
isShown
&&
this
.
settings
.
keyboard
)
{
$
(
'
body
'
).
bind
(
'
keyup.modal
'
,
function
(
e
)
{
$
(
document
).
bind
(
'
keyup.modal
'
,
function
(
e
)
{
if
(
e
.
which
==
27
)
{
if
(
e
.
which
==
27
)
{
that
.
hide
()
that
.
hide
()
}
}
})
})
}
else
if
(
!
this
.
isShown
)
{
}
else
if
(
!
this
.
isShown
)
{
$
(
'
body
'
).
unbind
(
'
keyup.modal
'
)
$
(
document
).
unbind
(
'
keyup.modal
'
)
}
}
}
}
...
@@ -209,12 +226,12 @@
...
@@ -209,12 +226,12 @@
$
.
fn
.
modal
.
defaults
=
{
$
.
fn
.
modal
.
defaults
=
{
backdrop
:
false
backdrop
:
false
,
keyboard
:
false
,
keyboard
:
false
,
show
:
tru
e
,
show
:
fals
e
}
}
/* MODAL DATA-
IMPLEMENTATION
/* MODAL DATA-IMPLEMENTATION
* =========================
=
*/
* ========================= */
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'
body
'
).
delegate
(
'
[data-controls-modal]
'
,
'
click
'
,
function
(
e
)
{
$
(
'
body
'
).
delegate
(
'
[data-controls-modal]
'
,
'
click
'
,
function
(
e
)
{
...
@@ -224,4 +241,4 @@
...
@@ -224,4 +241,4 @@
})
})
})
})
})(
window
.
jQuery
||
window
.
ender
)
}(
window
.
jQuery
||
window
.
ender
);
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
js/bootstrap-popover.js
+
3
-
3
View file @
a91a407b
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
* =========================================================== */
* =========================================================== */
(
function
(
$
)
{
!
function
(
$
)
{
var
Popover
=
function
(
element
,
options
)
{
var
Popover
=
function
(
element
,
options
)
{
this
.
$element
=
$
(
element
)
this
.
$element
=
$
(
element
)
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
}
}
,
getContent
:
function
()
{
,
getContent
:
function
()
{
var
content
var
var
content
,
$e
=
this
.
$element
,
$e
=
this
.
$element
,
o
=
this
.
options
,
o
=
this
.
options
...
@@ -74,4 +74,4 @@
...
@@ -74,4 +74,4 @@
$
.
fn
.
popover
.
defaults
=
$
.
extend
({}
,
$
.
fn
.
twipsy
.
defaults
,
{
content
:
'
data-content
'
,
placement
:
'
right
'
})
$
.
fn
.
popover
.
defaults
=
$
.
extend
({}
,
$
.
fn
.
twipsy
.
defaults
,
{
content
:
'
data-content
'
,
placement
:
'
right
'
})
})(
window
.
jQuery
||
window
.
ender
)
}(
window
.
jQuery
||
window
.
ender
);
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
js/bootstrap-tabs.js
+
12
-
6
View file @
a91a407b
...
@@ -18,30 +18,36 @@
...
@@ -18,30 +18,36 @@
* ======================================================== */
* ======================================================== */
(
function
(
$
){
!
function
(
$
){
function
activate
(
element
,
container
)
{
function
activate
(
element
,
container
)
{
container
.
find
(
'
.active
'
).
removeClass
(
'
active
'
)
container
.
find
(
'
>
.active
'
).
removeClass
(
'
active
'
)
element
.
addClass
(
'
active
'
)
element
.
addClass
(
'
active
'
)
}
}
function
tab
(
e
)
{
function
tab
(
e
)
{
var
$this
=
$
(
this
)
var
$this
=
$
(
this
)
,
$ul
=
$this
.
closest
(
'
ul
'
)
,
href
=
$this
.
attr
(
'
href
'
)
,
href
=
$this
.
attr
(
'
href
'
)
,
$ul
=
$
(
e
.
liveFired
)
,
previous
,
$controlled
if
(
/^#
\w
+/
.
test
(
href
))
{
if
(
/^#
\w
+/
.
test
(
href
))
{
e
.
preventDefault
()
e
.
preventDefault
()
if
(
$this
.
hasClass
(
'
active
'
))
{
if
(
$this
.
parent
(
'
li
'
).
hasClass
(
'
active
'
))
{
return
return
}
}
previous
=
$ul
.
find
(
'
.active a
'
)[
0
]
$href
=
$
(
href
)
$href
=
$
(
href
)
activate
(
$this
.
parent
(
'
li
'
),
$ul
)
activate
(
$this
.
parent
(
'
li
'
),
$ul
)
activate
(
$href
,
$href
.
parent
())
activate
(
$href
,
$href
.
parent
())
$this
.
trigger
({
type
:
'
change
'
,
relatedTarget
:
previous
})
}
}
}
}
...
@@ -59,4 +65,4 @@
...
@@ -59,4 +65,4 @@
$
(
'
body
'
).
tabs
(
'
ul[data-tabs] li > a, ul[data-pills] > li > a
'
)
$
(
'
body
'
).
tabs
(
'
ul[data-tabs] li > a, ul[data-pills] > li > a
'
)
})
})
})(
window
.
jQuery
||
window
.
ender
)
}(
window
.
jQuery
||
window
.
ender
);
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
js/bootstrap-twipsy.js
+
2
-
2
View file @
a91a407b
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
* ========================================================== */
* ========================================================== */
(
function
(
$
)
{
!
function
(
$
)
{
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */
* ======================================================= */
...
@@ -304,4 +304,4 @@
...
@@ -304,4 +304,4 @@
return
$
.
metadata
?
$
.
extend
({},
options
,
$
(
ele
).
metadata
())
:
options
return
$
.
metadata
?
$
.
extend
({},
options
,
$
(
ele
).
metadata
())
:
options
}
}
})(
window
.
jQuery
||
window
.
ender
)
}(
window
.
jQuery
||
window
.
ender
);
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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
Menu
Explore
Projects
Groups
Snippets