Problem with 'Select code' tutorial Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
5 posters

    Problem with 'Select code' tutorial

    brandon_g
    brandon_g
    Manager
    Manager


    Male Posts : 10113
    Reputation : 923
    Language : English
    Location : USA

    Solved Problem with 'Select code' tutorial

    Post by brandon_g April 10th 2015, 11:46 pm

    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


    Last edited by brandon_g on April 14th 2015, 2:55 am; edited 1 time in total
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Problem with 'Select code' tutorial

    Post by Ange Tuteur April 11th 2015, 12:05 am

    Try removing this script :
    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.
    brandon_g
    brandon_g
    Manager
    Manager


    Male Posts : 10113
    Reputation : 923
    Language : English
    Location : USA

    Solved Re: Problem with 'Select code' tutorial

    Post by brandon_g April 11th 2015, 12:50 am

    Hello Ange,

    Thanks for the reply, I have removed all scripts on the fa_likes system, the problem still persists Sad.

    Is there anything else that may be causing the problem?
    -Brandon



    Problem with 'Select code' tutorial Brando10
    Remember to mark your topic Problem with 'Select code' tutorial Solved15 when a solution is found.
    General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

    Problem with 'Select code' tutorial Scre1476
    Team Leader
    Review Section Rules | Request A Review | Sticker Points
    JScript
    JScript
    Forumember


    Male Posts : 741
    Reputation : 175
    Language : PT-BR, EN
    Location : Brazil

    Solved Re: Problem with 'Select code' tutorial

    Post by JScript April 11th 2015, 1:32 am

    brandon_g
    brandon_g
    Manager
    Manager


    Male Posts : 10113
    Reputation : 923
    Language : English
    Location : USA

    Solved Re: Problem with 'Select code' tutorial

    Post by brandon_g April 11th 2015, 1:55 am

    Hello,

    I have checked my css and JS... I can't find this anywhere bwi . 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



    Problem with 'Select code' tutorial Brando10
    Remember to mark your topic Problem with 'Select code' tutorial Solved15 when a solution is found.
    General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

    Problem with 'Select code' tutorial Scre1476
    Team Leader
    Review Section Rules | Request A Review | Sticker Points
    JScript
    JScript
    Forumember


    Male Posts : 741
    Reputation : 175
    Language : PT-BR, EN
    Location : Brazil

    Solved Re: Problem with 'Select code' tutorial

    Post by JScript April 11th 2015, 2:08 am

    @brandon_g

    This error is caused by external codes that have been added!

    Try removing all AWC's code,

    JS
    brandon_g
    brandon_g
    Manager
    Manager


    Male Posts : 10113
    Reputation : 923
    Language : English
    Location : USA

    Solved Re: Problem with 'Select code' tutorial

    Post by brandon_g April 11th 2015, 2:18 am

    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. Very Happy

    -Brandon
    JScript
    JScript
    Forumember


    Male Posts : 741
    Reputation : 175
    Language : PT-BR, EN
    Location : Brazil

    Solved Re: Problem with 'Select code' tutorial

    Post by JScript April 11th 2015, 2:29 am

    @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
    brandon_g
    brandon_g
    Manager
    Manager


    Male Posts : 10113
    Reputation : 923
    Language : English
    Location : USA

    Solved Re: Problem with 'Select code' tutorial

    Post by brandon_g April 11th 2015, 4:02 am

    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



    Problem with 'Select code' tutorial Brando10
    Remember to mark your topic Problem with 'Select code' tutorial Solved15 when a solution is found.
    General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

    Problem with 'Select code' tutorial Scre1476
    Team Leader
    Review Section Rules | Request A Review | Sticker Points
    JScript
    JScript
    Forumember


    Male Posts : 741
    Reputation : 175
    Language : PT-BR, EN
    Location : Brazil

    Solved Re: Problem with 'Select code' tutorial

    Post by JScript April 11th 2015, 4:21 am

    @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:
    Problem with 'Select code' tutorial YuocHRP

    JS


    Last edited by JScript on April 13th 2015, 2:20 pm; edited 1 time in total (Reason for editing : New code!)
    brandon_g
    brandon_g
    Manager
    Manager


    Male Posts : 10113
    Reputation : 923
    Language : English
    Location : USA

    Solved Re: Problem with 'Select code' tutorial

    Post by brandon_g April 11th 2015, 4:54 am

    Worked spot on! Thanks so much JScript... I love you almost as much as Ange now... haha thanks so much!

    -Brandon
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51499
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Problem with 'Select code' tutorial

    Post by SLGray April 11th 2015, 10:15 pm

    Topic solved and archived



    Problem with 'Select code' tutorial Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Derri
    Derri
    Helper
    Helper


    Male Posts : 8711
    Reputation : 638
    Language : English & Basic French
    Location : Scotland, United Kingdom

    Solved Re: Problem with 'Select code' tutorial

    Post by Derri April 12th 2015, 7:06 pm

    Topic unlocked upon authors request
    brandon_g
    brandon_g
    Manager
    Manager


    Male Posts : 10113
    Reputation : 923
    Language : English
    Location : USA

    Solved Re: Problem with 'Select code' tutorial

    Post by brandon_g April 13th 2015, 1:52 am

    Thanks for the unlock guys... Very Happy

    @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



    Problem with 'Select code' tutorial Brando10
    Remember to mark your topic Problem with 'Select code' tutorial Solved15 when a solution is found.
    General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

    Problem with 'Select code' tutorial Scre1476
    Team Leader
    Review Section Rules | Request A Review | Sticker Points
    JScript
    JScript
    Forumember


    Male Posts : 741
    Reputation : 175
    Language : PT-BR, EN
    Location : Brazil

    Solved Re: Problem with 'Select code' tutorial

    Post by JScript April 13th 2015, 4:08 am

    @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


    Last edited by JScript on April 13th 2015, 2:20 pm; edited 1 time in total (Reason for editing : New code!)
    brandon_g
    brandon_g
    Manager
    Manager


    Male Posts : 10113
    Reputation : 923
    Language : English
    Location : USA

    Solved Re: Problem with 'Select code' tutorial

    Post by brandon_g April 13th 2015, 12:55 pm

    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? Question): 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



    Problem with 'Select code' tutorial Brando10
    Remember to mark your topic Problem with 'Select code' tutorial Solved15 when a solution is found.
    General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

    Problem with 'Select code' tutorial Scre1476
    Team Leader
    Review Section Rules | Request A Review | Sticker Points
    JScript
    JScript
    Forumember


    Male Posts : 741
    Reputation : 175
    Language : PT-BR, EN
    Location : Brazil

    Solved Re: Problem with 'Select code' tutorial

    Post by JScript April 13th 2015, 2:00 pm

    @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:
    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 &nbsp; &nbsp; &nbsp; &nbsp;<button onclick="jsCodeExpand(this); return false;">expand</button>' +
             '   <button style="display: none" onclick="jsCodeCollapse(this); return false;">collapse</button>&nbsp; ' +
             '   <button onclick="jsCodeSelect(this); return false;">select</button>&nbsp; ' +
             '   <button onclick="jsCodePopup(this); return false;">popup</button>&nbsp; ' +
             '   <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
    brandon_g
    brandon_g
    Manager
    Manager


    Male Posts : 10113
    Reputation : 923
    Language : English
    Location : USA

    Solved Re: Problem with 'Select code' tutorial

    Post by brandon_g April 14th 2015, 2:51 am

    Ah now it seems to be working fine Very Happy.

    Thanks for taking your time develop and patch up this lovely code @JScript Smile.

    -Brandon



    Problem with 'Select code' tutorial Brando10
    Remember to mark your topic Problem with 'Select code' tutorial Solved15 when a solution is found.
    General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

    Problem with 'Select code' tutorial Scre1476
    Team Leader
    Review Section Rules | Request A Review | Sticker Points
    JScript
    JScript
    Forumember


    Male Posts : 741
    Reputation : 175
    Language : PT-BR, EN
    Location : Brazil

    Solved Re: Problem with 'Select code' tutorial

    Post by JScript April 14th 2015, 3:00 am

    brandon_g wrote:Ah now it seems to be working fine Very Happy.
    I'm glad for it!


    I'll play a little with the code and try to make a homemade Syntax Highlighter!
    Problem with 'Select code' tutorial IdpBuT1

    So long,

    JS
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Problem with 'Select code' tutorial

    Post by Ange Tuteur April 21st 2015, 6:37 pm

    Topic archived