[TRN] Discussion Preview [Deleted]

Hello, Mr. @farang
Is there a way to activate this add on per style basis? I would like to use this add on for my mobile style and leave the other styles as is.

Hi. I had to look this up as I actually didn't know it.

...

If you have template modifications (from the TM system in XF) that you do not want to be applied to a specific template in a specific style, you can click this to prevent it from being applied. This is effectively an admin option, rather than a developer option, so it isn't relevant to you as a developer.

This page explains more: https://xenforo.com/community/threads/template-modifications-and-comparison.48412/

[fgX] Discussion Preview currently makes 2 template modifications, both are made on " thread_list_item" and from what I understand by checking "Prevent template modifications from being automatically applied" it can be done.
 
Hi. I had to look this up as I actually didn't know it.



[fgX] Discussion Preview currently makes 2 template modifications, both are made on " thread_list_item" and from what I understand by checking "Prevent template modifications from being automatically applied" it can be done.
Thank you very much .

Edit;
Purchased the addon and installed it for the mobile theme.
Thanks again.
 
Last edited:
Is it possible to set preview lengths for the responsive options as I've found they're a little too long when looking at them on a mobile. If no option is it possible to add one?

Hi @CFodder

I believe that the best approach would be if you create a template modification for fgx_discussion_preview_item (Simple Replacement)

Find :
Code:
{xen:raw $thread.messageParsed}

Replace
Code:
{xen:helper wordTrim, {xen:raw $thread.messageParsed}, 100}

