Change overhaul Config/Search Providers plus fix a couple of config links.

Change Config/Search Providers texts and descriptions.
Fix display when no providers are visible on Config/Search Providers.
Fix failing "Search Settings" link that is shown on Config/Search Providers when Torrents Search is not enabled under that Config/Search Settings/Torrent Search tab.
Fix failing "Providers" link on Config/Search Settings/Episode Search tab.
Change case of labels in General Config/Interface/Timezone.
Split enabled from not enabled providers in the Configure Provider drop down on the Providers Options tab.
This commit is contained in:
JackDandy 2014-11-21 18:40:00 +00:00
parent 7f3ed3ef63
commit 5c6ca57474
9 changed files with 1001 additions and 964 deletions

View file

@ -37,6 +37,13 @@
* Add TVRage "Canceled/Ended" as "Ended" status to sort on Simple Layout of Show List page
* Fix qtips on Display Show and Config Post Processing
* Fix glitch above rating stars on Display Show page
* Change overhaul Config/Search Providers
* Change Config/Search Providers texts and descriptions
* Fix display when no providers are visible on Config/Search Providers
* Fix failing "Search Settings" link that is shown on Config/Search Providers when Torrents Search is not enabled
* Fix failing "Providers" link on Config/Search Settings/Episode Search
* Change case of labels in General Config/Interface/Timezone
* Split enabled from not enabled providers in the Configure Provider drop down on the Providers Options tab
[develop changelog]
* Fix typo for commit "ShowData handler" i.e. SHA-1:3eec217

View file

