mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-03 18:03:37 +00:00
Merge pull request #806 from JackDandy/feature/FixMassEditRoot
Change refactor js to use sgroot.
This commit is contained in:
commit
a981e836f0
2 changed files with 92 additions and 101 deletions
|
@ -71,6 +71,7 @@
|
||||||
<!--
|
<!--
|
||||||
var sbRoot = '$sbRoot', anonURL = '$sickbeard.ANON_REDIRECT', themeSpinner = '#echo ('', '-dark')['dark' == $sickbeard.THEME_NAME]#',
|
var sbRoot = '$sbRoot', anonURL = '$sickbeard.ANON_REDIRECT', themeSpinner = '#echo ('', '-dark')['dark' == $sickbeard.THEME_NAME]#',
|
||||||
top_image_html = '<img src="$sbRoot/images/top.gif" width="31" height="11" alt="Jump to top" />', topmenu = '$topmenu';
|
top_image_html = '<img src="$sbRoot/images/top.gif" width="31" height="11" alt="Jump to top" />', topmenu = '$topmenu';
|
||||||
|
\$.SickGear = {Root: '${sbRoot}'};
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="$sbRoot/js/lib/jquery.scrolltopcontrol-1.1.js"></script>
|
<script type="text/javascript" src="$sbRoot/js/lib/jquery.scrolltopcontrol-1.1.js"></script>
|
||||||
|
|
|
@ -1,123 +1,113 @@
|
||||||
$(document).ready(function(){
|
/** @namespace $.SickGear.Root */
|
||||||
|
|
||||||
$('#submitMassEdit').click(function(){
|
$(document).ready(function() {
|
||||||
var editArr = new Array()
|
|
||||||
|
|
||||||
$('.editCheck').each(function() {
|
|
||||||
if (this.checked == true) {
|
|
||||||
editArr.push($(this).attr('id').split('-')[1])
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (editArr.length == 0)
|
$('#submitMassEdit').click(function() {
|
||||||
return
|
var editArr = [];
|
||||||
|
|
||||||
url = 'massEdit?toEdit='+editArr.join('|')
|
$('.editCheck').each(function() {
|
||||||
window.location.href = url
|
if (true == this.checked) {
|
||||||
});
|
editArr.push($(this).attr('id').split('-')[1])
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (0 == editArr.length)
|
||||||
|
return !1;
|
||||||
|
|
||||||
$('#submitMassUpdate').click(function(){
|
window.location.href = $.SickGear.Root + 'massEdit?toEdit=' + editArr.join('|');
|
||||||
|
|
||||||
var updateArr = new Array()
|
|
||||||
var refreshArr = new Array()
|
|
||||||
var renameArr = new Array()
|
|
||||||
var subtitleArr = new Array()
|
|
||||||
var deleteArr = new Array()
|
|
||||||
var removeArr = new Array()
|
|
||||||
var metadataArr = new Array()
|
|
||||||
|
|
||||||
$('.updateCheck').each(function() {
|
|
||||||
if (this.checked == true) {
|
|
||||||
updateArr.push($(this).attr('id').split('-')[1])
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.refreshCheck').each(function() {
|
|
||||||
if (this.checked == true) {
|
|
||||||
refreshArr.push($(this).attr('id').split('-')[1])
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.renameCheck').each(function() {
|
|
||||||
if (this.checked == true) {
|
|
||||||
renameArr.push($(this).attr('id').split('-')[1])
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.subtitleCheck').each(function() {
|
|
||||||
if (this.checked == true) {
|
|
||||||
subtitleArr.push($(this).attr('id').split('-')[1])
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.deleteCheck').each(function() {
|
|
||||||
if (this.checked == true) {
|
|
||||||
deleteArr.push($(this).attr('id').split('-')[1])
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.removeCheck').each(function() {
|
|
||||||
if (this.checked == true) {
|
|
||||||
removeArr.push($(this).attr('id').split('-')[1])
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#submitMassUpdate').click(function() {
|
||||||
|
|
||||||
|
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])
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$('.metadataCheck').each(function() {
|
$('.metadataCheck').each(function() {
|
||||||
if (this.checked == true) {
|
if (true == this.checked) {
|
||||||
metadataArr.push($(this).attr('id').split('-')[1])
|
metadataArr.push($(this).attr('id').split('-')[1])
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
if (updateArr.length+refreshArr.length+renameArr.length+subtitleArr.length+deleteArr.length+removeArr.length+metadataArr.length == 0)
|
if (0 == updateArr.length + refreshArr.length + renameArr.length + subtitleArr.length + deleteArr.length + removeArr.length + metadataArr.length)
|
||||||
return false
|
return !1;
|
||||||
|
|
||||||
url = 'massUpdate?toUpdate='+updateArr.join('|')+'&toRefresh='+refreshArr.join('|')+'&toRename='+renameArr.join('|')+'&toSubtitle='+subtitleArr.join('|')+'&toDelete='+deleteArr.join('|')+'&toRemove='+removeArr.join('|')+'&toMetadata='+metadataArr.join('|')
|
window.location.href = $.SickGear.Root + 'massUpdate?toUpdate=' + updateArr.join('|') + '&toRefresh=' + refreshArr.join('|') + '&toRename=' + renameArr.join('|') + '&toSubtitle=' + subtitleArr.join('|') + '&toDelete=' + deleteArr.join('|') + '&toRemove=' + removeArr.join('|') + '&toMetadata=' + metadataArr.join('|');
|
||||||
|
|
||||||
window.location.href = url
|
});
|
||||||
|
|
||||||
});
|
$('.bulkCheck').click(function() {
|
||||||
|
|
||||||
$('.bulkCheck').click(function(){
|
var bulkCheck = this, whichBulkCheck = $(bulkCheck).attr('id');
|
||||||
|
|
||||||
var bulkCheck = this;
|
|
||||||
var whichBulkCheck = $(bulkCheck).attr('id');
|
|
||||||
|
|
||||||
$('.'+whichBulkCheck).each(function(){
|
$('.' + whichBulkCheck).each(function() {
|
||||||
if (!this.disabled)
|
if (!this.disabled)
|
||||||
this.checked = !this.checked
|
this.checked = !this.checked
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
['.editCheck', '.updateCheck', '.refreshCheck', '.renameCheck', '.deleteCheck', '.removeCheck'].forEach(function(name) {
|
['.editCheck', '.updateCheck', '.refreshCheck', '.renameCheck', '.deleteCheck', '.removeCheck'].forEach(function(name) {
|
||||||
var lastCheck = null;
|
var lastCheck = null;
|
||||||
|
|
||||||
$(name).click(function(event) {
|
$(name).click(function(event) {
|
||||||
|
|
||||||
if(!lastCheck || !event.shiftKey) {
|
if(!lastCheck || !event.shiftKey) {
|
||||||
lastCheck = this;
|
lastCheck = this;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var check = this;
|
var check = this, found = 0;
|
||||||
var found = 0;
|
|
||||||
|
|
||||||
$(name).each(function() {
|
$(name).each(function() {
|
||||||
switch (found) {
|
switch (found) {
|
||||||
case 2: return false;
|
case 2:
|
||||||
case 1:
|
return !1;
|
||||||
if (!this.disabled)
|
case 1:
|
||||||
this.checked = lastCheck.checked;
|
if (!this.disabled)
|
||||||
}
|
this.checked = lastCheck.checked;
|
||||||
|
}
|
||||||
|
|
||||||
if (this == check || this == lastCheck)
|
if (this == check || this == lastCheck)
|
||||||
found++;
|
found++;
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
lastClick = this;
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue