forked from prebid/prebid.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb-example.html
More file actions
82 lines (77 loc) · 4.31 KB
/
web-example.html
File metadata and controls
82 lines (77 loc) · 4.31 KB
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
<!-- markdownlint-disable MD034 -->
<!--
provide the following variables:
- id: unique id for the example
- html: html code snippet
- js: js code snippet
- scripts: a commad separate list of required scripts. Allowed values are pbjs,gpt,astjs . default is pbjs,ast
--->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item ui-tab" role="presentation">
<button class="nav-link active" id="{{ include.id }}-result-tab" data-toggle="tab" data-target="#{{ include.id }}-result" type="button" role="tab" aria-controls="result" aria-selected="true">result</button>
</li>
<li class="nav-item ui-tab" role="presentation">
<button class="nav-link" id="{{ include.id }}-html-tab" data-toggle="tab" data-target="#{{ include.id }}-html" type="button" role="tab" aria-controls="html" aria-selected="false">html</button>
</li>
<li class="nav-item ui-tab" role="presentation">
<button class="nav-link" id="{{ include.id }}-js-tab" data-toggle="tab" data-target="#{{ include.id }}-js" type="button" role="tab" aria-controls="js" aria-selected="false">js</button>
</li>
<li class="nav-item ui-tab" role="presentation">
<button class="nav-link" id="{{ include.id }}-source-tab" data-toggle="tab" data-target="#{{ include.id }}-source" type="button" role="tab" aria-controls="js" aria-selected="false">source</button>
</li>
</ul>
<div class="tab-content mb-3" id="example-tab-content">
<div class="tab-pane fade show active" id="{{ include.id }}-result" role="tabpanel" aria-labelledby="{{ include.id }}-result-tab">
<div class="bg-light p-3 shadow-sm">
<!-- external required scripts -->
{% assign scripts = include.scripts | split: "," %}
{% for script in scripts %}
{% if script == "pbjs" %}
{% include prebidjs-non-prod.html %}
{% elsif script == "gpt" %}
{% include gptjs.html %}
{% elsif script == "astjs" %}
{% include astjs.html %}
{% else %}
script tag '{{ script }}' unknown
{% endif %}
{% else %}
<!-- no required scripts defined, pbjs will be included by default -->
{% include prebidjs-non-prod.html %}
{% include gptjs.html %}
{% endfor %}
<!-- example code -->
<script>{{ include.js }}</script>
<!-- example html -->
{{ include.html }}
</div>
</div>
<div class="tab-pane fade" id="{{ include.id }}-html" role="tabpanel" aria-labelledby="{{ include.id }}-html-tab">
<pre class="mt-0 shadow-sm"><code class="language-html">{{ include.html | xml_escape}}</code></pre>
</div>
<div class="tab-pane fade" id="{{ include.id }}-js" role="tabpanel" aria-labelledby="{{ include.id }}-js-tab">
<pre class="mt-0 shadow-sm"><code class="language-javascript">{{ include.js }}</code></pre>
</div>
<div class="tab-pane fade" id="{{ include.id }}-source" role="tabpanel" aria-labelledby="{{ include.id }}-source-tab">
<pre class="mt-0 shadow-sm"><code class="language-html"><html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{ page.title }}</title>
<!-- required scripts -->
{% assign scripts = include.scripts | split: "," %}{% for script in scripts %}{% if script == "pbjs" %}<script async src="https://cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js"></script>
{% elsif script == "gpt" %}<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
{% elsif script == "astjs" %}<script async src="https://adsdk.microsoft.com/ast/ast.js"></script>{% else %}<!-- unknown script tag '{{ script }}' required -->{% endif %}{% else %}<script async src="//cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js"></script>
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>{% endfor %}
</head>
<body>
<!-- javascript -->
<script>{{ include.js }}</script>
<!-- html -->
{{ include.html | xml_escape}}
</body>
</html>
</code></pre>
</div>
</div>