Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EBI-Framework
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ebiwd
EBI-Framework
Commits
365bc2f5
Commit
365bc2f5
authored
7 years ago
by
khawkins98
Browse files
Options
Downloads
Patches
Plain Diff
Improve script invocation, GA detection
parent
8794df00
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
js/ebi-global-includes/script/6_ebiFrameworkInvokeScripts.js
+1
-1
1 addition, 1 deletion
js/ebi-global-includes/script/6_ebiFrameworkInvokeScripts.js
js/foundationExtendEBI.js
+7
-3
7 additions, 3 deletions
js/foundationExtendEBI.js
js/script.js
+8
-2
8 additions, 2 deletions
js/script.js
with
16 additions
and
6 deletions
js/ebi-global-includes/script/6_ebiFrameworkInvokeScripts.js
+
1
−
1
View file @
365bc2f5
...
...
@@ -17,7 +17,7 @@ function ebiFrameworkInvokeScripts() {
**/
document
.
addEventListener
(
"
DOMContentLoaded
"
,
function
(
event
)
{
var
bodyData
=
document
.
body
.
dataset
;
if
(
bodyData
.
ebi
F
ramework
I
nvoke
S
cripts
!=
false
)
{
if
(
bodyData
[
"
ebi
f
ramework
i
nvoke
s
cripts
"
]
!=
"
false
"
)
{
ebiFrameworkInvokeScripts
();
}
});
This diff is collapsed.
Click to expand it.
js/foundationExtendEBI.js
+
7
−
3
View file @
365bc2f5
...
...
@@ -15,14 +15,18 @@ var numberOfEbiGaChecks = 0;
var
numberOfEbiGaChecksLimit
=
2
;
var
lastGaEventTime
=
Date
.
now
();
// track the last time an event was send (don't double send)
function
ebiGaCheck
()
{
numberOfEbiGaChecks
++
;
try
{
if
(
ga
&&
ga
.
loaded
)
{
jQuery
(
'
body
'
).
addClass
(
'
google-analytics-loaded
'
);
// Confirm GA is loaded, add a class if found
ebiGaInit
();
}
else
{
if
(
numberOfEbiGaChecks
<=
numberOfEbiGaChecksLimit
)
{
setTimeout
(
ebiGaCheck
,
900
);
// give a second check if GA was slow to load
}
}
}
catch
(
err
)
{
if
(
numberOfEbiGaChecks
<
numberOfEbiGaChecksLimit
)
{
numberOfEbiGaChecks
++
;
if
(
numberOfEbiGaChecks
<=
numberOfEbiGaChecksLimit
)
{
setTimeout
(
ebiGaCheck
,
900
);
// give a second check if GA was slow to load
}
}
...
...
@@ -399,7 +403,7 @@ function invokeResponsiveMenuEBI() {
<script type="text/JavaScript">$(document).foundation();</script>
<script type="text/JavaScript">$(document).foundationExtendEBI();</script>
Background: https://github.com/ebiwd/EBI-Framework/issues/77
Background: https://github.com/ebiwd/EBI-Framework/issues/77
*/
var
bodyData
=
$
(
'
body
'
).
data
();
if
(
bodyData
.
foundationInvoke
)
{
...
...
This diff is collapsed.
Click to expand it.
js/script.js
+
8
−
2
View file @
365bc2f5
...
...
@@ -338,7 +338,13 @@ function ebiFrameworkInvokeScripts() {
ebiFrameworkCookieBanner
();
}
// init
/* All scripts are automatically loaded, unless the page asked us not to.
* Configurable with a data attribute:
* <body data-ebiFrameworkInvokeScripts="false">
**/
document
.
addEventListener
(
"
DOMContentLoaded
"
,
function
(
event
)
{
ebiFrameworkInvokeScripts
();
var
bodyData
=
document
.
body
.
dataset
;
if
(
bodyData
[
"
ebiframeworkinvokescripts
"
]
!=
"
false
"
)
{
ebiFrameworkInvokeScripts
();
}
});
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment