From 04b0d8f636805733dab3dd36b4f3a56f74126676 Mon Sep 17 00:00:00 2001 From: Julian Steinwachs Date: Wed, 21 Jan 2015 12:10:04 +0100 Subject: [PATCH] still experimenting --- js/interface_common.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/js/interface_common.js b/js/interface_common.js index cddb7e6..397e9c6 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -386,21 +386,44 @@ function watchHashChange(e) var hashstring = window.location.hash hashstring = decodeURIComponent(hashstring); + if(e!=null){ + //console.log(e.oldURL); + var prevhashstring = e.oldURL.split('#'); + prevhashstring=prevhashstring[1]; + //console.log(prevhashstring); + //var prevhashdata = prevhashstring.match(/(hashtag|profile|mentions)\?(?:user|hashtag)=(.+)/); + //console.log(prevhashdata); + + + if(prevhashstring.length>0){ + $('.modal-back').css('display','inline'); + $('.modal-back').on('click', function(){ + window.location.hash = '#' + prevhashstring; + }); + } + + } + var hashdata = hashstring.split(':'); if (hashdata[0] != '#web+twister') { - hashdata = hashstring.match(/(hashtag|profile|mentions)\?(?:user|hashtag)=(.+)/); + hashdata = hashstring.match(/(hashtag|profile|mentions|directmessages)\?(?:user|hashtag)=(.+)/); } + //console.log(hashdata); - if (hashdata && hashdata[1] != undefined && hashdata[2] != undefined) - { + if (hashdata && hashdata[1] != undefined && hashdata[2] != undefined) { if(hashdata[1] == 'profile') { openProfileModalWithUsernameHandler(hashdata[2]); }else if (hashdata[1] == 'hashtag') { openHashtagModalFromSearchHandler(hashdata[2]); }else if (hashdata[1] == 'mentions') { openMentionsModalHandler(hashdata[2]); + }else if (hashdata[1] == 'directmessages') { + openDmWithUserModal(hashdata[2]); } + } else if (hashstring == '#directmessages') { + directMessagesPopup(); } else { + console.log(hashstring); closeModalHandler(); } } @@ -1362,11 +1385,15 @@ function initInterfaceCommon() { $('.modal-back').css('display', 'none'); $('.mark-all-as-read').css('display', 'none'); }); + + /* $('.modal-back').on('click', function(){ if($('.modal-content .direct-messages-list')[0]) return; directMessagesPopup(); $(".modal-content").removeAttr("style"); }); + */ + $('.dropdown-menu').on('keydown', function(e){ e = event || window.event; e.stopPropagation();