(Change 100 to whatever length you wish but it must be smaller than what You've specified in the options.)

Uncheck "Automatically apply template modification" and apply it only for the style that you wish to change. See this post.

Also, to me, it would make more sense to have the 'User Editable' option in the option group for this than where it is currently??

I'm not really sure what You mean, I'm still jetlagged... Please explain further and I will try to answer.

Also, I may be blind here, but is there a way to adjust the image preview size?

Look for "Attachment Thumbnail Dimensions" in the Attachments option group. Furthermore the maximum size is determined by entries in fgx_discussion_preview.css . You may override these in EXTRA.css if you wish.
 
Last edited:
Someone using this addon ([fgX] Discussion Preview) is also using Lazy Load by @Xon ?
I would like to make it compatible.
I've created a new template modification (regular expression ) to: fgx_discussion_preview_item
find:
Code:
#(<img\s+src=")([^"]*)(".*?class="[^"]*)("\s*?/>)#is
replace:
Code:
$1<xen:callback class='SV_LazyImageLoader_Helper' method='getLazySpinnerUrl' params='$2' />$3 <xen:callback class='SV_LazyImageLoader_Helper' method='getLazySpinnerCss' params='{xen:array 'full={$full}', 'attachment={$attachment}', 'extra=$4', 'noscript={$1$2$3$4}'}' />
View attachment 131391
but doesn't work, don't add the new classes. any idea what I'm doing wrong? :coffee:

Hi @rafass

I'm not familiar with Lazy Load . Is it the regular expression that's not working for you? Is the problem that the regex expression is not rendering the desired result? I can not see why it shouldn't work in case it already produces the desired HTML. Can @Xon help You out?
 
Is it possible to set the size of the image? Cause I only want to have 1 big image showing.

Yes You can by setting the thumbnail image size. Set the thumbnail dimensions in "Attachment Thumbnail Dimensions" (Attachments option group in ACP)

If the thumbnail image is to large you can set maximum size. The maximum size is determined by entries in fgx_discussion_preview.css . You may override these in EXTRA.css if you wish.
 
Hi @farang, thanks for your replies, I've expanded a bit as per below :).
Hi @CFodder

I believe that the best approach would be if you create a template modification for fgx_discussion_preview_item (Simple Replacement)

Find :
Code:
{xen:raw $thread.messageParsed}

Replace
Code:
{xen:helper wordTrim, {xen:raw $thread.messageParsed}, 100}

(Change 100 to whatever length you wish but it must be smaller than what You've specified in the options.)

Uncheck "Automatically apply template modification" and apply it only for the style that you wish to change. See this post.
We only use one style so this really isn't an option, was hoping you could have it linked to the style options for 'Responsive Design' with screen widths there.

I'm not really sure what You mean, I'm still jetlagged... Please explain further and I will try to answer.
Simply that to me it would be better to have the user editable option under '[fgX] Discussion Preview' options than where it is currently.

Look for "Attachment Thumbnail Dimensions" in the Attachments option group. Furthermore the maximum size is determined by entries in fgx_discussion_preview.css . You may override these in EXTRA.css if you wish.
This will adjust the image size for all attachments will it not? I only want to adjust it for the discussion preview, am quite happy for the size of the images to remain as is when in posts.
 
We only use one style so this really isn't an option, was hoping you could have it linked to the style options for 'Responsive Design' with screen widths there.

As far as I understand, the "Responsive Design" Style Properties can add different CSS styling depending on the page width. But CSS can not limit the length of a text. Also there is no way for me in the add-on code to know what CSS is being used to show the preview text. Currently I don't think it's possible in XF to do what You ask for. If I'm wrong please let me know.

Simply that to me it would be better to have the user editable option under '[fgX] Discussion Preview' options than where it is currently.

The "General Options" properties for Custom User Fields (like "User editable") are made available through XF core functionality. It would probably be possible but not easy for me to hide these options in the Custom User Fields tab. To simply duplicate that option and put it under the Option Group for the add-on would be confusing, don't you think?

This will adjust the image size for all attachments will it not? I only want to adjust it for the discussion preview, am quite happy for the size of the images to remain as is when in posts.

There is only a single set of thumbnail images for attachments in XF. The add-on is bound to using those. If You find that the thumbnails are too small for Discussion Previews the best alternative is to increase the the dimensions for the thumbnails in XF. Yes, It will affect all thumbnails. If you want to use smaller attachments thumbnails in a specific place, like when showing posts, it should be fairly simple to limit the size using CSS on that specific place. That is, the attachment thumbnail size should be set to match your largest thumbnail image needs.
 
As far as I understand, the "Responsive Design" Style Properties can add different CSS styling depending on the page width. But CSS can not limit the length of a text. Also there is no way for me in the add-on code to know what CSS is being used to show the preview text. Currently I don't think it's possible in XF to do what You ask for. If I'm wrong please let me know.
I know other addons can change their appearance depending on the width of the screen so I guess it is possible. However I'm no coder, just a hacker at code, so I can't say how it's done :(.

The "General Options" properties for Custom User Fields (like "User editable") are made available through XF core functionality. It would probably be possible but not easy for me to hide these options in the Custom User Fields tab. To simply duplicate that option and put it under the Option Group for the add-on would be confusing, don't you think?
To me it makes more sense to have it in the options with your addon as I didn't even know where the setting was until you mentioned it :eek: ... but hey, that may just be me :).

There is only a single set of thumbnail images for attachments in XF. The add-on is bound to using those. If You find that the thumbnails are too small for Discussion Previews the best alternative is to increase the the dimensions for the thumbnails in XF. Yes, It will affect all thumbnails. If you want to use smaller attachments thumbnails in a specific place, like when showing posts, it should be fairly simple to limit the size using CSS on that specific place. That is, the attachment thumbnail size should be set to match your largest thumbnail image needs.
Would it not just be a case of having a new class for the discussion attachments, e.g. <img class="lbImage discussionPreview" ... and have it linked to a size set in the options for the addon?

I hope you don't think I'm criticising your addon as I'm not, just trying to see if we can get some extra features that may be useful for others as well.
 
I know other addons can change their appearance depending on the width of the screen so I guess it is possible. However I'm no coder, just a hacker at code, so I can't say how it's done :(.

While I can see how changing appearance depending on screen width is possible, it's within the scope of whatever CSS can do. Cutting whole words at the end of a text string is beyond what CSS is capable of. Those other add-ons that are referring to, isn't it just CSS doing the change of appearance? I can ask my fellow coders if they know a way to achieve what you are asking for.

To me it makes more sense to have it in the options with your addon as I didn't even know where the setting was until you mentioned it :eek: ... but hey, that may just be me :).

No, I get Your point. But when making an add-on I always try to rely on the built in framework as much as possible to keep the code clean, as small as possible and allow compatibility with current and future versions. In this specific case, XF already has a built in function to disallow a user from changing a user option. The benefits from using the built in functions are vast i believe. But as I said, I get your point here. ;)

Would it not just be a case of having a new class for the discussion attachments, e.g. <img class="lbImage discussionPreview" ... and have it linked to a size set in the options for the addon?

I don't follow You now. Would You like Discussion Preview to display a sized up version of the actual attachment thumbnail and accomplish that via CSS? That would be quite easy to do (without the need for additional classes) but it will look blurred. I wouldn't recommend it.

Attachment thumbnails are not generated "on the fly" when previewing a discussion, they already exist at this point. I don't understand what you mean by a "size set" option for an add-on. I might have missed out something crucial here ...

I hope you don't think I'm criticising your addon as I'm not, just trying to see if we can get some extra features that may be useful for others as well.

To improve the add-on further I'm actually depending on feedback and criticism of all kind from the users. But sometimes I don't understand the feedback. Then I will ask until I do understand, I won't give up easily. Many times that forced me study and learn new things and concepts. ;)
 
While I can see how changing appearance depending on screen width is possible, it's within the scope of whatever CSS can do. Cutting whole words at the end of a text string is beyond what CSS is capable of. Those other add-ons that are referring to, isn't it just CSS doing the change of appearance? I can ask my fellow coders if they know a way to achieve what you are asking for.
All good, will wait and see if you can come up with something :).

