Page 3 of 6 FirstFirst 12345 ... LastLast
Results 21 to 30 of 55

Thread: PHP help

  1. #21

    Default

    Remove the older conflicting versions of jQuery, and add this to the top of the script section within the <head> tags:

    Code:
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="http://code.jquery.com/own3mall.js"></script>
    Replace own3mall.js with the name of the file containing my script. Final step, see if it works consistently, which it may not... haha
    Browse MOHAA Servers Post GameSpy Era

    VISIT MOHREBORN.COM FOR LATEST INFORMATION



    Medal of Honor: Game Server Browser Fixer - Patches your MOHAA, MOHSH, and MOHBT game binaries to allow you to retrieve a list of game servers within the multi-player menu in-game even after GameSpy ceases operation!

    Medal of Honor: Query Launcher - Find, browse, organize, join, get your ping, and get more information regarding all Medal of Honor (AA, SH, & BT) servers from your PC at any time!
    Medal of Honor: Web Server Master List - Find and browse all Medal of Honor servers online using your browser!
    Add your Medal of Honor Server to the Master List
    YouTube Video for Medal of Honor: Query Launcher and MOHAASERVERS.TK!



    MOHAA Mods and Utilities
    OwN-3m-All's Mods
    Make Me Stock - A program that allows you to easily move-in and move-out non-stock mods and other files at the click of a button. Automates adding / removing mods without having to copy / move files manually.



    Quality Game Servers

    Rent dedicated Dallas Texas, Kansas City, Las Vegas Nevada, Chicago, Pennsylvania, and Sofia Bulgaria MOHAA and other game servers from We Be HostiN starting at $10 a month.


  2. #22
    Banned
    Join Date
    May 2010
    Location
    fuck off?
    Posts
    1,145

    Default

    love you to bits but i think it could be a LOT simpler script

    function { //foreach

    var $obj = $( ".highlight" );
    $obj.replaceWith( $obj.text() );

    } //do for each..done

  3. #23
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    Take a look at this

    /**
    * Wraps each line of the string into <code/> tag with given style applied to it.
    *
    * @param {String} str Input string.
    * @param {String} css Style name to apply to the string.
    * @return {String} Returns input string with each line surrounded by <span/> tag.
    */
    function wrapLinesWithCode(str, css)
    {
    if (str == null || str.length == 0 || str == '\n')
    return str;


    str = str.replace(/</g, '&lt;');


    // Replace two or more sequential spaces with &nbsp; leaving last space untouched.
    str = str.replace(/ {2,}/g, function(m)
    {
    var spaces = '';


    for (var i = 0, l = m.length; i < l - 1; i++)
    spaces += sh.config.space;


    return spaces + ' ';
    });


    // Split each line and apply <span class="...">...</span> to them so that
    // leading spaces aren't included.
    if (css != null)
    str = eachLine(str, function(line)
    {
    if (line.length == 0)
    return '';


    var spaces = '';


    line = line.replace(/^(&nbsp;| )+/, function(s)
    {
    spaces = s;
    return '';
    });


    if (line.length == 0)
    return spaces;


    return spaces + '<code class="' + css + '">' + line + '</code>'; <------
    });


    return str;
    };


    This seems to be the issue I think. It's in the xcode core function.

  4. #24
    Über Prodigy & Developer Razo[R]apiD's Avatar
    Join Date
    May 2010
    Location
    Poland, Lublin
    Posts
    3,257

    Default

    I would think about placing: highlight.js on forums, and ditch the xcode tag, replace it with own.

  5. #25

    Default

    Quote Originally Posted by Elgan View Post
    love you to bits but i think it could be a LOT simpler script

    function { //foreach

    var $obj = $( ".highlight" );
    $obj.replaceWith( $obj.text() );

    } //do for each..done
    I don't think that will work. I'm pretty sure text rendered within a code tag is considered plain text. I wish it were that simple, but based on how syntax highlighter breaks things up, it's not.
    Browse MOHAA Servers Post GameSpy Era

    VISIT MOHREBORN.COM FOR LATEST INFORMATION



    Medal of Honor: Game Server Browser Fixer - Patches your MOHAA, MOHSH, and MOHBT game binaries to allow you to retrieve a list of game servers within the multi-player menu in-game even after GameSpy ceases operation!

    Medal of Honor: Query Launcher - Find, browse, organize, join, get your ping, and get more information regarding all Medal of Honor (AA, SH, & BT) servers from your PC at any time!
    Medal of Honor: Web Server Master List - Find and browse all Medal of Honor servers online using your browser!
    Add your Medal of Honor Server to the Master List
    YouTube Video for Medal of Honor: Query Launcher and MOHAASERVERS.TK!



    MOHAA Mods and Utilities
    OwN-3m-All's Mods
    Make Me Stock - A program that allows you to easily move-in and move-out non-stock mods and other files at the click of a button. Automates adding / removing mods without having to copy / move files manually.



    Quality Game Servers

    Rent dedicated Dallas Texas, Kansas City, Las Vegas Nevada, Chicago, Pennsylvania, and Sofia Bulgaria MOHAA and other game servers from We Be HostiN starting at $10 a month.


  6. #26
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    I did some testing and came up with this..
    The function I posted above works like this.

    I used
    alert(str)

    to print the value of str and it went through each word.

    This was the output
    Code:
    SyntaxHighlighter.trig &lt;span class=
    
    
    
    
    SyntaxHighlighter"highlight"
    
    
    SyntaxHighlighter>
    
    
    SyntaxHighlighter targetname
    
    
    SyntaxHighlighter&lt;/span> port1
    I'm trying to do a str.replace(), but is giving me trouble. hmm.

    Code:
    str = str.replace('<span class="highlight">', '')
    str = str.replace('</span>','')
    Or something like this
    Code:
    '<span class=highlight>' + line + '</span>'
    Not sure :S

  7. #27
    Über Prodigy & Developer Razo[R]apiD's Avatar
    Join Date
    May 2010
    Location
    Poland, Lublin
    Posts
    3,257

    Default

    I've applied another highlighter - smaller size, faster, can handle HTML and has language autodetection.


    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/styles/monokai_sublime.min.css">
    <style type="text/css">
    .syntaxhighlight
    {
    width: 100% !important;
    height: auto !important;
    max-height: 500px;
    overflow-y: auto !important;
    overflow-x: auto !important;
    }
    </style>
    <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/highlight.min.js"></script>
    <script>hljs.initHighlightingOnLoad();</script>

    <pre class="syntaxhighlight"><code class="{option}">{param}</code></pre>


    For autodetection to work, just write "xcode=" without the language name.

  8. #28
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    Alright, so I've been doing some updates to the xcode tags.
    I sort of used Razors approach, but I tweaked it a bit.

    I'm running into 1 thing here. I have this code.

    <link rel="stylesheet" href="http://x-null.net/forums/xcode/prism.css">
    <script src="http://x-null.net/forums/xcode/prism.js"></script>
    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>

    <pre class="line-numbers"><code class="language-{option}">{param}</code></pre>

    <script>

    $( "code" ).dblclick(function()
    {
    <!-- alert( "Hello World!" ); -->
    document.getElementById('{param}').focus();
    document.getElementById('{param}').select();
    });

    </script>


    Basically the script in the tags should select all the text inside the xcode tags, but I'm not sure what I'm doing wrong.
    If I uncomment the alert, and double click in the code area, I get the alert message so I know the trigger works.

    I'd also like to see if there are multiple breaks in between lines.
    If there is more than 1 blank line in between a function or something, I would like to delete that extra line.

    for example

    blah()
    {
    test1;
    test2




    test3;
    }




    blah2()​
    {
    test1;




    test2


    test3;
    }



    Would be formatted as

    blah()
    {
    test1;
    test2

    test3;
    }

    blah2()​
    {
    test1;

    test2

    test3;
    }


    Any ideas?

  9. #29
    Client Beta Testers Appelpitje's Avatar
    Join Date
    Jan 2012
    Location
    Belgium
    Posts
    571

    Default

    Not sure if the alert was working for you but this works for me:
    HTML Code:
    $('document').ready(function(){
    	$("code").on('dblclick', function() 
    	{
                            alert("Hello World!");
    		        $('{param}').focus();
    			$('{param}').select();
    	});
    });
    Edit: Nvm didnt see that your alert was working too.
    I think: $('{param}') is wrong.
    So jquery selects now '{param}' instead of {param}
    Last edited by Appelpitje; May 6th, 2015 at 02:57 PM.

  10. #30
    Administrator James's Avatar
    Join Date
    May 2010
    Location
    on the intraweb
    Posts
    3,180

    Default

    I couldn't get yours to work so I am using this, and it sort of works.


    <link rel="stylesheet" href="http://x-null.net/forums/xcode/prism.css">
    <script src="http://x-null.net/forums/xcode/prism.js"></script>


    <!-- Additional Libraries (JQuery) -->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>


    <script type="text/javascript">
    $('document').ready(function()
    {
    $("pre").on('dblclick', function()
    {
    <!-- alert("Test1"); -->


    var myCode = document.getElementsByClassName("language-{option}");


    for (var i = 0; i < myCode.length; i++)
    {
    var selectedCode = myCode[i].innerText;
    alert(selectedCode);
    }


    });
    });
    </script>


    <pre class="line-numbers"><code class="language-{option}">{param}</code></pre>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •