function toggle$(el, cond){ var ifId = '-if-' + $(el).attr('id'); if(cond){ $('.hide' + ifId).fadeOut('fast', 'linear'); $('.show' + ifId).fadeIn('fast', 'linear'); } else { $('.show' + ifId).fadeOut('fast', 'linear'); $('.hide' + ifId).fadeIn('fast', 'linear'); } } function viewsIf(){ var that, className, done = [], target; $('[class*="views-if"]').each(function(){ that = this; $.each(that.classList, function(){ if(/views-if-/i.test(this)){ className = this.replace('views-if-', ''); if (-1 === $.inArray(className, done)){ done.push(className); target = '[class*="show-if-' + className + '"]'; if ($('[class*="views-if-' + className + '"]:checked').length){ $(target).fadeIn('fast', 'linear'); } else { $(target).fadeOut('fast', 'linear'); } } } }); }); } $(document).ready(function () { var enabler = $('.enabler'), viewIf = $('input.view-if'), viewIfSel = $('select.view-if'); enabler.each(function () { if (!$(this).prop('checked')) $(document.getElementById('content_' + $(this).attr('id'))).hide(); }); enabler.click(function () { var content_id = $(document.getElementById('content_' + $(this).attr('id'))); if ($(this).prop('checked')) content_id.fadeIn('fast', 'linear'); else content_id.fadeOut('fast', 'linear'); }); $('[class*="views-if"]').on({click: viewsIf}); viewsIf(); viewIf.each(function () { $(($(this).prop('checked') ? '.hide-if-' : '.show-if-') + $(this).attr('id')).hide(); }); viewIf.click(function () { toggle$(this, $(this).prop('checked')); }); viewIfSel.each(function () { $((0 < $(this).find('option:selected').val() ? '.hide-if-' : '.show-if-') + $(this).attr('id')).hide(); }); viewIfSel.change(function(){ toggle$(this, 0 < $(this).find('option:selected').val()); }); /** @namespace data.names */ /** @namespace data.numbers */ /** @namespace data.min_remain_iv */ $('input#alias').on('click', function() { var result$ = $('#alias-result'), that$ = $(this); that$.attr('disabled', 'disabled'); result$.html('checking for updates...'); $.getJSON(sbRoot + '/config/general/update-alt', function (data) { var output = 'checked, ', remain; result$.removeClass('grey-text'); if (data.names) { output += 'new alias names found'; result$.addClass('grey-text'); } else if (!data.numbers) { output += 'no updates found'; } if (data.numbers) { output += (data.names ? ' and ' : '') + data.numbers + ' alternative numbers updated'; result$.addClass('grey-text'); } remain = data.min_remain_iv/60; output += ', wait ' + parseInt(remain) + 'm before next fetch process' result$.html(output); that$.removeAttr('disabled'); }); }); var idSelect = '#imdb-accounts', idDel = '#imdb-list-del', idInput = '#imdb-url', idOnOff = '#imdb-list-onoff', sel = 'selected', opt = 'option', selOpt = [opt, sel].join(':'), elDropDown = $(idSelect), elDel = $(idDel), elInput = $(idInput), elOnOff = $(idOnOff); function accId() {return elDropDown.find(selOpt).val();} function nameList() {return elDropDown.find(selOpt).text();} function isAdd() {return 'new' === accId();} function isOff() {return 0 == nameList().indexOf('(Off) ');} function warnMessage(msg) { elInput.addClass('warning').prop('title', msg); } function all(state) {$([idSelect, idDel, idInput, idOnOff].join()).prop('disabled', 'on' == state ? !1 : !0)} function setOnOff() {elOnOff.val(isAdd() || isOff() ? 'Enable' : 'Disable');} function setLink() { var idView = '#view-list', idLink = '#link-list'; return $([idView, idLink].join()).removeClass() && ((isAdd() || isOff()) && $(idLink).addClass('hide') || $(idView).addClass('hide')) && (!isOff() && $(idLink) .attr('href', sbRoot + '/add-shows/watchlist-imdb?account=' + accId()) .attr('title', 'View ' + nameList())); } function defaultControls() { elDel.prop('disabled', isAdd()); elInput.removeClass('warning') .val(!isAdd() && accId() || '') .prop('title', isAdd() ? '' : 'Select Add. Use Delete or Disable') .prop('readonly', !isAdd()); setOnOff(); setLink(); } function populateSelect(jsonData) { /** @namespace response.accounts */ var response = $.parseJSON(jsonData); if ('Success' !== response.result) { warnMessage(response.result); return !1; } elDropDown.find(opt).slice(1).remove(); var i, l, accounts = response.accounts, options = elDropDown.get(0).options; for (i = 0, l = accounts.length; i < l; i = i + 2) { options[options.length] = new Option(accounts[i + 1] + (0 == accounts[i + 1].replace('(Off) ', '').toLowerCase().indexOf('your') ? '' : '\'s') + ' list', accounts[i]); if (0 <= $.trim(elInput.val()).indexOf(accounts[i])) { elDropDown.find(opt).prop(sel, !1); elDropDown.find('option[value="' + accounts[i] + '"]').prop(sel, sel); elInput.val(accounts[i]); elInput.prop('title', 'Select Add. Use Delete or Disable'); setOnOff(); } } return !0; } elDropDown.change(function() { defaultControls(); }); elDel.on('click', function(e) { all('off'); $.confirm({ 'title' : 'Remove the "' + nameList().replace('\'s', '').replace(' list', '') + '" IMDb Watchlist', 'message' : 'Are you sure you want to remove ' + nameList() + ' ?

', 'buttons' : { 'Yes' : { 'class' : 'green', 'action': function() { all('off'); $.get(sbRoot + '/add-shows/watchlist-imdb', { 'action': elDel.val().toLowerCase(), 'select': accId()}) .done(function(response) { all('on'); setControls(!populateSelect(response), !1); setOnOff(); }) .fail(function() { all('on'); setControls(!0, 'Invalid ID'); setOnOff(); }); } }, 'No' : { 'class' : 'red', 'action': function() { e.preventDefault(); all('on'); defaultControls();} } } }); }); elOnOff.on('click', function(e) { var strList = $.trim(elInput.val()); elInput.removeClass('warning'); if (!strList) { warnMessage('Missing IMDb list Id or URL'); } else { all('off'); var params = {'action': elOnOff.val().toLowerCase()}; if ('enable' == params.action) params.input = strList; else params.select = accId(); $.get(sbRoot + '/add-shows/watchlist-imdb', params) .done(function(data) { setControls(!populateSelect(data), !1); }) .fail(function() { setControls(!0, 'Failed to load list'); }); } }); function setControls(resetSelect, message) { all('on'); if (resetSelect) { if (message) warnMessage(message); var addList = '[value="new"]'; elDropDown.find(opt).not(addList).prop(sel, !1); elDropDown.find(opt + addList).prop(sel, sel); } elDel.prop('disabled', isAdd()); elInput.prop('readonly', !isAdd()); setLink() } var ui_update_trim_zero = (function () { var secs = ('00' + new Date().getSeconds().toString()).slice(-2), elSecs = $('#trim_info_seconds'), elTrimZero = $('#trim_zero'); elTrimZero.each(function () { var checked = $(this).prop('checked') && $('#fuzzy_dating').prop('checked'); $('#time_presets').find('option').each(function () { var text = ($(this).text()); $(this).text(checked ? text.replace(/(\b\d+:\d\d):\d+/mg, '$1') : text.replace(/(\b\d+:\d\d)(?:.\d+)?/mg, '$1:' + secs)); }); }); if ($('#fuzzy_dating').prop('checked')) if (elTrimZero.prop('checked')) elSecs.fadeOut('fast', 'linear'); else elSecs.fadeIn('fast', 'linear'); else elSecs.fadeIn('fast', 'linear'); }); $('#trim_zero, #fuzzy_dating').click(function () { ui_update_trim_zero(); }); ui_update_trim_zero(); $('.datePresets').click(function () { var elDatePresets = $('#date_presets'), defaultPreset = elDatePresets.val(); if ($(this).prop('checked') && '%x' == defaultPreset) { defaultPreset = '%a, %b %d, %Y'; $('#date_use_system_default').html('1') } else if (!$(this).prop('checked') && '1' == $('#date_use_system_default').html()) defaultPreset = '%x'; elDatePresets.attr('name', 'date_preset_old'); elDatePresets.attr('id', 'date_presets_old'); var elDatePresets_na = $('#date_presets_na'); elDatePresets_na.attr('name', 'date_preset'); elDatePresets_na.attr('id', 'date_presets'); var elDatePresets_old = $('#date_presets_old'); elDatePresets_old.attr('name', 'date_preset_na'); elDatePresets_old.attr('id', 'date_presets_na'); if (defaultPreset) elDatePresets.val(defaultPreset) }); // bind 'myForm' and provide a simple callback function $('#configForm').ajaxForm({ beforeSubmit: function () { $('.config_submitter').each(function () { $(this).attr('disabled', 'disabled'); $(this).after(' Saving...'); $(this).hide(); }); $('.show_update_hour_value').text($('#show_update_hour').val()) }, success: function (response) { setTimeout(function () {config_success(response)}, 2000); } }); var updateFB = function(){ $('a[rel=qr]').fancybox({ smallBtn: !0, type:'inline', baseClass: 'apikey-qr-dlg', afterLoad: function() { $('#qr-body') .html('') .qrcode({ render: 'image', fill: '#333', radius: 0.5, minVersion: 6, background: null, size: 300, text: this.opts.apiKey }) .append('
App name: ' + this.opts.apiName + '
'); }, }); }; var addQR = function(){ if (!!$('a[rel=qr]').length){ if ('function' === typeof($.fn.fancybox)){ updateFB(); } else { var fancy = sbRoot + '/js/fancybox/jquery.fancybox.min'; $.getScript(fancy + '.js', function () { $('head').append(''); !function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("jquery-qrcode",[],r):"object"==typeof exports?exports["jquery-qrcode"]=r():t["jquery-qrcode"]=r()}("undefined"!=typeof self?self:this,function(){return function(e){var n={};function o(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=n,o.d=function(t,r,e){o.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(r,t){if(1&t&&(r=o(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var e=Object.create(null);if(o.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var n in r)o.d(e,n,function(t){return r[t]}.bind(null,n));return e},o.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(r,"a",r),r},o.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},o.p="",o(o.s=0)}([function(v,t,p){(function(t){function c(t){return t&&"string"==typeof t.tagName&&"IMG"===t.tagName.toUpperCase()}function a(t,r,e,n){var o={},i=p(2);i.stringToBytes=i.stringToBytesFuncs["UTF-8"];var a=i(e,r);a.addData(t),a.make(),n=n||0;var u=a.getModuleCount(),s=u+2*n;return o.text=t,o.level=r,o.version=e,o.module_count=s,o.is_dark=function(t,r){return r-=n,0<=(t-=n)&&t")[0].getContext("2d");i.font=o;var a=i.measureText(e.label).width,u=e.mSize,f=a/n,c=(1-f)*e.mPosX,l=(1-u)*e.mPosY,g=c+f,s=l+u;1===e.mode?t.add_blank(0,l-.01,n,s+.01):t.add_blank(c-.01,l-.01,.01+g,s+.01),r.fillStyle=e.fontcolor,r.font=o,r.fillText(e.label,c*n,l*n+.75*e.mSize*n)}(t,r,e):!c(e.image)||3!==n&&4!==n||function(t,r,e){var n=e.size,o=e.image.naturalWidth||1,i=e.image.naturalHeight||1,a=e.mSize,u=a*o/i,f=(1-u)*e.mPosX,c=(1-a)*e.mPosY,l=f+u,g=c+a;3===e.mode?t.add_blank(0,c-.01,n,g+.01):t.add_blank(f-.01,c-.01,.01+l,g+.01),r.drawImage(e.image,f*n,c*n,u*n,a*n)}(t,r,e)}function l(t,r,e,n,o,i,a,u){t.is_dark(a,u)&&r.rect(n,o,i,i)}function g(t,r,e,n,o,i,a,u){var f=t.is_dark,c=n+i,l=o+i,g=e.radius*i,s=a-1,h=a+1,d=u-1,v=u+1,p=f(a,u),w=f(s,d),y=f(s,u),m=f(s,v),b=f(a,v),k=f(h,v),C=f(h,u),B=f(h,d),x=f(a,d);p?function(t,r,e,n,o,i,a,u,f,c){a?t.moveTo(r+i,e):t.moveTo(r,e),u?(t.lineTo(n-i,e),t.arcTo(n,e,n,o,i)):t.lineTo(n,e),f?(t.lineTo(n,o-i),t.arcTo(n,o,r,o,i)):t.lineTo(n,o),c?(t.lineTo(r+i,o),t.arcTo(r,o,r,e,i)):t.lineTo(r,o),a?(t.lineTo(r,e+i),t.arcTo(r,e,n,e,i)):t.lineTo(r,e)}(r,n,o,c,l,g,!y&&!x,!y&&!b,!C&&!b,!C&&!x):function(t,r,e,n,o,i,a,u,f,c){a&&(t.moveTo(r+i,e),t.lineTo(r,e),t.lineTo(r,e+i),t.arcTo(r,e,r+i,e,i)),u&&(t.moveTo(n-i,e),t.lineTo(n,e),t.lineTo(n,e+i),t.arcTo(n,e,n-i,e,i)),f&&(t.moveTo(n-i,o),t.lineTo(n,o),t.lineTo(n,o-i),t.arcTo(n,o,n-i,o,i)),c&&(t.moveTo(r+i,o),t.lineTo(r,o),t.lineTo(r,o-i),t.arcTo(r,o,r+i,o,i))}(r,n,o,c,l,g,y&&x&&w,y&&b&&m,C&&b&&k,C&&x&&B)}function n(t,r){var e=h(r.text,r.ecLevel,r.minVersion,r.maxVersion,r.quiet);if(!e)return null;var n=d(t).data("qrcode",e),o=n[0].getContext("2d");return i(e,o,r),function(t,r,e){var n,o,i=t.module_count,a=e.size/i,u=l;for(0").attr("width",t.size).attr("height",t.size);return n(r,t)}function o(t){return f&&"canvas"===t.render?r(t):f&&"image"===t.render?function(t){return d("").attr("src",r(t)[0].toDataURL("image/png"))}(t):function(t){var r=h(t.text,t.ecLevel,t.minVersion,t.maxVersion,t.quiet);if(!r)return null;var e,n,o=t.size,i=t.background,a=Math.floor,u=r.module_count,f=a(o/u),c=a(.5*(o-f*u)),l={position:"relative",left:0,top:0,padding:0,margin:0,width:o,height:o},g={position:"absolute",padding:0,margin:0,width:f,height:f,"background-color":t.fill},s=d("
").data("qrcode",r).css(l);for(i&&s.css("background-color",i),e=0;e").css(g).css({left:c+n*f,top:c+e*f}).appendTo(s);return s}(t)}var e,u=t.window,d=u.jQuery,f=!(!(e=u.document.createElement("canvas")).getContext||!e.getContext("2d")),s={render:"canvas",minVersion:1,maxVersion:40,ecLevel:"L",left:0,top:0,size:200,fill:"#000",background:"#fff",text:"no text",radius:0,quiet:0,mode:0,mSize:.1,mPosX:.5,mPosY:.5,label:"no label",fontname:"sans",fontcolor:"#000",image:null};d.fn.qrcode=v.exports=function(t){var e=d.extend({},s,t);return this.each(function(t,r){"canvas"===r.nodeName.toLowerCase()?n(r,e):d(r).append(o(e))})}}).call(this,p(1))},function(t,r){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r,e){var n,o,i,a=function(){function i(t,r){function a(t,r){l=function(t){for(var r=new Array(t),e=0;e>e&1);l[Math.floor(e/3)][e%3+g-8-3]=n}for(e=0;e<18;e+=1){n=!t&&1==(r>>e&1);l[e%3+g-8-3][Math.floor(e/3)]=n}},d=function(t,r){for(var e=f<<3|r,n=y.getBCHTypeInfo(e),o=0;o<15;o+=1){var i=!t&&1==(n>>o&1);o<6?l[o][8]=i:o<8?l[o+1][8]=i:l[g-15+o][8]=i}for(o=0;o<15;o+=1){i=!t&&1==(n>>o&1);o<8?l[8][g-o-1]=i:o<9?l[8][15-o-1+1]=i:l[8][15-o-1]=i}l[g-8][8]=!t},v=function(t,r){for(var e=-1,n=g-1,o=7,i=0,a=y.getMaskFunction(r),u=g-1;0>>o&1)),a(n,u-f)&&(c=!c),l[n][u-f]=c,-1==(o-=1)&&(i+=1,o=7)}if((n+=e)<0||g<=n){n-=e,e=-e;break}}},p=function(t,r,e){for(var n=C.getRSBlocks(t,r),o=B(),i=0;i8*u)throw"code length overflow. ("+o.getLengthInBits()+">"+8*u+")";for(o.getLengthInBits()+4<=8*u&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(!1);for(;!(o.getLengthInBits()>=8*u||(o.put(236,8),o.getLengthInBits()>=8*u));)o.put(17,8);return function(t,r){for(var e=0,n=0,o=0,i=new Array(r.length),a=new Array(r.length),u=0;u',e+="";for(var n=0;n";for(var o=0;o';e+=""}return e+="",e+=""},h.createSvgTag=function(t,r){var e={};"object"==typeof t&&(t=(e=t).cellSize,r=e.margin),t=t||2,r=void 0===r?4*t:r;var n,o,i,a,u=h.getModuleCount()*t+2*r,f="";for(a="l"+t+",0 0,"+t+" -"+t+",0 0,-"+t+"z ",f+='>>8),r.push(255&o)):r.push(a)}}return r}};var a=1,u=2,o=4,f=8,w={L:1,M:0,Q:3,H:2},n=0,c=1,l=2,g=3,s=4,h=5,d=6,v=7,y=function(){function e(t){for(var r=0;0!=t;)r+=1,t>>>=1;return r}var r=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],t={};return t.getBCHTypeInfo=function(t){for(var r=t<<10;0<=e(r)-e(1335);)r^=1335<>>8)},writeBytes:function(t,r,e){r=r||0,e=e||t.length;for(var n=0;n>>7-t%8&1)},put:function(t,r){for(var e=0;e>>r-e-1&1))},getLengthInBits:function(){return n},putBit:function(t){var r=Math.floor(n/8);e.length<=r&&e.push(0),t&&(e[r]|=128>>>n%8),n+=1}};return o},x=function(t){var r=a,n=t,e={getMode:function(){return r},getLength:function(t){return n.length},write:function(t){for(var r=n,e=0;e+2>>8&255)+(255&n),t.put(n,13),e+=2}if(e=e.length){if(0==i)return-1;throw"unexpected end of file./"+i}var t=e.charAt(n);if(n+=1,"="==t)return i=0,-1;t.match(/^\s$/)||(o=o<<6|a(t.charCodeAt(0)),i+=6)}var r=o>>>i-8&255;return i-=8,r}},a=function(t){if(65<=t&&t<=90)return t-65;if(97<=t&&t<=122)return t-97+26;if(48<=t&&t<=57)return t-48+52;if(43==t)return 62;if(47==t)return 63;throw"c:"+t};return r},L=function(t,r,e){for(var n=function(t,r){var n=t,o=r,g=new Array(t*r),e={setPixel:function(t,r,e){g[r*n+t]=e},write:function(t){t.writeString("GIF87a"),t.writeShort(n),t.writeShort(o),t.writeByte(128),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(255),t.writeByte(255),t.writeByte(255),t.writeString(","),t.writeShort(0),t.writeShort(0),t.writeShort(n),t.writeShort(o),t.writeByte(0);var r=i(2);t.writeByte(2);for(var e=0;255>>r!=0)throw"length over";for(;8<=n+r;)e.writeByte(255&(t<>>=8-n,n=o=0;o|=t<>>o-6),o-=6},t.flush=function(){if(0>6,128|63&n):n<55296||57344<=n?r.push(224|n>>12,128|n>>6&63,128|63&n):(e++,n=65536+((1023&n)<<10|1023&t.charCodeAt(e)),r.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|63&n))}return r}(t)},o=[],void 0===(i="function"==typeof(n=function(){return a})?n.apply(r,o):n)||(t.exports=i)}])}); updateFB(); }); } } }; addQR(); var generateApiKey = function(){ var appName$ = $('#app-name'); appName$.removeClass('warning'); $('#generate-result').html(' ').removeClass('dotted-surround'); $.getJSON(sbRoot + '/config/general/create_apikey', {app_name: appName$.val()}, function (data) { if (undefined === data.error) { var appInput$ = $('#app-name'); if (undefined === data.added) { appInput$.addClass('warning'); $('#generate-result').html(data.result).addClass('dotted-surround'); } else { $('#tip-addkeys').hide(); var newRow$ = $('#api-keys') .append($('.new-key').first().clone(!0)) .find('.new-key').last().removeClass('new-key'); newRow$.find('.api-key').text(data.added); newRow$.find('.app-name').text(appInput$.val()); newRow$.find('a') .attr('rel', 'qr') .attr('data-api-key', data.added) .attr('data-api-name', appInput$.val()); appInput$.val(''); newRow$.show(); addQR(); } } else { alert(data.error); } }); }; $('#app-name').keypress(function(ev){ if (13 === ev.which) { ev.preventDefault(); generateApiKey(); return !1; } }); $('#generate-api-key').on('click', generateApiKey); $('.revoke').on('click', function(){ $('#app-name').removeClass('warning'); $('#generate-result').html(' ').removeClass('dotted-surround'); var row$ = $(this).closest('div'), appName = row$.find('.app-name').text(); if (confirm('Revoke "' + appName + '" apikey?')) { $.getJSON(sbRoot + '/config/general/revoke_apikey', { app_name: appName, api_key: row$.find('.api-key').text()}, function (data) { if (undefined === data.error) { if (undefined === data.removed) { $('#app-name').addClass('warning'); $('#generate-result').html(data.result).addClass('dotted-surround'); } else { row$.remove(); if (!$('#api-keys').find('div:visible').length) { $('#tip-addkeys').show(); } } } else { alert(data.error); } } ); } }); $('#branch-checkout').click(function () { window.location.href = sbRoot + '/home/branch-checkout?branch=' + $('#branchVersion').val(); }); $('#pull-request-checkout').click(function () { window.location.href = sbRoot + '/home/pull-request-checkout?branch=' + $('#pullRequestVersion').val(); }); fetch_branches(); fetch_pullrequests(); $('#showlist_tagview').on('change', function() { var selected = '#showlist_tagview_', target = $(selected + 'custom_config'); target.removeClass('hidden'); if ('custom' !== $(this).val()) target.addClass('hidden'); $(selected + 'standard,' + selected + 'anime,' + selected + 'custom').removeClass('hidden').addClass('hidden'); $(selected + $(this).val()).removeClass('hidden'); }); }); function config_success(response) { if ('reload' == response) { window.location.reload(true); } else if ('restart' == response) { window.location.href = sbRoot + $('a.restart').attr('href') } $('.config_submitter').each(function () { $(this).removeAttr('disabled'); $(this).next().remove(); $(this).show(); }); $('#email_show').trigger('notify'); // update footer only on the config page for the propers option if('saveSearch' == $('#configForm').attr('action')){ getFooterTime({'change_layout': 0}); } } function fetch_pullrequests() { $.getJSON(sbRoot + '/config/general/fetch-pullrequests', function (data) { $('#pullRequestVersion').find('option').remove(); if (data['result'] == 'success') { var pulls = []; $.each(data['pulls'], function (i, pull) { if (pull[0] != '') { pulls.push(pull); } }); if (pulls.length > 0) { $.each(pulls, function (i, text) { add_option_to_pulls(text); }); $('#pull-request-checkout').removeAttr('disabled'); } else { add_option_to_pulls(['No pull requests available', '']); } } else { add_option_to_pulls(['Failed to connect to github', '']); } }); } function fetch_branches() { $.getJSON(sbRoot + '/config/general/fetch-branches', function (data) { $('#branchVersion').find('option').remove(); if (data['result'] == 'success') { var branches = []; $.each(data['branches'], function (i, branch) { if (branch != '') { branches.push(branch); } }); if (branches.length > 0) { $.each(branches, function (i, text) { add_option_to_branches(text); }); $('#branch-checkout').removeAttr('disabled'); $('#branchVersion').find('option[value="' + data['current'] + '"]').prop('selected', !0); } else { add_option_to_branches('No branches available'); } } else { add_option_to_branches('Failed to connect to github'); } }); } function add_option_to_pulls(text) { var option = $('