@ -1455,17 +1455,11 @@ config*.tmpl
min-height: 200px;
}
.component-group-desc{
float: left;
width: 250px;
}
.component-group-desc h3{
margin-top: 5px;
}
.component-group-desc p {
width: 90%;
margin: 10px 0;
color: #ddd;
}
@ -1523,18 +1517,10 @@ select .selected {
#provider_order_list li,
#service_order_list li {
padding: 5px;
margin: 5px 0;
font-size: 14px;
background: #333 !important;
color: #fff;
}
#provider_order_list input,
#service_order_list input {
margin: 0px 2px;
}
#config .tip_scale label span.component-title {
width: 85px !important;
font-size: 12px !important;
@ -2054,19 +2040,8 @@ fieldset[disabled] .navbar-default .btn-link:focus {
}
.btn {
display: inline-block;
*display: inline;
padding: 4px 10px 4px;
margin-bottom: 0;
*margin-left: .3em;
font-size: 12px;
line-height: 16px;
*line-height: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
vertical-align: middle;
cursor: pointer;
background-color: #2672B6;
*background-color: #2672B6;
background-image: -ms-linear-gradient(top, #297AB8, #15528F);
@ -2075,18 +2050,12 @@ fieldset[disabled] .navbar-default .btn-link:focus {
background-image: -o-linear-gradient(top, #297AB8, #15528F);
background-image: linear-gradient(top, #297AB8, #15528F);
background-image: -moz-linear-gradient(top, #297AB8, #15528F);
background-repeat: repeat-x;
border: 1px solid #111;
*border: 0;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-color: #111 #111 #111;
border-bottom-color: #111;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#297AB8', endColorstr='#15528F', GradientType=0);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
*zoom: 1;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.0), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.0), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.0), 0 1px 2px rgba(0, 0, 0, 0.05);
@ -2428,6 +2397,15 @@ pre {
/* =======================================================================
input sizing (for config pages)
========================================================================== */
#editAProvider optgroup {
color: #eee;
background-color: rgb(51, 51, 51);
}
#editAProvider optgroup option {
color: #222;
background-color: #fff;
}
#config select {
min-width: 0;

View file

@ -1437,17 +1437,12 @@ config*.tmpl
min-height: 200px;
}
.component-group-desc{
float: left;
width: 250px;
}
.component-group-desc h3{
margin-top: 5px;
}
.component-group-desc p {
width: 90%;
margin: 10px 0;
color: #666;
}
@ -1503,18 +1498,6 @@ select .selected {
list-style-type: none;
}
#provider_order_list li,
#service_order_list li {
padding: 5px;
margin: 5px 0;
font-size: 14px;
}
#provider_order_list input,
#service_order_list input {
margin: 0px 2px;
}
#config .tip_scale label span.component-title {
width: 85px !important;
font-size: 12px !important;
@ -2034,19 +2017,8 @@ fieldset[disabled] .navbar-default .btn-link:focus {
}
.btn {
display: inline-block;
*display: inline;
padding: 4px 10px 4px;
margin-bottom: 0;
*margin-left: .3em;
font-size: 12px;
line-height: 16px;
*line-height: 20px;
color: #333333;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
cursor: pointer;
background-color: #f5f5f5;
*background-color: #e6e6e6;
background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6);
@ -2055,18 +2027,12 @@ fieldset[disabled] .navbar-default .btn-link:focus {
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
background-image: linear-gradient(top, #ffffff, #e6e6e6);
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
background-repeat: repeat-x;
border: 1px solid #cccccc;
*border: 0;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-bottom-color: #b3b3b3;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
*zoom: 1;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
@ -2404,6 +2370,15 @@ pre {
/* =======================================================================
input sizing (for config pages)
========================================================================== */
#editAProvider optgroup {
color: #eee;
background-color: #888;
}
#editAProvider optgroup option {
color: #222;
background-color: #fff;
}
#config select {
min-width: 0;

View file

@ -1526,6 +1526,7 @@ config*.tmpl
.component-group-desc{
float: left;
width: 250px;
padding-right: 10px;
}
.component-group-desc h3{
@ -1533,7 +1534,6 @@ config*.tmpl
}
.component-group-desc p {
width: 90%;
margin: 10px 0;
color: #666;
}
@ -1544,7 +1544,7 @@ config*.tmpl
#config div.field-pair select,
#config div.field-pair input {
margin-right: 6px;
margin-right: 15px;
}
#config div.field-pair input {
@ -1572,7 +1572,7 @@ config*.tmpl
}
#config label.space-right {
margin-right:10px
margin-right:20px
}
#config .metadataDiv {
display: none;
@ -1612,16 +1612,56 @@ select .selected {
list-style-type: none;
}
#provider_order_list li,
#config.search_providers #core-component-group1 #provider_key h4 {
display: inline-block;
float: left;
margin: 0;
}
#config.search_providers #core-component-group1 #provider_key p {
margin: 0 0 20px 30px;
}
#config.search_providers #core-component-group1 .component-group-desc,
#config.search_providers #provider_order_list,
#config.search_providers #core-component-group1 #provider_key {
width: 300px
}
#config.search_providers #provider_order_list {
padding: 0;
float: left
}
#config.search_providers #provider_order_list,
#config.search_providers #core-component-group1 .btn {
margin: 0 auto
}
#config.search_providers #core-component-group1 .btn {
display: block
}
#config.search_providers #core-component-group1 #provider_key {
float: right;
margin-bottom:25px
}
#provider_order_list li,
#service_order_list li {
padding: 5px;
margin: 5px 0;
margin: 0 0 5px;
font-size: 14px;
}
#provider_order_list input,
#service_order_list input {
margin: 0px 2px;
margin: 0 5px 0 2px;
vertical-align: middle;
}
#provider_order_list a.imgLink {
margin-right: 3px
}
#config .tip_scale label span.component-title {
@ -2178,34 +2218,15 @@ fieldset[disabled] .navbar-default .btn-link:focus {
font-size: 12px;
line-height: 16px;
*line-height: 20px;
color: #333333;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
cursor: pointer;
background-color: #f5f5f5;
*background-color: #e6e6e6;
background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
background-image: linear-gradient(top, #ffffff, #e6e6e6);
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
background-repeat: repeat-x;
border: 1px solid #cccccc;
*border: 0;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-bottom-color: #b3b3b3;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
filter: progid:dximagetransform.microsoft.gradient(startColorstr='#ffffff', endColorstr='#e6e6e6', GradientType=0);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
*zoom: 1;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn:hover,
@ -3062,7 +3083,7 @@ span.token-input-delete-token {
width: 100%;
height: 100%;
z-index: 0;
background-image: url(/images/poster-dark.jpg)
background-image: url(../images/poster-dark.jpg)
}
/* =======================================================================
jquery.confirm.css
@ -3074,7 +3095,7 @@ jquery.confirm.css
position: fixed;
top: 0;
left: 0;
background: url('../images/bg.gif');
background: url(../images/bg.gif);
background: -moz-linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)) repeat-x rgba(0,0,0,0.5);
background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(0,0,0,0.5)), to(rgba(0,0,0,0.5))) repeat-x rgba(0,0,0,0.5);
z-index: 100000;
@ -3102,13 +3123,13 @@ jquery.confirm.css
color: #fff;
margin: 0;
font-size: 22px;
text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.75);
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.75);
}
#confirmBox p {
padding-top: 20px;
color: #000;
text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.75);
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
}
#confirmButtons {

View file

@ -282,10 +282,10 @@
<span class="component-title">Timezone:</span>
<span class="component-desc">
<label for="local" class="space-right">
<input type="radio" name="timezone_display" id="local" value="local" #if "local" == $sickbeard.TIMEZONE_DISPLAY then 'checked="checked"' else ''# />Local
<input type="radio" name="timezone_display" id="local" value="local" #if "local" == $sickbeard.TIMEZONE_DISPLAY then 'checked="checked"' else ''# />local
</label>
<label for="network">
<input type="radio" name="timezone_display" id="network" value="network" #if "network" == $sickbeard.TIMEZONE_DISPLAY then 'checked="checked"' else ''# />Network
<input type="radio" name="timezone_display" id="network" value="network" #if "network" == $sickbeard.TIMEZONE_DISPLAY then 'checked="checked"' else ''# />network
</label>
<div class="clear-left"><p>display dates and times in either your timezone or the shows network timezone</p></div>
</span>

File diff suppressed because it is too large Load diff

View file

@ -38,7 +38,7 @@
<div class="component-group-desc">
<h3>Episode Search</h3>
<p>How to manage searching with <a href="$sbRoot/config/providers">providers</a>.</p>
<p>How to manage searching with <a href="$sbRoot/config/providers/">providers</a>.</p>
</div>
<fieldset class="component-group-list">

View file

@ -1,27 +1,27 @@
$(document).ready(function(){
$(".enabler").each(function(){
$('.enabler').each(function(){
if (!$(this).prop('checked'))
$('#content_'+$(this).attr('id')).hide();
$('#content_' + $(this).attr('id')).hide();
});
$(".enabler").click(function() {
$('.enabler').click(function(){
if ($(this).prop('checked'))
$('#content_'+$(this).attr('id')).fadeIn("fast", "linear");
$('#content_' + $(this).attr('id')).fadeIn('fast', 'linear');
else
$('#content_'+$(this).attr('id')).fadeOut("fast", "linear");
$('#content_' + $(this).attr('id')).fadeOut('fast', 'linear');
});
$(".viewIf").click(function() {
$('.viewIf').click(function(){
if ($(this).prop('checked')) {
$('.hide_if_'+$(this).attr('id')).css('display','none');
$('.show_if_'+$(this).attr('id')).fadeIn("fast", "linear");
$('.hide_if_' + $(this).attr('id')).css('display','none');
$('.show_if_' + $(this).attr('id')).fadeIn('fast', 'linear');
} else {
$('.show_if_'+$(this).attr('id')).css('display','none');
$('.hide_if_'+$(this).attr('id')).fadeIn("fast", "linear");
$('.show_if_' + $(this).attr('id')).css('display','none');
$('.hide_if_' + $(this).attr('id')).fadeIn('fast', 'linear');
}
});
$(".datePresets").click(function() {
$('.datePresets').click(function(){
var def = $('#date_presets').val()
if ($(this).prop('checked') && '%x' == def) {
def = '%a, %b %d, %Y'
@ -46,7 +46,7 @@ $(document).ready(function(){
$('#configForm').ajaxForm({
beforeSubmit: function(){
$('.config_submitter').each(function(){
$(this).attr("disabled", "disabled");
$(this).attr('disabled', 'disabled');
$(this).after('<span><img src="' + sbRoot + '/images/loading16' + themeSpinner + '.gif"> Saving...</span>');
$(this).hide();
});
@ -58,7 +58,7 @@ $(document).ready(function(){
$('#api_key').click(function(){ $('#api_key').select() });
$("#generate_new_apikey").click(function(){
$.get(sbRoot + '/config/general/generateKey',
$.get(sbRoot + '/config/general/generateKey',
function(data){
if (data.error != undefined) {
alert(data.error);
@ -68,8 +68,8 @@ $(document).ready(function(){
});
});
$('#branchCheckout').click(function () {
url = sbRoot+'/home/branchCheckout?branch='+$("#branchVersion").val();
$('#branchCheckout').click(function(){
url = sbRoot + '/home/branchCheckout?branch=' + $('#branchVersion').val();
window.location.href = url;
});
@ -77,7 +77,7 @@ $(document).ready(function(){
function config_success(){
$('.config_submitter').each(function(){
$(this).removeAttr("disabled");
$(this).removeAttr('disabled');
$(this).next().remove();
$(this).show();
});

View file

@ -20,39 +20,39 @@ $(document).ready(function(){
* @return no return data. Function updateNewznabCaps() is run at callback
*/
$.fn.getCategories = function (isDefault, selectedProvider) {
var name = selectedProvider[0];
var url = selectedProvider[1];
var key = selectedProvider[2];
if (!name)
return;
if (!url)
return;
if (!key)
return;
var params = {url: url, name: name, key: key};
var returnData;
$.getJSON(sbRoot + '/config/providers/getNewznabCategories', params,
var name = selectedProvider[0];
var url = selectedProvider[1];
var key = selectedProvider[2];
if (!name)
return;
if (!url)
return;
if (!key)
return;
var params = {url: url, name: name, key: key};
var returnData;
$.getJSON(sbRoot + '/config/providers/getNewznabCategories', params,
function(data){
updateNewznabCaps( data, selectedProvider );
console.debug(data.tv_categories);
});
}
$.fn.addProvider = function (id, name, url, key, cat, isDefault, showProvider) {
url = $.trim(url);
if (!url)
return;
if (!/^https?:\/\//i.test(url))
url = "http://" + url;
url = $.trim(url);
if (!url)
return;
if (!/^https?:\/\//i.test(url))
url = 'http://' + url;
if (url.match('/$') == null)
url = url + '/';
@ -64,12 +64,12 @@ $(document).ready(function(){
$(this).populateNewznabSection();
}
if ($('#provider_order_list > #'+id).length == 0 && showProvider != false) {
if ($('#provider_order_list > #' + id).length == 0 && showProvider != false) {
var toAdd = '<li class="ui-state-default" id="' + id + '"> <input type="checkbox" id="enable_' + id + '" class="provider_enabler" CHECKED> <a href="' + anonURL + url + '" class="imgLink" target="_new"><img src="' + sbRoot
+ '/images/providers/newznab.png" alt="' + name + '" width="16" height="16"></a> ' + name + '</li>'
$('#provider_order_list').append(toAdd);
$('#provider_order_list').sortable("refresh");
$('#provider_order_list').sortable('refresh');
}
$(this).makeNewznabProviderString();
@ -84,12 +84,12 @@ $(document).ready(function(){
$('#editATorrentRssProvider').addOption(id, name);
$(this).populateTorrentRssSection();
if ($('#provider_order_list > #'+id).length == 0) {
if ($('#provider_order_list > #' + id).length == 0) {
var toAdd = '<li class="ui-state-default" id="' + id + '"> <input type="checkbox" id="enable_' + id + '" class="provider_enabler" CHECKED> <a href="' + anonURL + url + '" class="imgLink" target="_new"><img src="' + sbRoot
+ '/images/providers/torrentrss.png" alt="' + name + '" width="16" height="16"></a> ' + name + '</li>'
$('#provider_order_list').append(toAdd);
$('#provider_order_list').sortable("refresh");
$('#provider_order_list').sortable('refresh');
}
$(this).makeTorrentRssProviderString();
@ -113,7 +113,7 @@ $(document).ready(function(){
$('#editANewznabProvider').removeOption(id);
delete newznabProviders[id];
$(this).populateNewznabSection();
$('li').remove('#'+id);
$('li').remove('#' + id);
$(this).makeNewznabProviderString();
}
@ -129,7 +129,7 @@ $(document).ready(function(){
$('#editATorrentRssProvider').removeOption(id);
delete torrentRssProviders[id];
$(this).populateTorrentRssSection();
$('li').remove('#'+id);
$('li').remove('#' + id);
$(this).makeTorrentRssProviderString();
}
@ -144,115 +144,115 @@ $(document).ready(function(){
$('#newznab_update_div').hide();
$('#newznab_cat').attr('disabled','disabled');
$('#newznab_cap').attr('disabled','disabled');
$("#newznab_cat option").each(function() {
$(this).remove();
return;
$('#newznab_cat option').each(function() {
$(this).remove();
return;
});
$("#newznab_cap option").each(function() {
$(this).remove();
return;
$('#newznab_cap option').each(function() {
$(this).remove();
return;
});
} else {
var data = newznabProviders[selectedProvider][1];
var isDefault = newznabProviders[selectedProvider][0];
$('#newznab_add_div').hide();
$('#newznab_update_div').show();
$('#newznab_cat').removeAttr("disabled");
$('#newznab_cap').removeAttr("disabled");
$('#newznab_cat').removeAttr('disabled');
$('#newznab_cap').removeAttr('disabled');
}
$('#newznab_name').val(data[0]);
$('#newznab_url').val(data[1]);
$('#newznab_key').val(data[2]);
//Check if not already array
if (typeof data[3] === 'string') {
rrcat = data[3].split(",")
}
else {
rrcat = data[3];
rrcat = data[3].split(',')
}
else {
rrcat = data[3];
}
// Update the category select box (on the right)
var newCatOptions = [];
if (rrcat) {
rrcat.forEach(function (cat) {
newCatOptions.push({text : cat, value : cat});
rrcat.forEach(function (cat) {
newCatOptions.push({text : cat, value : cat});
});
$("#newznab_cat").replaceOptions(newCatOptions);
$('#newznab_cat').replaceOptions(newCatOptions);
};
if (selectedProvider == 'addNewznab') {
$('#newznab_name').removeAttr("disabled");
$('#newznab_url').removeAttr("disabled");
$('#newznab_name').removeAttr('disabled');
$('#newznab_url').removeAttr('disabled');
} else {
$('#newznab_name').attr("disabled", "disabled");
$('#newznab_name').attr('disabled', 'disabled');
if (isDefault) {
$('#newznab_url').attr("disabled", "disabled");
$('#newznab_delete').attr("disabled", "disabled");
$('#newznab_url').attr('disabled', 'disabled');
$('#newznab_delete').attr('disabled', 'disabled');
} else {
$('#newznab_url').removeAttr("disabled");
$('#newznab_delete').removeAttr("disabled");
$('#newznab_url').removeAttr('disabled');
$('#newznab_delete').removeAttr('disabled');
//Get Categories Capabilities
if (data[0] && data[1] && data[2] && !ifExists($.fn.newznabProvidersCapabilities, data[0])) {
$(this).getCategories(isDefault, data);
$(this).getCategories(isDefault, data);
}
else {
updateNewznabCaps( null, data );
updateNewznabCaps( null, data );
}
}
}
}
ifExists = function(loopThroughArray, searchFor) {
var found = false;
loopThroughArray.forEach(function(rootObject) {
if (rootObject.name == searchFor) {
found = true;
}
console.log(rootObject.name + " while searching for: "+ searchFor);
});
return found;
var found = false;
loopThroughArray.forEach(function(rootObject) {
if (rootObject.name == searchFor) {
found = true;
}
console.log(rootObject.name + ' while searching for: ' + searchFor);
});
return found;
};
/**
* Updates the Global array $.fn.newznabProvidersCapabilities with a combination of newznab prov name
* Updates the Global array $.fn.newznabProvidersCapabilities with a combination of newznab prov name
* and category capabilities. Return
* @param {Array} newzNabCaps, is the returned object with newzNabprod Name and Capabilities.
* @param {Array} selectedProvider
* @return no return data. The multiselect input $("#newznab_cap") is updated, as a result.
*/
updateNewznabCaps = function( newzNabCaps, selectedProvider ) {
if (newzNabCaps && !ifExists($.fn.newznabProvidersCapabilities, selectedProvider[0])) {
$.fn.newznabProvidersCapabilities.push({'name' : selectedProvider[0], 'categories' : newzNabCaps.tv_categories});
}
//Loop through the array and if currently selected newznab provider name matches one in the array, use it to
if (newzNabCaps && !ifExists($.fn.newznabProvidersCapabilities, selectedProvider[0])) {
$.fn.newznabProvidersCapabilities.push({'name' : selectedProvider[0], 'categories' : newzNabCaps.tv_categories});
}
//Loop through the array and if currently selected newznab provider name matches one in the array, use it to
//update the capabilities select box (on the left).
if (selectedProvider[0]) {
$.fn.newznabProvidersCapabilities.forEach(function(newzNabCap) {
if (newzNabCap.name && newzNabCap.name == selectedProvider[0] && newzNabCap.categories instanceof Array) {
var newCapOptions = [];
newzNabCap.categories.forEach(function(category_set) {
if (category_set.id && category_set.name) {
newCapOptions.push({value : category_set.id, text : category_set.name + "(" + category_set.id + ")"});
};
});
$("#newznab_cap").replaceOptions(newCapOptions);
}
$.fn.newznabProvidersCapabilities.forEach(function(newzNabCap) {
if (newzNabCap.name && newzNabCap.name == selectedProvider[0] && newzNabCap.categories instanceof Array) {
var newCapOptions = [];
newzNabCap.categories.forEach(function(category_set) {
if (category_set.id && category_set.name) {
newCapOptions.push({value : category_set.id, text : category_set.name + '(' + category_set.id + ')'});
};
});
$('#newznab_cap').replaceOptions(newCapOptions);
}
});
};
}
$.fn.makeNewznabProviderString = function() {
var provStrings = new Array();
@ -284,14 +284,14 @@ $(document).ready(function(){
$('#torrentrss_cookies').val(data[2]);
if (selectedProvider == 'addTorrentRss') {
$('#torrentrss_name').removeAttr("disabled");
$('#torrentrss_url').removeAttr("disabled");
$('#torrentrss_cookies').removeAttr("disabled");
$('#torrentrss_name').removeAttr('disabled');
$('#torrentrss_url').removeAttr('disabled');
$('#torrentrss_cookies').removeAttr('disabled');
} else {
$('#torrentrss_name').attr("disabled", "disabled");
$('#torrentrss_url').removeAttr("disabled");
$('#torrentrss_cookies').removeAttr("disabled");
$('#torrentrss_delete').removeAttr("disabled");
$('#torrentrss_name').attr('disabled', 'disabled');
$('#torrentrss_url').removeAttr('disabled');
$('#torrentrss_cookies').removeAttr('disabled');
$('#torrentrss_delete').removeAttr('disabled');
}
}
@ -309,26 +309,26 @@ $(document).ready(function(){
$.fn.refreshProviderList = function() {
var idArr = $("#provider_order_list").sortable('toArray');
var idArr = $('#provider_order_list').sortable('toArray');
var finalArr = new Array();
$.each(idArr, function(key, val) {
var checked = + $('#enable_'+val).prop('checked') ? '1' : '0';
var checked = + $('#enable_' + val).prop('checked') ? '1' : '0';
finalArr.push(val + ':' + checked);
});
$("#provider_order").val(finalArr.join(' '));
$('#provider_order').val(finalArr.join(' '));
}
var newznabProviders = new Array();
var torrentRssProviders = new Array();
$(this).on('change', '.newznab_key', function(){
var provider_id = $(this).attr('id');
provider_id = provider_id.substring(0, provider_id.length-'_hash'.length);
var url = $('#'+provider_id+'_url').val();
var cat = $('#'+provider_id+'_cat').val();
var url = $('#' + provider_id + '_url').val();
var cat = $('#' + provider_id + '_cat').val();
var key = $(this).val();
$(this).updateProvider(provider_id, url, key, cat);
@ -339,16 +339,16 @@ $(document).ready(function(){
var selectedProvider = $('#editANewznabProvider :selected').val();
if (selectedProvider == "addNewznab")
if (selectedProvider == 'addNewznab')
return;
var url = $('#newznab_url').val();
var key = $('#newznab_key').val();
var cat = $('#newznab_cat option').map(function(i, opt) {
return $(opt).text();
}).toArray().join(',');
return $(opt).text();
}).toArray().join(',');
$(this).updateProvider(selectedProvider, url, key, cat);
});
@ -357,7 +357,7 @@ $(document).ready(function(){
var selectedProvider = $('#editATorrentRssProvider :selected').val();
if (selectedProvider == "addTorrentRss")
if (selectedProvider == 'addTorrentRss')
return;
var url = $('#torrentrss_url').val();
@ -385,46 +385,46 @@ $(document).ready(function(){
$(this).on('click', '#newznab_cat_update', function(){
console.debug('Clicked Button');
//Maybe check if there is anything selected?
$("#newznab_cat option").each(function() {
$(this).remove();
return;
$('#newznab_cat option').each(function() {
$(this).remove();
return;
});
var newOptions = [];
// When the update botton is clicked, loop through the capabilities list
// When the update botton is clicked, loop through the capabilities list
// and copy the selected category id's to the category list on the right.
$("#newznab_cap option").each(function(){
$('#newznab_cap option').each(function(){
if($(this).attr('selected') == 'selected')
{
var selected_cat = $(this).val();
console.debug(selected_cat);
newOptions.push({text: selected_cat, value: selected_cat})
var selected_cat = $(this).val();
console.debug(selected_cat);
newOptions.push({text: selected_cat, value: selected_cat})
};
});
$("#newznab_cat").replaceOptions(newOptions);
var selectedProvider = $('#editANewznabProvider :selected').val();
if (selectedProvider == "addNewznab")
return;
var url = $('#newznab_url').val();
var key = $('#newznab_key').val();
var cat = $('#newznab_cat option').map(function(i, opt) {
return $(opt).text();
}).toArray().join(',');
$("#newznab_cat option:not([value])").remove();
$('#newznab_cat').replaceOptions(newOptions);
var selectedProvider = $('#editANewznabProvider :selected').val();
if (selectedProvider == 'addNewznab')
return;
var url = $('#newznab_url').val();
var key = $('#newznab_key').val();
var cat = $('#newznab_cat option').map(function(i, opt) {
return $(opt).text();
}).toArray().join(',');
$('#newznab_cat option:not([value])').remove();
$(this).updateProvider(selectedProvider, url, key, cat);
});
$('#newznab_add').click(function(){
var selectedProvider = $('#editANewznabProvider :selected').val();
@ -433,19 +433,19 @@ $(document).ready(function(){
var url = $.trim($('#newznab_url').val());
var key = $.trim($('#newznab_key').val());
//var cat = $.trim($('#newznab_cat').val());
var cat = $.trim($('#newznab_cat option').map(function(i, opt) {
return $(opt).text();}).toArray().join(','));
return $(opt).text();}).toArray().join(','));
if (!name)
return;
return;
if (!url)
return;
return;
if (!key)
return;
return;
var params = {name: name};
@ -496,12 +496,12 @@ $(document).ready(function(){
});
$(this).on('change', "[class='providerDiv_tip'] input", function(){
$('div .providerDiv ' + "[name=" + $(this).attr('name') + "]").replaceWith($(this).clone());
$('div .providerDiv ' + "[newznab_name=" + $(this).attr('id') + "]").replaceWith($(this).clone());
$(this).on('change', '[class="providerDiv_tip"] input', function(){
$('div .providerDiv ' + '[name=' + $(this).attr('name') + ']').replaceWith($(this).clone());
$('div .providerDiv ' + '[newznab_name=' + $(this).attr('id') + ']').replaceWith($(this).clone());
});
$(this).on('change', "[class='providerDiv_tip'] select", function(){
$(this).on('change', '[class="providerDiv_tip"] select', function(){
$(this).find('option').each( function() {
if ($(this).is(':selected')) {
@ -511,34 +511,34 @@ $(document).ready(function(){
}
});
$('div .providerDiv ' + "[name=" + $(this).attr('name') + "]").empty().replaceWith($(this).clone())});
$('div .providerDiv ' + '[name=' + $(this).attr('name') + ']').empty().replaceWith($(this).clone())});
$(this).on('change', '.enabler', function(){
if ($(this).is(':checked')) {
$('.content_'+$(this).attr('id')).each( function() {
$('.content_' + $(this).attr('id')).each( function() {
$(this).show()
})
} else {
$('.content_'+$(this).attr('id')).each( function() {
$('.content_' + $(this).attr('id')).each( function() {
$(this).hide()
})
}
});
$(".enabler").each(function(){
$('.enabler').each(function(){
if (!$(this).is(':checked')) {
$('.content_'+$(this).attr('id')).hide();
$('.content_' + $(this).attr('id')).hide();
} else {
$('.content_'+$(this).attr('id')).show();
$('.content_' + $(this).attr('id')).show();
}
});
$.fn.makeTorrentOptionString = function(provider_id) {
var seed_ratio = $('.providerDiv_tip #'+provider_id+'_seed_ratio').prop('value');
var seed_time = $('.providerDiv_tip #'+provider_id+'_seed_time').prop('value');
var process_met = $('.providerDiv_tip #'+provider_id+'_process_method').prop('value');
var option_string = $('.providerDiv_tip #'+provider_id+'_option_string');
var seed_ratio = $('.providerDiv_tip #' + provider_id + '_seed_ratio').prop('value');
var seed_time = $('.providerDiv_tip #' + provider_id + '_seed_time').prop('value');
var process_met = $('.providerDiv_tip #' + provider_id + '_process_method').prop('value');
var option_string = $('.providerDiv_tip #' + provider_id + '_option_string');
option_string.val([seed_ratio, seed_time, process_met].join('|'))
@ -548,11 +548,11 @@ $(document).ready(function(){
var provider_id = $(this).attr('id').split('_')[0];
$(this).makeTorrentOptionString(provider_id);
$(this).makeTorrentOptionString(provider_id);
});
$.fn.replaceOptions = function(options) {
var self, $option;
@ -560,8 +560,8 @@ $(document).ready(function(){
self = this;
$.each(options, function(index, option) {
$option = $("<option></option>")
.attr("value", option.value)
$option = $('<option></option>')
.attr('value', option.value)
.text(option.text);
self.append($option);
});
@ -569,18 +569,18 @@ $(document).ready(function(){
// initialization stuff
$.fn.newznabProvidersCapabilities = [];
$(this).showHideProviders();
$("#provider_order_list").sortable({
$('#provider_order_list').sortable({
placeholder: 'ui-state-highlight',
update: function (event, ui) {
$(this).refreshProviderList();
}
});
$("#provider_order_list").disableSelection();
$('#provider_order_list').disableSelection();
});