forked from rampatra/JavaNotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
48 lines (37 loc) · 2.26 KB
/
main.js
File metadata and controls
48 lines (37 loc) · 2.26 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
var elements = document.getElementsByTagName('script')
Array.prototype.forEach.call(elements, function (element) {
if (element.type.indexOf('math/tex') != -1) {
// Extract math markdown
var textToRender = element.innerText || element.textContent;
// Create span for KaTeX
var katexElement = document.createElement('span');
// Support inline and display math
if (element.type.indexOf('mode=display') != -1) {
katexElement.className += "math-display";
textToRender = '\\displaystyle {' + textToRender + '}';
} else {
katexElement.className += "math-inline";
}
katex.render(textToRender, katexElement);
element.parentNode.insertBefore(katexElement, element);
}
});
// Share bar
var share_bar = document.getElementsByClassName('share-bar');
var po = document.createElement('script');
po.type = 'text/javascript';
po.async = true;
po.src = 'https://apis.google.com/js/platform.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(po, s);
for (var i = 0; i < share_bar.length; i++) {
var html = '<iframe allowtransparency="true" frameborder="0" scrolling="no"' +
'src="http://platform.twitter.com/widgets/tweet_button.html?url=' + encodeURIComponent(window.location) + '&text=' + encodeURIComponent(document.title) + '&via=ramswarooppatra&hashtags=java&count=horizontal"' +
'style="width:105px; height:21px;">' +
'</iframe>' +
'<iframe src="//www.facebook.com/plugins/like.php?href=' + encodeURIComponent(window.location) + '&width&layout=button_count&action=like&show_faces=false&share=true&height=21&appId=101094500229731&width=150" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowTransparency="true"></iframe>' +
'<div class="g-plusone" data-size="medium"></div>';
//'<iframe src="https://plusone.google.com/_/+1/fastbutton?bsv&size=medium&url=' + encodeURIComponent(window.location) + '" allowtransparency="true" frameborder="0" scrolling="no" title="+1" style="width:105px; height:21px;"></iframe>';
share_bar[i].innerHTML = html;
share_bar[i].style.display = 'inline-block';
}