Pages:
Author

Topic: Identifying the linked-to post in a topic (SMF patch) - page 3. (Read 916 times)

legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Normally, the (optional) fragment identifier at the end of the URL (#msg60743 in the example link) suffices to position the viewport so that the linked-to post is obvious/unambiguous. But, sometimes that mechanism isn't precise enough, like when the post is the last or second-to-last one on its page
When images without height/width tags load, the page "jumps" a bit, which makes the post I'm looking for not the first one that shows even if it's in the middle of a long page.

Quote
I also sometimes lose track of the linked-to post when I scroll around the page for a bit to get some context before reading the actual post (then, I find myself going to the address bar and hitting Enter so that the browser snaps to the right post again).
I do that too Tongue

Quote
LoyceV and TryNinja would probably appreciate some notice before you merge it
I have so many (old) scrapers, I can't tell if this is going to break something. I'll just see when it happens.



I think your changes are too subtle to quickly identify the post I'm looking for.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
PowerGlove, you seem to know a lot about the custom SMF front end, so let me ask you a question:

When you open the HTML source of this page for example, there are a bunch of "shadow" posts under the OP. These are invisible posts that have the same HTML structure as real posts, but they don't have anything inside them. There is usually a random amount of these displayed, anywhere from one to three. So what is the deal with that, and where do they come from?
sr. member
Activity: 602
Merit: 387
Rollbit is for you. Take $RLB token!
I read your description many times to understand problems in this context and I faced with indexing problem after clicking on a link too. I see your solution is good but I also see you mentioned about issue for moderator when handling report.

I propose you to code a SMF patch, together with this one or another one, to quote a linked post. So with that patch, we will have two things like

- Linked-to post like this patch.
- A quote of that post.

If I am a moderator, and receive a report, with a post link, I will get its link and if possible, a quoted content of that reported post.
hero member
Activity: 510
Merit: 4005
Hey, everybody! Smiley

This suggestion came from Cyrus, and I think it's a really good idea, so I thought I'd sink some time into it, and put together a patch.

Basically, the idea is to make it easier to identify the target post after clicking an ordinary post link, like: https://bitcointalksearch.org/topic/m.60743.

Normally, the (optional) fragment identifier at the end of the URL (#msg60743 in the example link) suffices to position the viewport so that the linked-to post is obvious/unambiguous. But, sometimes that mechanism isn't precise enough, like when the post is the last or second-to-last one on its page (then, I often find myself hovering over the subject link and comparing it to the address bar to confirm that I'm reading the right post).

I also sometimes lose track of the linked-to post when I scroll around the page for a bit to get some context before reading the actual post (then, I find myself going to the address bar and hitting Enter so that the browser snaps to the right post again).

In the worst case, both of those situations occur: After landing on the relevant topic-page, you scroll around a bit for some context, then you use the Enter trick to snap to the right post, but that's not reliable for the last or second-to-last post, so you have to do the address-comparing thing too. Cheesy

I also have to imagine that report-handling would be a little more pleasant for moderators if they had a reliable way to always quickly identify the linked-to post.

Anyway, it's tempting to make the linked-to post really stand out by putting a differently-colored background or border on it, or an inset/outset box-shadow or something, but, all the variations of that idea that I tried ended up looking pretty naff (and, anyway, I don't really like messing with the SMF aesthetic that a lot of veteran members prefer as-is). In this case, I think it's wiser to just do something really subtle and "quiet" (after all, the forum has been just fine for a long time without this, so I don't think it should be something that jumps out from the page and draws your eye too much; it should just be something that people who know what to look for, will look for).

I've done this patch in two styles:

Style A

This one just makes the subject-line of the linked-to post render differently than normal (with font-style: italic).



Code:
--- baseline/Sources/Display.php 2011-02-07 16:45:09.000000000 +0000
+++ modified/Sources/Display.php 2024-04-04 00:02:44.000000000 +0000
@@ -230,24 +230,25 @@
  SELECT COUNT(*)
  FROM {$db_prefix}messages
  WHERE ID_MSG < $virtual_msg
  AND ID_TOPIC = $topic", __FILE__, __LINE__);
  list ($context['start_from']) = mysql_fetch_row($request);
  mysql_free_result($request);
  }
 
  // We need to reverse the start as well in this case.
  $_REQUEST['start'] = empty($options['view_newest_first']) ? $context['start_from'] : $topicinfo['numReplies'] - $context['start_from'];
 
  $context['robot_no_index'] = true;
+ $context['requested_msg'] = $virtual_msg;
  }
  }
 
  // Create a previous next string if the selected theme has it as a selected option.
  $context['previous_next'] = $modSettings['enablePreviousNext'] ? '' . $txt['previous_next_back'] . ' ' . $txt['previous_next_forward'] . '' : '';
 
  // Check if spellchecking is both enabled and actually working. (for quick reply.)
  $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');
 
  // Censor the title...
  censorText($topicinfo['subject']);
  $context['page_title'] = $topicinfo['subject'];

