Browse Source

Merge pull request #1 from miguelfreitas/master

update
master
Eugene Lifescale 10 years ago
parent
commit
6374da5da9
  1. 10
      css/style.css
  2. 49
      home.html
  3. 274
      js/interface_common.js
  4. 90
      js/interface_home.js
  5. 740
      js/interface_localization.js
  6. 82
      js/jQueryPlugins.js
  7. 359
      js/options.js
  8. 5
      js/twister_following.js
  9. 68
      js/twister_timeline.js
  10. 30
      licenses/caret.license
  11. 25
      licenses/franc.license
  12. 9
      licenses/notify.js.license
  13. 40
      options.html
  14. 5
      theme_calm/css/style.css
  15. 13
      theme_nin/css/style.css
  16. 10
      theme_nin/sass/style.sass

10
css/style.css

@ -785,6 +785,7 @@ textarea.splited-post { @@ -785,6 +785,7 @@ textarea.splited-post {
opacity: 1;
}
.refresh-toptrends,
.refresh-users,
.view-all-users
{
@ -794,8 +795,9 @@ textarea.splited-post { @@ -794,8 +795,9 @@ textarea.splited-post {
}
/***********************************
**********TOP TRENDS****************
************ TOP TRENDS ************
***********************************/
ol.toptrends-list {
margin: 0% 5% 5% 5%;
padding: 5px;
@ -803,9 +805,9 @@ ol.toptrends-list { @@ -803,9 +805,9 @@ ol.toptrends-list {
border-top: solid 1px rgba( 69, 71, 77, .1 );
}
.toptrends h3
{
margin: 5% 5% 2% 5%;
.toptrends h3 {
margin: 5% 0% 2% 5%;
display: inline;
}
/***********************************

49
home.html

@ -114,7 +114,7 @@ @@ -114,7 +114,7 @@
<!-- LADO ESQUERDO DE MÓDULOS INIT -->
<div class="dashboard left">
<!-- PROFILE MODULE INIT -->
<!-- PROFILE MODULE -->
<div class="module mini-profile">
<div class="mini-profile-info">
<!-- THEME NIN added sub-menu (mentions, messages and edit profile) -->
@ -151,29 +151,12 @@ @@ -151,29 +151,12 @@
</form>
</div>
</div>
<!-- PROFILE MODULE INIT -->
<!-- WHO TO FOLLOW MODULE INIT -->
<div class="module who-to-follow">
<h3>Who to Follow</h3>
<small>.</small>
<a class="refresh-users">Refresh</a>
<small>.</small>
<a class="view-all-users" href="#whotofollow">View All</a>
<ol class="follow-suggestions">
<!-- use "follow-suggestion-template" here -->
</ol>
</div>
<!-- WHO TO FOLLOW MODULE END -->
<!-- WHO TO FOLLOW MODULE -->
<div class="module who-to-follow"></div>
<!-- WHO TO FOLLOW MODULE INIT -->
<div class="module toptrends">
<h3><span>Top Trends</span></h3>
<ol class="toptrends-list">
<!-- use "follow-suggestion-template" here -->
</ol>
</div>
<!-- WHO TO FOLLOW MODULE END -->
<!-- TOP TRENDS MODULE -->
<div class="module toptrends"></div>
</div>
<!-- LADO ESQUERDO DE MÓDULOS END -->
@ -225,6 +208,28 @@ @@ -225,6 +208,28 @@
<!-- TEMPLATES INIT -->
<div id="templates" style="display:none;">
<!-- TEMPLATE DE WHO-TO-FOLLOW MODULE -->
<div id="who-to-follow-template">
<h3 class="label">Who to Follow</h3>
<small>.</small>
<a class="refresh-users">Refresh</a>
<small>.</small>
<a class="view-all-users" href="#whotofollow">View All</a>
<ol class="follow-suggestions">
<!-- use "follow-suggestion-template" here -->
</ol>
</div>
<!-- TEMPLATE DE TOP TRENDS MODULE -->
<div id="toptrends-template">
<h3 class="label">Top Trends</h3>
<small>.</small>
<a class="refresh-toptrends">Refresh</a>
<ol class="toptrends-list">
<!-- use "follow-suggestion-template" here -->
</ol>
</div>
<!-- TEMPLATE DE WHO-TO-FOLLOW SUGGESTION -->
<li id="follow-suggestion-template" class="twister-user">
<div class="">

274
js/interface_common.js

@ -292,7 +292,7 @@ function refreshWhoToFollow(e) { @@ -292,7 +292,7 @@ function refreshWhoToFollow(e) {
e.stopPropagation();
e.preventDefault();
$('.follow-suggestions').html('');
$('.module.who-to-follow .follow-suggestions').empty();
getRandomFollowSuggestion(processSuggestion);
getRandomFollowSuggestion(processSuggestion);
@ -729,10 +729,11 @@ var composeNewPost = function( e, postAreaNew ) @@ -729,10 +729,11 @@ var composeNewPost = function( e, postAreaNew )
}
var textArea = postAreaNew.find("textarea");
textArea.focus();
if( textArea.attr("data-reply-to") && !textArea.val().length ) {
textArea.val(textArea.attr("data-reply-to"));
}
if (!postAreaNew.find("textarea:focus").length)
postAreaNew.find("textarea:last").focus();
}
//Reduz Área do Novo post
@ -751,63 +752,76 @@ function checkPostForMentions(post, mentions, max) { @@ -751,63 +752,76 @@ function checkPostForMentions(post, mentions, max) {
var splitedPostsCount = 1;
var usePostSpliting = false;
function replyTextKeypress(e) {
function replyTextInput(e) {
e = e || event;
var $this = $( this );
var tweetForm = $this.parents("form");
if( tweetForm != undefined ) {
if ($.Options.getUnicodeConversionOpt() !== "disable")
$this.val(convert2Unicodes($this.val(), $this));
var c = 140 - $this.val().length;
if (usePostSpliting && !$this.parents('.directMessages').length) {
var $tas = tweetForm.find("textarea");
splitedPostsCount = $tas.length;
if ($this.hasClass('splited-post'))
$this.css('height', '28px');
var icurrentta = $tas.index(this); // current textarea $tas index
if (splitedPostsCount > 1)
var pml = getPostSplitingPML();
else
var pml = 140;
var cci = getPostSpittingCI(icurrentta);
var caretPos = $this.caret();
var reply_to = $this.attr('data-reply-to');
for (var i = 0; i < $tas.length; i++) {
var pml = 140 - (i+1).toString().length - splitedPostsCount.toString().length - 4;
//if mention exists, we shouldn't add it while posting.
if (typeof(reply_to) !== 'undefined' &&
!checkPostForMentions($tas[i].value, reply_to, pml - reply_to.length)) {
pml -= reply_to.length;
}
for (var i = 0; i < $tas.length; i++) {
if ($tas[i].value.length > pml) {
var endings = $tas[i].value.match(/ |,|;|\.|:|\/|\?|\!|\\|'|"|\n|\t/g);
var ci = $tas[i].value.lastIndexOf(endings[endings.length - 1]);
for (var j = endings.length - 2; j >= 0 && ci > pml; j--) {
ci = $tas[i].value.lastIndexOf(endings[j], ci - 1);
}
ci = (ci > pml ? pml : ci);
if (pml === 140)
pml = getPostSplitingPML();
var ci = getPostSpittingCI(i);
if (i < splitedPostsCount - 1) {
$tas[i + 1].value = $tas[i].value.substr(ci) + $tas[i + 1].value;
$tas[i].value = $tas[i].value.substr(0, ci);
if (caretPos > cci) {
caretPos -= ci;
icurrentta += 1;
cci = getPostSpittingCI(icurrentta);
var $targetta = $($tas[icurrentta]);
} else if (i === icurrentta)
$($tas[i]).caret(caretPos);
} else {
var $oldta = $($tas[i]);
if (typeof($.fn.textcomplete) === 'function') {
$oldta.textcomplete('destroy');
e.stopImmediatePropagation(); // something goes wrong in $.fn.textcomplete if we don't stop this immediately
}
var $newta = $($oldta).clone(true);
var cp = $oldta.val();
$oldta.val(cp.substr(0, ci));
$oldta.on("click", function(e) {
e.stopPropagation();
this.style.height = '80px';
});
$oldta.unbind("keyup");
$oldta.on("blur", replyTextKeypress);
$oldta.addClass('splited-post');
tweetForm.find(".textcomplete-wrapper").append($newta); // FIXME come find textcomplete-wrapper anywhere in code
$oldta.after($newta);
$newta.val(cp.substr(ci));
$newta.focus();
if ($newta[0].setSelectionRange)
$newta[0].setSelectionRange($newta.val().length, $newta.val().length);
else if ($newta[0].createTextRange)
$newta[0].createTextRange().moveEnd('character', $newta.val().length);
$oldta.val(cp.substr(0, ci));
$tas = tweetForm.find("textarea");
splitedPostsCount = $tas.length;
pml = getPostSplitingPML();
$oldta.on('focus', function() {
this.style.height = '80px';
});
$oldta.addClass('splited-post');
$oldta.on('focusout', function() {this.style.height = '28px';}); // FIXME move this to CSS
if (caretPos > cci) {
caretPos -= ci;
icurrentta += 1;
cci = getPostSpittingCI(icurrentta);
var $targetta = $newta;
$oldta[0].style.height = '28px'; // FIXME move this to CSS
} else if (i === icurrentta) {
$($tas[i]).caret(caretPos);
replyTextUpdateRemaining($tas[i]);
if (typeof($.fn.textcomplete) === 'function')
setTextcompleteOn($tas[i]);
}
}
} else if ($tas.length > 1 && $tas[i].value.length === 0) {
@ -819,34 +833,113 @@ function replyTextKeypress(e) { @@ -819,34 +833,113 @@ function replyTextKeypress(e) {
}
$tas = tweetForm.find("textarea");
splitedPostsCount = $tas.length;
if (splitedPostsCount > 1)
pml = getPostSplitingPML();
else
pml = 140;
caretPos = -1;
if (icurrentta >= i && icurrentta > 0) {
icurrentta -= 1;
cci = getPostSpittingCI(icurrentta);
}
var $targetta = $($tas[icurrentta]);
}
}
c = 140 - $tas[$tas.length - 1].value.length - (2 * splitedPostsCount.toString().length) - 4;
if (typeof(reply_to) !== 'undefined' &&
!checkPostForMentions($tas[$tas.length - 1].value, reply_to, 140 - c - reply_to.length))
c -= reply_to.length;
if (typeof($targetta) !== 'undefined' && $targetta[0] !== document.activeElement) {
$this = $targetta;
$this.focus();
$this.caret(caretPos);
}
}
var remainingCount = tweetForm.find(".post-area-remaining");
}
if( c < 0 )
remainingCount.addClass("warn");
else
remainingCount.removeClass("warn");
function getPostSplitingPML() {
var pml = 140 -(i+1).toString().length -splitedPostsCount.toString().length -4;
if (usePostSpliting && !$this.parents('.directMessages').length)
remainingCount.text(splitedPostsCount.toString() + ". post: " + c.toString());
else
remainingCount.text(c.toString());
// if mention exists, we shouldn't add it while posting.
if (typeof(reply_to) !== 'undefined' &&
!checkPostForMentions($tas[i].value, reply_to, pml -reply_to.length)) {
pml -= reply_to.length;
}
return pml;
}
function getPostSpittingCI(ita) {
var ci;
var endings = $tas[ita].value.match(/ |,|;|\.|:|\/|\?|\!|\\|'|"|\n|\t/g);
if (endings) {
ci = $tas[ita].value.lastIndexOf(endings[endings.length - 1]);
for (var j = endings.length - 2; j >= 0 && ci > pml; j--) {
ci = $tas[ita].value.lastIndexOf(endings[j], ci - 1);
}
}
if (!(ci > 0))
ci = pml;
return (ci > pml) ? pml : ci;
}
}
function replyTextUpdateRemaining(ta) {
if (ta === document.activeElement ) {
var $this = $(ta);
var tweetForm = $this.closest('form');
if( tweetForm != undefined ) {
var remainingCount = tweetForm.find(".post-area-remaining");
var c = replyTextCountRemaining(ta);
if (usePostSpliting && !$this.parents('.directMessages').length && splitedPostsCount > 1)
remainingCount.text((tweetForm.find("textarea").index(ta)+1).toString() +'/' +splitedPostsCount.toString() +": " +c.toString());
else
remainingCount.text(c.toString());
var tweetAction = tweetForm.find(".post-submit");
if( !tweetAction.length ) tweetAction = tweetForm.find(".dm-submit");
var disable = false;
$this.closest('form').find("textarea").each(function() {
if (replyTextCountRemaining(this) < 0) {
disable = true; // alternatively we could call replyTextInput()
return false;
}
});
if (!disable && c >= 0 && c < 140 && $this.val() != $this.attr("data-reply-to")) {
remainingCount.removeClass("warn");
$.MAL.enableButton(tweetAction);
} else {
if (disable)
remainingCount.addClass("warn");
$.MAL.disableButton(tweetAction);
}
}
}
}
function replyTextCountRemaining(ta) {
var $this = $(ta);
var c;
if (usePostSpliting && !$this.parents('.directMessages').length && splitedPostsCount > 1) {
c = 140 -ta.value.length -($this.closest('form').find("textarea").index(ta)+1).toString().length -splitedPostsCount.toString().length -4;
var reply_to = $this.attr('data-reply-to');
if (typeof(reply_to) !== 'undefined' &&
!checkPostForMentions(ta.value, reply_to, 140 -c -reply_to.length))
c -= reply_to.length;
} else
c = 140 - ta.value.length;
return c;
}
function replyTextKeySend(e) {
e = e || event;
var $this = $( this );
var tweetForm = $this.parents('form');
if( tweetForm != undefined ) {
var tweetAction = tweetForm.find(".post-submit");
if( !tweetAction.length ) tweetAction = tweetForm.find(".dm-submit");
if( c >= 0 && c < 140 &&
$this.val() != $this.attr("data-reply-to") ) {
$.MAL.enableButton(tweetAction);
} else {
$.MAL.disableButton(tweetAction);
}
if( $.Options.keyEnterToSend() && $('.dropdown-menu').css('display') == 'none'){
if (e.keyCode === 13 && (!e.metaKey && !e.ctrlKey)) {
@ -1445,19 +1538,20 @@ function replaceDashboards() { @@ -1445,19 +1538,20 @@ function replaceDashboards() {
if ($(window).width() >= 1200 && !$('.wrapper').hasClass('w1200')) {
$('.wrapper').addClass('w1200');
$('.userMenu').addClass('w1200');
var wf = $('.module.who-to-follow');
wf.detach();
wf.appendTo($('.dashboard.right'));
var wtf = $('.module.who-to-follow');
if (wtf.length > 0) {
wtf.detach();
wtf.appendTo($('.dashboard.right'));
}
} else if ($(window).width() < 1200 && $('.wrapper').hasClass('w1200')) {
$('.wrapper').removeClass('w1200');
$('.userMenu').removeClass('w1200');
var wf = $('.module.who-to-follow');
wf.detach();
$('.module.mini-profile').after(wf);
var wtf = $('.module.who-to-follow');
if (wtf.length > 0) {
wtf.detach();
$('.module.mini-profile').after(wtf);
}
}
$( ".who-to-follow .refresh-users" ).bind( "click", refreshWhoToFollow );
//$( ".who-to-follow .view-all-users" ).bind( "click", function(){window.location.hash = "#whotofollow"} );
}
function initInterfaceCommon() {
@ -1508,7 +1602,9 @@ function initInterfaceCommon() { @@ -1508,7 +1602,9 @@ function initInterfaceCommon() {
$( ".undo-unicode" ).click( undoLastUnicode );
var $replyText = $( ".post-area-new textarea" );
$replyText.on("keyup", replyTextKeypress );
$replyText.on('input', replyTextInput); // input event fires in modern browsers (IE9+) on any changes in textarea (and copypasting with mouse too)
$replyText.on('input focus', function() {replyTextUpdateRemaining(this);});
$replyText.on('keyup', replyTextKeySend);
$( ".open-profile-modal").bind( "click", function(e){ e.stopPropagation(); } );
//$( ".open-hashtag-modal").bind( "click", openHashtagModal );
@ -1519,6 +1615,11 @@ function initInterfaceCommon() { @@ -1519,6 +1615,11 @@ function initInterfaceCommon() {
replaceDashboards();
$( window ).resize(replaceDashboards);
if ($.Options.getWhoToFollowOpt() === 'enable')
initWhoToFollow();
else
killWhoToFollow();
$('.tox-ctc').on('click', function(){
window.prompt(polyglot.t('copy_to_clipboard'), $(this).attr('data'))
});
@ -1528,25 +1629,42 @@ function initInterfaceCommon() { @@ -1528,25 +1629,42 @@ function initInterfaceCommon() {
if (typeof($.fn.textcomplete) === 'function') {
$('textarea')
.on('focus', function () {
var element = this;
// Cursor has not set yet. And wait 100ms to skip global click event.
setTimeout(function () {
// Cursor is ready.
$(element).textcomplete(getMentionsForAutoComplete(), {
'appendTo': ($(element).parents('.dashboard').length > 0) ? $(element).parent() : $('body'),
'listPosition': setTextcompleteDropdownListPos
});
}, 100);
})
.on('focusout', function () {
$(this).textcomplete('destroy');
})
.on('focus', function () { setTextcompleteOn(this); })
.on('focusout', function () { $(this).textcomplete('destroy'); })
;
}
}
function initWhoToFollow() {
var wtf = $('.module.who-to-follow');
if (wtf.length) {
wtf.html($('#who-to-follow-template').html()).show();
var wtfRefresh = wtf.find('.refresh-users');
wtfRefresh.on('click', refreshWhoToFollow);
setTimeout(function() { wtfRefresh.click() }, 100);
//wtf.find('.view-all-users').on('click', function() { window.location.hash = '#whotofollow'; });
}
}
function killWhoToFollow() {
var wtf = $('.module.who-to-follow');
if (wtf.length)
wtf.empty().hide();
}
function setTextcompleteOn(element) {
var $this = $(element);
// Cursor has not set yet. And wait 100ms to skip global click event.
setTimeout(function () {
// Cursor is ready.
$this.textcomplete(getMentionsForAutoComplete(), {
'appendTo': ($this.parents('.dashboard').length > 0) ? $this.parent() : $('body'),
'listPosition': setTextcompleteDropdownListPos
});
}, 100);
}
// following workaround function is for calls from $.fn.textcomplete only
// we need this because currently implementation of caret position detection is way too imperfect

90
js/interface_home.js

@ -99,10 +99,6 @@ var InterfaceFunctions = function() @@ -99,10 +99,6 @@ var InterfaceFunctions = function()
twisterFollowingO = TwisterFollowing(defaultScreenName);
setTimeout("getRandomFollowSuggestion(processSuggestion)", 1000);
setTimeout("getRandomFollowSuggestion(processSuggestion)", 1000);
setTimeout("getRandomFollowSuggestion(processSuggestion)", 1000);
if( args.cbFunc )
args.cbFunc(args.cbArg);
}, {cbFunc:cbFunc, cbArg:cbArg});
@ -122,45 +118,67 @@ var InterfaceFunctions = function() @@ -122,45 +118,67 @@ var InterfaceFunctions = function()
});
}
setTimeout(updateTrendingHashtags, 1000);
if ($.Options.getTopTrendsAutoUpdateOpt() === 'enable' && $.Options.getTopTrendsAutoUpdateTimerOpt() > 0)
setInterval(updateTrendingHashtags, $.Options.getTopTrendsAutoUpdateTimerOpt()*1000);
if ($.Options.getTopTrendsOpt() === 'enable')
initTopTrends();
else
killTopTrends();
}
};
function initTopTrends() {
var $tt = $('.module.toptrends');
if ($tt.length) {
$tt.html($('#toptrends-template').html()).show();
var $ttRefresh = $tt.find('.refresh-toptrends');
$ttRefresh.on('click', updateTrendingHashtags);
setTimeout(function() { $ttRefresh.click() }, 100);
}
}
function killTopTrends() {
var $tt = $('.module.toptrends');
if ($tt.length)
$tt.empty().hide();
}
function updateTrendingHashtags() {
twisterRpc('gettrendinghashtags', [10],
function(args, ret) {
$('.toptrends-list').empty();
//console.log('hashtags trends: '+ret);
for( var i = 0; i < ret.length; i++ ) {
if ($.Options.getFilterLangOpt() !== 'disable' && $.Options.getFilterLangForTopTrendsOpt())
var langFilterData = filterLang(ret[i]);
if (typeof(langFilterData) === 'undefined' || langFilterData['pass'] || $.Options.getFilterLangSimulateOpt()) {
var $li = $('<li>');
var hashtagLinkTemplate = $('#hashtag-link-template').clone(true);
hashtagLinkTemplate.removeAttr('id');
hashtagLinkTemplate.attr('href',$.MAL.hashtagUrl(ret[i]));
hashtagLinkTemplate.text('#'+ret[i]);
$li.append(hashtagLinkTemplate);
if ($.Options.getFilterLangOpt() !== 'disable' && $.Options.getFilterLangSimulateOpt()) {
if (typeof(langFilterData) !== 'undefined') {
$li.append(' <span class="langFilterSimData"><em>'+((langFilterData['pass']) ? polyglot.t('passed') : polyglot.t('blocked'))+'</em>: '+langFilterData['prob'][0].toString()+'</span>');
} else {
$li.append(' <span class="langFilterSimData"><em>'+polyglot.t('not analyzed')+'</em></span>');
var $ttl = $('.module.toptrends .toptrends-list');
if ($ttl.length) {
twisterRpc('gettrendinghashtags', [10],
function(args, ret) {
$ttl.empty();
//console.log('hashtags trends: '+ret);
for( var i = 0; i < ret.length; i++ ) {
if ($.Options.getFilterLangOpt() !== 'disable' && $.Options.getFilterLangForTopTrendsOpt())
var langFilterData = filterLang(ret[i]);
if (typeof(langFilterData) === 'undefined' || langFilterData['pass'] || $.Options.getFilterLangSimulateOpt()) {
var $li = $('<li>');
var hashtagLinkTemplate = $('#hashtag-link-template').clone(true);
hashtagLinkTemplate.removeAttr('id');
hashtagLinkTemplate.attr('href',$.MAL.hashtagUrl(ret[i]));
hashtagLinkTemplate.text('#'+ret[i]);
$li.append(hashtagLinkTemplate);
if ($.Options.getFilterLangOpt() !== 'disable' && $.Options.getFilterLangSimulateOpt()) {
if (typeof(langFilterData) !== 'undefined') {
$li.append(' <span class="langFilterSimData"><em>'+((langFilterData['pass']) ? polyglot.t('passed') : polyglot.t('blocked'))+'</em>: '+langFilterData['prob'][0].toString()+'</span>');
} else {
$li.append(' <span class="langFilterSimData"><em>'+polyglot.t('not analyzed')+'</em></span>');
}
}
}
$('.toptrends-list').append($li);
$ttl.append($li);
}
}
}
}, {},
function(args, ret) {
console.log('Error with gettrendinghashtags. Older twister daemon?');
}, {}
);
}, {},
function(args, ret) {
console.log('Error with gettrendinghashtags. Older twister daemon?');
}, {}
);
if ($.Options.getTopTrendsAutoUpdateOpt() === 'enable' && $.Options.getTopTrendsAutoUpdateTimerOpt() > 0)
setTimeout(updateTrendingHashtags, $.Options.getTopTrendsAutoUpdateTimerOpt()*1000);
}
};
//***********************************************

740
js/interface_localization.js

File diff suppressed because it is too large Load Diff

82
js/jQueryPlugins.js

@ -11,4 +11,84 @@ @@ -11,4 +11,84 @@
});
return $(this);
}
})(jQuery);
})(jQuery);
(function($) {
$.fn.caret = function(pos) {
var target = this[0];
var isContentEditable = target.contentEditable === 'true';
//get
if (arguments.length == 0) {
//HTML5
if (window.getSelection) {
//contenteditable
if (isContentEditable) {
target.focus();
var range1 = window.getSelection().getRangeAt(0),
range2 = range1.cloneRange();
range2.selectNodeContents(target);
range2.setEnd(range1.endContainer, range1.endOffset);
return range2.toString().length;
}
//textarea
return target.selectionStart;
}
//IE<9
if (document.selection) {
target.focus();
//contenteditable
if (isContentEditable) {
var range1 = document.selection.createRange(),
range2 = document.body.createTextRange();
range2.moveToElementText(target);
range2.setEndPoint('EndToEnd', range1);
return range2.text.length;
}
//textarea
var pos = 0,
range = target.createTextRange(),
range2 = document.selection.createRange().duplicate(),
bookmark = range2.getBookmark();
range.moveToBookmark(bookmark);
while (range.moveStart('character', -1) !== 0) pos++;
return pos;
}
// Addition for jsdom support
if (target.selectionStart)
return target.selectionStart;
//not supported
return 0;
}
//set
if (pos == -1)
pos = this[isContentEditable? 'text' : 'val']().length;
//HTML5
if (window.getSelection) {
//contenteditable
if (isContentEditable) {
target.focus();
window.getSelection().collapse(target.firstChild, pos);
}
//textarea
else
target.setSelectionRange(pos, pos);
}
//IE<9
else if (document.body.createTextRange) {
if (isContentEditable) {
var range = document.body.createTextRange();
range.moveToElementText(target);
range.moveStart('character', pos);
range.collapse(true);
range.select();
} else {
var range = target.createTextRange();
range.move('character', pos);
range.select();
}
}
if (!isContentEditable)
target.focus();
return pos;
}
})(jQuery);

359
js/options.js

@ -20,15 +20,15 @@ var TwisterOptions = function() @@ -20,15 +20,15 @@ var TwisterOptions = function()
}
this.soundNotifOptions = function() {
$('#notifyForm select').each(function(){
this.value = $.Options.getOption(this.id, "false");
$('#notifyForm select').each(function() {
this.value = $.Options.getOption(this.id, 'false');
});
var player = $('#player');
player[0].pause();
$('#player').empty();
$('form#notifyForm').on('change','select',function(){
$('form#notifyForm').on('change', 'select', function() {
$.Options.setOption(this.id, this.value);
if(this.value == false) {player[0].pause(); return;}
@ -46,10 +46,10 @@ var TwisterOptions = function() @@ -46,10 +46,10 @@ var TwisterOptions = function()
this.volumeControl = function() {
var playerVol = $('#playerVol');
playerVol[0].value = $.Options.getOption(playerVol[0].id, 1);
playerVol[0].value = this.getOption(playerVol[0].id, 1);
$('.volValue').text((playerVol[0].value * 100).toFixed());
playerVol.on('change',function(){
playerVol.on('change', function() {
$.Options.setOption(this.id, this.value);
$('#player')[0].volume = (this.value);
$('.volValue').text((this.value * 100).toFixed());
@ -57,8 +57,8 @@ var TwisterOptions = function() @@ -57,8 +57,8 @@ var TwisterOptions = function()
}
this.DMsNotif = function() {
var sndDM = $.Options.getOption('sndDM', "false");
if( sndDM == "false") return;
var sndDM = this.getOption('sndDM', 'false');
if ( sndDM === 'false') return;
var player = $('#player');
$('#player').empty();
@ -69,13 +69,13 @@ var TwisterOptions = function() @@ -69,13 +69,13 @@ var TwisterOptions = function()
player.attr('type', 'audio/ogg');
player.attr('src', 'sound/'+sndDM+'.ogg');
}
player[0].volume = $.Options.getOption('playerVol',1);
player[0].volume = this.getOption('playerVol',1);
player[0].play();
}
this.mensNotif = function() {
var sndMention = $.Options.getOption('sndMention', "false");
if(sndMention == "false") return;
var sndMention = this.getOption('sndMention', 'false');
if (sndMention === 'false') return;
var player = $('#playerSec');
$('#playerSec').empty();
@ -86,23 +86,22 @@ var TwisterOptions = function() @@ -86,23 +86,22 @@ var TwisterOptions = function()
player.attr('type', 'audio/ogg');
player.attr('src', 'sound/'+sndMention+'.ogg');
}
player[0].volume = $.Options.getOption('playerVol',1);
player[0].volume = this.getOption('playerVol',1);
player[0].play();
}
this.getShowDesktopNotifPostsOpt = function() {
return $.Options.getOption('showDesktopNotifPosts','enable');
return this.getOption('showDesktopNotifPosts', 'enable');
}
this.setShowDesktopNotifPostsOpt = function () {
function showDesktopNotifPostsDesc() {
if ($.Options.getShowDesktopNotifPostsOpt() === 'enable') {
$('#showDesktopNotifPostsDesc')[0].style.display= 'inline';
} else {
$('#showDesktopNotifPostsDesc')[0].style.display= 'none';
}
if ($.Options.getShowDesktopNotifPostsOpt() === 'enable')
$('#showDesktopNotifPostsDesc').css('display', 'inline');
else
$('#showDesktopNotifPostsDesc').css('display', 'none');
}
$('#showDesktopNotifPosts').val(this.getShowDesktopNotifPostsOpt());
$('#showDesktopNotifPosts').val( this.getShowDesktopNotifPostsOpt() );
showDesktopNotifPostsDesc();
$('#showDesktopNotifPosts').on('change', function() {
$.Options.setOption(this.id, this.value);
@ -111,28 +110,26 @@ var TwisterOptions = function() @@ -111,28 +110,26 @@ var TwisterOptions = function()
}
this.getShowDesktopNotifPostsTimerOpt = function () {
return parseInt($.Options.getOption('showDesktopNotifPostsTimer', '6'));
return parseInt(this.getOption('showDesktopNotifPostsTimer', '6'));
}
this.setShowDesktopNotifPostsTimerOpt = function () {
$('#showDesktopNotifPostsTimer')[0].value = this.getShowDesktopNotifPostsTimerOpt().toString();
$('#showDesktopNotifPostsTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));});
$('#showDesktopNotifPostsTimer').val( this.getShowDesktopNotifPostsTimerOpt().toString() );
$('#showDesktopNotifPostsTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('second(s)')); });
}
this.getShowDesktopNotifPostsModalOpt = function() {
return $.Options.getOption('showDesktopNotifPostsModal','enable');
return this.getOption('showDesktopNotifPostsModal', 'enable');
}
this.setShowDesktopNotifPostsModalOpt = function () {
function showDesktopNotifPostsModalDesc() {
if ($.Options.getShowDesktopNotifPostsModalOpt() === 'enable') {
$('#showDesktopNotifPostsModalDesc')[0].style.display= 'inline';
} else {
$('#showDesktopNotifPostsModalDesc')[0].style.display= 'none';
}
if ($.Options.getShowDesktopNotifPostsModalOpt() === 'enable')
$('#showDesktopNotifPostsModalDesc').css('display', 'inline');
else
$('#showDesktopNotifPostsModalDesc').css('display', 'none');
}
$('#showDesktopNotifPostsModal').val(this.getShowDesktopNotifPostsModalOpt());
$('#showDesktopNotifPostsModal').val( this.getShowDesktopNotifPostsModalOpt() );
showDesktopNotifPostsModalDesc();
$('#showDesktopNotifPostsModal').on('change', function() {
$.Options.setOption(this.id, this.value);
@ -141,28 +138,26 @@ var TwisterOptions = function() @@ -141,28 +138,26 @@ var TwisterOptions = function()
}
this.getShowDesktopNotifPostsModalTimerOpt = function () {
return parseInt($.Options.getOption('showDesktopNotifPostsModalTimer', '6'));
return parseInt(this.getOption('showDesktopNotifPostsModalTimer', '6'));
}
this.setShowDesktopNotifPostsModalTimerOpt = function () {
$('#showDesktopNotifPostsModalTimer')[0].value = this.getShowDesktopNotifPostsModalTimerOpt().toString();
$('#showDesktopNotifPostsModalTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));});
$('#showDesktopNotifPostsModalTimer').val( this.getShowDesktopNotifPostsModalTimerOpt().toString() );
$('#showDesktopNotifPostsModalTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('second(s)')); });
}
this.getShowDesktopNotifMentionsOpt = function() {
return $.Options.getOption('showDesktopNotifMentions','enable');
return this.getOption('showDesktopNotifMentions', 'enable');
}
this.setShowDesktopNotifMentionsOpt = function () {
function showDesktopNotifMentionsDesc() {
if ($.Options.getShowDesktopNotifMentionsOpt() === 'enable') {
$('#showDesktopNotifMentionsDesc')[0].style.display= 'inline';
} else {
$('#showDesktopNotifMentionsDesc')[0].style.display= 'none';
}
if ($.Options.getShowDesktopNotifMentionsOpt() === 'enable')
$('#showDesktopNotifMentionsDesc').css('display', 'inline');
else
$('#showDesktopNotifMentionsDesc').css('display', 'none');
}
$('#showDesktopNotifMentions').val(this.getShowDesktopNotifMentionsOpt());
$('#showDesktopNotifMentions').val( this.getShowDesktopNotifMentionsOpt() );
showDesktopNotifMentionsDesc();
$('#showDesktopNotifMentions').on('change', function() {
$.Options.setOption(this.id, this.value);
@ -171,28 +166,26 @@ var TwisterOptions = function() @@ -171,28 +166,26 @@ var TwisterOptions = function()
}
this.getShowDesktopNotifMentionsTimerOpt = function () {
return parseInt($.Options.getOption('showDesktopNotifMentionsTimer', '60'));
return parseInt(this.getOption('showDesktopNotifMentionsTimer', '60'));
}
this.setShowDesktopNotifMentionsTimerOpt = function () {
$('#showDesktopNotifMentionsTimer')[0].value = this.getShowDesktopNotifMentionsTimerOpt().toString();
$('#showDesktopNotifMentionsTimer').val( this.getShowDesktopNotifMentionsTimerOpt().toString() );
$('#showDesktopNotifMentionsTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));});
}
this.getShowDesktopNotifDMsOpt = function() {
return $.Options.getOption('showDesktopNotifDMs','enable');
return this.getOption('showDesktopNotifDMs', 'enable');
}
this.setShowDesktopNotifDMsOpt = function () {
function showDesktopNotifDMsDesc() {
if ($.Options.getShowDesktopNotifDMsOpt() === 'enable') {
$('#showDesktopNotifDMsDesc')[0].style.display= 'inline';
} else {
$('#showDesktopNotifDMsDesc')[0].style.display= 'none';
}
if ($.Options.getShowDesktopNotifDMsOpt() === 'enable')
$('#showDesktopNotifDMsDesc').css('display', 'inline');
else
$('#showDesktopNotifDMsDesc').css('display', 'none');
}
$('#showDesktopNotifDMs').val(this.getShowDesktopNotifDMsOpt());
$('#showDesktopNotifDMs').val( this.getShowDesktopNotifDMsOpt() );
showDesktopNotifDMsDesc();
$('#showDesktopNotifDMs').on('change', function() {
$.Options.setOption(this.id, this.value);
@ -201,13 +194,12 @@ var TwisterOptions = function() @@ -201,13 +194,12 @@ var TwisterOptions = function()
}
this.getShowDesktopNotifDMsTimerOpt = function () {
return parseInt($.Options.getOption('showDesktopNotifDMsTimer', '60'));
return parseInt(this.getOption('showDesktopNotifDMsTimer', '60'));
}
this.setShowDesktopNotifDMsTimerOpt = function () {
$('#showDesktopNotifDMsTimer')[0].value = this.getShowDesktopNotifDMsTimerOpt().toString();
$('#showDesktopNotifDMsTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));});
$('#showDesktopNotifDMsTimer').val( this.getShowDesktopNotifDMsTimerOpt().toString() );
$('#showDesktopNotifDMsTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('second(s)')); });
}
this.setTestDesktopNotif = function() {
@ -216,159 +208,156 @@ var TwisterOptions = function() @@ -216,159 +208,156 @@ var TwisterOptions = function()
})
}
this.keysSendDefault = "ctrlenter";
this.keysSendDefault = 'ctrlenter';
this.keysSend = function() {
$('#keysOpt select')[0].value = $.Options.getOption('keysSend',this.keysSendDefault);
$('#keysOpt select').on('change', function(){
$.Options.setOption(this.id, this.value);
})
$('#keysOpt select').val( this.getOption('keysSend',this.keysSendDefault) );
$('#keysOpt select').on('change', function() { $.Options.setOption(this.id, this.value); });
}
this.keyEnterToSend = function() {
return $.Options.getOption('keysSend',this.keysSendDefault) == "enter";
return this.getOption('keysSend', this.keysSendDefault) === 'enter';
}
this.setLang = function() {
$('#language').val($.Options.getOption('locLang','auto'))
$('#language').on('change', 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 $.Options.getOption('theme','original');
return this.getOption('theme', 'original');
}
this.setTheme = function() {
$('#theme').val(this.getTheme())
$('#theme').on('change', function(){
$('#theme').val( this.getTheme() )
$('#theme').on('change', function() {
$.Options.setOption('theme', $(this).val());
location.reload();
});
}
this.getLineFeedsOpt = function() {
return $.Options.getOption('displayLineFeeds',"disable");
return this.getOption('displayLineFeeds', 'disable');
}
this.setLineFeedsOpt = function() {
$('#lineFeedsOpt select')[0].value = this.getLineFeedsOpt();
$('#lineFeedsOpt select').on('change', function(){
$.Options.setOption(this.id, this.value);
})
$('#lineFeedsOpt select').val( this.getLineFeedsOpt() );
$('#lineFeedsOpt select').on('change', function() { $.Options.setOption(this.id, this.value); });
}
this.getShowPreviewOpt = function() {
return $.Options.getOption('displayPreview',"disable");
return this.getOption('displayPreview', 'disable');
}
this.setShowPreviewOpt = function () {
$('#showPreviewOpt select')[0].value = this.getShowPreviewOpt();
$('#showPreviewOpt select').on('change', function(){
$.Options.setOption(this.id, this.value);
});
$('#showPreviewOpt select').val( this.getShowPreviewOpt() );
$('#showPreviewOpt select').on('change', function() { $.Options.setOption(this.id, this.value); });
}
this.getUnicodeConversionOpt = function () {
return $.Options.getOption('unicodeConversion', "disable");
return this.getOption('unicodeConversion', 'disable');
}
this.setUnicodeConversionOpt = function () {
$("#unicodeConversion")[0].value = this.getUnicodeConversionOpt();
$('#unicodeConversion').val( this.getUnicodeConversionOpt() );
if (this.getUnicodeConversionOpt() === "custom")
$("#unicodeConversionOpt .suboptions")[0].style.height = "230px";
if (this.getUnicodeConversionOpt() === 'custom')
$('#unicodeConversionOpt .suboptions').css('height', 'auto');
$("#unicodeConversion").on('change', function () {
$('#unicodeConversion').on('change', function () {
$.Options.setOption(this.id, this.value);
if (this.value === "custom")
$("#unicodeConversionOpt .suboptions")[0].style.height = "230px";
if (this.value === 'custom')
$('#unicodeConversionOpt .suboptions').css('height', 'auto');
else
$("#unicodeConversionOpt .suboptions")[0].style.height = "0px";
$('#unicodeConversionOpt .suboptions').css('height', '0px');
});
}
this.getConvertPunctuationsOpt = function() {
return $.Options.getOption('convertPunctuationsOpt', false);
return this.getOption('convertPunctuationsOpt', false);
}
this.setConvertPunctuationsOpt = function () {
$('#convertPunctuationsOpt')[0].checked = this.getConvertPunctuationsOpt();
$('#convertPunctuationsOpt').on('change', function(){
$.Options.setOption(this.id, this.checked);
});
$('#convertPunctuationsOpt').prop('checked', this.getConvertPunctuationsOpt());
$('#convertPunctuationsOpt').on('change', function() { $.Options.setOption(this.id, this.checked); });
}
this.getConvertEmotionsOpt = function() {
return $.Options.getOption('convertEmotionsOpt', false);
return this.getOption('convertEmotionsOpt', false);
}
this.setConvertEmotionsOpt = function () {
$('#convertEmotionsOpt')[0].checked = this.getConvertEmotionsOpt();
$('#convertEmotionsOpt').on('change', function(){
$.Options.setOption(this.id, this.checked);
});
$('#convertEmotionsOpt').prop('checked', this.getConvertEmotionsOpt());
$('#convertEmotionsOpt').on('change', function() { $.Options.setOption(this.id, this.checked); });
}
this.getConvertSignsOpt = function() {
return $.Options.getOption('convertSignsOpt', false);
return this.getOption('convertSignsOpt', false);
}
this.setConvertSignsOpt = function () {
$('#convertSignsOpt')[0].checked = this.getConvertSignsOpt();
$('#convertSignsOpt').on('change', function(){
$.Options.setOption(this.id, this.checked);
});
$('#convertSignsOpt').prop('checked', this.getConvertSignsOpt());
$('#convertSignsOpt').on('change', function() { $.Options.setOption(this.id, this.checked); });
}
this.getConvertFractionsOpt = function() {
return $.Options.getOption('convertFractionsOpt', false);
return this.getOption('convertFractionsOpt', false);
}
this.setConvertFractionsOpt = function () {
$('#convertFractionsOpt')[0].checked = this.getConvertFractionsOpt();
$('#convertFractionsOpt').on('change', function(){
$.Options.setOption(this.id, this.checked);
});
$('#convertFractionsOpt').prop('checked', this.getConvertFractionsOpt());
$('#convertFractionsOpt').on('change', function() { $.Options.setOption(this.id, this.checked); });
}
this.getUseProxyOpt = function () {
return $.Options.getOption('useProxy', 'disable');
return this.getOption('useProxy', 'disable');
}
this.setUseProxyOpt = function () {
$('#useProxy')[0].value = this.getUseProxyOpt();
$('#useProxy').val( this.getUseProxyOpt() );
if (this.getUseProxyOpt() === 'disable')
$('#useProxyForImgOnly').attr('disabled','disabled');
$('#useProxyForImgOnly').attr('disabled', 'disabled');
$('#useProxy').on('change', function () {
$.Options.setOption(this.id, this.value);
if (this.value === 'disable')
$('#useProxyForImgOnly').attr('disabled','disabled');
$('#useProxyForImgOnly').attr('disabled', 'disabled');
else
$('#useProxyForImgOnly').removeAttr('disabled');
});
}
this.getUseProxyForImgOnlyOpt = function () {
return $.Options.getOption('useProxyForImgOnly', false);
return this.getOption('useProxyForImgOnly', false);
}
this.setUseProxyForImgOnlyOpt = function () {
$('#useProxyForImgOnly')[0].checked = this.getUseProxyForImgOnlyOpt();
$('#useProxyForImgOnly').prop('checked', this.getUseProxyForImgOnlyOpt());
$('#useProxyForImgOnly').on('change', function () { $.Options.setOption(this.id, this.checked); });
}
this.getTopTrendsOpt = function() {
return this.getOption('TopTrends', 'enable');
}
$('#useProxyForImgOnly').on('change', function () {
$.Options.setOption(this.id, this.checked);
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();
});
}
@ -378,13 +367,12 @@ var TwisterOptions = function() @@ -378,13 +367,12 @@ var TwisterOptions = function()
this.setTopTrendsAutoUpdateOpt = function () {
function TopTrendsAutoUpdateCfg() {
if ($.Options.getTopTrendsAutoUpdateOpt() === 'enable') {
$('#TopTrendsAutoUpdateOpt')[0].style.display= 'inline';
} else {
$('#TopTrendsAutoUpdateOpt')[0].style.display= 'none';
}
if ($.Options.getTopTrendsAutoUpdateOpt() === 'enable')
$('#TopTrendsAutoUpdateOpt').css('display', 'inline');
else
$('#TopTrendsAutoUpdateOpt').css('display', 'none');
}
$('#TopTrendsAutoUpdate').val(this.getTopTrendsAutoUpdateOpt());
$('#TopTrendsAutoUpdate').val( this.getTopTrendsAutoUpdateOpt() );
TopTrendsAutoUpdateCfg();
$('#TopTrendsAutoUpdate').on('change', function() {
$.Options.setOption(this.id, this.value);
@ -397,86 +385,77 @@ var TwisterOptions = function() @@ -397,86 +385,77 @@ var TwisterOptions = function()
}
this.setTopTrendsAutoUpdateTimerOpt = function () {
$('#TopTrendsAutoUpdateTimer')[0].value = this.getTopTrendsAutoUpdateTimerOpt().toString();
$('#TopTrendsAutoUpdateTimer').val( this.getTopTrendsAutoUpdateTimerOpt().toString() );
$('#TopTrendsAutoUpdateTimer').on('keyup', function () { setElemValNumeric(this, polyglot.t('second(s)')); });
}
$('#TopTrendsAutoUpdateTimer').on('keyup', function () {setElemValNumeric(this, polyglot.t('second(s)'));});
this.getWhoToFollowOpt = function() {
return this.getOption('WhoToFollow', 'enable');
}
this.getSplitPostsOpt = function (){
return $.Options.getOption('splitPosts', 'disable');
this.setWhoToFollowOpt = function () {
$('#WhoToFollow').val(this.getWhoToFollowOpt());
$('#WhoToFollow').on('change', function() { $.Options.setOption(this.id, this.value); });
}
this.setSplitPostsOpt = function () {
$('#splitPosts')[0].value = this.getSplitPostsOpt();
this.getSplitPostsOpt = function () {
return this.getOption('splitPosts', 'disable');
}
$('#splitPosts').on('change', function () {
$.Options.setOption(this.id, this.value);
});
this.setSplitPostsOpt = function () {
$('#splitPosts').val( this.getSplitPostsOpt() );
$('#splitPosts').on('change', function () { $.Options.setOption(this.id, this.value); });
}
this.getHideRepliesOpt = function () {
return $.Options.getOption('hideReplies', 'following');
return this.getOption('hideReplies', 'following');
}
this.setHideRepliesOpt = function () {
$('#hideReplies')[0].value = this.getHideRepliesOpt();
$('#hideReplies').on('change', function () {
$.Options.setOption(this.id, this.value);
});
$('#hideReplies').val( this.getHideRepliesOpt() );
$('#hideReplies').on('change', function () { $.Options.setOption(this.id, this.value); });
}
this.getHideCloseRTsOpt = function () {
return $.Options.getOption('hideCloseRTs', 'disable');
return this.getOption('hideCloseRTs', 'disable');
};
this.setHideCloseRTsOpt = function () {
$('#hideCloseRTs')[0].value = this.getHideCloseRTsOpt();
if (this.getHideCloseRTsOpt() === 'disable') {
$('#hideCloseRTsDesc')[0].style.display = 'none';
} else {
$('#hideCloseRTsDesc')[0].style.display = 'inline';
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);
if (this.value === 'disable') {
$('#hideCloseRTsDesc')[0].style.display = 'none';
} else {
$('#hideCloseRTsDesc')[0].style.display = 'inline';
}
hideCloseRTsCfg();
});
};
this.getHideCloseRTsHourOpt = function () {
return parseInt($.Options.getOption('hideCloseRtsHour', '1'));
return parseInt(this.getOption('hideCloseRtsHour', '1'));
};
this.setHideCloseRTsHourOpt = function () {
$('#hideCloseRtsHour')[0].value = this.getHideCloseRTsHourOpt().toString();
$('#hideCloseRtsHour').on('keyup', function () {setElemValNumeric(this, polyglot.t('hour(s)'));});
};
this.getIsFollowingMeOpt = function () {
return $.Options.getOption('isFollowingMe');
$('#hideCloseRtsHour').val( this.getHideCloseRTsHourOpt().toString() );
$('#hideCloseRtsHour').on('keyup', function () { setElemValNumeric(this, polyglot.t('hour(s)')); });
};
this.getFilterLangOpt = function() {
return this.getOption('filterLang','disable');
return this.getOption('filterLang', 'disable');
}
this.setFilterLangOpt = function () {
function filterLangListCont() {
if ( $.Options.getFilterLangOpt() !== 'disable' ) {
$('#filterLangListCont')[0].style.display= 'block';
} else {
$('#filterLangListCont')[0].style.display= 'none';
}
if ( $.Options.getFilterLangOpt() !== 'disable' )
$('#filterLangListCont').css('display', 'block');
else
$('#filterLangListCont').css('display', 'none');
}
$('#filterLang').val(this.getFilterLangOpt());
$('#filterLang').val( this.getFilterLangOpt() );
filterLangListCont();
$('#filterLang').on('change', function() {
$.Options.setOption(this.id, this.value);
@ -489,9 +468,9 @@ var TwisterOptions = function() @@ -489,9 +468,9 @@ var TwisterOptions = function()
}
this.setFilterLangListOpt = function () {
$('#filterLangList').val(this.getFilterLangListOpt());
$('#filterLangList').val( this.getFilterLangListOpt() );
$('#filterLangList').on('keyup', function () {$.Options.setOption(this.id, this.value);});
$('#filterLangList').on('keyup', function () { $.Options.setOption(this.id, this.value); });
}
this.getFilterLangAccuracyOpt = function () {
@ -499,8 +478,8 @@ var TwisterOptions = function() @@ -499,8 +478,8 @@ var TwisterOptions = function()
}
this.setFilterLangAccuracyOpt = function () {
$('#filterLangAccuracy').val(this.getFilterLangAccuracyOpt());
$('#filterLangAccuracyVal').text(this.getFilterLangAccuracyOpt());
$('#filterLangAccuracy').val( this.getFilterLangAccuracyOpt() );
$('#filterLangAccuracyVal').text( this.getFilterLangAccuracyOpt() );
$('#filterLangAccuracy').on('change', function () {
$.Options.setOption(this.id, this.value);
$('#filterLangAccuracyVal').text(this.value);
@ -513,8 +492,7 @@ var TwisterOptions = function() @@ -513,8 +492,7 @@ var TwisterOptions = function()
this.setFilterLangForPostboardOpt = function () {
$('#filterLangForPostboard').prop('checked', this.getFilterLangForPostboardOpt());
$('#filterLangForPostboard').on('click', function () {$.Options.setOption(this.id, this.checked);});
$('#filterLangForPostboard').on('click', function () { $.Options.setOption(this.id, this.checked); });
}
this.getFilterLangForSearchingOpt = function () {
@ -523,8 +501,7 @@ var TwisterOptions = function() @@ -523,8 +501,7 @@ var TwisterOptions = function()
this.setFilterLangForSearchingOpt = function () {
$('#filterLangForSearching').prop('checked', this.getFilterLangForSearchingOpt());
$('#filterLangForSearching').on('click', function () {$.Options.setOption(this.id, this.checked);});
$('#filterLangForSearching').on('click', function () { $.Options.setOption(this.id, this.checked); });
}
this.getFilterLangForTopTrendsOpt = function () {
@ -533,8 +510,7 @@ var TwisterOptions = function() @@ -533,8 +510,7 @@ var TwisterOptions = function()
this.setFilterLangForTopTrendsOpt = function () {
$('#filterLangForTopTrends').prop('checked', this.getFilterLangForTopTrendsOpt());
$('#filterLangForTopTrends').on('click', function () {$.Options.setOption(this.id, this.checked);});
$('#filterLangForTopTrends').on('click', function () { $.Options.setOption(this.id, this.checked); });
}
this.getFilterLangSimulateOpt = function () {
@ -543,28 +519,25 @@ var TwisterOptions = function() @@ -543,28 +519,25 @@ var TwisterOptions = function()
this.setFilterLangSimulateOpt = function () {
$('#filterLangSimulate').prop('checked', this.getFilterLangSimulateOpt());
$('#filterLangSimulate').on('click', function () {$.Options.setOption(this.id, this.checked);});
$('#filterLangSimulate').on('click', function () { $.Options.setOption(this.id, this.checked); });
}
this.setIsFollowingMeOpt = function () {
$('#isFollowingMe')[0].value = this.getIsFollowingMeOpt();
this.getIsFollowingMeOpt = function () {
return this.getOption('isFollowingMe', 'in-profile');
};
$('#isFollowingMe').on('change', function () {
$.Options.setOption(this.id, this.value);
});
this.setIsFollowingMeOpt = function () {
$('#isFollowingMe').val( this.getIsFollowingMeOpt() );
$('#isFollowingMe').on('change', function () { $.Options.setOption(this.id, this.value); });
};
this.getDMCopySelfOpt = function() {
return $.Options.getOption('dmCopySelf',"enable");
return this.getOption('dmCopySelf', 'enable');
}
this.setDMCopySelfOpt = function () {
$('#dmCopySelfOpt select')[0].value = this.getDMCopySelfOpt();
$('#dmCopySelfOpt select').on('change', function(){
$.Options.setOption(this.id, this.value);
});
$('#dmCopySelfOpt select').val( this.getDMCopySelfOpt() );
$('#dmCopySelfOpt select').on('change', function() { $.Options.setOption(this.id, this.value); });
}
this.InitOptions = function() {
@ -592,7 +565,9 @@ var TwisterOptions = function() @@ -592,7 +565,9 @@ var TwisterOptions = function()
this.setUseProxyOpt();
this.setUseProxyForImgOnlyOpt();
this.setTopTrendsAutoUpdateOpt();
this.setTopTrendsOpt();
this.setTopTrendsAutoUpdateTimerOpt();
this.setWhoToFollowOpt();
this.setSplitPostsOpt();
this.setHideRepliesOpt();
this.setHideCloseRTsHourOpt();

5
js/twister_following.js

@ -441,7 +441,8 @@ function getRandomFollowSuggestion(cbFunc, cbArg) { @@ -441,7 +441,8 @@ function getRandomFollowSuggestion(cbFunc, cbArg) {
var i = parseInt( Math.random() * followingUsers.length );
if ( (i < followingUsers.length && followingUsers[i] == defaultScreenName) ||
typeof(twisterFollowingO.followingsFollowings[followingUsers[i]]) === 'undefined') {
typeof(twisterFollowingO) === 'undefined' ||
typeof(twisterFollowingO.followingsFollowings[followingUsers[i]]) === 'undefined') {
setTimeout(function() {getRandomFollowSuggestion(cbFunc, cbArg);}, 500);
return;
@ -562,7 +563,7 @@ function showFollowingUsers(){ @@ -562,7 +563,7 @@ function showFollowingUsers(){
}
function processSuggestion(arg, suggestion, followedBy) {
var dashboard = $(".follow-suggestions");
var dashboard = $('.module.who-to-follow .follow-suggestions');
if( suggestion ) {
var item = $("#follow-suggestion-template").clone(true);
item.removeAttr("id");

68
js/twister_timeline.js

@ -189,44 +189,42 @@ function showPosts(req, posts) @@ -189,44 +189,42 @@ function showPosts(req, posts)
var streamItemsParent = $.MAL.getStreamPostsParent();
for( var i = 0; i < posts.length; i++ ) {
if (req.users.indexOf(posts[i]['userpost']['n']) > -1 || req.getspam) { // FIXME maybe it's unecessary check but currently we got unwanted adverting posts which are coming with requested ones from 'getposts' sometimes
var post = posts[i];
//console.log(post);
var streamPost = postToElem(post, "original", req.getspam);
var timePost = post["userpost"]["time"];
streamPost.attr("data-time",timePost);
// post will only be shown if appended to the stream list
var streamPostAppended = false;
// insert the post in timeline ordered by (you guessed) time
// FIXME: lame! searching everything everytime. please optimize!
var streamItems = streamItemsParent.children();
if( streamItems.length == 0) {
// timeline is empty
streamItemsParent.append( streamPost );
streamPostAppended = true;
} else {
var j = 0;
for( j = 0; j < streamItems.length; j++) {
var streamItem = streamItems.eq(j);
var timeItem = streamItem.attr("data-time");
if( timeItem == undefined ||
timePost > parseInt(timeItem) ) {
// this post in stream is older, so post must be inserted above
streamItem.before(streamPost);
streamPostAppended = true;
break;
}
var post = posts[i];
//console.log(post);
var streamPost = postToElem(post, "original", req.getspam);
var timePost = post["userpost"]["time"];
streamPost.attr("data-time",timePost);
// post will only be shown if appended to the stream list
var streamPostAppended = false;
// insert the post in timeline ordered by (you guessed) time
// FIXME: lame! searching everything everytime. please optimize!
var streamItems = streamItemsParent.children();
if( streamItems.length == 0) {
// timeline is empty
streamItemsParent.append( streamPost );
streamPostAppended = true;
} else {
var j = 0;
for( j = 0; j < streamItems.length; j++) {
var streamItem = streamItems.eq(j);
var timeItem = streamItem.attr("data-time");
if( timeItem == undefined ||
timePost > parseInt(timeItem) ) {
// this post in stream is older, so post must be inserted above
streamItem.before(streamPost);
streamPostAppended = true;
break;
}
}
if (!streamPostAppended)
streamItemsParent.append( streamPost );
streamPostAppended = true;
streamPost.show();
req.reportProcessedPost(post["userpost"]["n"],post["userpost"]["k"], streamPostAppended);
}
if (!streamPostAppended)
streamItemsParent.append( streamPost );
streamPostAppended = true;
streamPost.show();
req.reportProcessedPost(post["userpost"]["n"],post["userpost"]["k"], streamPostAppended);
}
}

30
licenses/caret.license

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
Copyright (c) 2009, Gideon Sireling
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Gideon Sireling nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

25
licenses/franc.license

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
(The MIT License)
Copyright (c) 2014-2015 Titus Wormer <tituswormer@gmail.com>
Copyright (c) 2008 Kent S Johnson
Copyright (c) 2006 Jacob R Rideout <kde@jacobrideout.net>
Copyright (c) 2004 Maciej Ceglowski
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

9
licenses/notify.js.license

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
Copyright (c) 2014 Alex Gibson
http://alxgbsn.co.uk/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction except as noted below, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sublicense, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

40
options.html

@ -29,8 +29,8 @@ @@ -29,8 +29,8 @@
</head>
<body>
<!-- MENU SUPERIOR INIT -->
<!-- MENU SUPERIOR INIT -->
<nav class="userMenu">
<ul>
<li class="userMenu-home"><a href="home.html"><span class="selectable_theme theme_original label">Home</span></a></li>
@ -75,7 +75,7 @@ @@ -75,7 +75,7 @@
<select name="" id="language">
<option value="auto">Auto</option>
<option value="pt-BR">Brazilian Portuguese</option>
<option value="zh">Chinese</option>
<option value="zh-CN">Chinese Simplified</option>
<option value="cs">Czech</option>
<option value="nl">Dutch</option>
<option value="en">English</option>
@ -86,6 +86,7 @@ @@ -86,6 +86,7 @@
<option value="ru">Russian</option>
<option value="es">Spanish</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
</select>
</form>
</div>
@ -302,16 +303,35 @@ @@ -302,16 +303,35 @@
</div>
<div class="module">
<p class="label label-h"> Top Trends </p>
<div id="TopTrendsAutoUpdateCont" class="container">
<div class="container">
<form>
<p>
<select id="TopTrends">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
</p>
<div id="TopTrendsCont" class="container">
<p class="label">Auto updating</p>
<select id="TopTrendsAutoUpdate" class="container">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
<div id="TopTrendsAutoUpdateOpt" class="container">
<input type="text" id="TopTrendsAutoUpdateTimer" maxlength="6" size="6"/> <span class="label">second(s)</span>
</div>
</div>
</form>
</div>
</div>
<div class="module">
<p class="label label-h"> Who to Follow </p>
<div class="container">
<form>
<p class="label">Auto updating</p>
<select id="TopTrendsAutoUpdate" class="container">
<select id="WhoToFollow">
<option value="enable">Enable</option>
<option value="disable">Disable</option>
</select>
<div id="TopTrendsAutoUpdateOpt" class="container">
<input type="text" id="TopTrendsAutoUpdateTimer" maxlength="6" size="6"/> <span class="label">second(s)</span>
</div>
</form>
</div>
</div>
@ -332,7 +352,7 @@ @@ -332,7 +352,7 @@
<div class="container">
<label>Supported punctuations: </label>
<span>‥ … ⁇ ⁈ ⁉ ‼ — ⁓</span>
</div>
</div>
<input name="" id="convertEmotionsOpt" type="checkbox" /> <span class="label">Convert emotions codes to unicode symbols</span>
<div class="container">
<label>Supported emotions: </label>

5
theme_calm/css/style.css

@ -969,6 +969,7 @@ textarea.splited-post { @@ -969,6 +969,7 @@ textarea.splited-post {
text-decoration: none;
}
.refresh-toptrends,
.refresh-users,
.view-all-users
{
@ -979,14 +980,16 @@ textarea.splited-post { @@ -979,14 +980,16 @@ textarea.splited-post {
}
/***********************************
********************* TOP TRENDS
************ TOP TRENDS ************
***********************************/
.module.toptrends {
margin-top: 10px;
}
.module.toptrends h3 {
margin: 5px 0 5px 10px;
font: 14px 'Open Sans', sans-serif;
display: inline;
}
.module.toptrends ol {
margin: 0 0 10px 10px;

13
theme_nin/css/style.css

@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
font-style: normal;
}
/* line 64, ../sass/_fonts.sass */
[class^="icon-"]:before, [class*=" icon-"]:before, .extend-icon:before, .userMenu li.userMenu-config > a:before, .post-context span:before, .post-reply:before, .post-propagate:before, .post-favorite:before, .post .show-more:before, .mini-profile-actions span:before, ul.userMenu-search-profiles button:before, .mini-profile-indicators .userMenu-connections a:before, .mini-profile-indicators .userMenu-messages a:before, .mini-profile-indicators .userMenu-user a:before, .twister-user-remove:before, .refresh-users:before, .modal-close:before, .mark-all-as-read:before, .modal-back:before, .icon-down-after:after {
[class^="icon-"]:before, [class*=" icon-"]:before, .extend-icon:before, .userMenu li.userMenu-config > a:before, .post-context span:before, .post-reply:before, .post-propagate:before, .post-favorite:before, .post .show-more:before, .mini-profile-actions span:before, ul.userMenu-search-profiles button:before, .mini-profile-indicators .userMenu-connections a:before, .mini-profile-indicators .userMenu-messages a:before, .mini-profile-indicators .userMenu-user a:before, .twister-user-remove:before, .refresh-toptrends:before, .refresh-users:before, .modal-close:before, .mark-all-as-read:before, .modal-back:before, .icon-down-after:after {
font-family: "fontello";
font-style: normal;
font-weight: normal;
@ -198,7 +198,7 @@ @@ -198,7 +198,7 @@
/* '' */
/* line 183, ../sass/_fonts.sass */
.icon-arrows:before, .refresh-users:before {
.icon-arrows:before, .refresh-toptrends:before, .refresh-users:before {
content: "";
}
@ -1823,7 +1823,7 @@ button.disabled:hover, .mini-profile-actions span.disabled:hover, a.button.disab @@ -1823,7 +1823,7 @@ button.disabled:hover, .mini-profile-actions span.disabled:hover, a.button.disab
width: 90%;
}
.options #filterLangListCont div,.options #TopTrendsAutoUpdateCont div {
.options #filterLangListCont div,.options #TopTrendsCont div {
float: none;
padding: 0px 4px;
}
@ -2449,7 +2449,7 @@ button.follow:hover, .mini-profile-actions span.follow:hover, button.unfollow, . @@ -2449,7 +2449,7 @@ button.follow:hover, .mini-profile-actions span.follow:hover, button.unfollow, .
}
/* line 499, ../sass/style.sass */
.refresh-users {
.refresh-toptrends, .refresh-users {
color: #66686B;
cursor: pointer;
font-size: 11px;
@ -2479,13 +2479,16 @@ button.follow:hover, .mini-profile-actions span.follow:hover, button.unfollow, . @@ -2479,13 +2479,16 @@ button.follow:hover, .mini-profile-actions span.follow:hover, button.unfollow, .
}
/* line 527, ../sass/style.sass */
.refresh-users:hover, .view-all-users:hover {
.refresh-toptrends:hover, .refresh-users:hover, .view-all-users:hover {
color: #B4C669;
text-decoration: none;
background-color: transparent;
}
/***********TOP TRENDS************** */
.toptrends h3 {
float: left;
}
/* line 534, ../sass/style.sass */
ol.toptrends-list {
margin: 0;

10
theme_nin/sass/style.sass

@ -516,7 +516,7 @@ textarea.splited-post @@ -516,7 +516,7 @@ textarea.splited-post
.twister-user-remove:hover
opacity: 1
.refresh-users
.refresh-toptrends, .refresh-users
@extend .icon-arrows
@extend .extend-icon
color: $main-color-dark
@ -544,13 +544,17 @@ textarea.splited-post @@ -544,13 +544,17 @@ textarea.splited-post
margin: 0 0 0 15px
position: relative
.refresh-users:hover, .view-all-users:hover
.refresh-toptrends:hover, .refresh-users:hover, .view-all-users:hover
color: $main-color-color
text-decoration: none
background-color: transparent
/***********TOP TRENDS***************/
.toptrends
h3
float: left
ol.toptrends-list
margin: 0
margin-bottom: 10px
@ -1096,7 +1100,7 @@ ol.toptrends-list @@ -1096,7 +1100,7 @@ ol.toptrends-list
#filterLangList
width: 90%
#filterLangListCont div, #TopTrendsAutoUpdateCont div
#filterLangListCont div, #TopTrendsCont div
float: none
padding: 0px 4px

Loading…
Cancel
Save