Select All Code box for Subsilver2

Guides & Snippets for phpBB3.
Try the Snippets here and share Your own Snippets

Select All Code box for Subsilver2

Post by Post Bot »

Select All Code box for Subsilver2

Several of our users have asked how the get the Prosilver code box for Subsilver.
This guide will tell you how.
The author of this guide is Raimon at phpbb.com
select.jpg

Open styles/subsilver2/template/bbcode.html
Find:

Code: Select all

<!-- BEGIN code_open -->
<div class="codetitle"><b>{L_CODE}:</b></div><div class="codecontent">
<!-- END code_open -->

<!-- BEGIN code_close -->
</div>
<!-- END code_close -->
Replace with:

Code: Select all

<!-- BEGIN code_open -->
    <div>
    <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>
    </div>
    <!-- END code_close -->

Open styles/subsilver2/template/overall_header.html
Find:

Code: Select all

// ]]>
</script>
Add before:

Code: Select all

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();
	}
}

open styles/subsilver2/theme/stylesheet.css
Find:

Code: Select all

.codecontent {
	direction: ltr;
	margin: 0 5px 10px 5px;
	padding: 5px;
	border-color: #A9B8C2;
	border-width: 0 1px 1px 1px;
	border-style: solid;
	font-weight: normal;
	color: #006600;
	font-size: 0.85em;
	font-family: Monaco, 'Courier New', monospace;
	background-color: #FAFAFA;
}
Replace with:

Code: Select all

.codecontent {
overflow: auto;
	display: block;
	height: auto;
	max-height: 200px;
	white-space: normal;
	margin: 0 5px 10px 5px;
	padding: 5px;
	border-color: #A9B8C2;
	border-width: 0 1px 1px 1px;
	border-style: solid;
	font-weight: normal;
	color: #006600;
	font-size: 0.85em;
	font-family: Monaco, 'Courier New', monospace;
	background-color: #FAFAFA;
}

Save, upload and refresh theme and template.
You do not have the required permissions to view the files attached to this post.