Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add classes to IP addresses #5890

Closed
wants to merge 1 commit into from

Conversation

SoftCreatR
Copy link
Contributor

Working with IP addresses or user agents can be challenging due to the difficulty in efficiently locating them. This pull request addresses this issue by introducing specific classes to the fields where these elements appear, making them readily accessible. For instance, you can now easily manipulate or retrieve these values using JavaScript, streamlining the process and enhancing performance.

Additionally, there are scenarios, such as in the WBB/WSF (postIpAddress template), where applying this change could be beneficial or even necessary. However, for obvious reasons, those suggestions fall outside the scope of what I can propose in this context. :)

This change is relatively minor and carries no risk of causing side effects. Therefore, it should be safe to merge.

Working with IP addresses or user agents can be challenging due to the difficulty in efficiently locating them. This pull request addresses this issue by introducing specific classes to the fields where these elements appear, making them readily accessible. For instance, you can now easily manipulate or retrieve these values using JavaScript, streamlining the process and enhancing performance.

Additionally, there are scenarios, such as in the WBB/WSF (postIpAddress template), where applying this change could be beneficial or even necessary. However, for obvious reasons, those suggestions fall outside the scope of what I can propose in this context. :)
@@ -226,7 +226,7 @@
{if $user->getCurrentLocation()}<li>{@$user->getCurrentLocation()}</li>{/if}
{/if}
{if $__wcf->session->getPermission('admin.user.canViewIpAddress') && $user->registrationIpAddress}
<li>{lang}wcf.user.registrationIpAddress{/lang}: <span class="userRegistrationIpAddress">{@$user->getRegistrationIpAddress()|ipSearch}</span></li>
<li class="ipAddress">{lang}wcf.user.registrationIpAddress{/lang}: <span class="userRegistrationIpAddress">{@$user->getRegistrationIpAddress()|ipSearch}</span></li>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've overseen that there is already a span with an appropriate class. However, adding a class to the surrounding element doesn't hurt :)

@dtdesign dtdesign closed this Oct 15, 2024
@SoftCreatR
Copy link
Contributor Author

@dtdesign Any reason why?

@dtdesign
Copy link
Member

Sorry, I didn’t submit my message:

This is a pretty generic class name and introducing it in a stable version can cause unwanted side effects in case that class name is already in use somewhere else (plugins, styles, etc.). We can add it to 6.1 though if you want.

@SoftCreatR
Copy link
Contributor Author

SoftCreatR commented Oct 15, 2024

I just need a reliable way to manage IP addresses (and user agent strings) within the DOM. Instead of relying on complex and error-prone regex patterns, I prefer a more stable approach. The specific class name or data attribute used for this isn't critical, as long as it allows me to efficiently target and handle IP addresses (and user agent strings) selectively.

@SoftCreatR SoftCreatR deleted the feature/ip-classes branch October 15, 2024 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants