mirror of https://github.com/Sonarr/Sonarr
Minor fixes and polyfills
This commit is contained in:
parent
89a72a50cf
commit
feda4a9b67
|
@ -60,17 +60,18 @@ namespace NzbDrone.Host.Owin
|
||||||
{
|
{
|
||||||
if (ex.InnerException == null)
|
if (ex.InnerException == null)
|
||||||
{
|
{
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ex.InnerException as HttpListenerException == null)
|
if (ex.InnerException is HttpListenerException)
|
||||||
{
|
{
|
||||||
throw ex;
|
throw new PortInUseException("Port {0} is already in use, please ensure NzbDrone is not already running.",
|
||||||
|
ex,
|
||||||
|
_configFileProvider.Port);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new PortInUseException("Port {0} is already in use, please ensure NzbDrone is not already running.",
|
throw ex.InnerException;
|
||||||
ex,
|
|
||||||
_configFileProvider.Port);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ define(
|
||||||
});
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper('titleWithYear', function () {
|
Handlebars.registerHelper('titleWithYear', function () {
|
||||||
if (this.title.match(/\s\(\d{4}\)$/)) {
|
if (this.title.endsWith(' ({0})'.format(this.year))) {
|
||||||
return this.title;
|
return this.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ define(function () {
|
||||||
|
|
||||||
//check if ajax call was made with data option
|
//check if ajax call was made with data option
|
||||||
if (xhr && xhr.data && xhr.type === 'DELETE') {
|
if (xhr && xhr.data && xhr.type === 'DELETE') {
|
||||||
if (xhr.url.indexOf('?') === -1) {
|
if (!xhr.url.contains('?')) {
|
||||||
xhr.url = xhr.url + '?' + $.param(xhr.data);
|
xhr.url = xhr.url + '?' + $.param(xhr.data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
define(
|
|
||||||
[
|
|
||||||
], function () {
|
|
||||||
|
|
||||||
return {
|
|
||||||
|
|
||||||
startsWith: function (str, starts) {
|
|
||||||
if (starts === '') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (str == null || starts == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
str = String(str);
|
|
||||||
starts = String(starts);
|
|
||||||
return str.length >= starts.length && str.slice(0, starts.length) === starts;
|
|
||||||
},
|
|
||||||
|
|
||||||
endsWith: function (str, ends) {
|
|
||||||
if (ends === '') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (str == null || ends == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
str = String(str);
|
|
||||||
ends = String(ends);
|
|
||||||
return str.length >= ends.length && str.slice(str.length - ends.length) === ends;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -60,6 +60,7 @@
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
<script src="/polyfills.js"></script>
|
||||||
<script src="/JsLibraries/jquery.js"></script>
|
<script src="/JsLibraries/jquery.js"></script>
|
||||||
<script src="/JsLibraries/messenger.js"></script>
|
<script src="/JsLibraries/messenger.js"></script>
|
||||||
<script src="/ServerStatus.js"></script>
|
<script src="/ServerStatus.js"></script>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
define(['Shared/StringHelpers'],function (StringHelpers) {
|
define(function () {
|
||||||
//This module will automatically route all relative links through backbone router rather than
|
//This module will automatically route all relative links through backbone router rather than
|
||||||
//causing links to reload pages.
|
//causing links to reload pages.
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ define(['Shared/StringHelpers'],function (StringHelpers) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!StringHelpers.startsWith(href, 'http')) {
|
if (!href.startsWith('http')) {
|
||||||
router.navigate(href, { trigger: true });
|
router.navigate(href, { trigger: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
if (!String.prototype.startsWith) {
|
||||||
|
Object.defineProperty(String.prototype, 'startsWith', {
|
||||||
|
enumerable: false,
|
||||||
|
configurable: false,
|
||||||
|
writable: false,
|
||||||
|
value: function (searchString, position) {
|
||||||
|
position = position || 0;
|
||||||
|
return this.indexOf(searchString, position) === position;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.prototype.endsWith) {
|
||||||
|
Object.defineProperty(String.prototype, 'endsWith', {
|
||||||
|
enumerable: false,
|
||||||
|
configurable: false,
|
||||||
|
writable: false,
|
||||||
|
value: function (searchString, position) {
|
||||||
|
position = position || this.length;
|
||||||
|
position = position - searchString.length;
|
||||||
|
var lastIndex = this.lastIndexOf(searchString);
|
||||||
|
return lastIndex !== -1 && lastIndex === position;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!('contains' in String.prototype))
|
||||||
|
{
|
||||||
|
String.prototype.contains = function(str, startIndex) {
|
||||||
|
return -1 !== String.prototype.indexOf.call(this, str, startIndex);
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue