-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.html
executable file
·753 lines (708 loc) · 40.9 KB
/
index.html
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
<!DOCTYPE html>
<html>
<!-- @@@NOCONTENT -->
<head>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-K458FD6');</script>
<!-- End Google Tag Manager -->
<meta name="google-site-verification" content="IUkZKtVcIeoIBGWIh2XWp7jH9xuYIpviQWCFIAVmXbs" />
<!-- verif: beta-docs -->
<meta name="google-site-verification" content="2FsjXHulCMIalGc3OZqIXIKVThLV9KwcEgYj08iNbp8" />
<!-- verif: docs.midtrans.com -->
<!-- Bing Validate -->
<meta name="msvalidate.01" content="846642D2B12ABB4747D70776D2056651" />
<!-- Google Webmaster Validate -->
<meta name="google-site-verification" content="uUeOdHBzl0nbyvdyeRHKGIHPxnIpJDTTnWv-QfgkxRs" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<!-- Meta @NOTE: taken from old docs-->
<meta property="og:site_name" content="Midtrans Documentation" />
<meta property="og:title" content="Midtrans Payments || Technical Docs for online payment gateway" />
<meta property="og:description"
content="Technical Documentation to implement online payment system. Available for various payment methods, in various website programming language." />
<meta property="fb:app_id" content="404252079606310" />
<meta property="og:image" content="//docs.midtrans.com/images/midtrans/favicon/apple-touch-icon-120x120.png" />
<meta name="description"
content="Technical Documentation to implement online payment system. Available for various payment methods, in various website programming language.">
<meta name="keywords"
content="Midtrans, payment gateway indonesia, Pembayaran Online Indonesia, online payment Indonesia, sistem transaksi online">
<!-- Favicons -->
<link rel="apple-touch-icon" sizes="57x57" href="/asset/favicon/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/asset/favicon/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/asset/favicon/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/asset/favicon/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/asset/favicon/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/asset/favicon/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/asset/favicon/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/asset/favicon/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/asset/favicon/apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" sizes="32x32" href="/asset/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="192x192" href="/asset/favicon/android-chrome-192x192.png">
<link rel="icon" type="image/png" sizes="16x16" href="/asset/favicon/favicon-16x16.png">
<link rel="shortcut icon" href="/asset/favicon/favicon.ico">
<!-- Main Docsify Stylesheet -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/theme-simple.css" integrity="sha256-jv9fwK4BTDbiYNJeimGKb3leNXsi+v2ZGmYd3/sEnvw=" crossorigin="anonymous">
<!-- Manual style override -->
<link rel="stylesheet" type="text/css" href="/asset/custom.css" />
<link rel="stylesheet" type="text/css" href="/asset/mini-collapsible.css" />
<link rel="stylesheet" type="text/css" href="/asset/revamp/styles/main.css" />
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"
integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<title>Midtrans Technical Documentation</title>
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-K458FD6"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<nav class="app-nav no-badge">
<ul>
<li>Help Center<ul>
<li><a href="https://support.midtrans.com" target="_blank" rel="noopener" title="">General FAQ</a></li>
<li><a href="/en/other/faq/technical" title="">Technical FAQ</a></li>
<li><a href="https://midtrans.com/contact-us" target="_blank" rel="noopener" title="">Contact Us</a></li>
</ul>
</li>
<li>
<div class="theme-switch-wrapper">
<label class="theme-switch" for="checkbox-theme">
<input type="checkbox" id="checkbox-theme" class="checkbox-theme" onclick="changeTheme()">
<div class="slider round">☀️ 🌛</div>
</label>
</div>
</li>
</ul>
<div class="col-lg-3 sidebar__right d-none d-lg-block px-5">
<div class="sidebar__right-wrapper">
<h4 class="sidebar__right-title">In this page</h4>
<ul class="list-unstyled mt-0" id="right-bar-content">
</ul>
</div>
</div>
</nav>
<div id="app"></div>
<script type="text/javascript" src="/asset/revamp/js/custom.js"></script>
<script>
window.isUnderMidtransDomain = window.location.hostname.indexOf('.midtrans.com')>=0;
window.isUnderNonBetaDomain = !(window.location.hostname.indexOf('beta')>=0);
// @HACK: redirect to HTTPS
if (window.isUnderMidtransDomain && window.location.protocol == "http:") {
console.log("attempt to change protocol to https");
window.location.protocol = "https:";
}
// Check which Docsify router mode should be used
window.willUseDocsifyHashRouter =
document.location.href.indexOf("/#/")>=0 ||
document.location.href.indexOf("index.html#/")>=0 ||
// @OPTIMIZE: param checking.
document.location.href.indexOf("hash=1")>=0 ||
document.location.href.indexOf("hash=true")>=0
;
window.predictedHomeUrl = window.willUseDocsifyHashRouter ?
(document.location.href.split('/#/'))[0] + '/' :
document.location.origin;
// Check which GA UA-id should be used based on domain
window.GA_UA_ID = 'UA-157800130-2'; // secondary GA UA-id for dev env, default.
if (window.isUnderMidtransDomain && window.isUnderNonBetaDomain) {
window.GA_UA_ID = 'UA-85529823-1'; // docs.midtrans.com GA UA-id for prod
} else if (window.isUnderMidtransDomain) {
window.GA_UA_ID = 'UA-157800130-1'; // beta-docs subdomain GA UA-id
}
window.thisHookExecutedOnce = false;
// Main Docsify setup
window.$docsify = {
logo: 'asset/image/main/midtrans-logo.png',
ga: window.GA_UA_ID,
loadSidebar: true,
loadNavbar: false,
name: 'Midtrans Docs',
// themeColor: '#3F51B5',
homepage: 'en/home.md',
// repo: 'https://github.com/Midtrans/technical-documentation-site/',
// @TODO: combining `basePath` with `willUseDocsifyHashRouter` might solve absolute-relative stuff hacks
// basePath: "/",
alias: {
// proxy for any /gh/ url to fetch markdown from real github url
'.*?/gh/(.*)': 'https://raw.githubusercontent.com/$1',
// match either of these words, use shared sidebar between all payment product subfolder
'/en/(?:snap|core-api|payment-link).*/_sidebar.md': '/en/payments/_sidebar.md',
'/id/(?:snap|core-api|payment-link).*/_sidebar.md': '/id/payments/_sidebar.md',
/**
* Based on https://docsify.js.org/#/more-pages?id=nested-sidebars
* Custom override to force rewrite any request to `[subfolder]/_sidebar.md`
* to `[root folder]/_sidebar.md`
* Problem:
* Prevent unnecessary fallback.
* If docs is located on subfolder, on page load Docsify tried to fetch
* `[subfolder]/_sidebar.md`, if not exist then slowly move up to root.
* which can be slow to wait for 404 call. It impacted UI to be seem
* unresponsive for few second on prod
*/
// match any-word-except these will be forced to load root sidebar
// allow loading sub folder's sidebar only if word is specified here
'/en/(?!payments|disbursement|other).*/_sidebar.md': '/_sidebar.md',
'/id/(?!payments|disbursement|other).*/_sidebar.md': '/id/_sidebar.md',
// redirect to root navbar
'/en/.*/_navbar.md': '/_navbar.md',
'/id/.*/_navbar.md': '/id/_navbar.md'
},
crossOriginLinks: [
'https://mobile-docs.midtrans.com/',
'https://snap-docs.midtrans.com/',
'https://api-docs.midtrans.com/',
'https://iris-docs.midtrans.com/',
'https://support.midtrans.com/'
],
search: {
// set to 1 hour on development, change to 1 day on prod
maxAge: 1000 * 1 * 60 * 60,
depth: 6,
noData: '<a href="https://www.google.com/search?as_sitesearch=docs.midtrans.com&q=Snap Payment">Not found, click here to try web search.</a>',
placeholder: 'Search...'
},
routerMode: window.willUseDocsifyHashRouter ? 'hash' : 'history',
auto2top: true,
maxLevel: 3,
/**
* because right-sidebar is visual structure is good enough,
* we don't need left sub-sidebar anymore. For less cluttered visual.
*/
subMaxLevel: 0,
plugins: [
/**
* Custom plugin to show 404 if non-content file is fetched by Docsify.
* marked with specified keyword
*/
function (hook, vm) {
hook.beforeEach(function (content) {
if (content.indexOf('@@@NOCONTENT')>=0) {
var isIndoVersion = document.location.href.indexOf('/id/')>=0;
var englishVersionUrl = isIndoVersion ?
document.location.href.replace('/id/', '/en/') :
false;
content = '\r\n#### 404 Page Not Found.\r\n<br>The ';
content += isIndoVersion ?
'content you are looking for is currently not available in the language you have chosen, try the [English version]('+englishVersionUrl+'), or the ' :
'';
content += 'url you are trying to visit is not available. Please navigate to the [homepage]('+window.predictedHomeUrl+').<br><br><br>';
return content;
}
})
},
/**
* Custom plugin to replace all wrong sidebar & navbar image path
* So it point to right asset directory
* @HACK: Not extensively tested on and might broke on sub path, e.g: example.com/sub/path/
*/
function (hook, vm) {
hook.doneEach(function(){
// @HACK: use $docsify.logo as assetPath source, detect any extension
// might break when $docsify.logo is changed.
var assetPath = window.$docsify.logo.replace(/(.*)\/.+?\..+/g,"$1/");
// all sidebar img tag and navbar img tag, except `.emoji`
document
.querySelectorAll('.sidebar-nav ul>li img:not(.emoji), .app-nav li>img:not(.emoji)')
.forEach(function (el) {
// @NOTE: hardcoded path
var validSrc = el.src
.replace(/.*?\/asset\/image\/main\/(.*)/g, assetPath + "$1");
// only replace if path invalid
if (el.src != validSrc) {
el.src = validSrc;
}
})
})
},
/**
* Custom plugin to replace wrong home-logo href link on hash router mode
* and history mode if first opened from non-homepage url
* So it can be detected as `willUseDocsifyHashRouter` upon homepage load
*/
function (hook, vm) {
hook.doneEach(function(){
if($docsify.routerMode == 'hash'){
var homeLinkEl = document.querySelector('.app-name-link');
homeLinkEl.href += "#/";
} else {
var homeLinkEl = document.querySelector('.app-name-link');
homeLinkEl.href = window.predictedHomeUrl;
}
});
},
/**
* Custom plugin to replace all relative URL with absolute
* (Only useful on) So when crawled (for SEO), asset links are not broken
* @HACK: Not tested on and might broke on sub path, e.g: example.com/sub/path/
*/
function (hook, vm) {
hook.ready(function () {
var isPluginActivated = true;
if ($docsify.routerMode == 'hash') {
return false;
}
if (!isPluginActivated) {
return false
}
// url in these attribute will be replaced
var attributeQueries = [
'href',
'src'
]
var httpPrefix = 'http'
// loop all attribute
attributeQueries.map(function (attr) {
// query all element with the attribute
var elementFound = Array.from(document.querySelectorAll('[' + attr + ']'))
elementFound.map(function (el) {
// if url doesn't start with http prefix, replace with absolute url
if ((el[attr].toLocaleLowerCase()).startsWith(httpPrefix)) {
var newUrl = new URL(el[attr], document.location.href)
el[attr] = newUrl.href
}
})
})
})
},
/**
* custom plugin to replace various relative url to point to
* proper github repo url
* @NOTE: looks like unused, because no sidebar refer to ext repo
*/
function (hook, vm) {
hook.beforeEach(function (rawMarkdown) {
var modifiedMarkdown = rawMarkdown
// only apply changes if the file is fetched from github
if (/githubusercontent\.com/.test(vm.route.file)) {
var currentFileUrl = (vm.route.file).toLowerCase()
var currentFileRepoUrl =
currentFileUrl
.replace('raw.githubusercontent.com', 'github.com')
.replace('/master/', '/tree/master/')
.split('readme.md')[0]
// replace (example/) to (/example/), to make it consistent
modifiedMarkdown = modifiedMarkdown.replace(/\]\(example/g, "\]\(/example")
// replace relative /.. urls to absolute github urls
modifiedMarkdown = modifiedMarkdown.replace(/\]\(\/(.*)\)/g, "](" + currentFileRepoUrl + "$1)")
// replace #(begin with number) to #_ to make hash url work on docsify
modifiedMarkdown = modifiedMarkdown.replace(/\]\(\#([0-9].*)\)/g, " ](#_$1)")
// Add prefix text to link to original repo url
modifiedMarkdown = '> Note: [Click to visit the project Repository](' + currentFileRepoUrl + ')\n' + modifiedMarkdown
}
return modifiedMarkdown
})
},
/**
* Custom plugin to fix left sidebar open state not properly synced
* with current URL, especially when first window page load with
* specific heading `?id=` in the url.
* @FIXME : hook.ready doesn't wait for sidebar to load, sometimes this script
* is executed too soon, need to check if sidebar is loaded or not,
* with delay? or looped delay?
* @NOTE: after subMaxLevel changed to 0, this seems to be still needed
*/
function (hook, vm) {
// return 0; // plugin active if this line commented
hook.ready(function () {
var dd = 0;
function openParentListRecursive(el,matchCount,count){
var matchCount = matchCount || 0;
var count = count || 0;
count++
dd&&console.log('--- recursing',el,count)
var tagName = el.tagName.toLowerCase()
if (tagName == "aside" || tagName == "body" || count>20){
return 0
}
if (tagName == 'li'){
matchCount++
dd&&console.log('--- opening',el)
el.classList.add('open')
}
return openParentListRecursive(el.parentNode,matchCount,count)
}
function closeSubSidebar(el){
dd&&console.log('--- closing',el)
var subSidebarOpenEl = el.parentNode.querySelector('.active.open');
subSidebarOpenEl.classList.remove('open');
}
try {
var currentNavUrl = vm.route.path || '';
var currentActiveNavEl = document.querySelector('.sidebar-nav a[href$="'+currentNavUrl+'"]')
dd&&console.log('--- found currentActiveNavEl',currentActiveNavEl)
if (currentActiveNavEl){
openParentListRecursive(currentActiveNavEl,0,0)
closeSubSidebar(currentActiveNavEl)
}
} catch(e){ }
})
},
/**
* Custom plugin to hide Docsify sub-sidebar
* @NOTE: This seems not needed because it is redundant to subMaxLevel: 0
*/
function (hook, vm) {
return 0; // plugin active if this line commented
hook.doneEach(function () {
var dd = 0;
function hideParentLastSublist(el){
dd && console.log('--- hiding',el)
if(el.parentNode){
var subSidebarEl = el.parentNode.querySelector('ul .app-sub-sidebar')
if (subSidebarEl){
subSidebarEl.style.display = 'none'
}
}
}
try {
var currentNavUrl = vm.route.path || '';
var currentActiveNavEl = document.querySelector('.sidebar-nav a[href$="'+currentNavUrl+'"]')
if (currentActiveNavEl) {
hideParentLastSublist(currentActiveNavEl)
}
} catch(e) { }
})
},
/**
* Custom plugin to fix scrolling issue.
* Docsify have scrolling issue on page load of a page with image.
* https://github.com/docsifyjs/docsify/issues/351
* This will ensure scroll to element id based on id found on url.
* @HACK:
* - it use constant delay of 2 sec, then scroll, what if page load
* more than 2 sec?
* @OPTIMIZE: instead of constant delay, check if all image done loaded: https://stackoverflow.com/a/11071687
*/
function (hook, vm) {
hook.doneEach(function () {
// true = show debug log
var dd = false
var TARGET_QUERY = 'id'
var SCROLL_DELAY = 2000 // in milisecond
var location = window.location
var isBrowserTabFocused = !document.hidden
var browserTabFocusedCount = 0
dd && console.log('custom scroll plugin called!')
var currentUrlWithoutHash = new URL(
location.origin + location.pathname +
location.search + location.hash.substring(1)
)
var urlQueryParam = currentUrlWithoutHash.searchParams
var isUrlHasIdQuery = urlQueryParam.has(TARGET_QUERY)
// abort if URL dont have ID query
if (!isUrlHasIdQuery) {
return
}
dd && console.log('url has id')
var urlId = urlQueryParam.get(TARGET_QUERY)
var performDelayedScroll = function () {
// run delayed, to make sure everything loaded
setTimeout(function () {
dd && console.log('will scroll to element now')
try {
var element = document.querySelector('#' + urlId)
// on element not found, try searching for docsify-tabs element
if(!element){
var spacedId = urlId.replace(/-/g,' ');
element = document.querySelector('.docsify-tabs__tab[data-tab="'+spacedId+'"]');
}
// if element is not visible, in case the <details> is collapsed, then expand it.
if(!element.offsetParent){
var detailsEl = element.closest('details');
if (detailsEl){
detailsEl.open = true;
}
}
var offset = window.$docsify.topMargin;
var bodyRect = document.body.getBoundingClientRect().top;
var elementRect = element.getBoundingClientRect().top;
var elementPosition = elementRect - bodyRect;
var offsetPosition = elementPosition - offset;
window.scrollTo({
top: offsetPosition
});
} catch (e) { dd && console.log('custom scroll failed', e) }
}, SCROLL_DELAY);
}
// only scroll after browser tab focused
// @HACK: to handle url being opened on background tab
if (isBrowserTabFocused) {
performDelayedScroll()
return
}
// if not focused, wait on focus
// @HACK: to handle url being opened on background tab
window.addEventListener('focus', function () {
browserTabFocusedCount++
dd && console.log('browser tab is focused', browserTabFocusedCount)
var isBrowserFocusedFirstTime = browserTabFocusedCount <= 1
if (!isBrowserFocusedFirstTime) {
return
}
dd && console.log('browser tab focused 1st time')
performDelayedScroll()
})
})
},
/**
* Custom plugin for GA analytics event call
* @NOTE: there are some global `document.xxx` var used
*/
function (hook, vm) {
var dd = document.location.href.indexOf("://localhost") >= 0;
document.$usr = {
"user_agent": navigator.userAgent,
"ip_address": 0
};
var trackEventGa = function (eventName, trackObj) {
dd && console.log("trackEventGa", arguments);
if (typeof (ga) == "undefined") {
return dd && console.log("ga undefined");
}
if (eventName == "page-load") {
return ga('send', {
hitType: 'event',
eventCategory: 'pageload',
eventAction: trackObj['path'],
eventLabel: trackObj['section_id'],
dimension1: trackObj['section_id'],
});
}
if (eventName == "link-click") {
return ga('send', {
hitType: 'event',
eventCategory: 'link',
eventAction: 'click',
eventLabel: trackObj['url'],
transport: 'beacon'
});
}
if (eventName == "theme-switch") {
return ga('send', {
hitType: 'event',
eventCategory: 'theme',
eventAction: 'switch',
eventLabel: trackObj['theme_id']
});
}
};
var trackEvent = function (eventName, trackObj) {
var trackObj = trackObj || {};
dd && console.log("trackEvent", arguments);
// merge trackObj with $usr
for (attr in document.$usr) {
trackObj[attr] = document.$usr[attr];
};
// auto populate path from docsify if not defined
trackObj.path = trackObj.path || vm.route.path;
trackEventGa(eventName, trackObj);
};
var trackPageload = function (vm) {
var sectionId = undefined;
try {
sectionId = vm.route.query.id;
} catch (e) { }
trackEvent("page-load", {
"path": vm.route.path,
"section_id": sectionId
});
};
hook.doneEach(function () {
/* Track Page load part */
trackPageload(vm);
});
hook.ready(function () {
/* Register Listener to track link click */
// @NOTE: using body and "Event Bubbling" method
document.body.addEventListener('click', function (e) {
// exec if `<a href="x">` tag only`
if (event.target.tagName.toLowerCase() != 'a') { return 0; };
if (!event.target.href) { return 0; };
// track style/theme switch event
if (event.target.title && event.target.title.indexOf("style::")>=0) {
return trackEvent("theme-switch", {
"theme_id": event.target.title
});
}
trackEvent("link-click", {
url: event.target.href
});
});
// Expose trackEvent function for global usage outside plugin
window.$trackEvent = trackEvent;
});
},
/**
* Custom plugin to inject feedback footer on the bottom of ".markdown-section" element
*/
function (hook, vm) {
var docsifyContentWrapperSelector = ".markdown-section";
// Trigger on each page load
// @FIXME: on router mode JS based href will throw error, fix it
hook.doneEach(function () {
(document.querySelector(docsifyContentWrapperSelector)).insertAdjacentHTML(
'beforeend',
'<div class="footer-custom" style="text-align:center; margin-bottom:1rem;">'+
'<p><small>Is this page helpful? <a href=\'javascript:false&&"promptFeedback";\' onclick=\'promptFeedback();\'>Let us hear your feedback!</a></small></p>'+
'\<\/div\>'
);
});
// Prompt feedback popup
window.promptFeedback = function () {
Swal.fire({
// title: '<strong>HTML <u>example</u></strong>',
icon: 'success',
html:
'<p>Thanks for your valuable feedback!</p>'+
'<iframe src="https://docs.google.com/forms/d/e/1FAIpQLSdr1T9hIxKJr7kI2BHFYErOM-1-bO3ScxZOh6zclYxNdG7meA/viewform?embedded=true" style="width:95%; height:65vh" frameborder="0" marginheight="0" marginwidth="0">Loading…</iframe>'+
'<p><small>We always strive to improve. We appreciate your contribution to help us improve our service to you, we sincerely want to hear your thoughts!</small></p>',
showCloseButton: true,
showCancelButton: false,
showConfirmButton: false,
cancelButtonText: 'Close',
width: 600,
})
};
},
function(hook,vm){
hook.doneEach(function(){
//custom highlight
document.querySelectorAll('pre code').forEach( function(block) {
//ignore lang-
if( !block.classList.contains('lang-') ) {
hljs.highlightBlock(block);
}
});
hljs.initLineNumbersOnLoad({
singleLine: true
});
// add badge copy to clipboard
// add HighlightJS-badge (options are optional)
var options = {
// the selector for the badge template
templateSelector: "#CodeBadgeTemplate",
// base content CSS selector that is searched for snippets
contentSelector: "body",
// Delay in ms used for `setTimeout` before badging is applied
// Use if you need to time highlighting and badge application
// since the badges need to be applied afterwards.
// 0 - direct execution (ie. you handle timing
loadDelay: 0,
// CSS class(es) used to render the copy icon.
copyIconClass: "fa fa-copy",
// optional content for icons class (<i class="fa fa-copy"></i> or <i class="material-icons">file_copy</i>)
copyIconContent: "",
// CSS class(es) used to render the done icon.
checkIconClass: "fa fa-check text-success",
checkIconContent: "",
// function called before code is placed on clipboard that allows you inspect and modify
// the text that goes onto the clipboard. Passes text and code root element (hljs).
// Example: function(text, codeElement) { return text + " $$$"; }
// hook to allow modifying the text before it's pasted
onBeforeTextCopied: function(text, codeElement) {
console.log('text', text)
console.log('codeElement', codeElement)
return text; // you can fix up the text here
}
};
window.highlightJsBadge(options);
generateRightSideBarContent()
//custom style for accordion with label tag
applyAccordionLabelTagListener()
//add active class when scroll to right sidebar menu
activateRightMenuOnScroll()
applySavedTheme()
})
}
],
// config for tabs plugin
tabs: {
persist: true, // default
sync: true, // default
theme: 'classic', // default
tabComments: true, // default
tabHeadings: true // default
},
// config for pagination plugin
pagination: {
// routerMode: window.$docsify.routerMode, // default
crossChapter: true,
crossChapterText: true,
},
// config for themeable plugin
themeable: {
responsiveTables: false
},
topMargin: 80, // default: 0
}
</script>
<!-- SweetAlert library -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js"
integrity="sha256-1pZ3aajcQuFEOG/veUw/WxQjAMJiCSTZo8wH+opDplY=" crossorigin="anonymous">
</script>
<!-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/docsify.min.js"
integrity="sha256-ibnuwhVxau9TedtaK4AuoTzq0LhAmjbtHtyUoIJ2gH4=" crossorigin="anonymous">
</script> -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/docsify.min.js" integrity="sha256-hDWw8exa4qZ1EF+WSeLT5VFofnqN9OTqQhQMtaIXvf4=" crossorigin="anonymous"></script>
<!-- Docsify plugins -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/docsify-sidebar-collapse.min.js" integrity="sha256-AiLzf2giwPrSxRIu3TUge9h/ddBAAB16gXGzhht/IDE=" crossorigin="anonymous"></script>
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/plugins/ga.min.js"
integrity="sha256-IUguNo0T22vwAwWZnzpFB9nVTY00IUOvrBxOyY/i3Yk=" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/plugins/zoom-image.min.js"
integrity="sha256-QYPXHOsAicqyjr+Uc1I7WUnRe2xR1Y3ncJhse2HaCMM=" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/plugins/emoji.min.js"
integrity="sha256-6dICtD0wM98hdjoCiKe36HW2K/fZ2fqSMDv/0YG9ymo=" crossorigin="anonymous">
</script>
<!-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/plugins/search.min.js"
integrity="sha256-yInlTXGchef1hIEK6Q09H8zxJsBwk1loijHlkYHyvcs=" crossorigin="anonymous">
</script> -->
<script src="/asset/docsify-plugin-search-modified.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/docsify-pagination.min.js" integrity="sha256-rV7n3BaeEbTmT7UEVELv+sJ0XtOjtT1jrL23pJ3wf+0=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/docsify-themeable.min.js"
integrity="sha256-DjxvhlioSi/lO1GN+agurPW4RNl7naaPyEYwB99ez/o=" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/docsify-tabs.min.js"
integrity="sha256-6UO8rzmxCWkk2KHPL6PUBJIIFfC5t0iL6W5Iy4moWDE=" crossorigin="anonymous">
</script>
<!-- Code highlighter language plugins -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/components/prism-bash.min.js"
integrity="sha256-W7l8nP5GgjHSb7BvkoJKZQ+6+qFPM2VT6aF1lISibsA=" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/components/prism-python.min.js"
integrity="sha256-zXSwQE9cCZ8HHjjOoy6sDGyl5/3i2VFAxU8XxJWfhC0=" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/components/prism-go.min.js"
integrity="sha256-0gPlDXMlahNpCwHdKGf6TkjpLCXUS7mliN3nmbKOBCc=" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/components/prism-ruby.min.js"
integrity="sha256-SGBXZakPP3Fv0P4U6jksuwZQU5FlC22ZAANstHSSp3k=" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/components/prism-php.min.js"
integrity="sha256-gJj4RKQeXyXlVFu2I8jQACQZsii/YzVMhcDT99lr45I=" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/components/prism-java.min.js"
integrity="sha256-xkjfLarZfrNcxmgjDVE2XGj4/OIti0A0+HMRz8fg1rI=" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/components/prism-json.min.js"
integrity="sha256-tLgG7JGsKcY/xjGqVS3C/Rx8u5qq4OKmB9+g38o935c=" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js" crossorigin="anonymous"></script>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/highlightjs-line-numbers.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/highlightjs-badge.min.js" integrity="sha256-TwtXrVkW7AwB+717Z1VSybvvGMwP5hiQtgNtlxGMK7w=" crossorigin="anonymous"></script>
<!-- helper to handle invalid absolute/relative asset path, on both docsify route mode -->
<script type="text/javascript" src="/asset/absolute-to-relative-check.js"></script>
<!-- @TODO: prevent load failure on subdir url using body.onerror ?-->
<!-- Replace with `onerror` to detect invalid asset path -->
<script type="text/javascript" src="./asset/absolute-to-relative.js"></script>
</body>
</html>