-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #5244 Add examples component #5463
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
0f73f18
Fixes #5244 Add examples component
muuki88 f7fcbdd
Show case basic prebid example
muuki88 cd4b24f
Migrate all examples in dev-docs
muuki88 1be3d9d
Merge branch 'master' into jsfiddle
muuki88 29b880e
Add source panel
muuki88 01b6650
Merge branch 'master' into jsfiddle
muuki88 d21791d
Implement source tab and create better styling
muuki88 2e00ce2
Merge branch 'jsfiddle' of https://github.com/prebid/prebid.github.io…
muuki88 708f22f
document scripts include
muuki88 dbdf388
add gpt.js as default include
muuki88 4f6afd2
disable bare urls lint on script
ChrisHuie 5f75082
fix bare url lint
ChrisHuie e979743
fix bare url lint
ChrisHuie cd519b9
fix bare url linting
ChrisHuie 5a27a54
fix lint on bare url
ChrisHuie 28ae61b
remove lint override
ChrisHuie d90604f
disable bare url lint file
ChrisHuie 4c6aca0
update rule
ChrisHuie 639b202
update rule number
ChrisHuie 85277f4
update rule number
ChrisHuie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!-- markdownlint-disable MD034 --> | ||
<script async | ||
type="text/plain" | ||
class="cmplazyload" | ||
data-cmp-purpose="c51" | ||
data-cmp-src="https://acdn.adnxs.com/ast/ast.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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://acdn.adnxs.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 %} | ||
Comment on lines
+65
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks ugly in code, but nicer on the page: a lot less whitespace |
||
</head> | ||
<body> | ||
|
||
<!-- javascript --> | ||
<script>{{ include.js }}</script> | ||
|
||
<!-- html --> | ||
{{ include.html | xml_escape}} | ||
</body> | ||
</html> | ||
</code></pre> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<!-- markdownlint-disable MD034 --> | ||
<!-- non-production version of prebid.js--> | ||
<script type="text/plain" class="cmplazyload" data-cmp-vendor="s1442" async src="//cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js"></script> | ||
<script type="text/plain" class="cmplazyload" data-cmp-vendor="s1442" async data-cmp-src="https//cdn.jsdelivr.net/npm/prebid.js@latest/dist/not-for-prod/prebid.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the
scripts
include an example can specify the scripts required for this example. I chose a sensible default that most examples use