|
1 | 1 | var elements = document.getElementsByTagName('script') |
2 | 2 |
|
3 | | -Array.prototype.forEach.call(elements, function(element) { |
4 | | - if (element.type.indexOf('math/tex') != -1) { |
5 | | - // Extract math markdown |
6 | | - var textToRender = element.innerText || element.textContent; |
7 | | - |
8 | | - // Create span for KaTeX |
9 | | - var katexElement = document.createElement('span'); |
10 | | - |
11 | | - // Support inline and display math |
12 | | - if (element.type.indexOf('mode=display') != -1){ |
13 | | - katexElement.className += "math-display"; |
14 | | - textToRender = '\\displaystyle {' + textToRender + '}'; |
15 | | - } else { |
16 | | - katexElement.className += "math-inline"; |
17 | | - } |
18 | | - |
19 | | - katex.render(textToRender, katexElement); |
20 | | - element.parentNode.insertBefore(katexElement, element); |
21 | | - } |
| 3 | +Array.prototype.forEach.call(elements, function (element) { |
| 4 | + if (element.type.indexOf('math/tex') != -1) { |
| 5 | + // Extract math markdown |
| 6 | + var textToRender = element.innerText || element.textContent; |
| 7 | + |
| 8 | + // Create span for KaTeX |
| 9 | + var katexElement = document.createElement('span'); |
| 10 | + |
| 11 | + // Support inline and display math |
| 12 | + if (element.type.indexOf('mode=display') != -1) { |
| 13 | + katexElement.className += "math-display"; |
| 14 | + textToRender = '\\displaystyle {' + textToRender + '}'; |
| 15 | + } else { |
| 16 | + katexElement.className += "math-inline"; |
| 17 | + } |
| 18 | + |
| 19 | + katex.render(textToRender, katexElement); |
| 20 | + element.parentNode.insertBefore(katexElement, element); |
| 21 | + } |
22 | 22 | }); |
| 23 | + |
| 24 | +// Share bar |
| 25 | +var share_bar = document.getElementsByClassName('share-bar'); |
| 26 | + |
| 27 | +for (var i = 0; i < share_bar.length; i++) { |
| 28 | + |
| 29 | + var html = '<iframe allowtransparency="true" frameborder="0" scrolling="no"' + |
| 30 | + 'src="http://platform.twitter.com/widgets/tweet_button.html?url=' + encodeURIComponent(window.location) + '&text=' + encodeURIComponent(document.title) + '&via=ramswarooppatra&hashtags=java-concepts&count=horizontal"' + |
| 31 | + 'style="width:105px; height:21px;">' + |
| 32 | + '</iframe>' + |
| 33 | + |
| 34 | + '<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=217347368312341&width=150" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowTransparency="true"></iframe>' + |
| 35 | + |
| 36 | + '<script src="https://apis.google.com/js/plusone.js" async></script> <g:plusone href="' + encodeURIComponent(window.location) + '" size="medium"></g:plusone>'; |
| 37 | + |
| 38 | + share_bar[i].innerHTML = html; |
| 39 | + share_bar[i].style.display = 'inline-block'; |
| 40 | +} |
0 commit comments