What do you mean with "code sections"Antonio Linares wrote: Tue Jan 07, 2025 7:52 pm We have properly ugraded from 3.0.4 to 3.3.14 and now in the code sections there is no a "Expand code" option
The board linked in this post viewtopic.php?p=12348855#p12348855 has it. Maybe it is part of the style used.
Just had a look: prosilver style version = 3.0.14Brf wrote: Tue Jan 07, 2025 9:17 pmThe board linked in this post viewtopic.php?p=12348855#p12348855 has it. Maybe it is part of the style used.
Hmm? It's stylesheet says it is "Rin" style with the functions from subsilver2.
I know: but rinDark has no phpbb version mentioned so I checked prosilverBrf wrote: Wed Jan 08, 2025 1:10 pm Hmm? It's stylesheet says it is "Rin" style with the functions from subsilver2.
Code: Select all
General Information about this style
name = rinDark
copyright = by RessourectoR for cs.rin.ru
version = 1.1
Code: Select all
# General Information about this style
name = subsilver2
copyright = © 2005 phpBB Group
version = 3.0.14
/styles/prosilver/template/
directory.Code: Select all
<!-- IF S_PLUPLOAD --><!-- INCLUDE plupload.html --><!-- ENDIF -->
Code: Select all
<script type="text/javascript">
function expandcollapse(a) {
var ee = a.parentNode.parentNode.getElementsByTagName('code')[0];
if (ee.style.maxHeight == '200px') {
ee.style.maxHeight = '2000px';
a.innerHTML = 'collapse';
}
else {
ee.style.maxHeight = '200px';
a.innerHTML = 'expand';
};
}
</script>
Code: Select all
<!-- BEGIN code_open --><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></p><pre><code><!-- END code_open -->
Code: Select all
<!-- BEGIN code_open --><div class="codebox"><p>{L_CODE}{L_COLON} <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a> | <a href="#" onclick="expandcollapse(this); return false;">Expand</a></p><pre><code><!-- END code_open -->
Code: Select all
<script type="text/javascript">
function expandcollapse(a) {
var ee = a.parentNode.parentNode.getElementsByTagName('code')[0];
if (ee.style.maxHeight != 'none') {
ee.style.maxHeight = 'none';
a.innerHTML = 'collapse';
}
else {
ee.style.maxHeight = '200px';
a.innerHTML = 'expand';
};
}
</script>
Code: Select all
function expandCode( aTag )
{
var code = aTag.parentNode.nextSibling.childNodes[0];
if( code.style.maxHeight != "none" )
{
aTag.innerHTML = "Collapse view";
code.style.maxHeight = "none";
}
else
{
aTag.innerHTML = "Expand view";
code.style.maxHeight = "200px";
}
}
Code: Select all
<!-- IF S_VIEWTOPIC -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<!-- and it's easy to individually load additional languages -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/go.min.js"></script>
<script>hljs.highlightAll();</script>
<!-- ENDIF -->
It was never part of the phpBB core package. I can only assume you had a MOD installed that provided this functionality.
It worked fine on my test forum. Glad you were able to get it working though.Antonio Linares wrote: Thu Jan 09, 2025 9:11 am There is a bug in your proposed code. It forces double click on expand for the first time and also it does not behaves as old phpbb 3.0.4 code.
Working great, thank you so much!thecoalman wrote: Thu Jan 09, 2025 10:04 am That wasn't an extension, it was part of core features. That's actually a built in php function but it produces a massive amount of HTML. I would presume it was canned with new text formatting used for DB storage introduced with 3.2.
There is extension here:
https://github.com/s9e/phpbb-ext-highlighter
Appears the only thing it does is load is highlight.js which you can easily do with a template edit.
https://highlightjs.org/
Between the head tags in overall_header.html (HTML is from highlight.js example):
Code: Select all
<!-- IF S_VIEWTOPIC --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script> <!-- and it's easy to individually load additional languages --> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/go.min.js"></script> <script>hljs.highlightAll();</script> <!-- ENDIF -->