No, I get Your point. But when making an add-on I always try to rely on the built in framework as much as possible to keep the code clean, as small as possible and allow compatibility with current and future versions. In this specific case, XF already has a built in function to disallow a user from changing a user option. The benefits from using the built in functions are vast i believe. But as I said, I get your point here. ;)
Fair point

I don't follow You now. Would You like Discussion Preview to display a sized up version of the actual attachment thumbnail and accomplish that via CSS? That would be quite easy to do (without the need for additional classes) but it will look blurred. I wouldn't recommend it.

Attachment thumbnails are not generated "on the fly" when previewing a discussion, they already exist at this point. I don't understand what you mean by a "size set" option for an add-on. I might have missed out something crucial here ...
What I acutally wanted to do was make the attachment thumbnails, for the discussion preview only, smaller ... I know what I'm trying to say but think I'm having trouble explaining it.
 
What I acutally wanted to do was make the attachment thumbnails, for the discussion preview only, smaller ... I know what I'm trying to say but think I'm having trouble explaining it.

:) That's easy. Just put the following in EXTRA.css

Code:
.discussionListItem .secondRow img {
   max-height: 58px;
   max-width: 100px;
}

Adjust the numbers to meet your specific needs.

;)
 
:) That's easy. Just put the following in EXTRA.css

Code:
.discussionListItem .secondRow img {
   max-height: 58px;
   max-width: 100px;
}

Adjust the numbers to meet your specific needs.

;)
Thanks for that @farang, just to note you have to put !important after the height and width values to override the default values :).

What my initial question regarding this was are you able to add fields for this onto the addon's option page so we don't have to add it to extra.css?
 
farang updated [fgX] Discussion Preview with a new update entry:

Version 3.1.0 released

New features in version 3.1.0
  • Option to select if images shall be prepended with a title and a separator line. (The title and separator line was introduced in an earlier version but they could not be turned off. If You are already on version 3.0.1 and you like to keep the title and the separator line, there is actually no reason to upgrade just for this)

Read the rest of this update entry...
 
Thanks for that @farang, just to note you have to put !important after the height and width values to override the default values :).

What my initial question regarding this was are you able to add fields for this onto the addon's option page so we don't have to add it to extra.css?

Sure, good idea. I will add that in the next release. Thanks!
 
Back
Top Bottom