Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aspnet/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
def setup(app):
app.add_stylesheet('custom.css?v=1')
# app.add_javascript('helpfulness.js')
app.add_javascript('disqus.js')
if on_rtd:
app.add_javascript('wedc.js')

Expand Down
20 changes: 20 additions & 0 deletions common/_static/disqus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$(function(){
var button = $('#showComments');

if (button.length)
{
var handler = function(){
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'aspnetdocs'; // required: replace example with your forum shortname

/* * * DON'T EDIT BELOW THIS LINE * * */
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've used a JQuery style DOM selector in line 1 and a vanilla js DOM selector in line 13. Maybe try and be consistent?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of the code is the recommended code snippet from the disqus docs, so I'm leaving it untouched.


button.hide();
};

button.on("click", handler);
}
});
46 changes: 6 additions & 40 deletions common/_templates/page.html
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
<a id="helpfulness-btn-submit" href="javascript:;" class="common-btn">Submit</a>
{% extends "!page.html" %}

{% set disqus_shortname = 'aspnetdocs' %}

{#########################}
{# for disqus commenting #}
{#########################}

{% macro comments() %}
<hr/>
<h2 id="comments">
Comments
<a class="headerlink" href="#comments" title="Permalink to this headline">¶</a>
</h2>

<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = '{{ disqus_shortname }}'; // required: replace example with your forum shortname

/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
{% endmacro %}


{%- block body %}
{{ super() }}

Expand All @@ -47,7 +23,6 @@ <h2>Was this page helpful?</h2>
Sorry this wasn't helpful.
<input type="text" id="txt-helpfulness" placeholder="Please let us know why this wasn't helpful">
<span id="helpfulness-characters-left">characters remaining</span>
<a id="helpfulness-btn-submit" href="javascript:;" class="common-btn">Submit</a>
<a id="helpfulness-btn-skip" href="javascript:;" class="common-btn secondary">Skip this</a>
</div>
<a href="javascript:;" class="helpfulness-close">✖</a>
Expand All @@ -68,20 +43,11 @@ <h2>Was this page helpful?</h2>
<img alt="" width="1" height="1" src="https://c.microsoft.com/trans_pixel.aspx"/>
</noscript>

{% if disqus_shortname and 'index' not in pagename and on_rtd %}
{% if next or prev %}
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
{% if next %}
<a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
{% endif %}
{% if prev %}
<a href="{{ prev.link|e }}" class="btn btn-neutral" title="{{ prev.title|striptags|e }}" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
{% endif %}
</div>
{% endif %}
{{ comments() }}
{% else %}
<!-- disqus commenting disabled; set disqus_shortname -->
<!-- disqus -->
{% if 'index' not in pagename %}
<button id="showComments" type="button" class="btn btn-neutral"><i class="fa fa-comment"></i> Show comments</button>
<div id="disqus_thread"></div>
<hr/>
{% endif %}

{%- endblock %}
Expand Down
3 changes: 2 additions & 1 deletion mvc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@

def setup(app):
app.add_stylesheet('custom.css?v=1')
# app.add_javascript('helpfulness.js')
# app.add_javascript('helpfulness.js')
app.add_javascript('disqus.js')
if on_rtd:
app.add_javascript('wedc.js')

Expand Down