From ac59448db08a979f7fbaf33cc5610138b3722905 Mon Sep 17 00:00:00 2001 From: Simon Grim Date: Thu, 5 Mar 2015 21:40:52 +0500 Subject: [PATCH] prompt template to following, follow-unfollow window events and listeners, MAL.showMentions and MAL.showDMchat, notify.js to tmobile --- following.html | 14 +++++++++++++ js/interface_common.js | 20 ++++++------------- js/interface_home.js | 11 ++++++++--- js/mobile_abstract.js | 38 +++++++++++++++++++++++++++++++++++- js/twister_following.js | 19 ++++++++++++------ js/twister_newmsgs.js | 16 ++------------- theme_nin/css/style.css | 12 ++++++++++-- theme_nin/js/theme_option.js | 17 +++++++++++----- theme_nin/sass/style.sass | 35 +++++++++++++++++++++++---------- tmobile.html | 1 + 10 files changed, 128 insertions(+), 55 deletions(-) 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 9a8b379..7b108ee 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -574,23 +574,15 @@ function toggleFollowButton(button, followingUser) { .removeClass("unfollow") .addClass("follow") .unbind("click") - .bind("click", userClickFollow); - - if ($.Options.getTheme() === 'nin') { - this.attr('title', polyglot.t('Follow')); - } else { - this.text(polyglot.t('Follow')); - } + .bind("click", userClickFollow) + .text(polyglot.t('Follow')) + .trigger("toggleFollow"); }).bind($(e.target)) ); }).bind(followingUser) - ); - - if ($.Options.getTheme() === 'nin') { - button.attr('title', polyglot.t('Unfollow')); - } else { - button.text(polyglot.t('Unfollow')); - } + ) + .text(polyglot.t('Unfollow')) + .trigger("toggleUnfollow"); } var postExpandFunction = function( e, postLi ) 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/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 d47affc..8c3580e 100644 --- a/js/twister_following.js +++ b/js/twister_following.js @@ -354,8 +354,7 @@ function follow(user, publicFollow, cbFunc, cbArg) { if( followingUsers.indexOf(user) < 0 ) { followingUsers.push(user); twisterFollowingO.update(user); - $(".following-count").text(followingUsers.length-1); - setTimeout('requestTimelineUpdate("latest",postsPerRefresh,["'+user+'"],promotedPostsOnly)', 1000); + $(window).trigger("eventFollow", user) } if( publicFollow == undefined || publicFollow ) _isFollowPublic[user] = true; @@ -370,7 +369,7 @@ function unfollow(user, cbFunc, cbArg) { if( i >= 0 ) { followingUsers.splice(i,1); twisterFollowingO.update(user); - $(".following-count").text(followingUsers.length-1); + $(window).trigger("eventUnfollow", user) } delete _isFollowPublic[user]; saveFollowing(); @@ -731,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) { @@ -844,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 fe753e8..9b499db 100644 --- a/js/twister_newmsgs.js +++ b/js/twister_newmsgs.js @@ -101,13 +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(), function() { - if (window.location.pathname === '/home.html' || window.location.pathname === '/following.html' ) { - openMentionsModal(); - } else { - window.location.href = '/home.html#mentions?user='+defaultScreenName; - } - }, 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) } } @@ -121,13 +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() { - if (window.location.pathname === '/home.html' || window.location.pathname === '/following.html' ) { - window.location.hash = '#directmessages'; - } else { - window.location.href = '/home.html#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_nin/css/style.css b/theme_nin/css/style.css index 3984080..faa067d 100644 --- a/theme_nin/css/style.css +++ b/theme_nin/css/style.css @@ -2318,13 +2318,21 @@ textarea.splited-post { opacity: 1; } -/* line 491, ../sass/style.sass */ -button.follow, .mini-profile-actions span.follow, button.unfollow, .mini-profile-actions span.unfollow { +/* 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.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 @@ +