1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Other i need some help

Discussion in 'Custom Service/Development Requests' started by Stacy Enco, Mar 2, 2012.

  1. Stacy Enco

    Stacy Enco Member

    a gy who made a php script for a swtor server status script in php which i never could gt to work, he gave me a javascrpt version but it has seem to broke a few things i thought maybe some 1 can make into an ad on and help me fix the errors ill explain how i got it to work

    1st i made a template called torstatus
    which this code in the template
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Star Wars The Old Republic (SWTOR) Server Status PHP Widget</title>
            background:url('http://force-academy.com/pics/tor/graphics/swtorLogo.png') top left no-repeat;
            #swtor-serverStatus-widget .container{
                padding:6px 30px 6px 6px;
                -webkit-border-radius: 5px;
                -moz-border-radius: 5px;
                border-radius: 5px;
                border: 1px solid rgba(56,70,94,1);
                -webkit-box-shadow:0 0 0px #ffffff;
                -moz-box-shadow: 0 0 0px #ffffff;
                box-shadow:0 0 0px #ffffff;
                #swtor-serverStatus-widget .container .loading{
                #swtor-serverStatus-widget .container .serverInfo{
                #swtor-serverStatus-widget .status.UP
                ,#swtor-serverStatus-widget .status.DOWN{
                    background:url('http://force-academy.com/pics/tor/graphics/arrows.png') top left;
                    position: absolute;
                    #swtor-serverStatus-widget .status.down{
                        background-position:bottom left;
                #swtor-serverStatus-widget .population{
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
    * jQuery.ajax mid - CROSS DOMAIN AJAX
    * ---
    * @author James Padolsey (http://james.padolsey.com)
    * @version 0.11
    * @updated 12-JAN-10
    * ---
    * Note: Read the README!
    * ---
    * @info http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/
    jQuery.ajax = (function(_ajax){
        var protocol = location.protocol,
            hostname = location.hostname,
            exRegex = RegExp(protocol + '//' + hostname),
            YQL = 'http' + (/^https/.test(protocol)?'s':'') + '://query.yahooapis.com/v1/public/yql?callback=?',
            query = 'select * from html where url="{URL}" and xpath="*"';
        function isExternal(url) {
            return !exRegex.test(url) && /:\/\//.test(url);
        return function(o) {
            var url = o.url;
            if ( /get/i.test(o.type) && !/json/i.test(o.dataType) && isExternal(url) ) {
                // Manipulate options so that JSONP-x request is made to YQL
                o.url = YQL;
                o.dataType = 'json';
                o.data = {
                    q: query.replace(
                        url + (o.data ?
                            (/\?/.test(url) ? '&' : '?') + jQuery.param(o.data)
                        : '')
                    format: 'xml'
                // Since it's a JSONP request
                // complete === success
                if (!o.success && o.complete) {
                    o.success = o.complete;
                    delete o.complete;
                o.success = (function(_success){
                    return function(data) {
                        if (_success) {
                            // Fake XHR callback.
                            _success.call(this, {
                                responseText: data.results[0]
                                    // YQL screws with <script>s
                                    // Get rid of them
                                    .replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi, '')
                            }, 'success');
            return _ajax.apply(this, arguments);
        var SWTOR_WIDGET_SERVERNAME = "Lord Adraas";
            $.get('http://www.swtor.com/server-status', function(data) {
                var res = $(data.responseText);
                server = res.find('div.serverBody:contains("'+SWTOR_WIDGET_SERVERNAME+'")');
                var name = $.trim(server.find('div.name').text());
                var timezone = $.trim(server.find('div.timezone').text());
                var type = $.trim(server.find('div.type').text());
                var status = $.trim(server.find('div.status').text());
                var population = $.trim(server.find('div.population').text());
                var widget = $('#swtor-serverStatus-widget');
                widget.find('.container .name .value').text(name + ' (' + type +', ' + timezone + ')');
                widget.find('.container .status').addClass(status).find('.value').text(status);
                widget.find('.container .population .value').text(population);
    <div id="swtor-serverStatus-widget" data-name="test">
        <div class="container">
            <div class="loading">Loading...</div>
            <div class="serverInfo">
                <div class="name"><span class="value"></span></div>
                <div class="status"><strong>Status:</strong> <span class="value"></span></div>
                <div class="population"><strong>Population:</strong> <span class="value"></span></div>
    then in the template forum_list template i added this code

     <div class="section">
                <div class="secondaryContent statsList" id="swtor">
                      <h3>Tor Server Status</h3>
                    <xen:include template="torstatus" />
    if i could get some help into getting the errors fixed would be great and yes i do have the authors permision to port it over to XF


    any help with this would be great.

    itt has broken the style chooser overlay on the forums as well and the col side bar mod the opens and closes the sidebar i removed the code and they were working fine again

    oh befor i forget here is the imagez for the mod.

    cridit to the orginial authror he hasnt uploaded the javascript version yet but as per requested here the link to his dev page.

    Attached Files:

    • tor.zip
      File size:
      14 KB
  2. Stacy Enco

    Stacy Enco Member

    hope i posted this in the right section.
  3. Stacy Enco

    Stacy Enco Member

    any 1 cn help with this?
  4. Caelum

    Caelum Well-Known Member

    You could use an iframe or object. Other methods would involve modifying the widget's code.
  5. Stacy Enco

    Stacy Enco Member

    take the whole html page and wrap it in iframe tags?
  6. Caelum

    Caelum Well-Known Member

    No. Save the html page on your server, and do this:

    <iframe src='http://yourdomain.com/what-you-saved-it-as.html'>You can optionally place text here that will display if the iframe fails to load for some reason</iframe>
    You can also add some other attributes if you like. For instance:
    <iframe src='http://yourdomain.com/bla.html' height='200' width'200' frameborder='0' scrolling='no'></iframe>
  7. Kevin

    Kevin Well-Known Member

    Stacy, are you trying to add it to the sidebar or somewhere else? Have an example of what status display is supposed to look like?
  8. Stacy Enco

    Stacy Enco Member

Share This Page