Browse Source

First try around hashchange monitoring

master
Étienne Deparis 10 years ago
parent
commit
7ed9b8b84f
  1. 16
      js/interface_common.js
  2. 2
      js/interface_home.js

16
js/interface_common.js

@ -103,7 +103,12 @@ function openProfileModal(e) @@ -103,7 +103,12 @@ function openProfileModal(e)
var $this = $( this );
var username = $.MAL.urlToUser( $this.attr("href") );
openProfileModalWithUsername(username);
}
function openProfileModalWithUsername(username)
{
if(!username)
{
alert(polyglot.t("You don't have any profile because you are not logged in."));
@ -354,6 +359,17 @@ function openConversationModal(e) @@ -354,6 +359,17 @@ function openConversationModal(e)
$( "." + conversationModalClass + " h3" ).text( polyglot.t('conversation_title', {'username': postLi.find('.post-data').attr('data-screen-name')}) );
}
function watchHashChange(e){
if(/user=(.+)/.test(window.location.hash))
{
var username = location.hash.match(/user=(.+)/);
if(username[1] != undefined)
openProfileModalWithUsername(username[1]);
}
}
//
// Post actions, submit, count characters
// --------------------------------------

2
js/interface_home.js

@ -163,6 +163,7 @@ var InterfaceFunctions = function() @@ -163,6 +163,7 @@ var InterfaceFunctions = function()
var interfaceFunctions = new InterfaceFunctions;
$( document ).ready( interfaceFunctions.init );
$( window ).resize(replaceDashboards);
window.addEventListener('hashchange', watchHashChange, false);
//função no window que fixa o header das postagens
function fixDiv()
@ -174,4 +175,3 @@ function fixDiv() @@ -174,4 +175,3 @@ function fixDiv()
$cache.removeClass( "fixed" );
}
$(window).scroll(fixDiv);

Loading…
Cancel
Save