Development Blogdisplay: none; in css

Post Reply
User avatar
Topic Starter
Restless Rancor
Great Britain

Site Admin
New Member
Posts: 48
Joined: October 15th, 2018, 3:14 pm
Age: 25
Location: Hampshire, England
Contact:

display: none; in css

#1

Post by Restless Rancor » October 22nd, 2018, 6:28 pm

I've been using display: none; in css to override the display of a core template class and replace it with my own.

It's easy enough to achieve, but I've hit a roadblock in attachment.html

Take this section for example:

Code: Select all

		<!-- IF _file.S_IMAGE -->
		<dl class="file">
			<dt class="attach-image"><img src="{_file.U_INLINE_LINK}" class="postimage" alt="{_file.DOWNLOAD_NAME}" onclick="viewableArea(this);" /></dt>
			<!-- IF _file.COMMENT --><dd><em>{_file.COMMENT}</em></dd><!-- ENDIF -->
			<dd>{_file.DOWNLOAD_NAME} <img src="https://img.shields.io/badge/filesize-{_file.FILESIZE} {_file.SIZE_LANG}-blue.svg?LongCache=true&?label=healthinesses"> <img src="https://img.shields.io/badge/views-{_file.L_DOWNLOAD_COUNT}-blue.svg?LongCache=true&?label=healthinesses"></dd>
		</dl>
		<!-- ENDIF -->
I can set the css to:

Code: Select all

dt.attach-image {
	display:none;
}
to force hide the image, but as the file comment line doesn't have a dd class I can't use the same methods for dd - it would remove all other instances.

I'm honestly not sure if there is an alternative, as this is how the core file works.
I begun with a <!-- in attachment_file_prepend.html and a --> in attachment_file_append.html and may have to leave it with that. Thankfully it's not going to comment out too much code and it will all be replaced with the extensions alternative, but any extensions that also use those files may cause conflicts.

I think I'll move on with the improvements and come back to this problem later.


These aren't the droids you're looking for.

User avatar
Topic Starter
Restless Rancor
Great Britain

Site Admin
New Member
Posts: 48
Joined: October 15th, 2018, 3:14 pm
Age: 25
Location: Hampshire, England
Contact:

#2

Post by Restless Rancor » October 30th, 2018, 6:56 pm

I should have done some more testing: I didn't need to define the <dd>'s and can simply use:

Code: Select all

div.inline-attachment dl.file {
	display: none;
}

dl.file{
	display: none;
}
This method doesn't seem to work for flash files as they don't seem to be defined in the CSS, but as Flash has been handed it's EOL notice for the end of 2020 I'm not too worried about removing all flash file functionality in the extension.

The way I see it is if a forum has a considerable amount of flash attachments they either don't care about how the attachment details display, or will likely already have a custom setting.
Regardless, flash will be obsolete in just over 2 years. I know 2 years is 2 years, but in this instance I'll be thinking that far ahead.

The only issue I see is the extension modifies the language for download count and view count:

Code: Select all

$lang = array_merge($lang, array(
	'DOWNLOAD_COUNTS'		=> array(
		0	=> '0',
		1	=> '%d',
		2	=> '%d',
	),
	'VIEWED_COUNTS'		=> array(
		0	=> '0',
		1	=> '%d',
		2	=> '%d',
	),
));
... leaving this how it is and removing the custom flash file coding (leaving the default how it is) would still modify the language, resulting in the following:
Image

As you can see, '32' is referring to the view count, but this is not obvious due to the language changes.

Again, I'm probably putting far too much thought into handling flash attachments, but would like to see if I can overcome this issue, even if it isn't included in the final release.
These aren't the droids you're looking for.

Post Reply

Topic Subscribers

1 user subscribed to this topic: Restless Rancor