eslint fixes

This commit is contained in:
Isaac Connor 2019-03-28 09:43:31 -04:00
parent 9a70dff143
commit 49e3f0a68e
3 changed files with 162 additions and 160 deletions

View File

@ -10,10 +10,10 @@
// a bug in ActiveXObject prevents us from properly testing for it.
CsrfMagic = function(real) {
// try to make it ourselves, if you didn't pass it
if (!real) try { real = new XMLHttpRequest; } catch (e) {;}
if (!real) try { real = new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) {;}
if (!real) try { real = new ActiveXObject('Microsoft.XMLHTTP'); } catch (e) {;}
if (!real) try { real = new ActiveXObject('Msxml2.XMLHTTP.4.0'); } catch (e) {;}
if (!real) try {real = new XMLHttpRequest;} catch (e) {;}
if (!real) try {real = new ActiveXObject('Msxml2.XMLHTTP');} catch (e) {;}
if (!real) try {real = new ActiveXObject('Microsoft.XMLHTTP');} catch (e) {;}
if (!real) try {real = new ActiveXObject('Msxml2.XMLHTTP.4.0');} catch (e) {;}
this.csrf = real;
// properties
var csrfMagic = this;
@ -22,7 +22,7 @@ CsrfMagic = function(real) {
return csrfMagic.onreadystatechange ? csrfMagic.onreadystatechange() : null;
};
csrfMagic._updateProps();
}
};
CsrfMagic.prototype = {
@ -74,7 +74,7 @@ CsrfMagic.prototype = {
getResponseHeader: function(header) {
return this.csrf.getResponseHeader(header);
} // ,
}
};
// proprietary
CsrfMagic.prototype._updateProps = function() {
@ -85,16 +85,18 @@ CsrfMagic.prototype._updateProps = function() {
this.status = this.csrf.status;
this.statusText = this.csrf.statusText;
}
}
};
CsrfMagic.process = function(base) {
if(typeof base == 'object') {
if ( typeof base == 'object' ) {
base[csrfMagicName] = csrfMagicToken;
return base;
}
var prepend = csrfMagicName + '=' + csrfMagicToken;
if (base) return prepend + '&' + base;
if ( base ) return prepend + '&' + base;
return prepend;
}
};
// callback function for when everything on the page has loaded
CsrfMagic.end = function() {
// This rewrites forms AGAIN, so in case buffering didn't work this
@ -110,12 +112,12 @@ CsrfMagic.end = function() {
input.setAttribute('type', 'hidden');
form.appendChild(input);
}
}
};
// Sets things up for Mozilla/Opera/nice browsers
// We very specifically match against Internet Explorer, since they haven't
// implemented prototypes correctly yet.
if (window.XMLHttpRequest && window.XMLHttpRequest.prototype && '\v' != 'v') {
if ( window.XMLHttpRequest && window.XMLHttpRequest.prototype && '\v' != 'v' ) {
var x = XMLHttpRequest.prototype;
var c = CsrfMagic.prototype;
@ -133,7 +135,7 @@ if (window.XMLHttpRequest && window.XMLHttpRequest.prototype && '\v' != 'v') {
// The only way we can do this is by modifying a library you have been
// using. We support YUI, script.aculo.us, prototype, MooTools,
// jQuery, Ext and Dojo.
if (window.jQuery) {
if ( window.jQuery ) {
// jQuery didn't implement a new XMLHttpRequest function, so we have
// to do this the hard way.
jQuery.csrf_ajax = jQuery.ajax;
@ -145,47 +147,47 @@ if (window.XMLHttpRequest && window.XMLHttpRequest.prototype && '\v' != 'v') {
}
s.data = CsrfMagic.process(s.data);
}
return jQuery.csrf_ajax( s );
return jQuery.csrf_ajax(s);
};
}
}
if (window.Prototype) {
if ( window.Prototype ) {
// This works for script.aculo.us too
Ajax.csrf_getTransport = Ajax.getTransport;
Ajax.getTransport = function() {
return new CsrfMagic(Ajax.csrf_getTransport());
};
}
}
if (window.MooTools) {
if ( window.MooTools ) {
Browser.csrf_Request = Browser.Request;
Browser.Request = function () {
Browser.Request = function() {
return new CsrfMagic(Browser.csrf_Request());
};
}
}
if (window.YAHOO) {
if ( window.YAHOO ) {
// old YUI API
YAHOO.util.Connect.csrf_createXhrObject = YAHOO.util.Connect.createXhrObject;
YAHOO.util.Connect.createXhrObject = function (transaction) {
YAHOO.util.Connect.createXhrObject = function(transaction) {
obj = YAHOO.util.Connect.csrf_createXhrObject(transaction);
obj.conn = new CsrfMagic(obj.conn);
return obj;
};
}
}
if (window.Ext) {
if ( window.Ext ) {
// Ext can use other js libraries as loaders, so it has to come last
// Ext's implementation is pretty identical to Yahoo's, but we duplicate
// it for comprehensiveness's sake.
Ext.lib.Ajax.csrf_createXhrObject = Ext.lib.Ajax.createXhrObject;
Ext.lib.Ajax.createXhrObject = function (transaction) {
Ext.lib.Ajax.createXhrObject = function(transaction) {
obj = Ext.lib.Ajax.csrf_createXhrObject(transaction);
obj.conn = new CsrfMagic(obj.conn);
return obj;
};
}
}
if (window.dojo) {
if ( window.dojo ) {
// NOTE: this doesn't work with latest dojo
dojo.csrf__xhrObj = dojo._xhrObj;
dojo._xhrObj = function () {
dojo._xhrObj = function() {
return new CsrfMagic(dojo.csrf__xhrObj());
};
}
}
}
};

View File

@ -27,7 +27,7 @@ function Monitor(monitorData) {
this.eventHandler = function( event ) {
console.log(event);
}
};
this.onclick = function(evt) {
var el = evt.currentTarget;