FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
scripts/src/embed.js at master · binarweb/scripts · GitHub
binarweb
/
scripts
Public
forked from
simpleanalytics/scripts
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
scripts
/
src
/
embed.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
50 lines (47 loc) · 1.7 KB
Breadcrumbs
scripts
/
src
/
embed.js
Copy path
File metadata and controls
50 lines (47 loc) · 1.7 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(
function
(
document
)
{
NodeList
.
prototype
.
forEach
=
Array
.
prototype
.
forEach
;
document
.
addEventListener
(
"DOMContentLoaded"
,
function
(
)
{
var
counter
=
1
;
document
.
querySelectorAll
(
"[data-sa-graph-url]"
)
.
forEach
(
function
(
graph
)
{
var
url
=
graph
.
getAttribute
(
"data-sa-graph-url"
)
;
var
append
=
url
.
indexOf
(
"?"
)
>
-
1
?
"&"
:
"?"
;
var
iframe
=
document
.
createElement
(
"iframe"
)
;
iframe
.
setAttribute
(
"src"
,
url
+
append
+
"embed=true&graph_id="
+
counter
)
;
iframe
.
setAttribute
(
"id"
,
"sa-graph-"
+
counter
)
;
iframe
.
setAttribute
(
"scrolling"
,
"no"
)
;
iframe
.
style
.
width
=
"100%"
;
iframe
.
style
.
border
=
"none"
;
graph
.
innerHTML
=
iframe
.
outerHTML
;
counter
=
counter
+
1
;
}
)
;
window
.
onresize
=
function
(
)
{
document
.
querySelectorAll
(
"[data-sa-graph-url] iframe"
)
.
forEach
(
function
(
iframe
)
{
iframe
.
contentWindow
.
postMessage
(
"true"
,
"*"
)
;
}
)
;
}
;
window
.
addEventListener
(
"message"
,
function
(
event
)
{
if
(
typeof
event
.
data
!==
"object"
)
{
return
;
}
else
if
(
event
.
data
.
type
===
"resize"
)
{
document
.
getElementById
(
"sa-graph-"
+
event
.
data
.
id
)
.
height
=
event
.
data
.
height
+
"px"
;
}
else
if
(
event
.
data
.
type
===
"pageviews"
)
{
var
graph
=
document
.
getElementById
(
"sa-graph-"
+
event
.
data
.
id
)
;
var
selector
=
graph
.
parentNode
.
getAttribute
(
"data-sa-page-views-selector"
)
;
if
(
selector
)
document
.
querySelectorAll
(
selector
)
.
forEach
(
function
(
pageViewsElement
)
{
pageViewsElement
.
textContent
=
event
.
data
.
pageviews
;
}
)
;
}
}
)
;
}
)
;
}
)
(
document
)
;
Back
|
FazBrowse Home
|
New Git URL