Browse Source

implemented hasscheme for who-to-follow, added additional popuplayer called prompt and moved retwist reply and following-config from the modal to the prompt

master
Julian Steinwachs 10 years ago
parent
commit
12ec501d8d
  1. 16
      home.html
  2. 86
      js/interface_common.js
  3. 4
      js/twister_following.js

16
home.html

@ -157,7 +157,7 @@
<small>.</small> <small>.</small>
<a class="refresh-users">Refresh</a> <a class="refresh-users">Refresh</a>
<small>.</small> <small>.</small>
<a class="view-all-users">View All</a> <a class="view-all-users" href="#whotofollow">View All</a>
<ol class="follow-suggestions"> <ol class="follow-suggestions">
<!-- use "follow-suggestion-template" here --> <!-- use "follow-suggestion-template" here -->
</ol> </ol>
@ -342,6 +342,20 @@
</div> </div>
<!-- TEMPLATE DO MODAL GENÉRICO END --> <!-- TEMPLATE DO MODAL GENÉRICO END -->
<!-- TEMPLATE GENERAL PROMPT -->
<div class="prompt-wrapper" style="position: absolute; top: 50%; left: 50%; background: rgba( 255, 255,255, 1.0 ); box-shadow: 0 0 30px rgba( 0, 0, 0, .6 ); z-index: 5; width: 600px; margin-left:-300px;">
<div class="modal-header">
<h3></h3>
<span class="modal-close prompt-close">&times;</span>
</div>
<div class="modal-content"></div>
<div class="modal-buttons">
<button class="modal-cancel prompt-close">Cancel</button>
<button class="modal-propagate">Retransmit</button>
</div>
</div>
<!-- TEMPLATE GENERAL PROMPT END-->
<!-- MODAL DE RETWEET INIT --> <!-- MODAL DE RETWEET INIT -->
<!-- MODAL DE RETWEET END --> <!-- MODAL DE RETWEET END -->

86
js/interface_common.js

