Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
trs
Commits
e4f62ca1
Commit
e4f62ca1
authored
Nov 19, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added cancel/restart buttons to example interface
parent
31ea8b87
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
6 deletions
+55
-6
src/frontend/css/editor.css
src/frontend/css/editor.css
+1
-1
src/frontend/js/examples.js
src/frontend/js/examples.js
+54
-5
No files found.
src/frontend/css/editor.css
View file @
e4f62ca1
...
...
@@ -82,7 +82,7 @@ body {
display
:
inline-block
;
}
.popover-title
button
{
.popover-title
.btn-group
{
float
:
right
;
margin-right
:
-6px
;
}
...
...
src/frontend/js/examples.js
View file @
e4f62ca1
...
...
@@ -2,41 +2,90 @@
function
Example
(
actions
)
{
this
.
actions
=
actions
;
this
.
actions
.
push
(
this
.
destroy_popover
);
this
.
current_elem
=
null
;
}
var
current_example
;
var
current_example
=
null
;
$
.
extend
(
Example
.
prototype
,
{
destroy_popover
:
function
()
{
this
.
current_elem
&&
this
.
current_elem
.
popover
(
'
destroy
'
);
if
(
this
.
current_elem
)
{
this
.
current_elem
.
popover
(
'
destroy
'
);
this
.
current_elem
=
null
;
}
},
show_popover
:
function
(
selector
,
alignment
,
description
)
{
var
buttons
=
$
(
'
<div class="btn-group"/>
'
),
dropdown_buttons
=
$
(
'
<ul class="dropdown-menu pull-right"/>
'
),
btn_container
=
$
(
'
<div><div class="clear"/></div>
'
);
buttons
.
append
(
'
<button class="btn btn-primary next-example-step">
'
+
'
next
'
+
'
</button>
'
);
buttons
.
append
(
'
<button class="btn btn-primary dropdown-toggle"
'
+
'
data-toggle="dropdown">
'
+
'
<span class="caret"></span>
'
+
'
</button>
'
);
dropdown_buttons
.
append
(
'
<li><a href="#" class="cancel-example">cancel</a></li>
'
);
dropdown_buttons
.
append
(
'
<li><a href="#" class="restart-example">restart</a></li>
'
);
buttons
.
append
(
dropdown_buttons
);
btn_container
.
prepend
(
buttons
);
this
.
destroy_popover
();
this
.
current_elem
=
$
(
selector
);
this
.
current_elem
.
popover
({
trigger
:
'
manual
'
,
placement
:
alignment
,
html
:
true
,
title
:
'
<button id="next-example-step" class="btn btn-primary">next</button><div class="clear"/>
'
,
title
:
btn_container
,
content
:
description
,
animation
:
false
}).
popover
(
'
show
'
);
},
play
:
function
()
{
reset
:
function
()
{
this
.
destroy_popover
();
this
.
current_action
=
0
;
},
cancel
:
function
()
{
this
.
reset
();
current_example
=
null
;
},
play
:
function
()
{
current_example
&&
current_example
.
cancel
();
current_example
=
this
;
this
.
current_action
=
0
;
this
.
next
();
},
next
:
function
()
{
if
(
this
.
current_action
<
this
.
actions
.
length
)
$
.
proxy
(
this
.
actions
[
this
.
current_action
++
],
this
)();
if
(
this
.
current_action
==
this
.
actions
.
length
)
current_example
=
null
;
}
});
$
(
'
#
next-example-step
'
).
live
(
'
click
'
,
function
()
{
$
(
'
.
next-example-step
'
).
live
(
'
click
'
,
function
()
{
current_example
.
next
();
});
$
(
'
.cancel-example
'
).
live
(
'
click
'
,
function
()
{
current_example
.
cancel
();
});
$
(
'
.restart-example
'
).
live
(
'
click
'
,
function
()
{
current_example
.
reset
();
current_example
.
play
();
});
function
clear_input
()
{
$
(
'
#math-input
'
).
val
(
''
).
change
();
window
.
update_math
&&
window
.
update_math
();
...
...
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