Browse Source

switch to home page when clicking on notify, watch hash on loading, return scrolling after modal, primary-btn-only expand

master
Simon Grim 10 years ago
parent
commit
baf1060030
  1. 12
      js/interface_common.js
  2. 12
      js/twister_newmsgs.js

12
js/interface_common.js

@ -5,8 +5,11 @@
// Profile, mentions and hashtag modal // Profile, mentions and hashtag modal
// Post actions: submit, count characters // Post actions: submit, count characters
var window_scrollY = 0;
//dispara o modal genérico //dispara o modal genérico
//o modalClass me permite fazer tratamentos específicos de CSS para cada modal //o modalClass me permite fazer tratamentos específicos de CSS para cada modal
function openModal( modalClass ) function openModal( modalClass )
{ {
var $oldModal = $("body").children(".modal-blackout"); var $oldModal = $("body").children(".modal-blackout");
@ -26,6 +29,8 @@ function openModal( modalClass )
$body.css({ $body.css({
"overflow": "hidden" "overflow": "hidden"
}); });
window_scrollY = window.pageYOffset;
} }
//fecha o modal removendo o conteúdo por detach //fecha o modal removendo o conteúdo por detach
@ -33,6 +38,7 @@ function closeModal($this)
{ {
closeModalHandler($this); closeModalHandler($this);
window.location.hash = '#'; window.location.hash = '#';
window.scroll(window.pageXOffset, window_scrollY);
} }
function closeModalHandler($this) function closeModalHandler($this)
@ -479,8 +485,7 @@ 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); setTimeout(function(){ watchHashChange() }, 1000);
window.location.hash="#";
} }
@ -1454,7 +1459,8 @@ function initInterfaceCommon() {
$( ".userMenu-config-dropdown" ).bind( "click", dropDownMenu ); $( ".userMenu-config-dropdown" ).bind( "click", dropDownMenu );
$( ".config-menu" ).clickoutside( closeThis ); $( ".config-menu" ).clickoutside( closeThis );
$( ".module.post" ).bind( "click", function(e) { $( ".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) { $( ".post-area-new" ).bind( "click", function(e) {
composeNewPost(e,$(this));} ); composeNewPost(e,$(this));} );
$( ".post-area-new" ).clickoutside( unfocusThis ); $( ".post-area-new" ).clickoutside( unfocusThis );

12
js/twister_newmsgs.js

@ -101,7 +101,13 @@ function requestMentionsCount() {
$.MAL.soundNotifyMentions(); $.MAL.soundNotifyMentions();
if ($.Options.getShowDesktopNotifMentionsOpt() === 'enable') { 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() {
if (window.location.pathname === '/home.html' || window.location.pathname === '/following.html' ) {
openMentionsModal();
} else {
window.location.href = '/home.html#mentions?user='+defaultScreenName;
}
}, false)
} }
} }
@ -116,7 +122,11 @@ function requestMentionsCount() {
if ($.Options.getShowDesktopNotifDMsOpt() === 'enable') { 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() { $.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'; window.location.hash = '#directmessages';
} else {
window.location.href = '/home.html#directmessages';
}
}, false) }, false)
} }
} }

Loading…
Cancel
Save