We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] New "Select All" in [code] request
Topic Started: Dec 19 2014, 02:07 AM (326 Views)
Kankuro
Member Avatar
かんくろ
[ *  *  *  *  * ]
http://w11.zetaboards.com/GamesAndAnime/index/
Zeta

I know of 2 versions of this, the original and Cory's but I've tried both and neither work.
The original only highlighted the first line.
Cory's does some really weird stuff.

Cory's Code output:
Posted Image



How it looks with no "Select All" code (How it should look):
Posted Image
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
By "Cory's code" you're referring to this version, correct?

http://support.zathyus.com/topic/5171289/1/#post18031472

I'm pretty sure the version they're using on this board is for public use, last I checked with Reid, but I'm not 100% sure about that.
Offline Profile Goto Top
 
Kankuro
Member Avatar
かんくろ
[ *  *  *  *  * ]
Cory
Dec 19 2014, 08:01 AM
By "Cory's code" you're referring to this version, correct?

http://support.zathyus.com/topic/5171289/1/#post18031472

I'm pretty sure the version they're using on this board is for public use, last I checked with Reid, but I'm not 100% sure about that.
No, I was talking about this: http://support.zathyus.com/single/?p=18027872&t=5169738

This completely deleted the inner coding.
Code:
 

<script type="text/javascript">
//<![CDATA[
$(function () {
var codeFF = $('code').css('font-family');
$('code').css({
'padding': '0',
'overflow': 'hidden',
'max-height': '400px'
});

$('code').each(function () {
var codeW = $(this).prev('dl').width();
var codeH = $(this).height();

$(this).css('width', codeW + 'px');
$(this).wrapInner('<textarea cols="1" rows="1" readonly="readonly"></textarea>').parent('blockquote').find('dl dt').append('<a href="javascript: void(0);" class="select_code">Select All</a>');
$(this).html($(this).html().replace(/<br>/gi, '\n').replace(/<i><\/i>/gi, ''));
$(this).find('textarea').css({
'font-family': codeFF,
'height': codeH + 'px',
'width': (codeW - 5) + 'px',
'border': '0',
'background': 'none',
'line-height': '1.7'
});
});

$('a.select_code').click(function () {
$(this).parent('dt').parent('dl').parent('blockquote').find('code textarea').select();
});
});
//]]>
</script>


Screenshot: http://prntscr.com/5il2g2
Edited by Kankuro, Dec 19 2014, 10:46 AM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Both codes work fine on my test board, so it's probably a code conflict. Try placing it before all other codes.

Not sure if I ever tested the codes in Firefox, but I can confirm they're working properly on Google Chrome.
Offline Profile Goto Top
 
Helena
Member Avatar
M is for Mod

Cory
 
I'm pretty sure the version they're using on this board is for public use, last I checked with Reid, but I'm not 100% sure about that.


Yes, you can use that version if you like.

Here's another one to try:
http://support.zathyus.com/topic/5169738/
Offline Profile Goto Top
 
Mozz
Member Avatar
" It’s not a bug – it’s an undocumented feature "
[ *  *  *  * ]
All working for me as well on mine with FF
Offline Profile Goto Top
 
Kankuro
Member Avatar
かんくろ
[ *  *  *  *  * ]
It worked fine for me on Firefox, but FF turned into total crap for me recently so I switched to Chrome.

EDIT: I tried that one Helena.
Edited by Kankuro, Dec 19 2014, 12:25 PM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Helena
Dec 19 2014, 12:20 PM
Cory
 
I'm pretty sure the version they're using on this board is for public use, last I checked with Reid, but I'm not 100% sure about that.
Yes, you can use that version if you like.
In that case, here's the version this board uses:
Code:
 
<script type="text/javascript">
// <![CDATA[
// Add 'select all' to codes
(function () {
function select(element) {
if (document.selection) {
document.selection.empty();

var range = document.body.createTextRange();
range.moveToElementText(element);
range.select();
} else if (window.getSelection) {
window.getSelection().removeAllRanges();

var range = document.createRange();
range.selectNode(element);
window.getSelection().addRange(range);
}
}

if (document.selection || window.getSelection) {
$('td.c_post blockquote:has(code) dl dt').each(function () {
var selectButton = $('<a href="javascript:void(0)">Select All</a>');

selectButton.click(function () {
select($(this).closest('dl').nextAll('code').get(0));
});

$(this).append(selectButton);
});
}
}());
// ]]>
</script>
Offline Profile Goto Top
 
Kankuro
Member Avatar
かんくろ
[ *  *  *  *  * ]
Cory
Dec 19 2014, 12:26 PM
Helena
Dec 19 2014, 12:20 PM
Cory
 
I'm pretty sure the version they're using on this board is for public use, last I checked with Reid, but I'm not 100% sure about that.
Yes, you can use that version if you like.
In that case, here's the version this board uses:
Code:
 
<script type="text/javascript">
// <![CDATA[
// Add 'select all' to codes
(function () {
function select(element) {
if (document.selection) {
document.selection.empty();

var range = document.body.createTextRange();
range.moveToElementText(element);
range.select();
} else if (window.getSelection) {
window.getSelection().removeAllRanges();

var range = document.createRange();
range.selectNode(element);
window.getSelection().addRange(range);
}
}

if (document.selection || window.getSelection) {
$('td.c_post blockquote:has(code) dl dt').each(function () {
var selectButton = $('<a href="javascript:void(0)">Select All</a>');

selectButton.click(function () {
select($(this).closest('dl').nextAll('code').get(0));
});

$(this).append(selectButton);
});
}
}());
// ]]>
</script>
That makes the select and coding color work fine, only problem now is the blank line at the top and the highlight going outside of the box:

http://prntscr.com/5im8a4
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Can you link me to a topic that has the code block?
Offline Profile Goto Top
 
Kankuro
Member Avatar
かんくろ
[ *  *  *  *  * ]
Cory
Dec 19 2014, 12:31 PM
Can you link me to a topic that has the code block?
http://w11.zetaboards.com/GamesAndAnime/topic/10516216/1/#new
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Code:
 
code br:first-child {
display: none;
}
See what adding that to your CSS does.
Offline Profile Goto Top
 
Kankuro
Member Avatar
かんくろ
[ *  *  *  *  * ]
Cory
Dec 19 2014, 12:45 PM
Code:
 
code br:first-child {
display: none;
}
See what adding that to your CSS does.
That fixed it.
Offline Profile Goto Top
 
Helena
Member Avatar
M is for Mod

Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic