diff --git a/css/style.css b/css/style.css index ee88096..c493d5c 100644 --- a/css/style.css +++ b/css/style.css @@ -748,17 +748,18 @@ textarea.splited-post { .twister-user-remove:hover{ opacity: 1; } -.follow -{ + +.follow, .unfollow { background: none; border: solid 1px rgba( 0, 0, 0 ,.2 ); padding: 3px 15px; color: rgba( 0, 0, 0 ,.4 ); } -.follow:hover -{ + +.follow:hover, .unfollow:hover { color: rgba( 0, 0, 0 ,.7 ); } + .refresh-users, .view-all-users { @@ -1548,7 +1549,7 @@ ol.toptrends-list { .prompt-wrapper { - position: fixed; + position: fixed; top: 50%; left: 50%; background: rgba( 255, 255,255, 1.0 ); @@ -1559,7 +1560,7 @@ ol.toptrends-list { } .prompt-wrapper .modal-header h3{ - background: #45474D; + background: #E34F42; } /************************************* diff --git a/following.html b/following.html index 457a29a..6b9a212 100644 --- a/following.html +++ b/following.html @@ -314,6 +314,20 @@ + +
+ + + +
+ + diff --git a/js/interface_common.js b/js/interface_common.js index 72ec8da..7b108ee 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -5,8 +5,11 @@ // Profile, mentions and hashtag modal // Post actions: submit, count characters +var window_scrollY = 0; + //dispara o modal genérico //o modalClass me permite fazer tratamentos específicos de CSS para cada modal + function openModal( modalClass ) { var $oldModal = $("body").children(".modal-blackout"); @@ -26,6 +29,8 @@ function openModal( modalClass ) $body.css({ "overflow": "hidden" }); + + window_scrollY = window.pageYOffset; } //fecha o modal removendo o conteúdo por detach @@ -33,6 +38,7 @@ function closeModal($this) { closeModalHandler($this); window.location.hash = '#'; + window.scroll(window.pageXOffset, window_scrollY); } function closeModalHandler($this) @@ -479,8 +485,7 @@ function initHashWatching() // Register hash spy and launch it once window.addEventListener('hashchange', watchHashChange, false); - //watchHashChange(null); - window.location.hash="#"; + setTimeout(function(){ watchHashChange() }, 1000); } @@ -544,18 +549,41 @@ var replyInitPopup = function(e, post) } //abre o menu dropdown de configurações -var dropDownMenu = function( e ) -{ - var $configMenu = $( ".config-menu" ); - $configMenu.slideToggle( "fast" ); - e.stopPropagation(); +function dropDownMenu() { + $( ".config-menu" ).slideToggle( "fast" ); } //fecha o config menu ao clicar em qualquer lugar da tela -var closeThis = function() -{ +function closeThis() { $( this ).slideUp( "fast" ); -}; +} + +function toggleFollowButton(button, followingUser) { + if (!button || !followingUser) + return; + + button + .removeClass("follow") + .addClass("unfollow") + .unbind("click") + .bind("click", + (function(e) { + unfollow(this.toString(), + (function() { + this + .removeClass("unfollow") + .addClass("follow") + .unbind("click") + .bind("click", userClickFollow) + .text(polyglot.t('Follow')) + .trigger("toggleFollow"); + }).bind($(e.target)) + ); + }).bind(followingUser) + ) + .text(polyglot.t('Unfollow')) + .trigger("toggleUnfollow"); +} var postExpandFunction = function( e, postLi ) { @@ -1430,7 +1458,8 @@ function initInterfaceCommon() { $('.mark-all-as-read').css('display', 'none'); }); - $(".prompt-close").on('click', function(event){ + $(".prompt-close").on('click', function(e){ + e.stopPropagation(); closePrompt(); }); @@ -1451,10 +1480,11 @@ function initInterfaceCommon() { }); $( ".post-reply" ).bind( "click", postReplyClick ); $( ".post-propagate" ).bind( "click", reTwistPopup ); - $( ".userMenu-config-dropdown" ).bind( "click", dropDownMenu ); - $( ".config-menu" ).clickoutside( closeThis ); + $( ".userMenu-config" ).clickoutside( closeThis.bind($( ".config-menu" )) ); + $( ".userMenu-config-dropdown" ).click( dropDownMenu ); $( ".module.post" ).bind( "click", function(e) { - if(window.getSelection() == 0)postExpandFunction(e,$(this)); }); + if(e.button === 0 && window.getSelection() == 0) postExpandFunction(e,$(this)); + }); $( ".post-area-new" ).bind( "click", function(e) { composeNewPost(e,$(this));} ); $( ".post-area-new" ).clickoutside( unfocusThis ); diff --git a/js/interface_home.js b/js/interface_home.js index 102f363..b9e7df2 100644 --- a/js/interface_home.js +++ b/js/interface_home.js @@ -132,9 +132,14 @@ var InterfaceFunctions = function() args.cbFunc(args.cbArg); }, {cbFunc:cbFunc, cbArg:cbArg}); - - - + $(window) + .on("eventFollow", function(e, user) { + $(".following-count").text(followingUsers.length-1); + setTimeout('requestTimelineUpdate("latest",postsPerRefresh,["'+user+'"],promotedPostsOnly)', 1000); + }) + .on("eventUnfollow", function(e, user) { + $(".following-count").text(followingUsers.length-1); + }); } } }; diff --git a/js/interface_localization.js b/js/interface_localization.js index 34115c0..fc20020 100644 --- a/js/interface_localization.js +++ b/js/interface_localization.js @@ -314,6 +314,8 @@ if(preferredLanguage == "es"){ "Favorite": "Favorito", "File APIs not supported in this browser.": "Los archivos API no compatibles con este navegador", "Follow": "Seguir", + "Following config": "Following config", + "Which way do you want to follow": "Which way do you want to follow", "Followed by": "Seguido por", "followed_by": "Seguido por %{username}", "Followers": "Seguidores", @@ -556,6 +558,8 @@ if(preferredLanguage == "uk"){ "Favorite": "Улюблені", "File APIs not supported in this browser.": "File APIs не підтримуєтся цим браузером.", "Follow": "Підписатись", + "Following config": "Following config", + "Which way do you want to follow": "Which way do you want to follow", "Followed by": "Підписаний на", "followed_by": "%{username} підписан", "Followers": "Читачі", @@ -796,6 +800,8 @@ if(preferredLanguage == "zh"){ "Favorite": "收藏", "File APIs not supported in this browser.": "这个浏览器不支持文件APIs", "Follow": "关注", + "Following config": "Following config", + "Which way do you want to follow": "Which way do you want to follow", "Followed by": "被关注", "followed_by": "被 %{username} 关注", "Followers": "粉丝", @@ -1036,6 +1042,8 @@ if(preferredLanguage == "nl"){ "Favorite": "Favoriet", "File APIs not supported in this browser.": "File APIs worden nie ondersteund in deze browser.", "Follow": "Volgen", + "Following config": "Following config", + "Which way do you want to follow": "Which way do you want to follow", "Followed by": "Gevolgd door", "followed_by": "Gevolgd door %{username}", "Followers": "Volgers", @@ -1277,6 +1285,8 @@ if(preferredLanguage == "it"){ "Favorite": "Preferito", "File APIs not supported in this browser.": "File APIs non supportati in questo browser.", "Follow": "Segui", + "Following config": "Following config", + "Which way do you want to follow": "Which way do you want to follow", "Followed by": "Seguito da", "followed_by": "Seguiti da %{username}", "Followers": "Lettori", @@ -1516,6 +1526,8 @@ if(preferredLanguage == "fr"){ "Favorite": "Favori", "File APIs not supported in this browser.": "L'API de fichiers n'est pas pris en charge dans votre navigateur.", "Follow": "Suivre", + "Following config": "Following config", + "Which way do you want to follow": "Which way do you want to follow", "Followed by": "Suivi par", "followed_by": "Suivi par %{username}", "Followers": "Abonnés", @@ -2007,6 +2019,8 @@ if(preferredLanguage == "de"){ "Favorite": "Favorisieren", "File APIs not supported in this browser.": "File APIs werden von diesem Browser nicht unterstützt.", "Follow": "Folgen", + "Following config": "Following config", + "Which way do you want to follow": "Which way do you want to follow", "Followed by": "Gefolgt von", "followed_by": "Gefolgt von %{username}", "Followers": "Followers", @@ -2249,6 +2263,8 @@ if(preferredLanguage == "ja"){ "Favorite": "お気に入り", "File APIs not supported in this browser.": "利用しているブラウザはファイルAPIをサポートしていません。", "Follow": "フォロー", + "Following config": "Following config", + "Which way do you want to follow": "Which way do you want to follow", "Followed by": "フォローされている", "followed_by": "%{username}にフォローされている", "Followers": "フォロワー", @@ -2488,6 +2504,8 @@ if(preferredLanguage == "pt-BR"){ "Favorite": "Favorito", "File APIs not supported in this browser.": "O gerenciamento de arquivos não é suportado neste navegador.", "Follow": "Seguir", + "Following config": "Following config", + "Which way do you want to follow": "Which way do you want to follow", "Followed by": "Seguido por", "followed_by": "Seguido por %{username}", "Followers": "Seguidores", @@ -2731,6 +2749,8 @@ if(preferredLanguage == "tr"){ "Favorite": "Favori", "File APIs not supported in this browser.": "Tarayıcınızda dosya API'si desteklenmiyor.", "Follow": "Takip et", + "Following config": "Following config", + "Which way do you want to follow": "Which way do you want to follow", "Followed by": "Takip edenler", "followed_by": "%{username} tarafından takip edilenler", "Followers": "Takipçiler", @@ -2971,6 +2991,8 @@ if(preferredLanguage == "cs"){ "Favorite": "Přidat k oblíbeným", "File APIs not supported in this browser.": "Upozornění: váš webový prohlížeč nepodporuje File API.", "Follow": "Sledovat", + "Following config": "Following config", + "Which way do you want to follow": "Which way do you want to follow", "Followed by": "tohoto uživatele sleduje", "followed_by": "Uživatelé, které sleduje %{username}", "Followers": "Sledující", diff --git a/js/mobile_abstract.js b/js/mobile_abstract.js index fd7c426..2e8bced 100644 --- a/js/mobile_abstract.js +++ b/js/mobile_abstract.js @@ -188,7 +188,7 @@ var MAL = function() if( $.hasOwnProperty("mobile") ) { return "#dmchat?user=" + username; } else { - return "#dmchat?user=" + username; + return "#directmessages?user=" + username; } } @@ -315,6 +315,42 @@ var MAL = function() } } + this.showMentions = function(username) { + if( $.hasOwnProperty("mobile") ) { + $.mobile.navigate( this.mentionsUrl(username) ); + } else { + if ($(".postboard").length) { + openMentionsModal(); + } else { + window.location.href = 'home.html'+this.mentionsUrl(username); + } + } + } + + this.showDMchat = function(username) { + if (username) { + if( $.hasOwnProperty("mobile") ) { + $.mobile.navigate( this.dmchatUrl(username) ); + } else { + if ($(".postboard").length) { + window.location.hash = this.dmchatUrl(username); + } else { + window.location.href = 'home.html'+this.dmchatUrl(username); + } + } + } else { + if( $.hasOwnProperty("mobile") ) { + $.mobile.navigate( '#directmsg' ); + } else { + if ($(".postboard").length) { + window.location.hash = '#directmessages'; + } else { + window.location.href = 'home.html#directmessages'; + } + } + } + } + this.setNetworkStatusMsg = function(msg, statusGood) { if( $.hasOwnProperty("mobile") ) { $(".network-status").text(msg); diff --git a/js/twister_following.js b/js/twister_following.js index 5d42604..8c3580e 100644 --- a/js/twister_following.js +++ b/js/twister_following.js @@ -353,6 +353,8 @@ function updateFollowing(cbFunc, cbArg) { function follow(user, publicFollow, cbFunc, cbArg) { if( followingUsers.indexOf(user) < 0 ) { followingUsers.push(user); + twisterFollowingO.update(user); + $(window).trigger("eventFollow", user) } if( publicFollow == undefined || publicFollow ) _isFollowPublic[user] = true; @@ -367,6 +369,7 @@ function unfollow(user, cbFunc, cbArg) { if( i >= 0 ) { followingUsers.splice(i,1); twisterFollowingO.update(user); + $(window).trigger("eventUnfollow", user) } delete _isFollowPublic[user]; saveFollowing(); @@ -570,8 +573,7 @@ function processSuggestion(arg, suggestion, followedBy) { function closeSearchDialog() { - var $this = $(".userMenu-search-field");//$( this ); - $( this ).siblings().slideUp( "fast" ); + $(".userMenu-search-field").siblings().slideUp( "fast" ); removeUsersFromDhtgetQueue( _lastSearchUsersResults ); _lastSearchUsersResults = []; } @@ -654,6 +656,8 @@ function processDropdownUserResults(partialName, results){ resItem.find("a.open-profile-modal").attr("href",$.MAL.userUrl(results[i])); getAvatar(results[i],resItem.find(".mini-profile-photo")); getFullname(results[i],resItem.find(".mini-profile-name")); + if (followingUsers.indexOf(results[i]) >= 0) + toggleFollowButton(resItem.find(".follow"), results[i]); resItem.appendTo(typeaheadAccounts); } @@ -678,10 +682,15 @@ function userClickFollow(e) { e.stopPropagation(); e.preventDefault(); + var followingInitiator = $(".followingInitiator"); + if (followingInitiator) + followingInitiator.removeClass("followingInitiator"); + $(e.target).addClass("followingInitiator"); + var $this = $(this); var $userInfo = $this.closest("[data-screen-name]"); var username = $userInfo.attr("data-screen-name"); - + if(!defaultScreenName) { alert(polyglot.t("You have to log in to follow users.")); @@ -702,7 +711,7 @@ function initUserSearch() { var $userSearchField = $( ".userMenu-search-field" ); $userSearchField.keyup( userSearchKeypress ); $userSearchField.bind( "click", userSearchKeypress ); - $userSearchField.clickoutside( closeSearchDialog ); + $(".userMenu-search").clickoutside( closeSearchDialog ); $("button.follow").bind( "click", userClickFollow ); @@ -710,7 +719,7 @@ function initUserSearch() { $(".following-config-method-buttons .public-following").click( function() { closePrompt(); // delay reload so dhtput may do it's job - window.setTimeout("loadModalFromHash();",500); + window.setTimeout("loadModalFromHash();",500); }); } @@ -721,9 +730,7 @@ function followingListUnfollow(e) { var $this = $(this); var username = $this.closest(".mini-profile-info").attr("data-screen-name"); - unfollow(username, function() { - showFollowingUsers(); - }); + unfollow(username); } function followingListPublicCheckbox(e) { @@ -754,9 +761,14 @@ function setFollowingMethod(e) { if( !$this.hasClass("private") ) { publicFollow = true; } - //console.log("start following @" +username +" by method "+publicFollow); - follow(username, publicFollow); + follow(username, publicFollow, + (function() { + var followingInitiator = $(".followingInitiator"); + if (followingInitiator) + toggleFollowButton(followingInitiator, this); + }).bind(username) + ); } @@ -829,6 +841,16 @@ function initInterfaceFollowing() { initMentionsCount(); initDMsCount(); }); + + $(window) + .on("eventFollow", function(e, user) { + $(".following-count").text(followingUsers.length-1); + showFollowingUsers(); + }) + .on("eventUnfollow", function(e, user) { + $(".following-count").text(followingUsers.length-1); + showFollowingUsers(); + }); } diff --git a/js/twister_newmsgs.js b/js/twister_newmsgs.js index a078e31..9b499db 100644 --- a/js/twister_newmsgs.js +++ b/js/twister_newmsgs.js @@ -101,7 +101,7 @@ function requestMentionsCount() { $.MAL.soundNotifyMentions(); if ($.Options.getShowDesktopNotifMentionsOpt() === 'enable') { - $.MAL.showDesktopNotif(false, polyglot.t('You got')+' '+polyglot.t('new_mentions', _newMentions)+'.', false,'twister_notification_new_mentions', $.Options.getShowDesktopNotifMentionsTimerOpt(), openMentionsModal, false) + $.MAL.showDesktopNotif(false, polyglot.t('You got')+' '+polyglot.t('new_mentions', _newMentions)+'.', false,'twister_notification_new_mentions', $.Options.getShowDesktopNotifMentionsTimerOpt(), function(){$.MAL.showMentions(defaultScreenName)}, false) } } @@ -115,9 +115,7 @@ function requestMentionsCount() { $.MAL.soundNotifyDM(); if ($.Options.getShowDesktopNotifDMsOpt() === 'enable') { - $.MAL.showDesktopNotif(false, polyglot.t('You got')+' '+polyglot.t('new_direct_messages', newDMs)+'.', false, 'twister_notification_new_DMs', $.Options.getShowDesktopNotifDMsTimerOpt(), function() { - window.location.hash = '#directmessages'; - }, false) + $.MAL.showDesktopNotif(false, polyglot.t('You got')+' '+polyglot.t('new_direct_messages', newDMs)+'.', false, 'twister_notification_new_DMs', $.Options.getShowDesktopNotifDMsTimerOpt(), function(){$.MAL.showDMchat()}, false) } } } diff --git a/theme_calm/css/style.css b/theme_calm/css/style.css index 4546742..f633c7c 100644 --- a/theme_calm/css/style.css +++ b/theme_calm/css/style.css @@ -920,17 +920,18 @@ textarea.splited-post { opacity: 1; text-decoration: none; } -.follow -{ + +.follow, .unfollow { background: none; border: solid 1px rgba( 0, 0, 0 ,.2 ); padding: 3px 15px; color: rgba( 0, 0, 0 ,.4 ); } -.follow:hover -{ + +.follow:hover, .unfollow:hover { color: rgba( 0, 0, 0 ,.7 ); } + .refresh-users, .view-all-users { @@ -1648,7 +1649,7 @@ textarea.splited-post { .prompt-wrapper { - position: absolute; + position: fixed; top: 50%; left: 50%; background: rgba( 255, 255,255, 1.0 ); @@ -1658,8 +1659,9 @@ textarea.splited-post { margin-left:-300px; } - - +.prompt-wrapper .modal-header h3{ + background: #7691CE; +} /************************************* **************************** POPUP MODAL @@ -1698,7 +1700,7 @@ textarea.splited-post { { padding: 5px; font-weight: bold; - background: #43464d; + background: #7691CE; color: #fff; } .modal-close diff --git a/theme_nin/css/style.css b/theme_nin/css/style.css index bca39aa..faa067d 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -121,13 +121,13 @@ /* '' */ /* line 120, ../sass/_fonts.sass */ -.icon-plus:before, .mini-profile-actions span:before, ul.userMenu-search-profiles button:before { +.icon-plus:before, .mini-profile-actions span:before, ul.userMenu-search-profiles button.follow:before { content: ""; } /* '' */ /* line 125, ../sass/_fonts.sass */ -.icon-minus:before { +.icon-minus:before, ul.userMenu-search-profiles button.unfollow:before { content: ""; } @@ -1855,10 +1855,13 @@ ul.userMenu-search-profiles .mini-profile-info { float: none; } /* line 119, ../sass/style.sass */ -ul.userMenu-search-profiles button, ul.userMenu-search-profiles .mini-profile-actions span, .mini-profile-actions ul.userMenu-search-profiles span { +ul.userMenu-search-profiles button.unfollow, ul.userMenu-search-profiles .mini-profile-actions span, .mini-profile-actions ul.userMenu-search-profiles span { background-color: #66686B; padding: 3px; } +ul.userMenu-search-profiles button { + padding: 3px; +} /* line 124, ../sass/style.sass */ ul.userMenu-search-profiles button:after, ul.userMenu-search-profiles .mini-profile-actions span:after, .mini-profile-actions ul.userMenu-search-profiles span:after { content: ""; @@ -2315,15 +2318,23 @@ textarea.splited-post { opacity: 1; } -/* line 491, ../sass/style.sass */ -button.follow, .mini-profile-actions span.follow { +/* line 127, ../sass/style.sass */ +ul.userMenu-search-profiles .follow, ul.userMenu-search-profiles .unfollow, .follow-suggestions .follow, .follow-suggestions .unfollow { position: absolute; bottom: 10px; right: 10px; +} + +ul.userMenu-search-profiles .follow, .follow-suggestions .follow { background: #B4C669; } + +ul.userMenu-search-profiles .unfollow, .follow-suggestions .unfollow { + background-color: #66686B; +} + /* line 496, ../sass/style.sass */ -button.follow:hover, .mini-profile-actions span.follow:hover { +button.follow:hover, .mini-profile-actions span.follow:hover, button.unfollow, .mini-profile-actions span.unfollow { background: #aaa; } diff --git a/theme_nin/js/theme_option.js b/theme_nin/js/theme_option.js index 563b394..2f4d1dc 100644 --- a/theme_nin/js/theme_option.js +++ b/theme_nin/js/theme_option.js @@ -1,5 +1,5 @@ -$(function(){ - +$(function(){ + $('.modal-close').html(''); $('.modal-back').html(''); $('.twister-user-remove').html(''); @@ -13,7 +13,7 @@ $(function(){ }); - $( '.userMenu-home.current a' ).on( 'click', function() { + $( '.userMenu-home.current a' ).on( 'click', function() { $('html, body').animate({scrollTop:0},300); return false }); @@ -34,10 +34,17 @@ $(function(){ posScroll = $(document).scrollTop(); if(posScroll >= 250) $('.left .post-area-new').slideDown(300); - else + else $('.left .post-area-new').slideUp(150); - }); + }); + $(".userMenu-search-profiles .follow") + .on("toggleFollow", function() { + $(this).text('').attr('title', polyglot.t('Follow')); + }) + .on("toggleUnfollow", function() { + $(this).text('').attr('title', polyglot.t('Unfollow')); + }); }); diff --git a/theme_nin/sass/style.sass b/theme_nin/sass/style.sass index 10adcf1..cd796fa 100755 --- a/theme_nin/sass/style.sass +++ b/theme_nin/sass/style.sass @@ -117,13 +117,23 @@ ul.userMenu-search-profiles float: none button - background-color: $main-color-dark padding: 3px @extend .extend-icon - @extend .icon-plus &:after content: '' font-family: $symbol-font-family + .follow .unfollow + position: absolute + bottom: 10px + right: 10px + &:hover + background-color: $main-color-light + .follow + background-color: $main-color-color + @extend .icon-plus + .unfollow + background-color: $main-color-dark + @extend .icon-minus .userMenu-search input[type="text"] @@ -141,6 +151,19 @@ ul.userMenu-search-profiles clear: both +.follow-suggestions + button + .follow .unfollow + position: absolute + bottom: 10px + right: 10px + &:hover + background-color: $main-color-light + .follow + background-color: $main-color-color + .unfollow + background-color: $main-color-dark + /***************** MINI PROFILE *******************************/ @@ -488,14 +511,6 @@ textarea.splited-post .twister-user-remove:hover opacity: 1 -button.follow - position: absolute - bottom: 10px - right: 10px - background: $main-color-color - &:hover - background: $main-color-light - .refresh-users @extend .icon-arrows @extend .extend-icon diff --git a/tmobile.html b/tmobile.html index f5d66a1..2a7baa9 100644 --- a/tmobile.html +++ b/tmobile.html @@ -28,6 +28,7 @@ +