Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
qinwf committed Apr 26, 2020
1 parent d65e574 commit 78b1bed
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 81 deletions.
21 changes: 12 additions & 9 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,18 @@
<meta name="twitter:description" content="{{ page.description }}" /> {% endif %}
<meta name="twitter:image" content="https://rweekly.org/public/logo.png" />
<script>
var _paq = _paq || [];
function show_btn_more(a){
console.log("over");
console.log(a);
a.parentElement.previousElementSibling.classList.add("show-post-more");
a.classList.add('btn-hovered');
_paq.push(['trackEvent', 'read-more', 1]);
// _paq.push(['trackEvent', 'read-more', 1]);
}

function pas(a){
console.log(a.parentNode.innerText);
_paq.push(['trackEvent', 'goto-patreon', a.parentNode.innerText]);
// _paq.push(['trackEvent', 'goto-patreon', a.parentNode.innerText]);
}
var allptext = [
'<a class="non-visited externalLink" href="https://www.patreon.com/rweekly" onclick="pas(this)">Enjoy R Weekly! Support us with Patreon! 💞</a>',
Expand Down Expand Up @@ -110,7 +111,7 @@
pelt.innerHTML = '<button class="pure-button post-more-btn" onmouseover="show_btn_more(this)">More</button>';
var more_end = all_end[jj];
more_end.parentNode.insertBefore(pelt, more_end.nextSibling);
_paq.push(['trackEvent', 'setup-more', 1]);
// _paq.push(['trackEvent', 'setup-more', 1]);
// create range
var range = document.createRange();
range.setStartBefore(all_start[jj]);
Expand Down Expand Up @@ -212,7 +213,7 @@
a_g_clone.addEventListener("click",function(e){
e.preventDefault();
if(!localStorage.getItem("like-"+ this.getAttribute("id-href"))){
_paq.push(['trackEvent', 'Like', this.getAttribute("id-href"), this.getAttribute("id-text")]);
// _paq.push(['trackEvent', 'Like', this.getAttribute("id-href"), this.getAttribute("id-text")]);

var now_date = new Date();

Expand Down Expand Up @@ -242,7 +243,8 @@

setInterval(add_external_links, 1000);
</script>
<script type="text/javascript">

<!-- <script type="text/javascript">
var _paq = _paq || [];
_paq.push(['setCustomVariable', 1, "Night", localStorage.getItem('night'), "page"]);
_paq.push(['setCustomVariable', 2, "Origin", localStorage.getItem('origin'), "page"]);
Expand Down Expand Up @@ -272,7 +274,8 @@
</script>
<noscript>
<p><img src="//web.rweekly.org/js/index.php?idsite=1" style="border:0;" alt="" /></p>
</noscript>
</noscript> -->

<!--DNS Prefetch-->
<link rel="dns-prefetch" href="//www.rstudio.com">
<link rel="dns-prefetch" href="//github.com">
Expand All @@ -284,11 +287,11 @@
if (localStorage.getItem('night') === 'true') {
localStorage.setItem('night', 'false');
document.body.classList.remove('night');
_paq.push(['trackEvent', 'set-nightmode', 'false']);
// _paq.push(['trackEvent', 'set-nightmode', 'false']);
} else {
localStorage.setItem('night', 'true');
document.body.classList.add('night');
_paq.push(['trackEvent', 'set-nightmode', 'true']);
// _paq.push(['trackEvent', 'set-nightmode', 'true']);
}
}
document.addEventListener("DOMContentLoaded",function(){
Expand All @@ -311,7 +314,7 @@

if (localStorage.getItem("feature-support") === 'false'){
document.body.classList.add('no-support-rweekly');
_paq.push(['trackEvent', 'no-support-rweekly', true]);
// _paq.push(['trackEvent', 'no-support-rweekly', true]);
}
try{
var xlanguage = window.navigator.userLanguage || window.navigator.language;
Expand Down
38 changes: 19 additions & 19 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<div id="toc"></div>
<!--/.well -->

<div id="podcast" class="podcast">
<!-- <div id="podcast" class="podcast">
<div class="podcast-title"><strong>RWeekly Podcast</strong></div>
<iframe id="ytplayer" type="text/html" class="podcast-player"
src="https://www.youtube.com/embed/videoseries?list=PLGxFMt5POda38NafNl6GR3ydh-WXjPV3k&showinfo=0"></iframe>
</div>
</div> -->

{% include github-corner.html %}

Expand Down Expand Up @@ -52,23 +52,23 @@ <h3 class="masthead-title default-links">
<script>
{% include readable-number.js %}

page_view = document.getElementById("page_view");
var xhr = new XMLHttpRequest();
xhr.open("GET","https://page.rweekly.org/?page="+document.location.host + document.location.pathname);
if (page_view){
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
var ns = new NumberStrings();
var myArr = JSON.parse(xhr.responseText);
if (myArr.hit < 1000){
page_view.innerHTML = myArr.hit + " views" ;
} else {
page_view.innerHTML = ns.getDecimal(myArr.hit).toFixed(2) + " " + ns.getName(myArr.hit) + " views" ;
}
}
};
}
xhr.send();
// page_view = document.getElementById("page_view");
// var xhr = new XMLHttpRequest();
// xhr.open("GET","https://page.rweekly.org/?page="+document.location.host + document.location.pathname);
// if (page_view){
// xhr.onreadystatechange = function() {
// if (xhr.readyState == 4 && xhr.status == 200) {
// var ns = new NumberStrings();
// var myArr = JSON.parse(xhr.responseText);
// if (myArr.hit < 1000){
// page_view.innerHTML = myArr.hit + " views" ;
// } else {
// page_view.innerHTML = ns.getDecimal(myArr.hit).toFixed(2) + " " + ns.getName(myArr.hit) + " views" ;
// }
// }
// };
// }
// xhr.send();

var anchorForId = function (id) {
var anchor = document.createElement("a");
Expand Down
2 changes: 1 addition & 1 deletion privacy.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ <h1>Privacy on R Weekly</h1>

<hr>

<iframe style="border: 0; height: 200px; width: 600px;" src="https://web.rweekly.org/index.php?module=CoreAdminHome&action=optOut&language=en"></iframe>
<!-- <iframe style="border: 0; height: 200px; width: 600px;" src="https://web.rweekly.org/index.php?module=CoreAdminHome&action=optOut&language=en"></iframe> -->
Loading

0 comments on commit 78b1bed

Please sign in to comment.