Last active
August 29, 2015 13:56
-
-
Save suzukimilanpaak/8878595 to your computer and use it in GitHub Desktop.
Javascript for Blog
This file contains hidden or 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
<!-- | |
* highlight.js | |
--> | |
<link rel="stylesheet" href="https://googledrive.com/host/0B-jdnZOJbr7XUkgybU1zYUs0dG8/tomorrow.css" /> | |
<script src="http://yandex.st/highlightjs/8.0/highlight.min.js"></script> | |
<style type='text/css'> | |
/* | |
pre { | |
display: block; | |
padding: 8.5px; | |
margin: 0 0 9px; | |
font-size: 12px; | |
line-height: 18px; | |
background-color: #f5f5f5; | |
border: 1px solid #ccc; | |
border: 1px solid rgba(0,0,0,0.15); | |
-webkit-border-radius: 4px; | |
-moz-border-radius: 4px; | |
border-radius: 4px; | |
white-space: pre; | |
white-space: pre-wrap; | |
word-break: break-all; | |
word-wrap: break-word; | |
} | |
*/ | |
pre { | |
background-color: #f5f5f5; | |
border: 1px solid #ccc; | |
border: 1px solid rgba(0,0,0,0.15); | |
-webkit-border-radius: 5px; | |
-moz-border-radius: 5px; | |
border-radius: 5px; | |
} | |
pre.markdown { | |
border: none; | |
background-color: inherit; | |
} | |
</style> | |
<!-- | |
* marked.js | |
* | |
* Convert 'post-body' with markdown | |
--> | |
<script type='text/javascript' src='https://googledrive.com/host/0B-jdnZOJbr7XUkgybU1zYUs0dG8/marked.js' > | |
</script> | |
<script type='text/javascript' > | |
var postBody = document.getElementsByClassName('markdown')[0]; | |
marked.setOptions({ | |
gfm: true, | |
tables: true, | |
breaks: true, | |
pedantic: false, | |
sanitize: false, | |
smartLists: false, | |
smartypants: true, | |
highlight: function (code) { | |
return hljs.highlightAuto(code).value; | |
} | |
}); | |
postBody.innerHTML = marked(postBody.innerHTML); | |
</script> | |
<!-- | |
* addthis_widget.js | |
* | |
* Enable add this widget, which is set of SNS buttons | |
--> | |
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4fef206402b975f6"></script> | |
<script type="text/javascript"> | |
var addthis_config = {"data_track_addressbar":true}; | |
document.doAT = function(cl) | |
{ | |
var myclass = new RegExp('hentry'); | |
var myTitleContainer = new RegExp('post-title'); | |
var myPostContent = new RegExp('post-footer'); | |
var elem = this.getElementsByTagName('div'); | |
for (var i = 0; i < elem.length; i++) | |
{ | |
var classes = elem[i].className; | |
if (myclass.test(classes)) | |
{ var container = elem[i]; | |
for (var b = 0; b < container.childNodes.length; b++) | |
{ | |
var item = container.childNodes[b].className; | |
if (myTitleContainer.test(item)) | |
{ | |
var link = container.childNodes[b].getElementsByTagName('a'); | |
if (typeof(link[0]) != 'undefined') | |
{ | |
var url = link[0].href; | |
var title = link[0].innerHTML; | |
} | |
else | |
{ | |
var url = document.url; | |
var title = container.childNodes[b].innerHTML; | |
} | |
if (typeof(url) == 'undefined'|| url == 'undefined' ){ | |
url = window.location.href; | |
} | |
var singleq = new RegExp("'", 'g'); | |
var doubleq = new RegExp('"', 'g'); | |
title = title.replace(singleq, ''', 'gi'); | |
title = title.replace(doubleq, '"', 'gi'); | |
} | |
if (myPostContent.test(item)) | |
{ | |
var footer = container.childNodes[b]; | |
} | |
} | |
var n = document.createElement('div'); | |
var at = "<div class='addthis_toolbox addthis_default_style addthis_32x32_style' addthis:title='"+title+"' addthis:url='"+encodeURI(url)+"' > <a class='addthis_button_preferred_1'></a> <a class='addthis_button_preferred_2'></a> <a class='addthis_button_preferred_3'></a> <a class='addthis_button_preferred_4'></a> <a class='addthis_button_compact'></a> <a class='addthis_counter addthis_bubble_style'></a> </div> "; | |
n.innerHTML = at; | |
container.insertBefore(n , footer); | |
} | |
} | |
return true; | |
}; | |
document.doAT('hentry'); | |
</script> | |
<!-- | |
* Google Analytics | |
--> | |
<script type="text/javascript"> | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-1254561-3']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); | |
</script> | |
<!-- | |
* Follow me in twitter | |
* | |
* twitter follow badge by go2web20 | |
--> | |
<script src='http://www.go2web20.net/twitterfollowbadge/1.0/badge.js' type='text/javascript'></script><script type='text/javascript' charset='utf-8'><!-- | |
tfb.account = 'szkmp'; | |
tfb.label = 'follow-me'; | |
tfb.color = '#7c4900'; | |
tfb.side = 'r'; | |
tfb.top = 136; | |
tfb.showbadge(); | |
--></script> | |
<!-- | |
* Pretty Print | |
--> | |
<!-- | |
<script src='http://iwai.ug.googlepages.com/prettify.js' type='text/javascript' /> | |
<link href='http://iwai.ug.googlepages.com/prettify.css' rel='stylesheet' type='text/css' /></script> | |
<style type="text/css"> | |
/* Pretty printing styles. Used with prettify.js. */ | |
.prettyprint{ | |
/*background-color: #5E412F;*/ | |
background-color: #F5EEDD; | |
} | |
.str { color: #080; } | |
.kwd { color: #09F; } | |
.com { color: #800; } | |
.typ { color: #96F; } | |
.lit { color: #399; } | |
.pun { color: #996; } | |
.pln { color: #000; } | |
.tag { color: #09F; } | |
.atn { color: #96F; } | |
.atv { color: #080; } | |
.dec { color: #96F; } | |
@media print { | |
.str { color: #060; } | |
.kwd { color: #006; font-weight: bold; } | |
.com { color: #600; font-style: italic; } | |
.typ { color: #404; font-weight: bold; } | |
.lit { color: #044; } | |
.pun { color: #440; } | |
.pln { color: #000; } | |
.tag { color: #006; font-weight: bold; } | |
.atn { color: #404; } | |
.atv { color: #060; } | |
} | |
</style> | |
--> | |
<!-- | |
* Disqus | |
--> | |
<div id="disqus_thread"></div> | |
<script type="text/javascript"> | |
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ | |
var disqus_shortname = 'engineerflies'; | |
/* * * 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); | |
})(); | |
</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> | |
<script type="text/javascript"> | |
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ | |
var disqus_shortname = 'engineerflies'; // required: replace example with your forum shortname | |
/* * * DON'T EDIT BELOW THIS LINE * * */ | |
(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> | |
<style type="text/css"> | |
#disqus_thread { | |
color: #000; | |
} | |
</style> |
This file contains hidden or 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
# example text of marked | |
http://dillinger.io/ | |
# Realtime demo of marked | |
http://www.javascriptoo.com/marked | |
# highlight js | |
http://highlightjs.org/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment