[REL]In Game Browser V2.0.2

Discussion in 'Released Mods' started by someonewhoisnobody, June 12, 2014.

  1. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    In Game Browser 2.0.2
    Completely Rewritten

    In Game Browser adds an internet browser into PA. This allows you to browse the internet while you play PA.

    Main Features
    • Complete Tab System
    • Saved tab states
    • Complete modder API

    Complete Tab System
    In Game Browser 2.0 features a new system, tabs. In previous versions it was only possible to have one window open, this meant you could not browse more than 1 page at a time. Now with In Game Browser 2.0 the idea of tabs has been introduced.

    Tabs allow the user to have completely separate web pages open, in completely separate windows. Each tab can be closed or just minimized.

    To manage all these new tabs a new feature has been added in called the tabs bar. This is a new item on the left side of the Uberbar that allows you to manage your open tabs and create new tabs. The tab bar will always be present.

    [​IMG]
    Example of having more than one tab open

    [​IMG]
    The tab bar, where you can control your open tabs, always in the Uberbar
    Saved Tab States
    In Game Browser 2.0 now has the ability to completely save tabs. Between UI pages or when you close the game, your In Game Browser tabs will be saved.

    In Game Browser 2.0 saves:
    • Tab Name
    • Tab URL
    • Tab Position
    • Tab Size
    • Tab State(Open, or minimized)

    Minor Features

    • 'X-Frame-Options' error detection
      • Sometimes websites set an option on their server that blocks the technology used in In Game Browser. In previous versions the only way to tell if this was the case was to go into the debug console and look for an error. With In Game Browser 2.0 if a website blocks the browser, an error page will show.
    • Start page twitch streams open in a new tab
      • On the start page of PA there is a list of twitch users streaming PA. Without In Game Browser these streams will open in an external browser. With In Game Browser these streams will open up in a new tab
    • New UI
      • The look of In Game Browser 2.0 has change significantly. It is now easier than ever to use.
    Complete Modder API
    In Game Browser now has a new modder API. This allows modders to use In Game Browser's features in their own mod.

    To use In Game Browser in your mod you must first include the In Game Browser scripts.
    Code:
    loadScript('coui://ui/main/shared/js/inGameBrowserCore.js');
    loadScript('coui://ui/main/shared/js/inGameBrowserEngine.js');
    


    You must then create an 'inGameBrowserEngineClient', this client will communicate with the core of the In Game Browser which reside in the 'uberbar' scene.
    Code:
    var inGameBrowserDB = new inGameBrowserDB();
    var inGameBrowserEngineQueueHandler = new inGameBrowserEngineQueueHandler("client", inGameBrowserDB);
    
    var inGameBrowserEngineClient = new inGameBrowserEngineClient(inGameBrowserDB, inGameBrowserEngineQueueHandler);
    

    After you have created an 'inGameBrowserEngineClient' you can make In Game Browser Engine calls. Each engine call has a command name, and a payload. The command name is the name of the engine command to execute, and the payload contains any options needed to execute the command.

    In the In Game Browser API tabs are referred to as 'sessions'. Each engine command will return an object. This return object will contain an 'errors' index and any other information that the command is supposed to return.

    If you do not see a command in the list bellow that you think should be included in the API, PM me

    In Game Browser Engine Commands:

    • Add Session
      • Desc: Creates a new session and opens it
      • Command Name: addSession
      • Arguments needed in payload
        • sessionTitle - The name of the session to create
        • sessionUrl - The Url of the new session
      • Arguments returned
        • errors - Any errors that where encountered while executing the command, can be empty
        • sessionId - The Id of the session created, use this to run commands on the session

    • Open Session
      • Desc: Opens an existing session
      • Command Name: openSession
      • Arguments needed in payload
        • sessionId - The Id of the session to open
      • Arguments returned
        • errors - Any errors that where encountered while executing the command, can be empty

    • Close Session
      • Desc: Closes a session, this deletes it. Can not be undone
      • Command Name: closeSession
      • Arguments needed in payload
        • sessionId - The Id of the session to open
      • Arguments returned
        • errors - Any errors that where encountered while executing the command, can be empty

    • Minimize Session
      • Desc: Minimizes a session, hides it
      • Command Name: minimizeSession
      • Arguments needed in payoad
        • sessionId - The Id of the session to minimize
      • Arguments returned
        • errors - Any errors that where encountered while executing the command, can be empty

    • Set Session Url
      • Desc: Sets the Url of a session
      • Command Name: setSessionUrl
      • Arguments needed in payload
        • sessionId - The Id of the session to set the Url of
        • sessionUrl - The new Url for the session
      • Arguments returned
        • errors - Any errors that where encountered while executing the command, can be empty

    • Get Session By Id

      • Desc: Returns a session object
      • Command Name: getSessionById
      • Arguments needed in payload
        • sessionId - The Id of the session to get
      • Arguments returned
        • errors - Any errors that where encountered while executing the command, can be empty
        • session - Session object
          • id - The session id
          • title - The session title
          • url - The session Url
          • active - Is the session active(True = open, False = minimized)
          • position - The position of the session window
            • top - Amount of pixels from the top of the screen
            • left - Amount of pixels from the left of the screen
          • dimensions - The size of the session window
            • width - The width of the session window
            • height - The height of the session window


    Making an engine call
    Code:
    inGameBrowserEngineClient.call(commandName, payload, callback);
    
    Example Call:
    Code:
      var newSessionTitle = "Twitch TV";
      var newSessionUrl = "http://twitch.tv/";
    
      var payload = {
        "sessionTitle": newSessionTitle,
        "sessionUrl": newSessionUrl
      };
    
      inGameBrowserEngineClient.call("addSession", payload, function(name, payload){
        //Do something with data
      });
    
    You will notice that the 3rd argument is a callback function, this function accepts 2 arguments, name, and payload. This is because making an engine call is asynchronous. Meaning the command might not execute right away. The name argument is the name of the command that you called. The payload is the object that the inGameBrowserEngine will return with any errors or other data returned by the function.
    Source on Github

    Change Log
    [2.0.0] - Complete rewritte
    [2.0.1] - Added in sandbox options to browser iframe, this fixes issue of some pages taking over uberbar view
    [2.0.2] - More sandbox options for iframe
  2. Fr33Lancer

    Fr33Lancer Well-Known Member

    Messages:
    595
    Likes Received:
    288
    Had a weird scrolling issue with 2 opened tabs.
    With the mouse cursor outside of both iframe areas, I was able to scroll down the UI :confused:
    Pic :
    [​IMG]
    [​IMG]
    [​IMG]
    Can anyone confirm or not this bug ? (could be a conflicting mod)
  3. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    Can you reproduce? If so can you open up the debugger and show me the uberbar view?
    Fr33Lancer likes this.
  4. Fr33Lancer

    Fr33Lancer Well-Known Member

    Messages:
    595
    Likes Received:
    288
    I can reproduce :)
    Tell me if the following is what you're looking for.
    Just after login, here's what I got :
    [​IMG]
    And after messing with the 2 tabs (just scrolling in fact) :
    [​IMG]
    Hope it helps.
  5. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    Weird...

    Can you scroll it back up?

    If not then disable other mods. If it does get fixed by doing that then try and tell which mod it doesn't play nice with.

    I will probably not be able to patch for another couple weeks because I am on vacation.
    Fr33Lancer likes this.
  6. Fr33Lancer

    Fr33Lancer Well-Known Member

    Messages:
    595
    Likes Received:
    288
    Yes, if I scroll up, at some point it goes back to normal (until I scroll down again)
    Tried with only this mod enabled and same issue.
    I tried to reinstall, thinking maybe something went wrong after some update, but it didn't work. Un-install / install either.
    Discarded the tabs and re-set them, same issue.
    Problem appears as soon as 2 tabs are displayed at the same time (works with empty tabs)

    Quick workaround would be to allow only one displayed tab at a time, but I don't think it is the philosophy of the mod ;) (Although it makes sense on single screen setup)
  7. someonewhoisnobody

    someonewhoisnobody Well-Known Member

    Messages:
    657
    Likes Received:
    361
    Alright from that I can tell what's wrong. Although each tab appears to be floating each tab takes up space as they stack.

    If I can I will patch it but it might be hard because I don't have PA or a computer with me right now(Just a phone)

    If someone wants to fix and then submit a pull request: https://github.com/Noah-Huppert/In-Game-Browser
    Fr33Lancer likes this.
  8. Fr33Lancer

    Fr33Lancer Well-Known Member

    Messages:
    595
    Likes Received:
    288
    It's not a deal breaker and can wait. Enjoy your holidays ;)

Share This Page