Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
5490ac1f
Commit
5490ac1f
authored
Oct 13, 2016
by
c24b
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TOOLTIP
parent
3f9c4420
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
53 deletions
+22
-53
guided_tour.js
static/lib/gargantext/guided_tour.js
+22
-53
No files found.
static/lib/gargantext/guided_tour.js
View file @
5490ac1f
function
popOverFactory
(
selector
,
pos
,
confirmation
){
function
popOverFactory
(
selector
,
step
,
pos
){
//Factory for popover indicated by class tour
// transforming into btn and mapping title and content
// $(selector).attr({ "type": "button",
// "data-toggle": "popover",
// "data-placement": pos,
// "data-trigger": "toogle",
//
// });
var
title
=
$
(
selector
).
attr
(
'name'
);
var
placement
=
$
(
selector
).
attr
(
'placement'
);
console
.
log
(
title
)
console
.
log
(
placement
)
if
(
title
==
false
||
title
==
undefined
)
{
title
=
"<h1>STEP"
+
step
+
"</h1>"
}
if
(
placement
==
false
||
placement
==
undefined
)
{
placement
:
pos
}
$
(
selector
).
popover
({
html
:
true
,
title
:
'<h1>'
+
$
(
selector
).
attr
(
"title"
)
+
'</h1>'
,
title
:
title
,
content
:
'<p class="text-center">'
+
$
(
selector
).
attr
(
"content"
)
+
'</p>'
+
'<div class="btn-group col-sm-12">'
+
'<button class="col-sm-6 btn btn-sm btn-danger" data-role="prev">« Prev</button>'
+
...
...
@@ -17,46 +22,17 @@ function popOverFactory(selector, pos, confirmation){
'</div><br>'
,
container
:
'body'
,
trigger
:
"toogle"
,
placement
:
p
os
placement
:
p
lacement
});
//$('.btn').not(this).popover('hide');
//$(selector).popover('toggle');
};
var
steps
=
{}
function
getStep
(
element
,
i
){
steps
=
$
(
document
).
find
(
".tour"
)
console
.
log
(
"curr"
,
element
);
$
(
document
).
on
(
"click"
,
"button[data-role='next']"
,
function
(
e
){
$
(
element
).
popover
(
"hide"
);
native_pop
=
$
(
element
).
children
()
native_pop
.
popover
(
"show"
);
i
=
i
+
1
return
i
})
$
(
document
).
on
(
"click"
,
"button[data-role='prev']"
,
function
(
i
){
$
(
element
).
popover
(
"hide"
);
native_pop
=
$
(
element
).
children
()
native_pop
.
popover
(
"show"
);
i
=
i
-
1
return
i
})
element
=
steps
[
i
]
popOverFactory
(
element
,
"right"
);
$
(
element
).
popover
(
"show"
);
alert
(
i
);
return
[
element
,
i
];
}
function
nextStep
(
element
,
i
){
steps
=
$
(
document
).
find
(
".tour"
)
$
(
document
).
on
(
"click"
,
"button[data-role='next']"
,
function
(
e
){
console
.
log
(
"curr"
,
element
);
$
(
"div.jumbotron"
>
"button.popover"
)
native_pop
=
$
(
element
).
children
()
//native_pop.addClass("tour")
...
...
@@ -72,7 +48,7 @@ function nextStep(element, i){
if
(
submit
.
length
>=
1
){
$
(
document
).
on
(
"click"
,
submit
,
function
(
e
){
i
=
i
+
1
"clicked"
alert
(
"clicked"
)
})
}
else
{
...
...
@@ -95,7 +71,7 @@ function nextStep(element, i){
element
=
steps
[
i
]
console
.
log
(
"next"
,
element
);
popOverFactory
(
element
,
"right"
);
popOverFactory
(
element
,
i
,
"right"
);
$
(
element
).
popover
(
"show"
);
return
[
element
,
i
];
...
...
@@ -114,27 +90,20 @@ function activateTour(){
}
else
{
$
(
this
).
parent
().
addClass
(
"active"
);
curr
=
$
(
this
)
i
=
-
1
//create the popover
popOverFactory
(
$
(
this
),
"bottom"
,
true
);
popOverFactory
(
curr
,
i
,
"bottom"
);
//hide the other popover
$
(
'.popover'
).
not
(
this
).
popover
(
'hide'
);
//show the popover
$
(
this
).
popover
(
'toggle'
);
//buildTour
curr
=
$
(
this
)
i
=
-
1
//curr, i = getStep(curr,i)
curr
,
i
=
nextStep
(
curr
,
i
)
console
.
log
(
i
,
curr
)
if
(
i
>
steps
.
lenght
){
return
false
}
if
(
i
==
-
2
){
return
false
}
if
(
curr
==
"undefined"
){
return
false
}
}
})
...
...
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