2016-10-17 18:08:14 +00:00
|
|
|
/** @namespace $.SickGear.Root */
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
$('#submitMassEdit').click(function() {
|
|
|
|
var editArr = [];
|
|
|
|
|
|
|
|
$('.editCheck').each(function() {
|
|
|
|
if (true == this.checked) {
|
|
|
|
editArr.push($(this).attr('id').split('-')[1])
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (0 == editArr.length)
|
|
|
|
return !1;
|
|
|
|
|
2016-10-23 02:23:44 +00:00
|
|
|
window.location.href = $.SickGear.Root + '/manage/massEdit?toEdit=' + editArr.join('|');
|
2014-09-30 22:20:37 +00:00
|
|
|
});
|
2014-08-29 17:05:15 +00:00
|
|
|
|
2016-10-17 18:08:14 +00:00
|
|
|
|
2016-12-18 20:24:18 +00:00
|
|
|
$('#submitBulkChange').click(function() {
|
2016-10-17 18:08:14 +00:00
|
|
|
|
|
|
|
var updateArr = [], refreshArr = [], renameArr = [], subtitleArr = [],
|
|
|
|
deleteArr = [], removeArr = [], metadataArr = [];
|
|
|
|
|
|
|
|
$('.updateCheck').each(function() {
|
|
|
|
if (true == this.checked) {
|
|
|
|
updateArr.push($(this).attr('id').split('-')[1])
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.refreshCheck').each(function() {
|
|
|
|
if (true == this.checked) {
|
|
|
|
refreshArr.push($(this).attr('id').split('-')[1])
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.renameCheck').each(function() {
|
|
|
|
if (true == this.checked) {
|
|
|
|
renameArr.push($(this).attr('id').split('-')[1])
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.subtitleCheck').each(function() {
|
|
|
|
if (true == this.checked) {
|
|
|
|
subtitleArr.push($(this).attr('id').split('-')[1])
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.deleteCheck').each(function() {
|
|
|
|
if (true == this.checked) {
|
|
|
|
deleteArr.push($(this).attr('id').split('-')[1])
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$('.removeCheck').each(function() {
|
|
|
|
if (true == this.checked) {
|
|
|
|
removeArr.push($(this).attr('id').split('-')[1])
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-03-10 05:18:05 +00:00
|
|
|
/*
|
2016-10-17 18:08:14 +00:00
|
|
|
$('.metadataCheck').each(function() {
|
|
|
|
if (true == this.checked) {
|
|
|
|
metadataArr.push($(this).attr('id').split('-')[1])
|
|
|
|
}
|
|
|
|
});
|
2014-03-10 05:18:05 +00:00
|
|
|
*/
|
2016-10-17 18:08:14 +00:00
|
|
|
if (0 == updateArr.length + refreshArr.length + renameArr.length + subtitleArr.length + deleteArr.length + removeArr.length + metadataArr.length)
|
|
|
|
return !1;
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2016-12-18 20:24:18 +00:00
|
|
|
window.location.href = $.SickGear.Root + 'bulkChange?toUpdate=' + updateArr.join('|') + '&toRefresh=' + refreshArr.join('|') + '&toRename=' + renameArr.join('|') + '&toSubtitle=' + subtitleArr.join('|') + '&toDelete=' + deleteArr.join('|') + '&toRemove=' + removeArr.join('|') + '&toMetadata=' + metadataArr.join('|');
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2016-10-17 18:08:14 +00:00
|
|
|
});
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2016-10-17 18:08:14 +00:00
|
|
|
$('.bulkCheck').click(function() {
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2016-10-17 18:08:14 +00:00
|
|
|
var bulkCheck = this, whichBulkCheck = $(bulkCheck).attr('id');
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2016-10-17 18:08:14 +00:00
|
|
|
$('.' + whichBulkCheck).each(function() {
|
|
|
|
if (!this.disabled)
|
|
|
|
this.checked = !this.checked
|
|
|
|
});
|
|
|
|
});
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2016-10-17 18:08:14 +00:00
|
|
|
['.editCheck', '.updateCheck', '.refreshCheck', '.renameCheck', '.deleteCheck', '.removeCheck'].forEach(function(name) {
|
|
|
|
var lastCheck = null;
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2016-10-17 18:08:14 +00:00
|
|
|
$(name).click(function(event) {
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2016-10-17 18:08:14 +00:00
|
|
|
if(!lastCheck || !event.shiftKey) {
|
|
|
|
lastCheck = this;
|
|
|
|
return;
|
|
|
|
}
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2016-10-17 18:08:14 +00:00
|
|
|
var check = this, found = 0;
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2016-10-17 18:08:14 +00:00
|
|
|
$(name).each(function() {
|
|
|
|
switch (found) {
|
|
|
|
case 2:
|
|
|
|
return !1;
|
|
|
|
case 1:
|
|
|
|
if (!this.disabled)
|
|
|
|
this.checked = lastCheck.checked;
|
|
|
|
}
|
2014-03-10 05:18:05 +00:00
|
|
|
|
2016-10-17 18:08:14 +00:00
|
|
|
if (this == check || this == lastCheck)
|
|
|
|
found++;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-03-10 05:18:05 +00:00
|
|
|
|
|
|
|
});
|