Skip to content

Commit 4b20874

Browse files
authored
Add segment script and update iframe attributes for YouTube video player (#68)
1 parent a39c937 commit 4b20874

File tree

3 files changed

+88
-1
lines changed

3 files changed

+88
-1
lines changed

docs/introduction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ performing continuous, incremental reviews for each commit within a pull
2323
request. Review feedback is sent back to the pull requests and can be directly
2424
committed.
2525

26-
<iframe width="560" height="315" src="https://www.youtube.com/embed/3SyUOSebG7E?si=i0oT9RAnH0PW81lY" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
26+
<iframe width="560" height="315" src="https://www.youtube.com/embed/3SyUOSebG7E?si=i0oT9RAnH0PW81lY" title="YouTube video player" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerPolicy="strict-origin-when-cross-origin" allowFullScreen></iframe>
2727

2828
**CodeRabbit** integrates into code repositories using GitHub or GitLab webhooks
2929
and monitors events related to Pull Request (PR) and Merge Request (MR) changes.

docusaurus.config.ts

+4
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ const config: Config = {
118118
"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js",
119119
"/docs/js/code-block-buttons.js",
120120
"https://cdnjs.cloudflare.com/ajax/libs/axios/1.2.1/axios.min.js",
121+
{
122+
src: "/js/segment.js",
123+
async: false,
124+
},
121125
{
122126
src: "https://js.hs-scripts.com/43613284.js",
123127
type: "text/javascript",

static/js/segment.js

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
!(function () {
2+
var i = "analytics",
3+
analytics = (window[i] = window[i] || []);
4+
if (!analytics.initialize)
5+
if (analytics.invoked)
6+
window.console &&
7+
console.error &&
8+
console.error("Segment snippet included twice.");
9+
else {
10+
analytics.invoked = !0;
11+
analytics.methods = [
12+
"trackSubmit",
13+
"trackClick",
14+
"trackLink",
15+
"trackForm",
16+
"pageview",
17+
"identify",
18+
"reset",
19+
"group",
20+
"track",
21+
"ready",
22+
"alias",
23+
"debug",
24+
"page",
25+
"screen",
26+
"once",
27+
"off",
28+
"on",
29+
"addSourceMiddleware",
30+
"addIntegrationMiddleware",
31+
"setAnonymousId",
32+
"addDestinationMiddleware",
33+
"register",
34+
];
35+
analytics.factory = function (e) {
36+
return function () {
37+
if (window[i].initialized)
38+
return window[i][e].apply(window[i], arguments);
39+
var n = Array.prototype.slice.call(arguments);
40+
if (
41+
["track", "screen", "alias", "group", "page", "identify"].indexOf(
42+
e
43+
) > -1
44+
) {
45+
var c = document.querySelector("link[rel='canonical']");
46+
n.push({
47+
__t: "bpc",
48+
c: (c && c.getAttribute("href")) || void 0,
49+
p: location.pathname,
50+
u: location.href,
51+
s: location.search,
52+
t: document.title,
53+
r: document.referrer,
54+
});
55+
}
56+
n.unshift(e);
57+
analytics.push(n);
58+
return analytics;
59+
};
60+
};
61+
for (var n = 0; n < analytics.methods.length; n++) {
62+
var key = analytics.methods[n];
63+
analytics[key] = analytics.factory(key);
64+
}
65+
analytics.load = function (key, n) {
66+
var t = document.createElement("script");
67+
t.type = "text/javascript";
68+
t.async = !0;
69+
t.setAttribute("data-global-segment-analytics-key", i);
70+
t.src =
71+
"https://cdn.segment.com/analytics.js/v1/" +
72+
key +
73+
"/analytics.min.js";
74+
var r = document.getElementsByTagName("script")[0];
75+
r.parentNode.insertBefore(t, r);
76+
analytics._loadOptions = n;
77+
};
78+
analytics._writeKey = "IvcQvqtKQS24hYl0lkuvsfFSCpCse4F8";
79+
analytics.SNIPPET_VERSION = "5.2.0";
80+
analytics.load("IvcQvqtKQS24hYl0lkuvsfFSCpCse4F8");
81+
analytics.page();
82+
}
83+
})();

0 commit comments

Comments
 (0)