Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT ESLint issues #114

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 59 additions & 59 deletions client/src/js/realme.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,108 +9,108 @@
*/
// eslint-disable-next-line no-use-before-define
const RealMe = RealMe || (function (document, window, jQuery) {
/**
/**
* Windows Phone with the mango update doesn't realise it has touchevents.
* @type {Boolean}
*/
const isIE9Mobile = navigator.userAgent.match(/(IEMobile\/9.0)/);
const isIE6 = /\bMSIE 6/.test(navigator.userAgent) && !window.opera;
const isIE9Mobile = navigator.userAgent.match(/(IEMobile\/9.0)/);
const isIE6 = /\bMSIE 6/.test(navigator.userAgent) && !window.opera;

if (isIE6) {
return false;
}
if (isIE6) {
return false;
}

/**
/**
* Internal namespace for RealMe
* @type {Object}
*/
const RM = {
const RM = {

/**
/**
* Cache all our DOM elements
* @return {void}
*/
cacheElements() {
this.$container = jQuery('.realme_widget');
this.$trigger = jQuery('.whats_realme', this.$container);
this.$modal = jQuery('.realme_popup', this.$container);
},
cacheElements() {
this.$container = jQuery('.realme_widget');
this.$trigger = jQuery('.whats_realme', this.$container);
this.$modal = jQuery('.realme_popup', this.$container);
},

/**
/**
* Called when jQuery Document is ready.
* Simple feature detection to determine if device is touch or not
* @return {void}
*/
init() {
/**
init() {
/**
* Get all the elements when we init.
*/
this.cacheElements();
if ('ontouchstart' in document || isIE9Mobile !== null) {
this.$container.addClass('touch');
this.popup_window();
} else {
this.$container.addClass('no_touch');
this.bind_no_touch();
}
},
this.cacheElements();
if ('ontouchstart' in document || isIE9Mobile !== null) {
this.$container.addClass('touch');
this.popup_window();
} else {
this.$container.addClass('no_touch');
this.bind_no_touch();
}
},

/**
/**
* use JS to prevent the href on the <a> from being followed in case user clicks instead of just hovers
* @return {void}
*/
bind_no_touch() {
this.$trigger.on('click', (e) => {
e.preventDefault();
});
},
bind_no_touch() {
this.$trigger.on('click', (e) => {
e.preventDefault();
});
},

/**
/**
* [bind events for touch devices - add class to popup window to show / hide it
* @param {jQuery element} $elem
* @return {void}
*/
show_popup() {
this.$modal.addClass('active');
},
show_popup() {
this.$modal.addClass('active');
},

/**
/**
* @param {jQuery element} $elem
* @return {void}
*/
hide_popup() {
this.$modal.removeClass('active');
},
hide_popup() {
this.$modal.removeClass('active');
},

/**
/**
* Popups up an information modal
* @param {jQuery element} $link
* @param {jQuery element} $modal
* @return {void}
*/
popup_window() {
const me = this;

this.$trigger.click(function (e) {
if (this.$modal.hasClass('active')) {
me.hide_popup();
} else {
me.show_popup();
}
e.stopPropagation();
});
popup_window() {
const me = this;

this.$trigger.click(() => false);
this.$trigger.click(function (e) {
if (this.$modal.hasClass('active')) {
me.hide_popup();
} else {
me.show_popup();
}
};
e.stopPropagation();
});

/**
this.$trigger.click(() => false);
}
};

/**
* Initialise RealMe widget
* @return {[type]}
*/
jQuery(document).ready(() => {
RM.init();
});
jQuery(document).ready(() => {
RM.init();
});

return RM;
return RM;
}(document, window, jQuery));