-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4348505
commit deadf71
Showing
1 changed file
with
48 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,60 @@ | ||
/* eslint strict:0 */ | ||
|
||
$(function() { | ||
jQuery(function() { | ||
'use strict'; | ||
|
||
$.getJSON('/points/ajax/getDirectory.php', function(data) { | ||
var i; | ||
var path = 'http://slivka.northwestern.edu/points/img/slivkans/'; | ||
|
||
for (i = 0; i < data.length; i++) { | ||
data[i][5] = [ | ||
'<img class="directoryphoto" src="', path, data[i][5], '"', | ||
'title="', data[i][0], ' ', data[i][1], '"', | ||
'style="height: 100px; display: none;" />' | ||
].join(''); | ||
var checkForDataTables = function() { | ||
if (typeof($().DataTable) === 'undefined') { | ||
setTimeout(checkForDataTables, 100); | ||
} else { | ||
init(); | ||
} | ||
}, | ||
init = function() { | ||
$.getJSON('/points/ajax/getDirectory.php', function(data) { | ||
var i; | ||
var path = 'http://slivka.northwestern.edu/points/img/slivkans/'; | ||
|
||
$('#directory').dataTable( { | ||
data: data, | ||
columns: [ | ||
{ title: 'First Name' }, | ||
{ title: 'Last Name' }, | ||
{ title: 'Year' }, | ||
{ title: 'Major' }, | ||
{ title: 'Suite' }, | ||
{ title: 'Photo', orderable: false } | ||
], | ||
order: [[0, 'asc']], | ||
paging: false | ||
}); | ||
for (i = 0; i < data.length; i++) { | ||
data[i][5] = [ | ||
'<img class="directoryphoto" src="', path, data[i][5], '"', | ||
'title="', data[i][0], ' ', data[i][1], '"', | ||
'style="height: 100px; display: none;" />' | ||
].join(''); | ||
} | ||
|
||
// directory password | ||
// This is a very insecure measure, mostly so the photos | ||
// aren't displayed by default and you have to know javascript to display them | ||
$('#submitdirectorypass').click(function() { | ||
if ('discoverslivka' === $('#directorypass').val()) { | ||
$('.directoryphoto').show(); | ||
$('#directory').dataTable( { | ||
data: data, | ||
columns: [ | ||
{ title: 'First Name' }, | ||
{ title: 'Last Name' }, | ||
{ title: 'Year' }, | ||
{ title: 'Major' }, | ||
{ title: 'Suite' }, | ||
{ title: 'Photo', orderable: false } | ||
], | ||
order: [[0, 'asc']], | ||
paging: false | ||
}); | ||
|
||
// dumb but works: saving password in localstorage | ||
localStorage.directorypass = 'discoverslivka'; | ||
// directory password | ||
// This is a very insecure measure, mostly so the photos | ||
// aren't displayed by default and you have to know javascript to display them | ||
$('#submitdirectorypass').click(function() { | ||
if ('discoverslivka' === $('#directorypass').val()) { | ||
$('.directoryphoto').show(); | ||
|
||
// dumb but works: saving password in localstorage | ||
localStorage.directorypass = 'discoverslivka'; | ||
} | ||
}); | ||
|
||
if (localStorage.directorypass) { | ||
$('#directorypass').val(localStorage.directorypass); | ||
$('#submitdirectorypass').click(); | ||
} | ||
}); | ||
} | ||
|
||
if (localStorage.directorypass) { | ||
$('#directorypass').val(localStorage.directorypass); | ||
$('#submitdirectorypass').click(); | ||
} | ||
}); | ||
$.getScript('/points/node_modules/datatables/media/js/jquery.dataTables.min.js', checkForDataTables); | ||
}); |