mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Add feature to General Config to display fuzzy dates instead of absolute dates. Add feature to General Config to trim the leading number "0" shown on hour of day and date of month.
Affects UI dates on the Coming Episodes, Display Show, Manage > Backlog Overview, Home and History pages. Widen the General Config tab widths and tweak, format and align some texts. The many 'test date' variations in the General Config -> "Date and Time" drop down are useless during the month of May as both short and long styles are the same. Change the 'test date' to January 1 of the next year so short and long month styles are distinguishable.
This commit is contained in:
parent
41ff17a2f0
commit
cf1d88343d
@ -107,6 +107,17 @@
|
||||
|
||||
\$('#sbRoot').ajaxEpSearch();
|
||||
|
||||
#set $fuzzydate = 'airdate'
|
||||
#if $sickbeard.FUZZY_DATING:
|
||||
fuzzyMoment({
|
||||
containerClass : '.${fuzzydate}',
|
||||
dateHasTime : true,
|
||||
dateFormat : '${sickbeard.DATE_PRESET}',
|
||||
timeFormat : '${sickbeard.TIME_PRESET}',
|
||||
trimZero : #if $sickbeard.TRIM_ZERO then "true" else "false"#
|
||||
});
|
||||
#end if
|
||||
|
||||
});
|
||||
//-->
|
||||
</script>
|
||||
@ -146,7 +157,8 @@
|
||||
|
||||
<!-- start $cur_result["show_name"] //-->
|
||||
<tr class="$show_div">
|
||||
<td align="center" class="nowrap">$sbdatetime.sbdatetime.sbfdatetime($cur_result["localtime"]).decode($sickbeard.SYS_ENCODING)<span class="sort_data">$time.mktime($cur_result["localtime"].timetuple())</span></td>
|
||||
## forced to use a div to wrap airdate, the column sort went crazy with a span
|
||||
<td align="center" class="nowrap"><div class="${fuzzydate}">$sbdatetime.sbdatetime.sbfdatetime($cur_result["localtime"]).decode($sickbeard.SYS_ENCODING)</div><span class="sort_data">$time.mktime($cur_result["localtime"].timetuple())</span></td>
|
||||
<td class="tvShow"><a href="$sbRoot/home/displayShow?show=${cur_result["showid"]}">$cur_result["show_name"]</a>
|
||||
#if int($cur_result["paused"]):
|
||||
<span class="pause">[paused]</span>
|
||||
@ -212,7 +224,7 @@
|
||||
#set $show_div = "ep_listing listing_default"
|
||||
|
||||
#if $sort == "show":
|
||||
<br/><br/>
|
||||
<br /><br />
|
||||
#end if
|
||||
|
||||
#for $cur_result in $sql_results:
|
||||
|
@ -48,7 +48,7 @@
|
||||
<p><b>Some options may require a manual restart to take effect.</b></p>
|
||||
</div>
|
||||
|
||||
<fieldset class="component-group-list">
|
||||
<fieldset class="component-group-list" style="width:670px">
|
||||
<div class="field-pair">
|
||||
<input type="checkbox" name="launch_browser" id="launch_browser" #if $sickbeard.LAUNCH_BROWSER then "checked=\"checked\"" else ""#/>
|
||||
<label class="clearfix" for="launch_browser">
|
||||
@ -92,18 +92,18 @@
|
||||
<input type="checkbox" name="auto_update" id="auto_update" #if $sickbeard.AUTO_UPDATE then "checked=\"checked\"" else ""#/>
|
||||
<label class="clearfix" for="auto_update">
|
||||
<span class="component-title">Automatic Updates</span>
|
||||
<span class="component-desc">Automatically get and install updates for SickRage when available.</span>
|
||||
<span class="component-desc">Automatically get and install updates for SickRage when available. These</span>
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
<span class="component-desc">Automatic Updates run on startup and in the background on the interval specified above.</span>
|
||||
<span class="component-desc">updates run on startup and in the background on the interval specified above.</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="field-pair">
|
||||
<input type="checkbox" name="sort_article" id="sort_article" #if $sickbeard.SORT_ARTICLE then "checked=\"checked\"" else ""#/>
|
||||
<label class="clearfix" for="sort_article">
|
||||
<span class="component-title">Sort articles</span>
|
||||
<span class="component-title">Sort Articles</span>
|
||||
<span class="component-desc">Include articles (The, A, An) when sorting show lists.</span>
|
||||
</label>
|
||||
</div>
|
||||
@ -124,7 +124,7 @@
|
||||
|
||||
<div class="field-pair">
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title">Indexer Timeout:</span>
|
||||
<span class="component-title">Indexer Timeout</span>
|
||||
<input type="text" name="indexer_timeout" id="indexer_timeout" value="$sickbeard.INDEXER_TIMEOUT" size="5" />
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
@ -135,7 +135,7 @@
|
||||
|
||||
<div class="field-pair">
|
||||
<label class="nocheck clearfix" for="log_dir">
|
||||
<span class="component-title">Logging Director:y</span>
|
||||
<span class="component-title">Logging Directory</span>
|
||||
<input type="text" name="log_dir" id="log_dir" value="$sickbeard.ACTUAL_LOG_DIR" size="40" />
|
||||
</label>
|
||||
</div>
|
||||
@ -143,8 +143,12 @@
|
||||
<div class="field-pair">
|
||||
<input type="checkbox" name="handle_reverse_proxy" id="handle_reverse_proxy" #if $sickbeard.HANDLE_REVERSE_PROXY then "checked=\"checked\"" else ""#/>
|
||||
<label class="clearfix" for="handle_reverse_proxy">
|
||||
<span class="component-title">Handle reverse proxies:</span>
|
||||
<span class="component-desc">Should SickRage accept reverse proxy headers? (X-Forwarded-Host, X-Forwarded-For, X-Forwarded-Proto)</span>
|
||||
<span class="component-title">Reverse Proxy Headers</span>
|
||||
<span class="component-desc">Should SickRage accept the following reverse proxy headers?</span>
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
<span class="component-desc">(X-Forwarded-Host, X-Forwarded-For, X-Forwarded-Proto)</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@ -255,18 +259,22 @@
|
||||
<p>You need to know what you are doing here!!!</p>
|
||||
</div>
|
||||
|
||||
<fieldset class="component-group-list">
|
||||
<fieldset class="component-group-list" style="width:670px">
|
||||
|
||||
<div class="field-pair">
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title">CPU Throttling:
|
||||
<span class="component-title">CPU Throttling:</span>
|
||||
<span class="component-desc">
|
||||
<select id="cpu_presets" name="cpu_preset">
|
||||
#for $cur_preset in $cpu_presets:
|
||||
<option value="$cur_preset" #if $cur_preset == $sickbeard.CPU_PRESET then "selected=\"selected\"" else ""#>$cur_preset</option>
|
||||
<option value="$cur_preset" #if $cur_preset == $sickbeard.CPU_PRESET then "selected=\"selected\"" else ""#>$cur_preset.capitalize()</option>
|
||||
#end for
|
||||
</select>
|
||||
</span>
|
||||
<span class="component-desc">HIGH = Lower CPU usage<br>NORMAL = Defaults<br>LOW = Higher CPU usage</span>
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
<span class="component-desc">Normal = Default. High = Lower CPU usage. Low = Higher CPU usage.</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@ -288,7 +296,7 @@
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
<span class="component-desc">Specify path to Git binary, only use if OS is unable to find the path.</span>
|
||||
<span class="component-desc">Specify path to Git binary, use only if OS is unable to find the path.</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@ -318,11 +326,11 @@
|
||||
<input type="checkbox" name="encryption_version" id="encryption_version" #if $sickbeard.ENCRYPTION_VERSION then "checked=\"checked\"" else ""#/>
|
||||
<label class="clearfix" for="encryption_version">
|
||||
<span class="component-title">Encrypt Passwords</span>
|
||||
<span class="component-desc">Should SickRage encrypt the passwords in <code>config.ini</code> file?</span>
|
||||
<span class="component-desc">Should SickRage encrypt passwords in <code>config.ini</code> file?</span>
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
<span class="component-desc"><b>Warning</b>: Password must be only with <a style="color: blue;" href="http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters">ASCII characters</a></span>
|
||||
<span class="component-desc"><b>Warning</b>: Passwords must only contain <a style="color: blue;" href="http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters">ASCII characters</a></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@ -330,7 +338,7 @@
|
||||
<input type="checkbox" name="calendar_unprotected" id="calendar_unprotected" #if $sickbeard.CALENDAR_UNPROTECTED then "checked=\"checked\"" else ""#/>
|
||||
<label class="clearfix" for="calendar_unprotected">
|
||||
<span class="component-title">Unprotected Calendar</span>
|
||||
<span class="component-desc">This allows to subscribe to the calendar without user and password.</span>
|
||||
<span class="component-desc">Allow subscribing to the calendar without user and password.</span>
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
@ -345,7 +353,7 @@
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
<span class="component-desc">Proxy to use for connecting to providers. Leave empty to not use proxy</b></span>
|
||||
<span class="component-desc">Proxy to use for connecting to providers. Leave empty to not use proxy.</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@ -359,16 +367,32 @@
|
||||
<h3>Date and Time</h3>
|
||||
</div>
|
||||
|
||||
<fieldset class="component-group-list">
|
||||
<fieldset class="component-group-list" style="width:670px">
|
||||
|
||||
<div class="field-pair">
|
||||
<input type="checkbox" name="fuzzy_dating" id="fuzzy_dating" #if $sickbeard.FUZZY_DATING == True then "checked=\"checked\"" else ""#/>
|
||||
<label class="clearfix" for="fuzzy_dating">
|
||||
<span class="component-title">Display Fuzzy Dates</span>
|
||||
<span class="component-desc">E.g "Last Thu", "On Tue" and move the absolute date into time tooltips?</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="field-pair">
|
||||
<input type="checkbox" name="trim_zero" id="trim_zero" #if $sickbeard.TRIM_ZERO == True then "checked=\"checked\"" else ""#/>
|
||||
<label class="clearfix" for="trim_zero">
|
||||
<span class="component-title">Trim Zero Padding</span>
|
||||
<span class="component-desc">Trim leading number "0" shown on hour of day and date of month?</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="field-pair">
|
||||
<label class="nocheck clearfix" for="date_presets">
|
||||
<span class="component-title">Date Format:</span>
|
||||
<span class="component-title">Date Style:</span>
|
||||
<span class="component-desc">
|
||||
<select id="date_presets" name="date_preset">
|
||||
<option value="%x" #if "%x" == $sickbeard.DATE_PRESET then "selected=\"selected\"" else ""#>Use System Default</option>
|
||||
#for $cur_preset in $date_presets:
|
||||
<option value="$cur_preset" #if $cur_preset == $sickbeard.DATE_PRESET then "selected=\"selected\"" else ""#>$datetime.datetime.now().strftime($cur_preset)</option>
|
||||
<option value="$cur_preset" #if $cur_preset == $sickbeard.DATE_PRESET then "selected=\"selected\"" else ""#>$datetime.datetime($datetime.datetime.now().year+1, 1, 1, 14, 30, 47).strftime($cur_preset)</option>
|
||||
#end for
|
||||
</select>
|
||||
</span>
|
||||
@ -377,7 +401,7 @@
|
||||
|
||||
<div class="field-pair">
|
||||
<label class="nocheck clearfix" for="time_presets">
|
||||
<span class="component-title">Time Format:</span>
|
||||
<span class="component-title">Time Style:</span>
|
||||
<span class="component-desc">
|
||||
<select id="time_presets" name="time_preset">
|
||||
#for $cur_preset in $time_presets:
|
||||
@ -385,16 +409,26 @@
|
||||
#end for
|
||||
</select>
|
||||
</span>
|
||||
<span class="component-desc"><b>Note:</b> Seconds are only shown on the History Page.</span>
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
<span class="component-desc"><b>Note:</b> Seconds are only shown on the History page.</span>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="field-pair">
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title">Timezones:</span>
|
||||
<span class="component-desc">Display Dates and Times in either your timezone or the shows network timezone?</span>
|
||||
<span class="component-desc">Display dates and times in either your timezone or the shows network timezone?</span>
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
<span class="component-desc">
|
||||
<input type="radio" name="timezone_display" id="local" value="local" class="radio" #if $sickbeard.TIMEZONE_DISPLAY=="local" then "checked=\"checked\"" else ""# />Local Timezone<br />
|
||||
</label>
|
||||
<label class="nocheck clearfix">
|
||||
<span class="component-title"> </span>
|
||||
<input type="radio" name="timezone_display" id="network" value="network" class="radio" #if $sickbeard.TIMEZONE_DISPLAY=="network" then "checked=\"checked\"" else ""# />Network Timezone<br />
|
||||
</span>
|
||||
</label>
|
||||
|
@ -25,7 +25,23 @@
|
||||
<script type="text/javascript" src="$sbRoot/js/ajaxEpSearch.js?$sbPID"></script>
|
||||
<script type="text/javascript" src="$sbRoot/js/ajaxEpSubtitles.js?$sbPID"></script>
|
||||
<script type="text/javascript" src="$sbRoot/js/ajaxEpRetry.js?$sbPID"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
<!--
|
||||
\$(document).ready(function(){
|
||||
## #if not $network_timezones.test_timeformat($show.airs) #
|
||||
#set $fuzzydate = 'airdate'
|
||||
#if $sickbeard.FUZZY_DATING:
|
||||
fuzzyMoment({
|
||||
containerClass : '.${fuzzydate}',
|
||||
dateHasTime : false,
|
||||
dateFormat : '${sickbeard.DATE_PRESET}',
|
||||
timeFormat : '${sickbeard.TIME_PRESET}',
|
||||
trimZero : #if $sickbeard.TRIM_ZERO then "true" else "false"#
|
||||
});
|
||||
#end if
|
||||
});
|
||||
//-->
|
||||
</script>
|
||||
<div class="navShows">
|
||||
</br>
|
||||
<div class="align-left"><b>Change Show:</b>
|
||||
@ -271,7 +287,7 @@
|
||||
#end if
|
||||
$epResult["name"]
|
||||
</td>
|
||||
<td align="center" class="nowrap">#if int($epResult["airdate"]) == 1 then "never" else $sbdatetime.sbdatetime.sbfdate($network_timezones.parse_date_time($epResult["airdate"],$show.airs,$show.network))#</td>
|
||||
<td align="center" class="nowrap"><div class="${fuzzydate}">#if int($epResult["airdate"]) == 1 then "never" else $sbdatetime.sbdatetime.sbfdate($network_timezones.parse_date_time($epResult["airdate"],$show.airs,$show.network))#</div></td>
|
||||
<td class="filename"><small>
|
||||
#if $epLoc and $show._location and $epLoc.lower().startswith($show._location.lower()):
|
||||
#set $epLoc = os.path.basename($epLoc[len($show._location)+1:])
|
||||
|
@ -65,6 +65,19 @@
|
||||
url = '$sbRoot/history/?limit='+\$(this).val()
|
||||
window.location.href = url
|
||||
});
|
||||
|
||||
#set $fuzzydate = 'airdate'
|
||||
#if $sickbeard.FUZZY_DATING:
|
||||
fuzzyMoment({
|
||||
containerClass : '.${fuzzydate}',
|
||||
dateHasTime : true,
|
||||
dateFormat : '${sickbeard.DATE_PRESET}',
|
||||
timeFormat : '${sickbeard.TIME_PRESET_W_SECONDS}',
|
||||
trimZero : #if $sickbeard.TRIM_ZERO then "true" else "false"#,
|
||||
dtGlue : ', ',
|
||||
});
|
||||
#end if
|
||||
|
||||
});
|
||||
//-->
|
||||
</script>
|
||||
@ -97,7 +110,7 @@
|
||||
#set $curStatus, $curQuality = $Quality.splitCompositeStatus(int($hItem["action"]))
|
||||
<tr>
|
||||
#set $curdatetime = $datetime.datetime.strptime(str($hItem["date"]), $history.dateFormat)
|
||||
<td class="nowrap">$sbdatetime.sbdatetime.sbfdatetime($curdatetime, show_seconds=True)<span class="sort_data">$time.mktime($curdatetime.timetuple())</span></td>
|
||||
<td class="nowrap"><div class="${fuzzydate}">$sbdatetime.sbdatetime.sbfdatetime($curdatetime, show_seconds=True)</div><span class="sort_data">$time.mktime($curdatetime.timetuple())</span></td>
|
||||
<td width="35%"><a style="color: #000000; text-align: center;" href="$sbRoot/home/displayShow?show=$hItem["showid"]#season-$hItem["season"]">$hItem["show_name"] - <%=str(hItem["season"]) +"x"+ "%02i" % int(hItem["episode"]) %>#if "proper" in $hItem["resource"].lower or "repack" in $hItem["resource"].lower then ' <span class="quality Proper">Proper</span>' else ""#</a></td>
|
||||
<td align="center" #if $curStatus == SUBTITLED then 'class="subtitles_column"' else ''#><span style="cursor: help;" title="$os.path.basename($hItem["resource"])">$statusStrings[$curStatus]</span>
|
||||
#if $curStatus == SUBTITLED:
|
||||
|
@ -119,6 +119,17 @@
|
||||
}
|
||||
});
|
||||
|
||||
#set $fuzzydate = 'airdate'
|
||||
#if $sickbeard.FUZZY_DATING:
|
||||
fuzzyMoment({
|
||||
containerClass : '.${fuzzydate}',
|
||||
dateHasTime : false,
|
||||
dateFormat : '${sickbeard.DATE_PRESET}',
|
||||
timeFormat : '${sickbeard.TIME_PRESET}',
|
||||
trimZero : #if $sickbeard.TRIM_ZERO then "true" else "false"#
|
||||
});
|
||||
#end if
|
||||
|
||||
});
|
||||
|
||||
//-->
|
||||
@ -201,7 +212,7 @@ $myShowList.sort(lambda x, y: cmp(x.name, y.name))
|
||||
<tr>
|
||||
#if len($curEp) != 0:
|
||||
#set $ldatetime = $network_timezones.parse_date_time($curEp[0].airdate.toordinal(),$curShow.airs,$curShow.network)
|
||||
<td align="center" class="nowrap" style="color: #555555;font-weight:bold;">$sbdatetime.sbdatetime.sbfdate($ldatetime)<span class="sort_data">$time.mktime($ldatetime.timetuple())</span> </td>
|
||||
<td align="center" class="nowrap" style="color: #555555;font-weight:bold;"><div class="${fuzzydate}">$sbdatetime.sbdatetime.sbfdate($ldatetime)</div><span class="sort_data">$time.mktime($ldatetime.timetuple())</span> </td>
|
||||
#else:
|
||||
<td align="center" class="nowrap" style="color: #555555;font-weight:bold;"></td>
|
||||
#end if
|
||||
|
@ -125,7 +125,10 @@ a > i.icon-question-sign { background-image: url("$sbRoot/images/glyphicons-half
|
||||
<script type="text/javascript" src="$sbRoot/js/lib/jquery.form-3.35.js?$sbPID"></script>
|
||||
<script type="text/javascript" src="$sbRoot/js/lib/jquery.ui.touch-punch-0.2.2.min.js?$sbPID"></script>
|
||||
<script type="text/javascript" src="$sbRoot/js/script.js?$sbPID"></script>
|
||||
|
||||
#if $sickbeard.FUZZY_DATING:
|
||||
<script type="text/javascript" src="$sbRoot/js/moment/moment.min.js?$sbPID"></script>
|
||||
<script type="text/javascript" src="$sbRoot/js/fuzzyMoment.js?$sbPID"></script>
|
||||
#end if
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
<!--
|
||||
sbRoot = "$sbRoot"; // needed for browser.js & ajaxNotifications.js
|
||||
|
@ -21,6 +21,18 @@
|
||||
\$('html,body').animate({scrollTop: \$("#show-"+id).offset().top -25},'slow');
|
||||
}
|
||||
});
|
||||
|
||||
#set $fuzzydate = 'airdate'
|
||||
#if $sickbeard.FUZZY_DATING:
|
||||
fuzzyMoment({
|
||||
containerClass : '.${fuzzydate}',
|
||||
dateHasTime : false,
|
||||
dateFormat : '${sickbeard.DATE_PRESET}',
|
||||
timeFormat : '${sickbeard.TIME_PRESET}',
|
||||
trimZero : #if $sickbeard.TRIM_ZERO then "true" else "false"#
|
||||
});
|
||||
#end if
|
||||
|
||||
});
|
||||
//-->
|
||||
</script>
|
||||
@ -84,7 +96,7 @@ Jump to Show
|
||||
<tr class="$Overview.overviewStrings[$showCats[$curShow.indexerid][$whichStr]]">
|
||||
<td align="center">$whichStr</td>
|
||||
<td>$curResult["name"]</td>
|
||||
<td align="center" class="nowrap">#if int($curResult["airdate"]) == 1 then "never" else $sbdatetime.sbdatetime.sbfdate($network_timezones.parse_date_time($curResult["airdate"],$curShow.airs,$curShow.network))#</td>
|
||||
<td align="center" class="nowrap"><div class="${fuzzydate}">#if int($curResult["airdate"]) == 1 then "never" else $sbdatetime.sbdatetime.sbfdate($network_timezones.parse_date_time($curResult["airdate"],$curShow.airs,$curShow.network))#</div></td>
|
||||
</tr>
|
||||
|
||||
#end for
|
||||
|
164
gui/slick/js/fuzzyMoment.js
Normal file
164
gui/slick/js/fuzzyMoment.js
Normal file
@ -0,0 +1,164 @@
|
||||
/**
|
||||
* Fuzzy Moment - convert an absolute date text into a fuzzy moment
|
||||
*
|
||||
* containerClass string The class name of dom element to convert (default: 'fuzzydate')
|
||||
* dateHasTime boolean Whether containerClass contains a time (default: false)
|
||||
* dateFormat string The python token date formatting
|
||||
* timeFormat string The python token time formatting
|
||||
* trimZero Whether to trim leading "0"s (default : false)
|
||||
* dtGlue string To insert between the output of date and time (default: '<br />')
|
||||
*/
|
||||
function fuzzyMoment(fmConfig) {
|
||||
|
||||
var containerClass = (/undefined/i.test(typeof(fmConfig)) || /undefined/i.test(typeof(fmConfig.containerClass)) ? '.fuzzydate' : fmConfig.containerClass),
|
||||
dateWithTime = (/undefined/i.test(typeof(fmConfig)) || /undefined/i.test(typeof(fmConfig.dateHasTime)) ? false : !!fmConfig.dateHasTime),
|
||||
dateFormat = (/undefined/i.test(typeof(fmConfig)) || /undefined/i.test(typeof(fmConfig.dateFormat)) ? '' : fmConfig.dateFormat),
|
||||
timeFormat = (/undefined/i.test(typeof(fmConfig)) || /undefined/i.test(typeof(fmConfig.timeFormat)) ? '' : fmConfig.timeFormat),
|
||||
trimZero = (/undefined/i.test(typeof(fmConfig)) || /undefined/i.test(typeof(fmConfig.trimZero)) ? false : !!fmConfig.trimZero),
|
||||
dtGlue = (/undefined/i.test(typeof(fmConfig)) || /undefined/i.test(typeof(fmConfig.dtGlue)) ? '<br />' : fmConfig.dtGlue),
|
||||
|
||||
jd = (function (str) {
|
||||
var token_map = ['a', 'ddd', 'A', 'dddd', 'b', 'MMM', 'B', 'MMMM', 'd', 'DD', 'm', 'MM', 'y', 'YY', 'Y', 'YYYY', 'x', 'L',
|
||||
'H', 'HH', 'I', 'hh', 'M', 'mm', 'S', 'ss', 'p', 'A'],
|
||||
result = '';
|
||||
|
||||
for (var i = 0; i < str.length; i++)
|
||||
if (/[aAbBdmyYxHIMSp]/.test(str[i])) {
|
||||
for (var t = 0; t < token_map.length; t = t + 2)
|
||||
if (str[i] == token_map[t]) {
|
||||
result += token_map[t + 1];
|
||||
break;
|
||||
}
|
||||
} else if ('%' != str[i])
|
||||
result += str[i];
|
||||
|
||||
return result;
|
||||
}),
|
||||
dateToken = jd(dateFormat),
|
||||
timeToken = jd(timeFormat),
|
||||
|
||||
addQTip = (function() {
|
||||
$(this).css('cursor', 'help');
|
||||
$(this).qtip({
|
||||
show: {
|
||||
solo: true
|
||||
},
|
||||
position: {
|
||||
viewport: $(window),
|
||||
my: 'left center',
|
||||
adjust: {
|
||||
y: -10,
|
||||
x: 2
|
||||
}
|
||||
},
|
||||
style: {
|
||||
tip: {
|
||||
corner: true,
|
||||
method: 'polygon'
|
||||
},
|
||||
classes: 'qtip-rounded qtip-dark qtip-shadow ui-tooltip-sb'
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (trimZero) {
|
||||
timeToken = timeToken.replace(/hh/ig, 'h');
|
||||
dateToken = dateToken.replace(/\bDD\b/g, 'D');
|
||||
}
|
||||
|
||||
$(containerClass).each(function() {
|
||||
var input = $(this).text(),
|
||||
dateA = '[<span class="fd">',
|
||||
dtSeparator = ' ',
|
||||
timeA = '</span>]', timeB = '[' + timeA;
|
||||
|
||||
if (dateWithTime) {
|
||||
var timeMeta = input.match(/^.{6,}?([,\s]+)(\d{1,2}).(?:\d{2,2})(?:.(\d{2,2}))?(?:\s([ap]m))?$/im);
|
||||
if (null != timeMeta) {
|
||||
dtSeparator = (! /undefined/i.test(typeof(timeMeta[1])) ? timeMeta[1] : dtSeparator);
|
||||
// adjust timeToken to num digits of input hours
|
||||
timeToken = (! /undefined/i.test(typeof(timeMeta[2])) && 1 == timeMeta[2].length ? timeToken.replace(/hh/ig, 'h') : timeToken);
|
||||
// adjust timeToken to use seconds if input has them
|
||||
timeToken = (! /undefined/i.test(typeof(timeMeta[3])) && 2 == timeMeta[3].length ? timeToken : timeToken.replace(/.ss/, ''));
|
||||
// adjust timeToken to am/pm or AM/PM if input has it
|
||||
timeToken = (! /undefined/i.test(typeof(timeMeta[4])) && 2 == timeMeta[4].length ? timeToken.replace(/A$/, (/[ap]m/.test(timeMeta[4]) ? 'a' : 'A')) : timeToken);
|
||||
}
|
||||
timeA = '</span>' + dtGlue + '<span class="ft">]' + timeToken + '[' + timeA;
|
||||
timeB = '[</span>' + dtGlue + '<span class="ft">]' + timeToken + timeB;
|
||||
}
|
||||
|
||||
var inputTokens = dateToken + dtSeparator + (dateWithTime ? timeToken : 'HH:mm:ss');
|
||||
|
||||
if (! moment(input + (dateWithTime ? '' : dtSeparator + '00:00:00'), inputTokens).isValid())
|
||||
return;
|
||||
|
||||
moment.lang('en', {
|
||||
calendar: {
|
||||
lastDay:dateA + 'Yesterday' + timeA, sameDay:dateA + 'Today' + timeA, nextDay:dateA + 'Tomorrow' + timeA,
|
||||
lastWeek:dateA + 'last] ddd' + timeB, nextWeek:dateA + 'on] ddd' + timeB,
|
||||
sameElse:dateA + ']ddd, MMM D YYYY[' + timeA
|
||||
},
|
||||
relativeTime: {
|
||||
future:'in %s', past:'%s ago', s:'seconds', m:'a minute', mm:'%d minutes', h:'an hour', hh:'%d hours',
|
||||
d:'a day', dd:'%d days', M:'a month', MM:'%d months', y:'a year', yy:'%d years'
|
||||
}
|
||||
});
|
||||
|
||||
var airdatetime = moment(input + (dateWithTime ? '' : dtSeparator + '00:00:00'), inputTokens),
|
||||
airdate = airdatetime.clone().hour(0).minute(0).second(0).millisecond(0),
|
||||
today = moment({}),
|
||||
day = Math.abs(airdate.diff(today, 'days')),
|
||||
week = airdate.diff(today, 'week'), isPast = week < 0, week = Math.abs(week),
|
||||
titleThis = false, qTipTime = false
|
||||
result = (0 == week ? airdatetime.calendar() : '');
|
||||
|
||||
if (/\bOn\b/i.test(result)) {
|
||||
var fuzzer = false, weekday = today.format('dd');
|
||||
if (/we/i.test(weekday))
|
||||
fuzzer = (5 <= day);
|
||||
else if (/(?:th|fr)/i.test(weekday))
|
||||
fuzzer = (4 <= day);
|
||||
else
|
||||
fuzzer = (6 == day);
|
||||
if (fuzzer)
|
||||
result = result.replace(/\bOn\b/, 'Next');
|
||||
|
||||
} else if (! /\b((yester|to)day\b|tomo|last\b)/i.test(result)) {
|
||||
if (14 > day)
|
||||
result = airdate.from(today) + (dateWithTime ? dtGlue + airdatetime.format(timeToken) : '');
|
||||
else if (4 > week) {
|
||||
result = (isPast ? '' : 'in ') + (1 == week ? 'a' : week) + ' week' + (1 == week ? '' : 's') + (isPast ? ' ago' : '');
|
||||
qTipTime = true;
|
||||
} else {
|
||||
result = airdate.from(today);
|
||||
qTipTime = true;
|
||||
var month = airdate.diff(today, 'month');
|
||||
if (1 == parseInt(airdate.year() - today.year()))
|
||||
result += '<br />(Next Year)';
|
||||
}
|
||||
titleThis = true;
|
||||
}
|
||||
|
||||
var n = false; // disable for prod
|
||||
$(this).html(result);
|
||||
if (dateWithTime && /(yester|to)day/i.test(result))
|
||||
$(this).find('.fd').attr('title',(n?'1) ':'') + moment.duration(airdatetime.diff(moment(),'seconds'),'seconds').humanize(true)).each(addQTip);
|
||||
else if (dateWithTime)
|
||||
$(this).find('.fd').attr('title',(n?'2) ':'') + airdate.from(today)).each(addQTip);
|
||||
else if (! /today/i.test(result))
|
||||
$(this).find('.fd').attr('title',(n?'3) ':'') + airdate.from(today)).each(addQTip);
|
||||
else
|
||||
titleThis = false;
|
||||
|
||||
if (titleThis)
|
||||
if (dateWithTime && qTipTime)
|
||||
$(this).attr('title',(n?'4) ':'') + airdatetime.format(inputTokens)).each(addQTip);
|
||||
else
|
||||
$(this).attr('title',(n?'5) ':'') + airdate.format(dateToken)).each(addQTip);
|
||||
else
|
||||
if (dateWithTime && qTipTime)
|
||||
$(this).find('.ft').attr('title',(n?'6) ':'') + airdatetime.format(inputTokens)).each(addQTip);
|
||||
else
|
||||
$(this).find('.ft').attr('title',(n?'7) ':'') + airdate.format(dateToken)).each(addQTip);
|
||||
});
|
||||
}
|
6
gui/slick/js/moment/moment.min.js
vendored
Normal file
6
gui/slick/js/moment/moment.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -390,6 +390,8 @@ COMING_EPS_LAYOUT = None
|
||||
COMING_EPS_DISPLAY_PAUSED = None
|
||||
COMING_EPS_SORT = None
|
||||
COMING_EPS_MISSED_RANGE = None
|
||||
FUZZY_DATING = False
|
||||
TRIM_ZERO = False
|
||||
DATE_PRESET = None
|
||||
TIME_PRESET = None
|
||||
TIME_PRESET_W_SECONDS = None
|
||||
@ -456,7 +458,7 @@ def initialize(consoleLogging=True):
|
||||
USE_EMAIL, EMAIL_HOST, EMAIL_PORT, EMAIL_TLS, EMAIL_USER, EMAIL_PASSWORD, EMAIL_FROM, EMAIL_NOTIFY_ONSNATCH, EMAIL_NOTIFY_ONDOWNLOAD, EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD, EMAIL_LIST, \
|
||||
USE_LISTVIEW, METADATA_XBMC, METADATA_XBMC_12PLUS, METADATA_MEDIABROWSER, METADATA_PS3, metadata_provider_dict, \
|
||||
NEWZBIN, NEWZBIN_USERNAME, NEWZBIN_PASSWORD, GIT_PATH, MOVE_ASSOCIATED_FILES, CLEAR_CACHE, dailySearchScheduler, \
|
||||
GUI_NAME, HOME_LAYOUT, HISTORY_LAYOUT, DISPLAY_SHOW_SPECIALS, COMING_EPS_LAYOUT, COMING_EPS_SORT, COMING_EPS_DISPLAY_PAUSED, COMING_EPS_MISSED_RANGE, DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, \
|
||||
GUI_NAME, HOME_LAYOUT, HISTORY_LAYOUT, DISPLAY_SHOW_SPECIALS, COMING_EPS_LAYOUT, COMING_EPS_SORT, COMING_EPS_DISPLAY_PAUSED, COMING_EPS_MISSED_RANGE, FUZZY_DATING, TRIM_ZERO, DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, \
|
||||
METADATA_WDTV, METADATA_TIVO, METADATA_MEDE8ER, IGNORE_WORDS, CALENDAR_UNPROTECTED, CREATE_MISSING_SHOW_DIRS, \
|
||||
ADD_SHOWS_WO_DIR, USE_SUBTITLES, SUBTITLES_LANGUAGES, SUBTITLES_DIR, SUBTITLES_SERVICES_LIST, SUBTITLES_SERVICES_ENABLED, SUBTITLES_HISTORY, SUBTITLES_FINDER_FREQUENCY, subtitlesFinderScheduler, \
|
||||
USE_FAILED_DOWNLOADS, DELETE_FAILED, ANON_REDIRECT, LOCALHOST_IP, TMDB_API_KEY, DEBUG, PROXY_SETTING, \
|
||||
@ -859,6 +861,8 @@ def initialize(consoleLogging=True):
|
||||
COMING_EPS_DISPLAY_PAUSED = bool(check_setting_int(CFG, 'GUI', 'coming_eps_display_paused', 0))
|
||||
COMING_EPS_SORT = check_setting_str(CFG, 'GUI', 'coming_eps_sort', 'date')
|
||||
COMING_EPS_MISSED_RANGE = check_setting_int(CFG, 'GUI', 'coming_eps_missed_range', 7)
|
||||
FUZZY_DATING = bool(check_setting_int(CFG, 'GUI', 'fuzzy_dating', 0))
|
||||
TRIM_ZERO = bool(check_setting_int(CFG, 'GUI', 'trim_zero', 0))
|
||||
DATE_PRESET = check_setting_str(CFG, 'GUI', 'date_preset', '%x')
|
||||
TIME_PRESET_W_SECONDS = check_setting_str(CFG, 'GUI', 'time_preset', '%I:%M:%S %p')
|
||||
TIME_PRESET = TIME_PRESET_W_SECONDS.replace(u":%S", u"")
|
||||
@ -1693,6 +1697,8 @@ def save_config():
|
||||
new_config['GUI']['coming_eps_display_paused'] = int(COMING_EPS_DISPLAY_PAUSED)
|
||||
new_config['GUI']['coming_eps_sort'] = COMING_EPS_SORT
|
||||
new_config['GUI']['coming_eps_missed_range'] = int(COMING_EPS_MISSED_RANGE)
|
||||
new_config['GUI']['fuzzy_dating'] = int(FUZZY_DATING)
|
||||
new_config['GUI']['trim_zero'] = int(TRIM_ZERO)
|
||||
new_config['GUI']['date_preset'] = DATE_PRESET
|
||||
new_config['GUI']['time_preset'] = TIME_PRESET_W_SECONDS
|
||||
new_config['GUI']['timezone_display'] = TIMEZONE_DISPLAY
|
||||
|
@ -1010,7 +1010,8 @@ class ConfigGeneral:
|
||||
use_api=None, api_key=None, indexer_default=None, timezone_display=None, cpu_preset=None,
|
||||
web_password=None, version_notify=None, enable_https=None, https_cert=None, https_key=None,
|
||||
handle_reverse_proxy=None, sort_article=None, auto_update=None, proxy_setting=None,
|
||||
anon_redirect=None, git_path=None, calendar_unprotected=None, date_preset=None, time_preset=None,
|
||||
anon_redirect=None, git_path=None, calendar_unprotected=None,
|
||||
fuzzy_dating=None, trim_zero=None, date_preset=None, time_preset=None,
|
||||
indexer_timeout=None):
|
||||
|
||||
results = []
|
||||
@ -1039,6 +1040,9 @@ class ConfigGeneral:
|
||||
sickbeard.WEB_USERNAME = web_username
|
||||
sickbeard.WEB_PASSWORD = web_password
|
||||
|
||||
sickbeard.FUZZY_DATING = config.checkbox_to_value(fuzzy_dating)
|
||||
sickbeard.TRIM_ZERO = config.checkbox_to_value(trim_zero)
|
||||
|
||||
if date_preset:
|
||||
sickbeard.DATE_PRESET = date_preset
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user