Problem with 'Select code' tutorial
5 posters
Page 1 of 1
Problem with 'Select code' tutorial
Hello,
In this topic: https://help.forumotion.com/t140078-a-select-all-button-for-code-box#952085 someone pointed the topic starter to a tutorial I followed the steps in the suggested tutorial, I did so on my test forum, there is still no 'select code' button, I have double and triple checked the codes stated in the tutorial and they are correct. Now this feature is totally an optional feature, but I would love to have it because it makes it easier to copy codes and stuff from my tablet.
Any ideas why it is working
my test forum: http://www.testingduo.forumotion.com
Regards,
-Brandon
In this topic: https://help.forumotion.com/t140078-a-select-all-button-for-code-box#952085 someone pointed the topic starter to a tutorial I followed the steps in the suggested tutorial, I did so on my test forum, there is still no 'select code' button, I have double and triple checked the codes stated in the tutorial and they are correct. Now this feature is totally an optional feature, but I would love to have it because it makes it easier to copy codes and stuff from my tablet.
Any ideas why it is working
my test forum: http://www.testingduo.forumotion.com
Regards,
-Brandon
Last edited by brandon_g on 14/4/2015, 02:55; edited 1 time in total
Re: Problem with 'Select code' tutorial
Try removing this script :
I know that it's only for phpbb3, so it's most likely causing an error on your forum.
- Code:
$(function(){ var pid=9, i=0, lang={ like:'Like', loading:'Loading...', people:'People like this post.', person:'Person likes this post.' }; $('.post').each(function(){ var plus=$(this).find('.vote-button:first a'),id=$(this).attr('id').slice(1),clear=$(this).find('.clear'),votes=0,text=lang.people; if(plus.length)clear.after('<div class="fa_like_row"><a class="fa_like_button" href="'+plus.attr('href')+'">'+lang.like+'</a></div>'); else clear.after('<div class="fa_like_row"><span class="fa_liked">'+lang.like+'</span></div>'); if($(this).find('.vote-bar').length){ votes=Number($(this).find('.vote-bar').attr('title').replace(/.*?\((\d+)\s.*/,'$1')); if(votes==1)text=lang.person; } $(this).find('.fa_like_row').append('<div class="fa_like_text">'+votes+' '+text+'</div><div class="fa_like_list" id="fa_like_list'+id+'">Loading...</div>'); $(this).find('.vote').remove(); i++; if(i==$('.post').length){ $.get(_database.tid,function(data){ $('.post').each(function(){ var id=$(this).attr('id').slice(1),dblikes; $('#fa_like_list'+id).html(''); if($('#fa_likes #likes'+id,data).length){ dblikes=$('#fa_likes #likes'+id,data).text().replace(/likes=\{(.*?)\}/,'$1').split(','); for(var i=0;i<dblikes.length;i++){ var comma=', '; if(i==dblikes.length-1)comma=''; $('#fa_like_list'+id).append(dblikes[i].replace(/^(.*?):(.*?)$/,'<a href="/u$1">$2</a>'+comma)) } } }); }); } }); $('.fa_like_button').on('click',function(){ var id=$(this).attr('href').replace(/^.*?p\_vote=(\d+)$/,'$1'); $(this).after('<span class="fa_like_button">'+lang.loading+'</span>').hide(); $.get($(this).attr('href'),function(){ _database.post({ pid:pid, tableid:'likes'+id, update:['\\[td id="likes'+id+'"\\]likes=\\{(.*?)\\}\\[/td\\]','[td id="likes'+id+'"]likes={$1,'+_userdata.user_id+':'+_userdata.username+'}[/td]'], newRow:'[tr][td]t'+window.location.pathname.replace(/\/t(\d+).*/,'$1')+'p'+id+'[/td][td id="likes'+id+'"]likes={'+_userdata.user_id+':'+_userdata.username+'}[/td][/tr]', reload:true }); }); return false; })});
I know that it's only for phpbb3, so it's most likely causing an error on your forum.
Re: Problem with 'Select code' tutorial
Hello Ange,
Thanks for the reply, I have removed all scripts on the fa_likes system, the problem still persists .
Is there anything else that may be causing the problem?
-Brandon
Thanks for the reply, I have removed all scripts on the fa_likes system, the problem still persists .
Is there anything else that may be causing the problem?
-Brandon
Remember to mark your topic when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
Team Leader
Review Section Rules | Request A Review | Sticker Points
Re: Problem with 'Select code' tutorial
Hello,
I have checked my css and JS... I can't find this anywhere . The only Javascripts I have installed is for a database developed by ange and AWC... the only other one is for this code with the select code thing... all css is also for each of these things in turn as well. So where are these errors... and can you tell me what script it is likely to be in.
-Brandon
I have checked my css and JS... I can't find this anywhere . The only Javascripts I have installed is for a database developed by ange and AWC... the only other one is for this code with the select code thing... all css is also for each of these things in turn as well. So where are these errors... and can you tell me what script it is likely to be in.
-Brandon
Remember to mark your topic when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
Team Leader
Review Section Rules | Request A Review | Sticker Points
Re: Problem with 'Select code' tutorial
@brandon_g
This error is caused by external codes that have been added!
Try removing all AWC's code,
JS
This error is caused by external codes that have been added!
Try removing all AWC's code,
JS
Re: Problem with 'Select code' tutorial
Awc's code... man forget it... It would have been nice, but I do tests for the awc on my main forum... where awc is definitelly not leaving.
Well if there is no other way to get this to work other then that you might as well consider this solved and lock it.
Sorry if I sounded a little nasty there... it was not intended as such and apologize to anyone who may get offended. It is just I cant use the script if I have to remove awc... I mean its fine for the test forum, but I plan to expand it to my real main forum where awc can never leave, my members are not big fans of the annoying 'your session has been timed out' that they get frequently with the standard fm chat. So awc (even if the feature doesn't geniunely prevent the timeouts) takes the annoyance out of it. That is the only thing about the FM chatbox that keeps me from using it on my forum.
Thanks for the help @Ange Tuteur and @JScript I truly appericate it.
-Brandon
Well if there is no other way to get this to work other then that you might as well consider this solved and lock it.
Sorry if I sounded a little nasty there... it was not intended as such and apologize to anyone who may get offended. It is just I cant use the script if I have to remove awc... I mean its fine for the test forum, but I plan to expand it to my real main forum where awc can never leave, my members are not big fans of the annoying 'your session has been timed out' that they get frequently with the standard fm chat. So awc (even if the feature doesn't geniunely prevent the timeouts) takes the annoyance out of it. That is the only thing about the FM chatbox that keeps me from using it on my forum.
Thanks for the help @Ange Tuteur and @JScript I truly appericate it.
-Brandon
Re: Problem with 'Select code' tutorial
@brandon_g
Give up so easy is never "the best way", right?
I'll give you a hint:
1- How about waiting for the creation of a new code that will ignore the errors of your forum and making them irrelevant?
If you want, I can try,
JS
Give up so easy is never "the best way", right?
I'll give you a hint:
1- How about waiting for the creation of a new code that will ignore the errors of your forum and making them irrelevant?
If you want, I can try,
JS
Re: Problem with 'Select code' tutorial
Sure.. yeah I shouldnt give up. I am sorry man. I am all for a new code if your willing to try?
Thanks again... I apologize, it was not my intention to sound so grouchy.. it is bothering me that I said it like that. I am sorry, I know you are genuinely trying to help.
-Brandon
Thanks again... I apologize, it was not my intention to sound so grouchy.. it is bothering me that I said it like that. I am sorry, I know you are genuinely trying to help.
-Brandon
Remember to mark your topic when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
Team Leader
Review Section Rules | Request A Review | Sticker Points
Re: Problem with 'Select code' tutorial
@brandon_g
Try this code below and tell me what do you think, the placement is only "In the topics":
Final code: https://help.forumotion.com/t140087-problem-with-select-code-tutorial#952445
Result:
JS
Try this code below and tell me what do you think, the placement is only "In the topics":
Final code: https://help.forumotion.com/t140087-problem-with-select-code-tutorial#952445
Result:
JS
Last edited by JScript on 13/4/2015, 14:20; edited 1 time in total (Reason for editing : New code!)
Re: Problem with 'Select code' tutorial
Worked spot on! Thanks so much JScript... I love you almost as much as Ange now... haha thanks so much!
-Brandon
-Brandon
Re: Problem with 'Select code' tutorial
Topic solved and archived
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Problem with 'Select code' tutorial
Topic unlocked upon authors request
Derri- Helper
- Posts : 8711
Reputation : 638
Language : English & Basic French
Location : Scotland, United Kingdom
Re: Problem with 'Select code' tutorial
Thanks for the unlock guys...
@JScript I am having a slight issue with your code. I mean I suppose it functions the way it should, but the problem I have with it is, after adding your code onto the main forum to try it out, I viewed a topic. When I viewed the topic,while I got 1 of the 3 codes selectable to me, I also had the other 2 codes plus the post content no longer visible or appearing. As seen in this screenshot taken when I installed your code on my main forum: http://prntscr.com/6t1h7i now that is only 1 of 3 codes selectable and visible in that topic, this screenshot shows what the topic should look like... it looked like beford I tried your code and after I removed it (until this issue is sorted): http://prntscr.com/6t1j49
You can see very nearly entire post was missing along with 2 codes. Is there a way this can be fixed?
-Brandon
@JScript I am having a slight issue with your code. I mean I suppose it functions the way it should, but the problem I have with it is, after adding your code onto the main forum to try it out, I viewed a topic. When I viewed the topic,while I got 1 of the 3 codes selectable to me, I also had the other 2 codes plus the post content no longer visible or appearing. As seen in this screenshot taken when I installed your code on my main forum: http://prntscr.com/6t1h7i now that is only 1 of 3 codes selectable and visible in that topic, this screenshot shows what the topic should look like... it looked like beford I tried your code and after I removed it (until this issue is sorted): http://prntscr.com/6t1j49
You can see very nearly entire post was missing along with 2 codes. Is there a way this can be fixed?
-Brandon
Remember to mark your topic when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
Team Leader
Review Section Rules | Request A Review | Sticker Points
Re: Problem with 'Select code' tutorial
@brandon_g
Try this code:
Final code: https://help.forumotion.com/t140087-problem-with-select-code-tutorial#952445
Result:
Link: https://i.imgur.com/TvTKHmz.png
Note: Although the previous code does not have this problem in my tests!
Waiting for your reply,
JS
Try this code:
Final code: https://help.forumotion.com/t140087-problem-with-select-code-tutorial#952445
Result:
Link: https://i.imgur.com/TvTKHmz.png
Note: Although the previous code does not have this problem in my tests!
Waiting for your reply,
JS
Last edited by JScript on 13/4/2015, 14:20; edited 1 time in total (Reason for editing : New code!)
Re: Problem with 'Select code' tutorial
Hello,
Ok I gave the code you said a try on my test forum (simply by modifying the field and replacing the old code with the new one). I still seem to get the problem... it is hiding content from me... as you can see in this screenshot I edited the post with words and single smiley (Hello, how are you? ): http://prntscr.com/6t613t and then I go to view the topic: http://prntscr.com/6t60eq it is like those words are not even there...
My forum (both the test forum and my main forum) version is PHPBB2 if this affects anything at all...
Regards,
-Brandon
Ok I gave the code you said a try on my test forum (simply by modifying the field and replacing the old code with the new one). I still seem to get the problem... it is hiding content from me... as you can see in this screenshot I edited the post with words and single smiley (Hello, how are you? ): http://prntscr.com/6t613t and then I go to view the topic: http://prntscr.com/6t60eq it is like those words are not even there...
My forum (both the test forum and my main forum) version is PHPBB2 if this affects anything at all...
Regards,
-Brandon
Remember to mark your topic when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
Team Leader
Review Section Rules | Request A Review | Sticker Points
Re: Problem with 'Select code' tutorial
@brandon_g
Ok, I just prove it!
Wait for a while until I identify and resolve the problem,
Edit:
It was only a matter of selectors, I simplify and the result was expected for all versions!
Try this code:
So long,
JS
Ok, I just prove it!
Wait for a while until I identify and resolve the problem,
Edit:
It was only a matter of selectors, I simplify and the result was expected for all versions!
Try this code:
- Code:
var style = document.createElement("style");
style.type = "text/css";
style.innerHTML =
'code.jsCode_block, pre.jsCode_block {' +
' background-color: #FAFAFA !important;' +
' border: 1px solid #C9C9C9 !important;' +
' color: #000000;' +
' font-family: Consolas,"Bitstream Vera Sans Mono","Andale Mono",Monaco,"DejaVu Sans Mono","Lucida Console",monospace !important;' +
' font-size: 11px !important;' +
' line-height: 110% !important;' +
' margin-top: 0 !important;' +
' max-height: 250px !important;' +
' overflow: auto !important;' +
' padding: 5px !important;' +
' white-space: pre-wrap !important;' +
' width: auto !important;' +
'}' +
'.jsCodetop {' +
' background-color: #FFDEAD !important;' +
' color: #1D3652;' +
' font-size: 10px;' +
' font-weight: bold;' +
' line-height: 100%;' +
' margin-top: 5px;' +
' padding: 2px 1px 2px 3px;' +
'}' +
'.jsCodetop button {' +
' background: -moz-linear-gradient(center top , #EDEDED 5%, #DFDFDF 100%) repeat scroll 0 0 #EDEDED;' +
' border: 1px solid #BBBBBB;' +
' border-radius: 3px 3px 3px 3px;' +
' color: #1D3652;' +
' cursor: pointer;' +
' display: inline-block;' +
' font-size: 10px;' +
' padding: 0 6px;' +
' text-decoration: none;' +
'}' +
'.jsCodetop button:hover {' +
' background: -moz-linear-gradient(center top , #DFDFDF 5%, #EDEDED 100%) repeat scroll 0 0 #DFDFDF;' +
' border-color: #9A9A9A;' +
' color: #3D70A3;' +
'}' +
'.jsCodetop button:active {' +
' position: relative;' +
' top: 1px;' +
'}' +
'pre.jsCode_block.expand, code.jsCode_block.expand {' +
' max-height: 100% !important;' +
'}' +
'pre ol.linenums {' +
' color: #afafaf;' +
' font-size: 12px;' +
' list-style: outside none decimal;' +
' padding: 5px 0 5px 42px !important;' +
' margin: -16px 0 0;' +
' width: auto;' +
'}' +
'pre ol.linenums li > span {' +
' color: #000000;' +
'}' +
'pre ol.linenums li {' +
' border-left: 3px solid #6ce26c;' +
' padding-left: 15px;' +
' list-style: inherit;' +
' font-size: inherit !important;' +
'}';
document.getElementsByTagName("head")[0].appendChild(style);
jQuery(function() {
var tagCode = jQuery('.cont_code, code'),
codebox = null;
for (var i = 0, len = tagCode.length; i < len; i++) {
codebox = jQuery(tagCode[i]).closest('.codebox');
codebox.before(
'<div class="jsCodetop">Code <button onclick="jsCodeExpand(this); return false;">expand</button>' +
' <button style="display: none" onclick="jsCodeCollapse(this); return false;">collapse</button> ' +
' <button onclick="jsCodeSelect(this); return false;">select</button> ' +
' <button onclick="jsCodePopup(this); return false;">popup</button> ' +
' <button style="margin-right: 50px; float: right;" onclick="jsCodeAbout(this); return false;">?</button>' +
'</div>' +
'<pre class="jsCode_block">' +
' <ol class="linenums">' + tagCode[i].innerHTML.replace(/<br>/mg, '<li class="L1"><span>') + '</ol>' +
'</pre>'
);
codebox.remove();
}
});
function jsCodeExpand(oThis) {
jQuery(oThis).css('display', 'none');
jQuery(oThis).next().css('display', '');
jQuery(oThis).parent().next('pre.jsCode_block').addClass('expand');
}
function jsCodeCollapse(oThis) {
jQuery(oThis).css('display', 'none');
jQuery(oThis).prev().css('display', '');
jQuery(oThis).parent().next('pre.jsCode_block').removeClass('expand');
}
function jsCodePopup(oThis) {
var content = jQuery(oThis).parent().next('pre.jsCode_block').html();
var my_window = window.open("", "To select the code: [Ctrl] + [A]", "scrollbars=1toolbar=no,menubar=no,personalbar=no,status=0,left=0,location=0,menubar=0,top=0,width=640,height=480");
my_window.document.write('<pre>'+content+'</pre>');
}
function jsCodeAbout(oThis) {
alert('Simple code to add line counter fuctionality for Forumotion\n\nBy JScript FROM Brazil - 2015/04/10\n');
}
function jsCodeSelect(oThis) {
var doc = document;
var text = jQuery(oThis).parent().next('pre.jsCode_block')[0];
if (doc.body.createTextRange) {
var range = doc.body.createTextRange();
range.moveToElementText(text);
range.select();
} else if (window.getSelection) {
var selection = window.getSelection();
var range = doc.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
}
}
So long,
JS
Re: Problem with 'Select code' tutorial
Ah now it seems to be working fine .
Thanks for taking your time develop and patch up this lovely code @JScript .
-Brandon
Thanks for taking your time develop and patch up this lovely code @JScript .
-Brandon
Remember to mark your topic when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?
Team Leader
Review Section Rules | Request A Review | Sticker Points
Re: Problem with 'Select code' tutorial
I'm glad for it!brandon_g wrote:Ah now it seems to be working fine .
I'll play a little with the code and try to make a homemade Syntax Highlighter!
So long,
JS
Similar topics
» Code: Select Content for code box
» "Select Code"
» Select all Code
» Javascript Code for Select All
» Code Of " Select Content"
» "Select Code"
» Select all Code
» Javascript Code for Select All
» Code Of " Select Content"
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum