-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from AdmiringWorm/disqus-jsfile
(GH-27) Moved disqus logic to its own javascript file
- Loading branch information
Showing
2 changed files
with
34 additions
and
21 deletions.
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 |
---|---|---|
@@ -1,24 +1,4 @@ | ||
<div id="disqus_thread"></div> | ||
<script type="text/javascript"> | ||
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ | ||
var disqus_shortname = 'aberdeendevelopersnetusergroup'; // required: replace example with your forum shortname | ||
var disqus_identifier = '@Model.FilePath(Keys.RelativeFilePath).FileNameWithoutExtension.FullPath'; | ||
var disqus_title = '@Model.String(BlogKeys.Title)'; | ||
var disqus_url = '@Context.GetLink(Model, true)'; | ||
/* * * DON'T EDIT BELOW THIS LINE * * */ | ||
(function() { | ||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; | ||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; | ||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | ||
})(); | ||
(function () { | ||
var s = document.createElement('script'); s.async = true; | ||
s.type = 'text/javascript'; | ||
s.src = '//' + disqus_shortname + '.disqus.com/count.js'; | ||
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); | ||
}()); | ||
</script> | ||
<script type="text/javascript" src="~/assets/js/disqus.js" async></script> | ||
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> | ||
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> |
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,33 @@ | ||
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ | ||
var metaElements = document.getElementsByTagName('meta'); | ||
|
||
var disqus_shortname = 'aberdeendevelopersnetusergroup'; // required: replace example with your forum shortname | ||
var disqus_identifier; | ||
var disqus_title; | ||
var disqus_url; | ||
|
||
for (var i = 0; i < metaElements.length; i++) { | ||
var element = metaElements[i]; | ||
var propAttribute = element.getAttribute('property'); | ||
if (propAttribute === 'og:title') { | ||
disqus_title = element.getAttribute('content'); | ||
} | ||
else if (propAttribute === 'og:url') { | ||
disqus_url = element.getAttribute('content'); | ||
disqus_identifier = disqus_url.split(/\//).pop(); | ||
} | ||
} | ||
|
||
/* * * DON'T EDIT BELOW THIS LINE * * */ | ||
(function() { | ||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; | ||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; | ||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | ||
})(); | ||
|
||
(function () { | ||
var s = document.createElement('script'); s.async = true; | ||
s.type = 'text/javascript'; | ||
s.src = '//' + disqus_shortname + '.disqus.com/count.js'; | ||
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); | ||
}()); |