Merge pull request #588 from JackDandy/FuzzyMoments

Fuzzy Moments Update
This commit is contained in:
echel0n 2014-06-03 21:12:54 -07:00
commit e788580d09
4 changed files with 61 additions and 18 deletions

View file

@ -370,31 +370,42 @@
<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 ""#/>
<input type="checkbox" name="fuzzy_dating" id="fuzzy_dating" class="viewIf datePresets" #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 class="show_if_fuzzy_dating#if True == $sickbeard.FUZZY_DATING then '' else ' metadataDiv'#">
<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>
<div class="field-pair">
<label class="nocheck clearfix" for="date_presets">
<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($datetime.datetime.now().year+1, 1, 1, 14, 30, 47).strftime($cur_preset)</option>
#end for
</select>
<div class="show_if_fuzzy_dating#if True == $sickbeard.FUZZY_DATING then '' else ' metadataDiv'#">
<select id="date_presets#if True == $sickbeard.FUZZY_DATING then '' else '_na'#" name="date_preset#if True == $sickbeard.FUZZY_DATING then '' else '_na'#">
#for $cur_preset in $date_presets:
<option value="$cur_preset" #if $cur_preset == $sickbeard.DATE_PRESET or ("%x" == $sickbeard.DATE_PRESET and "$cur_preset" == '%a, %b %d, %Y') then "selected=\"selected\"" else ""#>$datetime.datetime($datetime.datetime.now().year, 12, 31, 14, 30, 47).strftime($cur_preset)</option>
#end for
</select>
</div>
<div class="hide_if_fuzzy_dating#if True != $sickbeard.FUZZY_DATING then '' else ' metadataDiv'#">
<select id="date_presets#if True != $sickbeard.FUZZY_DATING then '' else '_na'#" name="date_preset#if True != $sickbeard.FUZZY_DATING then '' else '_na'#">
<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($datetime.datetime.now().year, 12, 31, 14, 30, 47).strftime($cur_preset)</option>
#end for
</select>
</div>
<div id="date_use_system_default" class="metadataDiv"></div>
</span>
</label>
</div>

View file

@ -9,7 +9,38 @@ $(document).ready(function(){
$('#content_'+$(this).attr('id')).fadeIn("fast", "linear");
else
$('#content_'+$(this).attr('id')).fadeOut("fast", "linear");
});
});
$(".viewIf").click(function() {
if ($(this).prop('checked')) {
$('.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");
}
});
$(".datePresets").click(function() {
var def = $('#date_presets').val()
if ($(this).prop('checked') && '%x' == def) {
def = '%a, %b %d, %Y'
$('#date_use_system_default').html('1')
} else if (!$(this).prop('checked') && '1' == $('#date_use_system_default').html())
def = '%x'
$('#date_presets').attr('name', 'date_preset_old')
$('#date_presets').attr('id', 'date_presets_old')
$('#date_presets_na').attr('name', 'date_preset')
$('#date_presets_na').attr('id', 'date_presets')
$('#date_presets_old').attr('name', 'date_preset_na')
$('#date_presets_old').attr('id', 'date_presets_na')
if (def)
$('#date_presets').val(def)
});
// bind 'myForm' and provide a simple callback function
$('#configForm').ajaxForm({

View file

@ -108,8 +108,8 @@
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
week = Math.abs(weekdiff = airdate.diff(today, 'week')), isPast = weekdiff < 0,
titleThis = false, qTipTime = false,
result = (0 == week ? airdatetime.calendar() : '');
if (/\bOn\b/i.test(result)) {

View file

@ -1047,7 +1047,7 @@ class ConfigGeneral:
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,
fuzzy_dating=None, trim_zero=None, date_preset=None, time_preset=None,
fuzzy_dating=None, trim_zero=None, date_preset=None, date_preset_na=None, time_preset=None,
indexer_timeout=None):
results = []
@ -1081,6 +1081,7 @@ class ConfigGeneral:
if date_preset:
sickbeard.DATE_PRESET = date_preset
discarded_na_data = date_preset_na
if indexer_default:
sickbeard.INDEXER_DEFAULT = config.to_int(indexer_default)