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. 14
      js/twister_newmsgs.js

12
js/interface_common.js

@ -5,8 +5,11 @@ @@ -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 ) @@ -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) @@ -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() @@ -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);
}
@ -1454,7 +1459,8 @@ function initInterfaceCommon() { @@ -1454,7 +1459,8 @@ function initInterfaceCommon() {
$( ".userMenu-config-dropdown" ).bind( "click", dropDownMenu );
$( ".config-menu" ).clickoutside( closeThis );
$( ".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 );

14
js/twister_newmsgs.js

@ -101,7 +101,13 @@ function requestMentionsCount() { @@ -101,7 +101,13 @@ 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() {
if (window.location.pathname === '/home.html' || window.location.pathname === '/following.html' ) {
openMentionsModal();
} else {
window.location.href = '/home.html#mentions?user='+defaultScreenName;
}
}, false)
}
}
@ -116,8 +122,12 @@ function requestMentionsCount() { @@ -116,8 +122,12 @@ function requestMentionsCount() {
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';
}, false)
} else {
window.location.href = '/home.html#directmessages';
}
}, false)
}
}
}

Loading…
Cancel
Save