Page 1 of 1

Forums & bbcode [code][/code]

Posted: Thu Mar 24, 2011 9:05 pm
by Grey
RE: http://www.phpbb.com/community/viewtopi ... 5#p6866755
RE: http://www.phpbb.com/community/viewtopi ... &t=1285355

phpbb3\styles\black_pearl\theme\stylesheet.css
Find:
.codecontent {

change to, make sure to adjust your color/background etc, see my example posted below for what this made mine look like.
.codecontent {
color: #FFCC33;
background: #232323;
border: 1px solid #555555;
border-top: 0;
font-family: Monaco, 'Courier New', monospace;
font-size: 0.95em;
font-weight: normal;
text-align: left;
padding: 3px;
width: 90%;
height: 185px;
overflow: auto;
direction: ltr;
}

Make that box a little bigger, think your default value was 90ish.. way to small for my taste.

phpbb3\styles\black_pearl\template\bbcode.html
Just find the <div class="codetitle"> part and replace all of it.
<!-- BEGIN code_open -->
<div class="codetitle"><b>{L_CODE}:</b> <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></div><div class="codecontent"><code>
<!-- END code_open -->

<!-- BEGIN code_close -->
</code></div>
<!-- END code_close -->


phpbb3\styles\black_pearl\template\overall_header.html
Find
// ]]>
</script>

Add:
function selectCode(a)
{
// Get ID of code block
var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];

// Not IE
if (window.getSelection)
{
var s = window.getSelection();
// Safari
if (s.setBaseAndExtent)
{
s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
}
// Firefox and Opera
else
{
var r = document.createRange();
r.selectNodeContents(e);
s.removeAllRanges();
s.addRange(r);
}
}
// Some older browsers
else if (document.getSelection)
{
var s = document.getSelection();
var r = document.createRange();
r.selectNodeContents(e);
s.removeAllRanges();
s.addRange(r);
}
// IE
else if (document.selection)
{
var r = document.body.createTextRange();
r.moveToElementText(e);
r.select();
}
}

// ]]>
</script>


Off the top of my head I dont think I dont think I changed anything else.
Basically this makes the code box bigger, kind of like how I am using quote in this thread.
Will also add a "select all" option at the top.
I prefer that as when someone drops a lot of text into a post you can simply click the select all and then hotkey copy/paste to your favorite text editor.
Mouse dragging to select text can just suck when its a lot of code/text.

Example of current:

Code: Select all

 This is a code box with random text in it, repeated several times.
This is a code box with random text in it, repeated several times.
This is a code box with random text in it, repeated several times.
This is a code box with random text in it, repeated several times.
This is a code box with random text in it, repeated several times.
This is a code box with random text in it, repeated several times.

Example of mine:
Image
Image

Re: Forums & bbcode [code][/code]

Posted: Thu Mar 31, 2011 7:17 pm
by Topsy
thats a great idea. Lillu! this is your department git r done :)

Re: Forums & bbcode [code][/code]

Posted: Thu Mar 31, 2011 11:00 pm
by Grey
Btw I suggested this one because I liked this forum so much I downloaded phpbb3 and put up my own test forum using the same style as THF.

Also changed
font-size: 0.95em;
to
font-size: 1.10em;

Which made the text large enough to be easier to read and not sure what else I might have changed.
I just really really like having the select all option and anything else is just nice.