Skip to content

Commit

Permalink
Improve JavaScript code by fixing lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzschmid committed Feb 15, 2021
1 parent 6dc57d5 commit 77521da
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
jekyll-theme-conference (3.1.0)
jekyll-theme-conference (3.1.1)
jekyll (~> 4.0)

GEM
Expand Down
21 changes: 13 additions & 8 deletions _includes/js/conference-live.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,23 @@ window.conference.live = (function() {
}
};

let resetTime = function (timeStr) {
let resetTime = function () {
// Reset app time
timeOffset = 0;
freezeTime = false;

startUpdate();
};

let setTime = function (newTime, newDay=1) {
let setTime = function (newTime, newDay) {
// Set and pause app time
pauseTime();

let dayIdx;
if (Number.isInteger(newDay)) {
if (arguments.length < 2) {
dayIdx = 0;
}
else if (Number.isInteger(newDay)) {
dayIdx = newDay-1;
}
else if (/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/.test(newDay)) {
Expand All @@ -123,7 +126,7 @@ window.conference.live = (function() {
else {
dayIdx = data.days.find(o => o.name === newDay);
}
newDate = data.days[dayIdx].date;
let newDate = data.days[dayIdx].date;

let d = new Date(newDate);
newTime = newTime.split(':');
Expand All @@ -134,8 +137,10 @@ window.conference.live = (function() {
update();
};

let getTime = function (tConvert=time()) {
let getTime = function () {
// Return app time as string
let tConvert = time();

let d = new Date(tConvert * 1000);
let dStr = d.toISOString().slice(0,10);
let h = d.getHours();
Expand Down Expand Up @@ -564,7 +569,7 @@ window.conference.live = (function() {
}
};

let hideModal = function (event) {
let hideModal = function () {
// Close stream modal
streamModal.find('iframe').attr('src', '');
streamModal.find('.modal-footer .btn').removeClass('active');
Expand All @@ -581,8 +586,8 @@ window.conference.live = (function() {
let roomName = button.data('room');
setStream(roomName);
});
streamModal.on('hide.bs.modal', function (event) {
hideModal(event);
streamModal.on('hide.bs.modal', function () {
hideModal();
});

// configure room selection buttons in modal
Expand Down
2 changes: 1 addition & 1 deletion _includes/js/conference-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ window.conference.mapConfig = (function() {
};

let init = function () {
elId = 'map';
let elId = 'map';

if (document.getElementById(elId)) {
setup(elId);
Expand Down
8 changes: 4 additions & 4 deletions _includes/js/conference-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ window.conference.modal = (function () {
}
};

let hide = function (el, event) {
let hide = function (el) {
let modal = $(el);

modal.find('.modal-title h3').text('');
Expand All @@ -61,13 +61,13 @@ window.conference.modal = (function () {
};

let init = function() {
elSel = '#link-modal';
let elSel = '#link-modal';

$(elSel).on('show.bs.modal', function (event) {
show(this, event);
});
$(elSel).on('hide.bs.modal', function (event) {
hide(this, event);
$(elSel).on('hide.bs.modal', function () {
hide(this);
});
};

Expand Down
2 changes: 1 addition & 1 deletion _includes/js/conference-program.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ window.conference.program = (function() {
}

// Add current selected day as hash to URL while keeping current scrolling position
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$('a[data-toggle="tab"]').on('shown.bs.tab', function () {
updateHash(this.hash);
});
}
Expand Down
2 changes: 1 addition & 1 deletion _includes/js/syncscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function (exports) {
var elems = document.getElementsByClassName('syncscroll');
var i, j, el, found, name;
for (name in names) {
if (names.hasOwnProperty(name)) {
if (Object.prototype.hasOwnProperty.call(names, name)) {
for (i = 0; i < names[name].length; i++) {
names[name][i].removeEventListener(
'scroll', names[name][i].syn, 0
Expand Down
2 changes: 1 addition & 1 deletion jekyll-theme-conference.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "jekyll-theme-conference"
spec.version = "3.1.0"
spec.version = "3.1.1"
spec.authors = ["Lorenz Schmid"]
spec.email = ["lorenzschmid@users.noreply.github.com"]

Expand Down

0 comments on commit 77521da

Please sign in to comment.