@ -32,7 +32,7 @@ function openModal( modalClass )
function closeModal($this) function closeModal($this)
{ {
closeModalHandler($this); closeModalHandler($this);
window.location.hash = ''; window.location.hash = '#';
} }
function closeModalHandler($this) function closeModalHandler($this)
@ -50,6 +50,45 @@ function closeModalHandler($this)
}); });
} }
function openPrompt( modalClass )
{
var $oldModal = $("body").children(".prompt-wrapper");
var $template = $( "#templates" );
var $templateModal = $template.find( ".prompt-wrapper" ).clone(true);
$templateModal.addClass( modalClass );
if( $oldModal.length ) {
$templateModal.show();
$oldModal.replaceWith($templateModal);
} else {
$templateModal.prependTo( "body" ).fadeIn( "fast" );
}
//escondo o overflow da tela
var $body = $( "body" );
$body.css({
"overflow": "hidden"
});
}
function closePrompt()
{
var $body = $( "body" );
var $modalWindows = $( "body" ).children( ".prompt-wrapper" );
$modalWindows.fadeOut( "fast", function()
{
$modalWindows.detach();
});
$body.css({
"overflow": "auto",
"margin-right": "0"
});
}
function checkNetworkStatusAndAskRedirect(cbFunc, cbArg) { function checkNetworkStatusAndAskRedirect(cbFunc, cbArg) {
networkUpdate(function(args) { networkUpdate(function(args) {
if( !twisterdConnectedAndUptodate ) { if( !twisterdConnectedAndUptodate ) {
@ -305,9 +344,7 @@ function fillWhoToFollowModal(list, hlist, start) {
return true; return true;
} }
function openWhoToFollowModal(e) { function openWhoToFollowModal() {
e.stopPropagation();
e.preventDefault();
var whoToFollowModalClass = "who-to-follow-modal"; var whoToFollowModalClass = "who-to-follow-modal";
openModal( whoToFollowModalClass ); openModal( whoToFollowModalClass );
@ -371,9 +408,12 @@ function watchHashChange(e)
prevhashstring=prevhashstring[1]; prevhashstring=prevhashstring[1];
if(prevhashstring.length>0 && prevhashstring!=undefined){ if(prevhashstring.length>0 && prevhashstring!=undefined){
$('.modal-back').css('display','inline'); $('.modal-back').css('display','inline');
$('.modal-back').on('click', function(){ $('.modal-back').on('click', function(e){
window.location.hash = '#' + prevhashstring; e.preventDefault();
history.back(1);
}); });
} else {
$('.modal-back').css('display','none');
} }
} }
@ -397,7 +437,9 @@ function watchHashChange(e)
} }
} else if (hashstring == '#directmessages') { } else if (hashstring == '#directmessages') {
directMessagesPopup(); directMessagesPopup();
} else { } else if (hashstring == '#whotofollow'){
openWhoToFollowModal();
} else{
console.log(hashstring); console.log(hashstring);
closeModalHandler(); closeModalHandler();
} }
@ -417,7 +459,8 @@ function initHashWatching()
// Register hash spy and launch it once // Register hash spy and launch it once
window.addEventListener('hashchange', watchHashChange, false); window.addEventListener('hashchange', watchHashChange, false);
watchHashChange(null); //watchHashChange(null);
window.location.hash="#";
} }
@ -435,7 +478,7 @@ var reTwistPopup = function( e )
} }
var reTwistClass = "reTwist"; var reTwistClass = "reTwist";
openModal( reTwistClass ); openPrompt( reTwistClass );
//título do modal //título do modal
$( ".reTwist h3" ).text( polyglot.t("retransmit_this") ); $( ".reTwist h3" ).text( polyglot.t("retransmit_this") );
@ -451,7 +494,7 @@ var reTwistPopup = function( e )
var replyInitPopup = function(e, post) var replyInitPopup = function(e, post)
{ {
var replyClass = "reply"; var replyClass = "reply";
openModal( replyClass ); openPrompt( replyClass );
//título do modal //título do modal
var fullname = post.find(".post-info-name").text(); var fullname = post.find(".post-info-name").text();
@ -1251,7 +1294,13 @@ var postSubmit = function(e, oldLastPostId)
var remainingCount = tweetForm.find(".post-area-remaining"); var remainingCount = tweetForm.find(".post-area-remaining");
remainingCount.text(140); remainingCount.text(140);
$replyText.attr("placeholder", "Your message was sent!"); $replyText.attr("placeholder", "Your message was sent!");
closeModal($this);
if ($this.parents('.modal-wrapper').length) {
closeModal($this);
} else if ($this.parents('.prompt-wrapper').length) {
closePrompt();
}
if($this.closest('.post-area,.post-reply-content')){ if($this.closest('.post-area,.post-reply-content')){
$('.post-area-new').removeClass('open').find('textarea').blur(); $('.post-area-new').removeClass('open').find('textarea').blur();
}; };
@ -1267,11 +1316,11 @@ var retweetSubmit = function(e)
e.preventDefault(); e.preventDefault();
var $this = $( this ); var $this = $( this );
var $postOrig = $this.closest(".modal-wrapper").find(".post-data"); var $postOrig = $this.closest(".prompt-wrapper").find(".post-data");
newRtMsg($postOrig); newRtMsg($postOrig);
closeModal($this); closePrompt();
} }
function changeStyle() { function changeStyle() {
@ -1347,13 +1396,14 @@ function replaceDashboards() {
} }
$( ".who-to-follow .refresh-users" ).bind( "click", refreshWhoToFollow ); $( ".who-to-follow .refresh-users" ).bind( "click", refreshWhoToFollow );
$( ".who-to-follow .view-all-users" ).bind( "click", openWhoToFollowModal ); //$( ".who-to-follow .view-all-users" ).bind( "click", function(){window.location.hash = "#whotofollow"} );
} }
function initInterfaceCommon() { function initInterfaceCommon() {
$( "body" ).on( "click", function(event) { $( "body" ).on( "click", function(event) {
if($(event.target).hasClass('cancel')) closeModal($(this)); if($(event.target).hasClass('cancel')) closeModal($(this));
}); });
$(".cancel").on('click', function(event){ $(".cancel").on('click', function(event){
if(!$(event.target).hasClass("cancel")) return; if(!$(event.target).hasClass("cancel")) return;
if($(".modal-content").attr("style") != undefined){$(".modal-content").removeAttr("style")}; if($(".modal-content").attr("style") != undefined){$(".modal-content").removeAttr("style")};
@ -1361,6 +1411,10 @@ function initInterfaceCommon() {
$('.mark-all-as-read').css('display', 'none'); $('.mark-all-as-read').css('display', 'none');
}); });
$(".prompt-close").on('click', function(event){
closePrompt();
});
/* /*
$('.modal-back').on('click', function(){ $('.modal-back').on('click', function(){
if($('.modal-content .direct-messages-list')[0]) return; if($('.modal-content .direct-messages-list')[0]) return;
@ -1397,10 +1451,10 @@ function initInterfaceCommon() {
var $replyText = $( ".post-area-new textarea" ); var $replyText = $( ".post-area-new textarea" );
$replyText.on("keyup", replyTextKeypress ); $replyText.on("keyup", replyTextKeypress );
$( ".open-profile-modal").bind( "click", openProfileModal ); //$( ".open-profile-modal").bind( "click", openProfileModal );
//$( ".open-hashtag-modal").bind( "click", openHashtagModal ); //$( ".open-hashtag-modal").bind( "click", openHashtagModal );
//$( ".open-following-modal").bind( "click", openFollowingModal ); //$( ".open-following-modal").bind( "click", openFollowingModal );
$( ".userMenu-connections a").bind( "click", openMentionsModal ); //$( ".userMenu-connections a").bind( "click", openMentionsModal );
$( ".mentions-from-user").bind( "click", openMentionsModal ); $( ".mentions-from-user").bind( "click", openMentionsModal );
replaceDashboards(); replaceDashboards();

4
js/twister_following.js

@ -690,7 +690,7 @@ function userClickFollow(e) {
} }
var FollowingConfigClass = "following-config-modal"; var FollowingConfigClass = "following-config-modal";
openModal( FollowingConfigClass ); openPrompt( FollowingConfigClass );
var FollowingConfigContent = newFollowingConfigModal(username); var FollowingConfigContent = newFollowingConfigModal(username);
FollowingConfigContent.appendTo("." +FollowingConfigClass +" .modal-content"); FollowingConfigContent.appendTo("." +FollowingConfigClass +" .modal-content");
@ -709,7 +709,7 @@ function initUserSearch() {
$(".following-config-method-buttons .public-following").bind( "click", setFollowingMethod ); $(".following-config-method-buttons .public-following").bind( "click", setFollowingMethod );
$(".following-config-method-buttons .public-following").click( function() { $(".following-config-method-buttons .public-following").click( function() {
closeModal($(this)); closePrompt();
// delay reload so dhtput may do it's job // delay reload so dhtput may do it's job
window.setTimeout("location.reload();",500); window.setTimeout("location.reload();",500);
}); });

Loading…
Cancel
Save