|
|
@ -1,691 +1,353 @@ |
|
|
|
$(function() { |
|
|
|
function twisterOptions() { |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'locLang', |
|
|
|
|
|
|
|
selector: '#language', |
|
|
|
|
|
|
|
valDefault: 'auto', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
if (elem.value !== 'auto') |
|
|
|
|
|
|
|
twisterRpc('setpreferredspamlang', [elem.value]); |
|
|
|
|
|
|
|
location.reload(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
tickNotOnInit: 1 |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
var _desktopNotificationTimeout = 10; // it should be an option
|
|
|
|
name: 'theme', |
|
|
|
|
|
|
|
valDefault: 'original', |
|
|
|
var TwisterOptions = function() |
|
|
|
tickMethod: function () {location.reload();}, |
|
|
|
{ |
|
|
|
tickNotOnInit: 1 |
|
|
|
this.getOption = function(optionName, defaultValue) { |
|
|
|
|
|
|
|
var keyName = "options:" + optionName; |
|
|
|
|
|
|
|
if( $.localStorage.isSet(keyName) ) |
|
|
|
|
|
|
|
return $.localStorage.get(keyName); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
return defaultValue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setOption = function(optionName, value) { |
|
|
|
|
|
|
|
var keyName = "options:" + optionName; |
|
|
|
|
|
|
|
$.localStorage.set(keyName, value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.soundNotifOptions = function() { |
|
|
|
|
|
|
|
$('#notifyForm select').each(function() { |
|
|
|
|
|
|
|
this.value = $.Options.getOption(this.id, 'false'); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
var player = $('#player'); |
|
|
|
name: 'TopTrends', |
|
|
|
player[0].pause(); |
|
|
|
valDefault: 'enable', |
|
|
|
$('#player').empty(); |
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#TopTrendsCont').css('display', (elem.value === 'enable') ? 'block' : 'none'); |
|
|
|
$('form#notifyForm').on('change', 'select', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(this.value == false) {player[0].pause(); return;} |
|
|
|
|
|
|
|
if (player[0].canPlayType('audio/mpeg;')) { |
|
|
|
|
|
|
|
player.attr('type', 'audio/mpeg'); |
|
|
|
|
|
|
|
player.attr('src', 'sound/'+this.value+'.mp3'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
player.attr('type', 'audio/ogg'); |
|
|
|
|
|
|
|
player.attr('src', 'sound/'+this.value+'.ogg'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
player[0].play(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'TopTrendsAutoUpdate', |
|
|
|
|
|
|
|
valDefault: 'enable', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#TopTrendsAutoUpdateOpt').css('display', (elem.value === 'enable') ? 'inline' : 'none'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.volumeControl = function() { |
|
|
|
|
|
|
|
var playerVol = $('#playerVol'); |
|
|
|
|
|
|
|
playerVol[0].value = this.getOption(playerVol[0].id, 1); |
|
|
|
|
|
|
|
$('.volValue').text((playerVol[0].value * 100).toFixed()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
playerVol.on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
$('#player')[0].volume = (this.value); |
|
|
|
|
|
|
|
$('.volValue').text((this.value * 100).toFixed()); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'TopTrendsAutoUpdateTimer', |
|
|
|
this.DMsNotif = function() { |
|
|
|
type: 'numeric', |
|
|
|
var sndDM = this.getOption('sndDM', 'false'); |
|
|
|
valDefault: '120', |
|
|
|
if ( sndDM === 'false') return; |
|
|
|
valMes: 'second(s)', |
|
|
|
var player = $('#player'); |
|
|
|
getMethod: function (val) {return parseInt(val);} |
|
|
|
$('#player').empty(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (player[0].canPlayType('audio/mpeg;')) { |
|
|
|
|
|
|
|
player.attr('type', 'audio/mpeg'); |
|
|
|
|
|
|
|
player.attr('src', 'sound/'+sndDM+'.mp3'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
player.attr('type', 'audio/ogg'); |
|
|
|
|
|
|
|
player.attr('src', 'sound/'+sndDM+'.ogg'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
player[0].volume = this.getOption('playerVol',1); |
|
|
|
|
|
|
|
player[0].play(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.mensNotif = function() { |
|
|
|
|
|
|
|
var sndMention = this.getOption('sndMention', 'false'); |
|
|
|
|
|
|
|
if (sndMention === 'false') return; |
|
|
|
|
|
|
|
var player = $('#playerSec'); |
|
|
|
|
|
|
|
$('#playerSec').empty(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (player[0].canPlayType('audio/mpeg;')) { |
|
|
|
|
|
|
|
player.attr('type', 'audio/mpeg'); |
|
|
|
|
|
|
|
player.attr('src', 'sound/'+sndMention+'.mp3'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
player.attr('type', 'audio/ogg'); |
|
|
|
|
|
|
|
player.attr('src', 'sound/'+sndMention+'.ogg'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
player[0].volume = this.getOption('playerVol',1); |
|
|
|
|
|
|
|
player[0].play(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getShowDesktopNotifPostsOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('showDesktopNotifPosts', 'enable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setShowDesktopNotifPostsOpt = function () { |
|
|
|
|
|
|
|
function showDesktopNotifPostsDesc() { |
|
|
|
|
|
|
|
if ($.Options.getShowDesktopNotifPostsOpt() === 'enable') |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsDesc').css('display', 'inline'); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsDesc').css('display', 'none'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$('#showDesktopNotifPosts').val( this.getShowDesktopNotifPostsOpt() ); |
|
|
|
|
|
|
|
showDesktopNotifPostsDesc(); |
|
|
|
|
|
|
|
$('#showDesktopNotifPosts').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
showDesktopNotifPostsDesc(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'WhoToFollow', |
|
|
|
this.getShowDesktopNotifPostsTimerOpt = function () { |
|
|
|
valDefault: 'enable' |
|
|
|
return parseInt(this.getOption('showDesktopNotifPostsTimer', '6')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setShowDesktopNotifPostsTimerOpt = function () { |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsTimer').val( this.getShowDesktopNotifPostsTimerOpt().toString() ); |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('second(s)')); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getShowDesktopNotifPostsModalOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('showDesktopNotifPostsModal', 'enable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setShowDesktopNotifPostsModalOpt = function () { |
|
|
|
|
|
|
|
function showDesktopNotifPostsModalDesc() { |
|
|
|
|
|
|
|
if ($.Options.getShowDesktopNotifPostsModalOpt() === 'enable') |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsModalDesc').css('display', 'inline'); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsModalDesc').css('display', 'none'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsModal').val( this.getShowDesktopNotifPostsModalOpt() ); |
|
|
|
|
|
|
|
showDesktopNotifPostsModalDesc(); |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsModal').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
showDesktopNotifPostsModalDesc(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'TwistdayReminder', |
|
|
|
|
|
|
|
valDefault: 'enable', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#TwistdayReminderCont').css('display', (elem.value === 'enable') ? 'block' : 'none'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getShowDesktopNotifPostsModalTimerOpt = function () { |
|
|
|
|
|
|
|
return parseInt(this.getOption('showDesktopNotifPostsModalTimer', '6')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setShowDesktopNotifPostsModalTimerOpt = function () { |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsModalTimer').val( this.getShowDesktopNotifPostsModalTimerOpt().toString() ); |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsModalTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('second(s)')); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getShowDesktopNotifMentionsOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('showDesktopNotifMentions', 'enable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setShowDesktopNotifMentionsOpt = function () { |
|
|
|
|
|
|
|
function showDesktopNotifMentionsDesc() { |
|
|
|
|
|
|
|
if ($.Options.getShowDesktopNotifMentionsOpt() === 'enable') |
|
|
|
|
|
|
|
$('#showDesktopNotifMentionsDesc').css('display', 'inline'); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#showDesktopNotifMentionsDesc').css('display', 'none'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$('#showDesktopNotifMentions').val( this.getShowDesktopNotifMentionsOpt() ); |
|
|
|
|
|
|
|
showDesktopNotifMentionsDesc(); |
|
|
|
|
|
|
|
$('#showDesktopNotifMentions').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
showDesktopNotifMentionsDesc(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'TwistdayReminderAutoUpdate', |
|
|
|
|
|
|
|
valDefault: 'enable', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#TwistdayReminderAutoUpdateOpt').css('display', (elem.value === 'enable') ? 'inline' : 'none'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getShowDesktopNotifMentionsTimerOpt = function () { |
|
|
|
|
|
|
|
return parseInt(this.getOption('showDesktopNotifMentionsTimer', '60')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setShowDesktopNotifMentionsTimerOpt = function () { |
|
|
|
|
|
|
|
$('#showDesktopNotifMentionsTimer').val( this.getShowDesktopNotifMentionsTimerOpt().toString() ); |
|
|
|
|
|
|
|
$('#showDesktopNotifMentionsTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getShowDesktopNotifDMsOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('showDesktopNotifDMs', 'enable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setShowDesktopNotifDMsOpt = function () { |
|
|
|
|
|
|
|
function showDesktopNotifDMsDesc() { |
|
|
|
|
|
|
|
if ($.Options.getShowDesktopNotifDMsOpt() === 'enable') |
|
|
|
|
|
|
|
$('#showDesktopNotifDMsDesc').css('display', 'inline'); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#showDesktopNotifDMsDesc').css('display', 'none'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$('#showDesktopNotifDMs').val( this.getShowDesktopNotifDMsOpt() ); |
|
|
|
|
|
|
|
showDesktopNotifDMsDesc(); |
|
|
|
|
|
|
|
$('#showDesktopNotifDMs').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
showDesktopNotifDMsDesc(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'TwistdayReminderAutoUpdateTimer', |
|
|
|
this.getShowDesktopNotifDMsTimerOpt = function () { |
|
|
|
type: 'numeric', |
|
|
|
return parseInt(this.getOption('showDesktopNotifDMsTimer', '60')); |
|
|
|
valDefault: '3600', |
|
|
|
} |
|
|
|
valMes: 'second(s)', |
|
|
|
|
|
|
|
getMethod: function (val) {return parseInt(val);} |
|
|
|
this.setShowDesktopNotifDMsTimerOpt = function () { |
|
|
|
|
|
|
|
$('#showDesktopNotifDMsTimer').val( this.getShowDesktopNotifDMsTimerOpt().toString() ); |
|
|
|
|
|
|
|
$('#showDesktopNotifDMsTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('second(s)')); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setTestDesktopNotif = function() { |
|
|
|
|
|
|
|
$('#testDesktopNotif').on('click', function() { |
|
|
|
|
|
|
|
$.MAL.showDesktopNotif(false, polyglot.t('notify_desktop_test'), false,'twister_notification_test', false, false, function() { alert(polyglot.t('notify_desktop_perm_denied', {'this_domain': document.domain})) }) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.keysSendDefault = 'ctrlenter'; |
|
|
|
|
|
|
|
this.keysSend = function() { |
|
|
|
|
|
|
|
$('#keysOpt select').val( this.getOption('keysSend',this.keysSendDefault) ); |
|
|
|
|
|
|
|
$('#keysOpt select').on('change', function() { $.Options.setOption(this.id, this.value); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.keyEnterToSend = function() { |
|
|
|
|
|
|
|
return this.getOption('keysSend', this.keysSendDefault) === 'enter'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setLang = function() { |
|
|
|
|
|
|
|
$('#language').val( this.getOption('locLang', 'auto') ); |
|
|
|
|
|
|
|
$('#language').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption('locLang', $(this).val()); |
|
|
|
|
|
|
|
if($(this).val() != 'auto') { |
|
|
|
|
|
|
|
twisterRpc("setpreferredspamlang", [$(this).val()]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
location.reload(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getTheme = function() { |
|
|
|
|
|
|
|
return this.getOption('theme', 'original'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setTheme = function() { |
|
|
|
|
|
|
|
$('#theme').val( this.getTheme() ) |
|
|
|
|
|
|
|
$('#theme').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption('theme', $(this).val()); |
|
|
|
|
|
|
|
location.reload(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'TwistdayReminderShowUpcoming', |
|
|
|
|
|
|
|
valDefault: 'enable', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#TwistdayReminderShowUpcomingOpt').css('display', (elem.value === 'enable') ? 'inline' : 'none'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getLineFeedsOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('displayLineFeeds', 'disable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setLineFeedsOpt = function() { |
|
|
|
|
|
|
|
$('#lineFeedsOpt select').val( this.getLineFeedsOpt() ); |
|
|
|
|
|
|
|
$('#lineFeedsOpt select').on('change', function() { $.Options.setOption(this.id, this.value); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getShowPreviewOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('displayPreview', 'disable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setShowPreviewOpt = function () { |
|
|
|
|
|
|
|
$('#showPreviewOpt select').val( this.getShowPreviewOpt() ); |
|
|
|
|
|
|
|
$('#showPreviewOpt select').on('change', function() { $.Options.setOption(this.id, this.value); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getUnicodeConversionOpt = function () { |
|
|
|
|
|
|
|
return this.getOption('unicodeConversion', 'disable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setUnicodeConversionOpt = function () { |
|
|
|
|
|
|
|
$('#unicodeConversion').val( this.getUnicodeConversionOpt() ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.getUnicodeConversionOpt() === 'custom') |
|
|
|
|
|
|
|
$('#unicodeConversionOpt .suboptions').css('height', 'auto'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#unicodeConversion').on('change', function () { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
if (this.value === 'custom') |
|
|
|
|
|
|
|
$('#unicodeConversionOpt .suboptions').css('height', 'auto'); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#unicodeConversionOpt .suboptions').css('height', '0px'); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'TwistdayReminderShowUpcomingTimer', |
|
|
|
this.getConvertPunctuationsOpt = function() { |
|
|
|
type: 'numeric', |
|
|
|
return this.getOption('convertPunctuationsOpt', false); |
|
|
|
valDefault: '72', |
|
|
|
} |
|
|
|
valMes: 'hour(s)', |
|
|
|
|
|
|
|
getMethod: function (val) {return parseInt(val);} |
|
|
|
this.setConvertPunctuationsOpt = function () { |
|
|
|
|
|
|
|
$('#convertPunctuationsOpt').prop('checked', this.getConvertPunctuationsOpt()); |
|
|
|
|
|
|
|
$('#convertPunctuationsOpt').on('change', function() { $.Options.setOption(this.id, this.checked); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getConvertEmotionsOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('convertEmotionsOpt', false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setConvertEmotionsOpt = function () { |
|
|
|
|
|
|
|
$('#convertEmotionsOpt').prop('checked', this.getConvertEmotionsOpt()); |
|
|
|
|
|
|
|
$('#convertEmotionsOpt').on('change', function() { $.Options.setOption(this.id, this.checked); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getConvertSignsOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('convertSignsOpt', false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setConvertSignsOpt = function () { |
|
|
|
|
|
|
|
$('#convertSignsOpt').prop('checked', this.getConvertSignsOpt()); |
|
|
|
|
|
|
|
$('#convertSignsOpt').on('change', function() { $.Options.setOption(this.id, this.checked); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getConvertFractionsOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('convertFractionsOpt', false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setConvertFractionsOpt = function () { |
|
|
|
|
|
|
|
$('#convertFractionsOpt').prop('checked', this.getConvertFractionsOpt()); |
|
|
|
|
|
|
|
$('#convertFractionsOpt').on('change', function() { $.Options.setOption(this.id, this.checked); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getUseProxyOpt = function () { |
|
|
|
|
|
|
|
return this.getOption('useProxy', 'disable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setUseProxyOpt = function () { |
|
|
|
|
|
|
|
$('#useProxy').val( this.getUseProxyOpt() ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.getUseProxyOpt() === 'disable') |
|
|
|
|
|
|
|
$('#useProxyForImgOnly').attr('disabled', 'disabled'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#useProxy').on('change', function () { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
if (this.value === 'disable') |
|
|
|
|
|
|
|
$('#useProxyForImgOnly').attr('disabled', 'disabled'); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#useProxyForImgOnly').removeAttr('disabled'); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'showDesktopNotifPosts', |
|
|
|
|
|
|
|
valDefault: 'enable', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsDesc').css('display', (elem.value === 'enable') ? 'inline' : 'none'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getUseProxyForImgOnlyOpt = function () { |
|
|
|
|
|
|
|
return this.getOption('useProxyForImgOnly', false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setUseProxyForImgOnlyOpt = function () { |
|
|
|
|
|
|
|
$('#useProxyForImgOnly').prop('checked', this.getUseProxyForImgOnlyOpt()); |
|
|
|
|
|
|
|
$('#useProxyForImgOnly').on('change', function () { $.Options.setOption(this.id, this.checked); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getTopTrendsOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('TopTrends', 'enable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setTopTrendsOpt = function () { |
|
|
|
|
|
|
|
function TopTrendsCfg() { |
|
|
|
|
|
|
|
if ($.Options.getTopTrendsOpt() === 'enable') |
|
|
|
|
|
|
|
$('#TopTrendsCont').show(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#TopTrendsCont').hide(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$('#TopTrends').val( this.getTopTrendsOpt() ); |
|
|
|
|
|
|
|
TopTrendsCfg(); |
|
|
|
|
|
|
|
$('#TopTrends').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
TopTrendsCfg(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'showDesktopNotifPostsTimer', |
|
|
|
this.getTopTrendsAutoUpdateOpt = function() { |
|
|
|
type: 'numeric', |
|
|
|
return this.getOption('TopTrendsAutoUpdate', 'enable'); |
|
|
|
valDefault: '6', |
|
|
|
} |
|
|
|
valMes: 'second(s)', |
|
|
|
|
|
|
|
getMethod: function (val) {return parseInt(val);} |
|
|
|
this.setTopTrendsAutoUpdateOpt = function () { |
|
|
|
|
|
|
|
function TopTrendsAutoUpdateCfg() { |
|
|
|
|
|
|
|
if ($.Options.getTopTrendsAutoUpdateOpt() === 'enable') |
|
|
|
|
|
|
|
$('#TopTrendsAutoUpdateOpt').css('display', 'inline'); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#TopTrendsAutoUpdateOpt').css('display', 'none'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$('#TopTrendsAutoUpdate').val( this.getTopTrendsAutoUpdateOpt() ); |
|
|
|
|
|
|
|
TopTrendsAutoUpdateCfg(); |
|
|
|
|
|
|
|
$('#TopTrendsAutoUpdate').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
TopTrendsAutoUpdateCfg(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'showDesktopNotifPostsModal', |
|
|
|
|
|
|
|
valDefault: 'enable', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#showDesktopNotifPostsModalDesc').css('display', (elem.value === 'enable') ? 'inline' : 'none'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getTopTrendsAutoUpdateTimerOpt = function () { |
|
|
|
|
|
|
|
return parseInt(this.getOption('TopTrendsAutoUpdateTimer', '120')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setTopTrendsAutoUpdateTimerOpt = function () { |
|
|
|
|
|
|
|
$('#TopTrendsAutoUpdateTimer').val( this.getTopTrendsAutoUpdateTimerOpt().toString() ); |
|
|
|
|
|
|
|
$('#TopTrendsAutoUpdateTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('second(s)')); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getTwistdayReminderOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('TwistdayReminder', 'enable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setTwistdayReminderOpt = function () { |
|
|
|
|
|
|
|
function TwistdayReminderCfg() { |
|
|
|
|
|
|
|
if ($.Options.getTwistdayReminderOpt() === 'enable') |
|
|
|
|
|
|
|
$('#TwistdayReminderCont').show(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#TwistdayReminderCont').hide(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$('#TwistdayReminder').val( this.getTwistdayReminderOpt() ); |
|
|
|
|
|
|
|
TwistdayReminderCfg(); |
|
|
|
|
|
|
|
$('#TwistdayReminder').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
TwistdayReminderCfg(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'showDesktopNotifPostsModalTimer', |
|
|
|
this.getTwistdayReminderAutoUpdateOpt = function() { |
|
|
|
type: 'numeric', |
|
|
|
return this.getOption('TwistdayReminderAutoUpdate', 'enable'); |
|
|
|
valDefault: '6', |
|
|
|
} |
|
|
|
valMes: 'second(s)', |
|
|
|
|
|
|
|
getMethod: function (val) {return parseInt(val);} |
|
|
|
this.setTwistdayReminderAutoUpdateOpt = function () { |
|
|
|
|
|
|
|
function TwistdayReminderAutoUpdateCfg() { |
|
|
|
|
|
|
|
if ($.Options.getTwistdayReminderAutoUpdateOpt() === 'enable') |
|
|
|
|
|
|
|
$('#TwistdayReminderAutoUpdateOpt').css('display', 'inline'); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#TwistdayReminderAutoUpdateOpt').css('display', 'none'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$('#TwistdayReminderAutoUpdate').val( this.getTwistdayReminderAutoUpdateOpt() ); |
|
|
|
|
|
|
|
TwistdayReminderAutoUpdateCfg(); |
|
|
|
|
|
|
|
$('#TwistdayReminderAutoUpdate').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
TwistdayReminderAutoUpdateCfg(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'showDesktopNotifMentions', |
|
|
|
|
|
|
|
valDefault: 'enable', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#showDesktopNotifMentionsDesc').css('display', (elem.value === 'enable') ? 'inline' : 'none'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
this.getTwistdayReminderAutoUpdateTimerOpt = function () { |
|
|
|
this.add({ |
|
|
|
return parseInt(this.getOption('TwistdayReminderAutoUpdateTimer', '3600')); |
|
|
|
name: 'showDesktopNotifMentionsTimer', |
|
|
|
} |
|
|
|
type: 'numeric', |
|
|
|
|
|
|
|
valDefault: '60', |
|
|
|
this.setTwistdayReminderAutoUpdateTimerOpt = function () { |
|
|
|
valMes: 'second(s)', |
|
|
|
$('#TwistdayReminderAutoUpdateTimer').val( this.getTwistdayReminderAutoUpdateTimerOpt().toString() ); |
|
|
|
getMethod: function (val) {return parseInt(val);} |
|
|
|
$('#TwistdayReminderAutoUpdateTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('second(s)')); }); |
|
|
|
}); |
|
|
|
} |
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'showDesktopNotifDMs', |
|
|
|
this.getTwistdayReminderShowUpcomingOpt = function() { |
|
|
|
valDefault: 'enable', |
|
|
|
return this.getOption('TwistdayReminderShowUpcoming', 'enable'); |
|
|
|
tickMethod: function (elem) { |
|
|
|
} |
|
|
|
$('#showDesktopNotifDMsDesc').css('display', (elem.value === 'enable') ? 'inline' : 'none'); |
|
|
|
|
|
|
|
|
|
|
|
this.setTwistdayReminderShowUpcomingOpt = function () { |
|
|
|
|
|
|
|
function TwistdayReminderShowUpcomingCfg() { |
|
|
|
|
|
|
|
if ($.Options.getTwistdayReminderShowUpcomingOpt() === 'enable') |
|
|
|
|
|
|
|
$('#TwistdayReminderShowUpcomingOpt').css('display', 'inline'); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#TwistdayReminderShowUpcomingOpt').css('display', 'none'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
$('#TwistdayReminderShowUpcoming').val( this.getTwistdayReminderShowUpcomingOpt() ); |
|
|
|
|
|
|
|
TwistdayReminderShowUpcomingCfg(); |
|
|
|
|
|
|
|
$('#TwistdayReminderShowUpcoming').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
TwistdayReminderShowUpcomingCfg(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'showDesktopNotifDMsTimer', |
|
|
|
|
|
|
|
type: 'numeric', |
|
|
|
|
|
|
|
valDefault: '60', |
|
|
|
|
|
|
|
valMes: 'second(s)', |
|
|
|
|
|
|
|
getMethod: function (val) {return parseInt(val);} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'displayLineFeeds', |
|
|
|
|
|
|
|
valDefault: 'enable' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'displayPreview', |
|
|
|
|
|
|
|
valDefault: 'disable' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'unicodeConversion', |
|
|
|
|
|
|
|
valDefault: 'disable', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#unicodeConversionOpt .suboptions').css('height', (elem.value === 'custom') ? 'auto' : '0'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
this.getTwistdayReminderShowUpcomingTimerOpt = function () { |
|
|
|
this.add({ |
|
|
|
return parseInt(this.getOption('TwistdayReminderShowUpcomingTimer', '72')); |
|
|
|
name: 'convertPunctuationsOpt', |
|
|
|
|
|
|
|
type: 'checkbox', |
|
|
|
|
|
|
|
valDefault: false |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'convertEmotionsOpt', |
|
|
|
|
|
|
|
type: 'checkbox', |
|
|
|
|
|
|
|
valDefault: false |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'convertSignsOpt', |
|
|
|
|
|
|
|
type: 'checkbox', |
|
|
|
|
|
|
|
valDefault: false |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'convertFractionsOpt', |
|
|
|
|
|
|
|
type: 'checkbox', |
|
|
|
|
|
|
|
valDefault: false |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'useProxy', |
|
|
|
|
|
|
|
valDefault: 'disable', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#useProxyForImgOnly').attr('disabled', (elem.value === 'disable') ? true : false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
this.setTwistdayReminderShowUpcomingTimerOpt = function () { |
|
|
|
this.add({ |
|
|
|
$('#TwistdayReminderShowUpcomingTimer').val( this.getTwistdayReminderShowUpcomingTimerOpt().toString() ); |
|
|
|
name: 'useProxyForImgOnly', |
|
|
|
$('#TwistdayReminderShowUpcomingTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('hour(s)')); }); |
|
|
|
type: 'checkbox', |
|
|
|
|
|
|
|
valDefault: false |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'splitPosts', |
|
|
|
|
|
|
|
valDefault: 'disable' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'isFollowingMe', |
|
|
|
|
|
|
|
valDefault: 'in-profile' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'dmCopySelf', |
|
|
|
|
|
|
|
valDefault: 'enable' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'hideReplies', |
|
|
|
|
|
|
|
valDefault: 'following' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'hideCloseRTs', |
|
|
|
|
|
|
|
valDefault: 'disable', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#hideCloseRTsDesc').css('display', (elem.value === 'show-if') ? 'inline' : 'none'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
this.getWhoToFollowOpt = function() { |
|
|
|
this.add({ |
|
|
|
return this.getOption('WhoToFollow', 'enable'); |
|
|
|
name: 'hideCloseRtsHour', |
|
|
|
|
|
|
|
type: 'numeric', |
|
|
|
|
|
|
|
valDefault: '1', |
|
|
|
|
|
|
|
valMes: 'hour(s)', |
|
|
|
|
|
|
|
getMethod: function (val) {return parseInt(val);} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'filterLang', |
|
|
|
|
|
|
|
valDefault: 'disable', |
|
|
|
|
|
|
|
tickMethod: function (elem) { |
|
|
|
|
|
|
|
$('#filterLangListCont').css('display', (elem.value === 'disable') ? 'none' : 'block'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
this.setWhoToFollowOpt = function () { |
|
|
|
this.add({ |
|
|
|
$('#WhoToFollow').val(this.getWhoToFollowOpt()); |
|
|
|
name: 'filterLangList', |
|
|
|
$('#WhoToFollow').on('change', function() { $.Options.setOption(this.id, this.value); }); |
|
|
|
valDefault: '', |
|
|
|
|
|
|
|
getMethod: function (val) {return val.split(/\s*,\s*/);} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'filterLangAccuracy', |
|
|
|
|
|
|
|
valDefault: '0.82', |
|
|
|
|
|
|
|
getMethod: function (val) {return parseFloat(val);}, |
|
|
|
|
|
|
|
tickMethod: function (elem) {$('#filterLangAccuracyVal').text(elem.value);} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'filterLangForPostboard', |
|
|
|
|
|
|
|
type: 'checkbox', |
|
|
|
|
|
|
|
valDefault: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'filterLangForSearching', |
|
|
|
|
|
|
|
type: 'checkbox', |
|
|
|
|
|
|
|
valDefault: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'filterLangForTopTrends', |
|
|
|
|
|
|
|
type: 'checkbox', |
|
|
|
|
|
|
|
valDefault: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'filterLangSimulate', |
|
|
|
|
|
|
|
type: 'checkbox', |
|
|
|
|
|
|
|
valDefault: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'keysSend', |
|
|
|
|
|
|
|
valDefault: 'ctrlenter' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'sndMention', |
|
|
|
|
|
|
|
valDefault: 'false', |
|
|
|
|
|
|
|
tickMethod: function () {$.MAL.soundNotifyMentions();}, // FIXME it's wrapped because $.MAL may be not loaded yet; $.MAL methods should be static
|
|
|
|
|
|
|
|
tickNotOnInit: 1 |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'sndDM', |
|
|
|
|
|
|
|
valDefault: 'false', |
|
|
|
|
|
|
|
tickMethod: function () {$.MAL.soundNotifyDM();}, // FIXME it's wrapped because $.MAL may be not loaded yet; $.MAL methods should be static
|
|
|
|
|
|
|
|
tickNotOnInit: 1 |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.add({ |
|
|
|
|
|
|
|
name: 'playerVol', |
|
|
|
|
|
|
|
valDefault: 1, |
|
|
|
|
|
|
|
getMethod: function (val) {return parseFloat(val);}, |
|
|
|
|
|
|
|
tickMethod: function (elem) {$('.volValue').text((elem.value * 100).toFixed());} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getSplitPostsOpt = function () { |
|
|
|
twisterOptions.prototype.add = function (option) { |
|
|
|
return this.getOption('splitPosts', 'disable'); |
|
|
|
if (option.name && !this[option.name]) |
|
|
|
} |
|
|
|
this[option.name] = new twisterOption(option); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.setSplitPostsOpt = function () { |
|
|
|
twisterOptions.prototype.initControls = function () { |
|
|
|
$('#splitPosts').val( this.getSplitPostsOpt() ); |
|
|
|
for (var option in this) { |
|
|
|
$('#splitPosts').on('change', function () { $.Options.setOption(this.id, this.value); }); |
|
|
|
if (typeof this[option] === 'object') { |
|
|
|
|
|
|
|
var elem = $(this[option].option.selector); |
|
|
|
|
|
|
|
if (elem.length) { |
|
|
|
|
|
|
|
if (elem.attr('type') && elem.attr('type').toLowerCase() === 'checkbox') |
|
|
|
|
|
|
|
elem.prop('checked', /^\s*1|true\s*$/i.test(this[option].val)) |
|
|
|
|
|
|
|
.on('change', (this[option].tick).bind(this[option])) |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
elem.val(this[option].val) |
|
|
|
|
|
|
|
.on((elem[0].tagName === 'SELECT') ? 'change' : 'input', (this[option].tick).bind(this[option])) |
|
|
|
|
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!this[option].option.tickNotOnInit && typeof this[option].option.tickMethod === 'function') |
|
|
|
this.getHideRepliesOpt = function () { |
|
|
|
this[option].option.tickMethod(elem[0]); |
|
|
|
return this.getOption('hideReplies', 'following'); |
|
|
|
} else |
|
|
|
|
|
|
|
console.warn('cannot find option \''+option+'\' controls, selector: '+this[option].option.selector); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.setHideRepliesOpt = function () { |
|
|
|
|
|
|
|
$('#hideReplies').val( this.getHideRepliesOpt() ); |
|
|
|
|
|
|
|
$('#hideReplies').on('change', function () { $.Options.setOption(this.id, this.value); }); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getHideCloseRTsOpt = function () { |
|
|
|
$('#testDesktopNotif').on('click', function() { |
|
|
|
return this.getOption('hideCloseRTs', 'disable'); |
|
|
|
$.MAL.showDesktopNotif(false, polyglot.t('notify_desktop_test'), false,'twister_notification_test', false, false, function() { alert(polyglot.t('notify_desktop_perm_denied', {'this_domain': document.domain})) }) |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setHideCloseRTsOpt = function () { |
|
|
|
|
|
|
|
function hideCloseRTsCfg() { |
|
|
|
|
|
|
|
if ($.Options.getHideCloseRTsOpt() === 'disable') |
|
|
|
|
|
|
|
$('#hideCloseRTsDesc').css('display', 'none'); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
$('#hideCloseRTsDesc').css('display', 'inline'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$('#hideCloseRTs').val( this.getHideCloseRTsOpt() ); |
|
|
|
|
|
|
|
hideCloseRTsCfg(); |
|
|
|
|
|
|
|
$('#hideCloseRTs').on('change', function () { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
hideCloseRTsCfg(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.getHideCloseRTsHourOpt = function () { |
|
|
|
function twisterOption(option) { |
|
|
|
return parseInt(this.getOption('hideCloseRtsHour', '1')); |
|
|
|
this.option = option; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setHideCloseRTsHourOpt = function () { |
|
|
|
|
|
|
|
$('#hideCloseRtsHour').val( this.getHideCloseRTsHourOpt().toString() ); |
|
|
|
|
|
|
|
$('#hideCloseRtsHour').on('keyup', function () { setElemValNumeric(this, polyglot.t('hour(s)')); }); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getFilterLangOpt = function() { |
|
|
|
|
|
|
|
return this.getOption('filterLang', 'disable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setFilterLangOpt = function () { |
|
|
|
if (!option.selector) |
|
|
|
function filterLangListCont() { |
|
|
|
this.option.selector = '#' + option.name; |
|
|
|
if ( $.Options.getFilterLangOpt() !== 'disable' ) |
|
|
|
if (option.valRaw) { |
|
|
|
$('#filterLangListCont').css('display', 'block'); |
|
|
|
this.set(option.valRaw); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
var keyName = 'options:' + option.name; |
|
|
|
|
|
|
|
if ($.localStorage.isSet(keyName)) |
|
|
|
|
|
|
|
this.option.valRaw = $.localStorage.get(keyName); |
|
|
|
else |
|
|
|
else |
|
|
|
$('#filterLangListCont').css('display', 'none'); |
|
|
|
this.option.valRaw = option.valDefault; |
|
|
|
} |
|
|
|
this.val = (this.option.getMethod) ? this.option.getMethod(this.option.valRaw) : this.option.valRaw; |
|
|
|
$('#filterLang').val( this.getFilterLangOpt() ); |
|
|
|
|
|
|
|
filterLangListCont(); |
|
|
|
|
|
|
|
$('#filterLang').on('change', function() { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
filterLangListCont(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getFilterLangListOpt = function () { |
|
|
|
|
|
|
|
return this.getOption('filterLangList', '').replace(/\s+/g, '').split(/\s*,\s*/); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setFilterLangListOpt = function () { |
|
|
|
|
|
|
|
$('#filterLangList').val( this.getFilterLangListOpt() ); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#filterLangList').on('keyup', function () { $.Options.setOption(this.id, this.value); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getFilterLangAccuracyOpt = function () { |
|
|
|
|
|
|
|
return parseFloat(this.getOption('filterLangAccuracy', '0.82')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setFilterLangAccuracyOpt = function () { |
|
|
|
|
|
|
|
$('#filterLangAccuracy').val( this.getFilterLangAccuracyOpt() ); |
|
|
|
|
|
|
|
$('#filterLangAccuracyVal').text( this.getFilterLangAccuracyOpt() ); |
|
|
|
|
|
|
|
$('#filterLangAccuracy').on('change', function () { |
|
|
|
|
|
|
|
$.Options.setOption(this.id, this.value); |
|
|
|
|
|
|
|
$('#filterLangAccuracyVal').text(this.value); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getFilterLangForPostboardOpt = function () { |
|
|
|
|
|
|
|
return this.getOption('filterLangForPostboard', true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setFilterLangForPostboardOpt = function () { |
|
|
|
|
|
|
|
$('#filterLangForPostboard').prop('checked', this.getFilterLangForPostboardOpt()); |
|
|
|
|
|
|
|
$('#filterLangForPostboard').on('click', function () { $.Options.setOption(this.id, this.checked); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getFilterLangForSearchingOpt = function () { |
|
|
|
|
|
|
|
return this.getOption('filterLangForSearching', true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setFilterLangForSearchingOpt = function () { |
|
|
|
|
|
|
|
$('#filterLangForSearching').prop('checked', this.getFilterLangForSearchingOpt()); |
|
|
|
|
|
|
|
$('#filterLangForSearching').on('click', function () { $.Options.setOption(this.id, this.checked); }); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getFilterLangForTopTrendsOpt = function () { |
|
|
|
|
|
|
|
return this.getOption('filterLangForTopTrends', true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setFilterLangForTopTrendsOpt = function () { |
|
|
|
|
|
|
|
$('#filterLangForTopTrends').prop('checked', this.getFilterLangForTopTrendsOpt()); |
|
|
|
|
|
|
|
$('#filterLangForTopTrends').on('click', function () { $.Options.setOption(this.id, this.checked); }); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.getFilterLangSimulateOpt = function () { |
|
|
|
twisterOption.prototype.val = undefined; |
|
|
|
return this.getOption('filterLangSimulate', true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setFilterLangSimulateOpt = function () { |
|
|
|
twisterOption.prototype.set = function (val) { |
|
|
|
$('#filterLangSimulate').prop('checked', this.getFilterLangSimulateOpt()); |
|
|
|
this.val = (this.option.getMethod) ? this.option.getMethod(val) : val; |
|
|
|
$('#filterLangSimulate').on('click', function () { $.Options.setOption(this.id, this.checked); }); |
|
|
|
this.option.valRaw = val; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getIsFollowingMeOpt = function () { |
|
|
|
$.localStorage.set('options:' + this.option.name, val); |
|
|
|
return this.getOption('isFollowingMe', 'in-profile'); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.setIsFollowingMeOpt = function () { |
|
|
|
twisterOption.prototype.tick = function (event) { |
|
|
|
$('#isFollowingMe').val( this.getIsFollowingMeOpt() ); |
|
|
|
if (this.option.type !== 'numeric' || checkForNumeric(event.target)) { |
|
|
|
$('#isFollowingMe').on('change', function () { $.Options.setOption(this.id, this.value); }); |
|
|
|
this.set((this.option.type === 'checkbox') ? event.target.checked : event.target.value); |
|
|
|
|
|
|
|
if (this.option.valMes) |
|
|
|
|
|
|
|
$(event.target).next('span').text(polyglot.t(this.option.valMes)); |
|
|
|
|
|
|
|
if (typeof this.option.tickMethod === 'function') |
|
|
|
|
|
|
|
this.option.tickMethod(event.target); |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
this.getDMCopySelfOpt = function() { |
|
|
|
jQuery.Options = new twisterOptions(); |
|
|
|
return this.getOption('dmCopySelf', 'enable'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setDMCopySelfOpt = function () { |
|
|
|
|
|
|
|
$('#dmCopySelfOpt select').val( this.getDMCopySelfOpt() ); |
|
|
|
|
|
|
|
$('#dmCopySelfOpt select').on('change', function() { $.Options.setOption(this.id, this.value); }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.InitOptions = function() { |
|
|
|
function checkForNumeric(elem) { |
|
|
|
this.soundNotifOptions(); |
|
|
|
if (/^\d+\.?\d*$/.test(elem.value) && parseFloat(elem.value) > 0) { |
|
|
|
this.volumeControl(); |
|
|
|
|
|
|
|
this.keysSend(); |
|
|
|
|
|
|
|
this.setLang(); |
|
|
|
|
|
|
|
this.setTheme(); |
|
|
|
|
|
|
|
this.setShowDesktopNotifPostsOpt(); |
|
|
|
|
|
|
|
this.setShowDesktopNotifPostsTimerOpt(); |
|
|
|
|
|
|
|
this.setShowDesktopNotifPostsModalOpt(); |
|
|
|
|
|
|
|
this.setShowDesktopNotifPostsModalTimerOpt(); |
|
|
|
|
|
|
|
this.setShowDesktopNotifMentionsOpt(); |
|
|
|
|
|
|
|
this.setShowDesktopNotifMentionsTimerOpt(); |
|
|
|
|
|
|
|
this.setShowDesktopNotifDMsOpt(); |
|
|
|
|
|
|
|
this.setShowDesktopNotifDMsTimerOpt(); |
|
|
|
|
|
|
|
this.setTestDesktopNotif(); |
|
|
|
|
|
|
|
this.setLineFeedsOpt(); |
|
|
|
|
|
|
|
this.setShowPreviewOpt(); |
|
|
|
|
|
|
|
this.setUnicodeConversionOpt(); |
|
|
|
|
|
|
|
this.setConvertPunctuationsOpt(); |
|
|
|
|
|
|
|
this.setConvertEmotionsOpt(); |
|
|
|
|
|
|
|
this.setConvertSignsOpt(); |
|
|
|
|
|
|
|
this.setConvertFractionsOpt(); |
|
|
|
|
|
|
|
this.setUseProxyOpt(); |
|
|
|
|
|
|
|
this.setUseProxyForImgOnlyOpt(); |
|
|
|
|
|
|
|
this.setTopTrendsOpt(); |
|
|
|
|
|
|
|
this.setTopTrendsAutoUpdateOpt(); |
|
|
|
|
|
|
|
this.setTopTrendsAutoUpdateTimerOpt(); |
|
|
|
|
|
|
|
this.setTwistdayReminderOpt(); |
|
|
|
|
|
|
|
this.setTwistdayReminderAutoUpdateOpt(); |
|
|
|
|
|
|
|
this.setTwistdayReminderAutoUpdateTimerOpt(); |
|
|
|
|
|
|
|
this.setTwistdayReminderShowUpcomingOpt(); |
|
|
|
|
|
|
|
this.setTwistdayReminderShowUpcomingTimerOpt(); |
|
|
|
|
|
|
|
this.setWhoToFollowOpt(); |
|
|
|
|
|
|
|
this.setSplitPostsOpt(); |
|
|
|
|
|
|
|
this.setHideRepliesOpt(); |
|
|
|
|
|
|
|
this.setHideCloseRTsHourOpt(); |
|
|
|
|
|
|
|
this.setHideCloseRTsOpt(); |
|
|
|
|
|
|
|
this.setFilterLangOpt(); |
|
|
|
|
|
|
|
this.setFilterLangListOpt(); |
|
|
|
|
|
|
|
this.setFilterLangAccuracyOpt(); |
|
|
|
|
|
|
|
this.setFilterLangForPostboardOpt(); |
|
|
|
|
|
|
|
this.setFilterLangForSearchingOpt(); |
|
|
|
|
|
|
|
this.setFilterLangForTopTrendsOpt(); |
|
|
|
|
|
|
|
this.setFilterLangSimulateOpt(); |
|
|
|
|
|
|
|
this.setIsFollowingMeOpt(); |
|
|
|
|
|
|
|
this.setDMCopySelfOpt(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setElemValNumeric(elem, mes) { |
|
|
|
|
|
|
|
//var elem = $(elem_nm);
|
|
|
|
|
|
|
|
if (/^\d+$/.test(elem.value) && parseFloat(elem.value) > 0) { |
|
|
|
|
|
|
|
elem.style.backgroundColor = ''; |
|
|
|
elem.style.backgroundColor = ''; |
|
|
|
$.Options.setOption(elem.id, elem.value); |
|
|
|
return true; |
|
|
|
$(elem).next('span').text(mes); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
elem.style.backgroundColor = '#f00'; |
|
|
|
elem.style.backgroundColor = '#f00'; |
|
|
|
$(elem).next('span').text(polyglot.t('only positive numbers!')); |
|
|
|
$(elem).next('span').text(polyglot.t('only positive numbers!')); |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jQuery.Options = new TwisterOptions; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function localizeLabels() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$("label[for=tab_language]").text(polyglot.t("Language")); |
|
|
|
|
|
|
|
$("label[for=t-2]").text(polyglot.t("Theme")); |
|
|
|
|
|
|
|
$("label[for=t-3]").text(polyglot.t("Notifications")); |
|
|
|
|
|
|
|
$("label[for=t-4]").text(polyglot.t("Keys")); |
|
|
|
|
|
|
|
$("label[for=t-5]").text(polyglot.t("Appearance")); |
|
|
|
|
|
|
|
$("label[for=t-6]").text(polyglot.t("Users")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(localizeLabels); |
|
|
|
|
|
|
|