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 @@ @@ -157,7 +157,7 @@
<small>.</small>
<a class="refresh-users">Refresh</a>
<small>.</small>
<a class="view-all-users">View All</a>
<a class="view-all-users" href="#whotofollow">View All</a>
<ol class="follow-suggestions">
<!-- use "follow-suggestion-template" here -->
</ol>
@ -342,6 +342,20 @@ @@ -342,6 +342,20 @@
</div>
<!-- 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 END -->

86
js/interface_common.js

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

4
js/twister_following.js

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

Loading…
Cancel
Save