Code:
--- baseline/Themes/default/Display.template.php 2010-10-22 01:38:35.000000000 +0000
+++ modified/Themes/default/Display.template.php 2024-04-04 00:03:41.000000000 +0000
@@ -359,32 +359,33 @@
  echo '
  ', $settings['use_image_buttons'] ? '' . $message['member']['online']['label'] . '' : $message['member']['online']['label'], '';
  }
  }
  // Otherwise, show the guest's email.
  elseif (empty($message['member']['hide_email']))
  echo '
 

 

  ', ($settings['use_image_buttons'] ? '' . $txt[69] . '' : $txt[69]), '';
 
  // Done with the information about the poster... on to the post itself.
+ $is_requested_message = isset($context['requested_msg']) && $context['requested_msg'] == $message['id'];
  echo '
 

 
 
 
 
 
 
 

-

+ ';
 
  // If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
  echo '
 
« ', !empty($message['counter']) ? $txt[146] . ' #' . $message['counter'] : '', ' ', $txt[30], ': ', $message['time'], ' »
';
 
  // Can they reply? Have they turned on quick reply?
  if ($context['can_reply'] && !empty($options['display_quick_reply']))
  echo '
  ', $reply_button, '';

Style B

This one places a small, low-opacity Unicode arrow just before the subject-line of the linked-to post.



Code:
--- baseline/Sources/Display.php 2011-02-07 16:45:09.000000000 +0000
+++ modified/Sources/Display.php 2024-04-04 00:02:44.000000000 +0000
@@ -230,24 +230,25 @@
  SELECT COUNT(*)
  FROM {$db_prefix}messages
  WHERE ID_MSG < $virtual_msg
  AND ID_TOPIC = $topic", __FILE__, __LINE__);
  list ($context['start_from']) = mysql_fetch_row($request);
  mysql_free_result($request);
  }
 
  // We need to reverse the start as well in this case.
  $_REQUEST['start'] = empty($options['view_newest_first']) ? $context['start_from'] : $topicinfo['numReplies'] - $context['start_from'];
 
  $context['robot_no_index'] = true;
+ $context['requested_msg'] = $virtual_msg;
  }
  }
 
  // Create a previous next string if the selected theme has it as a selected option.
  $context['previous_next'] = $modSettings['enablePreviousNext'] ? '' . $txt['previous_next_back'] . ' ' . $txt['previous_next_forward'] . '' : '';
 
  // Check if spellchecking is both enabled and actually working. (for quick reply.)
  $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && function_exists('pspell_new');
 
  // Censor the title...
  censorText($topicinfo['subject']);
  $context['page_title'] = $topicinfo['subject'];

Code:
--- baseline/Themes/default/Display.template.php 2010-10-22 01:38:35.000000000 +0000
+++ modified/Themes/default/Display.template.php 2024-04-04 00:05:27.000000000 +0000
@@ -359,33 +359,34 @@
  echo '
  ', $settings['use_image_buttons'] ? '' . $message['member']['online']['label'] . '' : $message['member']['online']['label'], '';
  }
  }
  // Otherwise, show the guest's email.
  elseif (empty($message['member']['hide_email']))
  echo '
 

 

  ', ($settings['use_image_buttons'] ? '' . $txt[69] . '' : $txt[69]), '';
 
  // Done with the information about the poster... on to the post itself.
+ $is_requested_message = isset($context['requested_msg']) && $context['requested_msg'] == $message['id'];
  echo '
 

 

 
 
 
 

 

- ', $message['subject'], '
+ ', $is_requested_message ? '⇾ ' : '', '', $message['subject'], '
 
';
 
  // If this is the first post, (#0) just say when it was posted - otherwise give the reply #.
  echo '
 
« ', !empty($message['counter']) ? $txt[146] . ' #' . $message['counter'] : '', ' ', $txt[30], ': ', $message['time'], ' »
';
 
  // Can they reply? Have they turned on quick reply?
  if ($context['can_reply'] && !empty($options['display_quick_reply']))
  echo '
  ', $reply_button, '';

As always, everyone's thoughts/notes/votes are appreciated. Wink

@theymos: Style A doesn't add or remove any markup, so post scrapers (probably) won't be affected by the change. Style B introduces a new element just before the element that wraps the subject-line, so if that's the one you like (assuming that you like either one to begin with), then LoyceV and TryNinja would probably appreciate some notice before you merge it, so that they can tweak their scrapers if necessary.
Jump to:
© 2020, Bitcointalksearch.org