Remove unused timeString statements (#2568) [ci skip]
This commit is contained in:
parent
2be61f826f
commit
158c398df4
4 changed files with 35 additions and 37 deletions
|
|
@ -62,8 +62,8 @@ function fetchNotificationsCount() {
|
|||
}
|
||||
}
|
||||
};
|
||||
var timeString = (Date.now()).toString();
|
||||
xmlhttp.open('Get', '/notifications/counts', true);
|
||||
|
||||
xmlhttp.open('GET', '/notifications/counts', true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
function initializeBodyData() {
|
||||
fetchBaseData();
|
||||
}
|
||||
|
|
@ -6,48 +5,47 @@ function initializeBodyData() {
|
|||
function fetchBaseData() {
|
||||
var xmlhttp;
|
||||
if (window.XMLHttpRequest) {
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
} else {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
|
||||
}
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
|
||||
var json = JSON.parse(xmlhttp.responseText);
|
||||
if (json.token) {
|
||||
removeExistingCSRF();
|
||||
}
|
||||
var meta = document.createElement('meta');
|
||||
var metaTag = document.querySelector("meta[name='csrf-token']");
|
||||
meta.name = "csrf-param";
|
||||
meta.content = json.param;
|
||||
document.getElementsByTagName('head')[0].appendChild(meta);
|
||||
var meta = document.createElement('meta');
|
||||
meta.name = "csrf-token";
|
||||
meta.content = json.token;
|
||||
document.getElementsByTagName('head')[0].appendChild(meta);
|
||||
document.getElementsByTagName('body')[0].dataset.loaded = "true";
|
||||
if (checkUserLoggedIn()) {
|
||||
document.getElementsByTagName('body')[0].dataset.user = json.user;
|
||||
browserStoreCache("set",json.user)
|
||||
setTimeout(function(){
|
||||
if (typeof ga === "function") {
|
||||
ga('set', 'userId', JSON.parse(json.user).id);
|
||||
}
|
||||
},400)
|
||||
}
|
||||
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
|
||||
var json = JSON.parse(xmlhttp.responseText);
|
||||
if (json.token) {
|
||||
removeExistingCSRF();
|
||||
}
|
||||
};
|
||||
var timeString = (Date.now()).toString();
|
||||
xmlhttp.open("GET", "/async_info/base_data", true);
|
||||
var meta = document.createElement('meta');
|
||||
var metaTag = document.querySelector("meta[name='csrf-token']");
|
||||
meta.name = 'csrf-param';
|
||||
meta.content = json.param;
|
||||
document.getElementsByTagName('head')[0].appendChild(meta);
|
||||
var meta = document.createElement('meta');
|
||||
meta.name = 'csrf-token';
|
||||
meta.content = json.token;
|
||||
document.getElementsByTagName('head')[0].appendChild(meta);
|
||||
document.getElementsByTagName('body')[0].dataset.loaded = 'true';
|
||||
if (checkUserLoggedIn()) {
|
||||
document.getElementsByTagName('body')[0].dataset.user = json.user;
|
||||
browserStoreCache('set', json.user);
|
||||
setTimeout(function() {
|
||||
if (typeof ga === 'function') {
|
||||
ga('set', 'userId', JSON.parse(json.user).id);
|
||||
}
|
||||
}, 400);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xmlhttp.open('GET', '/async_info/base_data', true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
|
||||
function removeExistingCSRF(){
|
||||
function removeExistingCSRF() {
|
||||
var csrfTokenMeta = document.querySelector("meta[name='csrf-token']");
|
||||
var csrfParamMeta = document.querySelector("meta[name='csrf-param']");
|
||||
if (csrfTokenMeta && csrfParamMeta) {
|
||||
csrfTokenMeta.parentNode.removeChild(csrfTokenMeta);
|
||||
csrfParamMeta.parentNode.removeChild(csrfParamMeta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ function initializeCommentsPage() {
|
|||
}
|
||||
}
|
||||
};
|
||||
var timeString = (Date.now()).toString();
|
||||
|
||||
ajaxReq.open("GET", "/reactions?commentable_id=" + commentableIdList[i] + "&commentable_type=" + commentableType, true);
|
||||
ajaxReq.send();
|
||||
})(i);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
document.getElementsByTagName('body')[0].dataset.loaded = "true";
|
||||
}
|
||||
};
|
||||
var timeString = (Date.now()).toString();
|
||||
|
||||
xmlhttp.open("GET", "/async_info/base_data", true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue