can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r19329: LJSUP-9091: Sort by poster in friends pa...

Committer: dpetrov
LJSUP-9091: Sort by poster in friends page
U   trunk/htdocs/js/contextualhover.js
Modified: trunk/htdocs/js/contextualhover.js
===================================================================
--- trunk/htdocs/js/contextualhover.js	2011-06-21 01:31:29 UTC (rev 19328)
+++ trunk/htdocs/js/contextualhover.js	2011-06-21 02:30:18 UTC (rev 19329)
@@ -176,6 +176,10 @@
 			} else {
 				continue;
 			}
+
+			if (parent.parentNode.getAttribute('data-journal')) {
+				ljuser.posted_in = parent.parentNode.getAttribute('data-journal');
+			}
 			DOM.addClassName(ljuser, 'ContextualPopup');
 		}
 		
@@ -186,6 +190,9 @@
 			ljuser = ljusers[i];
 			if (ljuser.src.match(rex_userpic)) {
 				ljuser.up_url = ljuser.src;
+				if (ljuser.parentNode.getAttribute('data-journal')) {
+					ljuser.posted_in = ljuser.parentNode.getAttribute('data-journal');
+				}
 				DOM.addClassName(ljuser, 'ContextualPopup');
 			}
 		}
@@ -524,13 +531,13 @@
 		content.appendChild(document.createElement('br'));
 	}
 
-	if( !data.is_comm && Site.current_journal && ( "is_comm" in Site.current_journal ) 
-				&& Site.current_journal.is_comm === "1" ) {
+	if( ( !data.is_comm && Site.current_journal && ( "is_comm" in Site.current_journal ) 
+				&& Site.current_journal.is_comm === "1" ) || data.posted_in ) {
 		jQuery( '<a/>', {
-			href: Site.current_journal.url_journal + '/?poster=' + data.username,
-			text: ( Site.remoteUser === data.username ) 
-                    ? ( data.ml_filter_by_poster_me || 'Filter community by me' ) 
-                    : ( data.ml_filter_by_poster || 'Filter community by poster' )
+			href: ( ( data.posted_in ) ? data.posted_in : Site.current_journal.url_journal ) + '/?poster=' + data.username,
+			text: ( Site.remoteUser === data.username && !data.posted_in ) 
+					? ( data.ml_filter_by_poster_me || 'Filter community by me' ) 
+					: ( data.ml_filter_by_poster || 'Filter community by poster' )
 		} )
 		.appendTo(content);
 		content.appendChild(document.createElement('br'));
@@ -737,6 +744,10 @@
 				t.showNote(data.error, target);
 				return;
 			}
+
+			if( target.posted_in ) {
+				data.posted_in = target.posted_in;
+			}
 			
 			t.cachedResults[String(data.userid)] =
 			t.cachedResults[data.username] =

Tags: can3p, js, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments