(API) Config

  • plamzi
  • plamzi's Avatar Topic Author
  • Offline
  • Administrator
More
09 Nov 2013 17:42 - 11 Sep 2014 20:53 #1 by plamzi
(API) Config was created by plamzi
Config is a single object that contains certain browser properties, a logged-in user's game & profile preferences, and any settings passed as URL parameters.

In addition, Config is used to store any module instances that need to be accessed by multiple other modules (e. g. the Socket module).

A basic use of Config is to override or toggle app settings at the time of page load. A game admin can use this to make sure the app always loads with a "clean" look. A player can use this to make sure the app for a certain game loads without a Game Center window.

PROPERTIES & METHODS:

Config.clean = 1;Load the app without a site header, and list only the current game and its profiles in Game Center. Sets or overrides the URL parameter "clean". Note that if you are posting a deep link, such as a Play button, you may still wish to set the URL &clean=1 parameter so that the the app page can start loading without any traces of the site.
Config.solo = 1;Load the app normally, but list only the current game and its profiles in Game Center.
Config.nocenter = 1;Load the app normally, but without loading the Game Center (control panel) module. This also disables the "Quick Buttons" panel generated based on a user's "favorite" macros.
Config.width = 800;
Config.height = 540;
Sets the default width and height of the ScrollView window in pixels. Note that if an authenticated portal user changes the dimensions, this setting will be ignored for them afterwards. Equivalent to the 'width' and 'height' URL parameters.
Config.top = 80;
Config.left = 240;
Sets the default position of the ScrollView window in pixels. If a logged-in user changes the position, this setting will be ignored for them. Same can be achieved with 'top' and 'left' URL parameters.
Config.debug = 1;Enables all modules logging debugging information to the browser console via the use of the "log" utility function. Also enables websocket proxy logging (which for now is not visible in the browser). Equivalent to passing debug=1 in the URL parameters. One of the first things you will see in the console log is a full dump of the Config object.
Config.dev = 1;Equivalent to setting dev=1 in the URL parameters. Enables the loading of "Official" code in an unpublished state, as well as of any code in your "Private" category that is in an unpublished state. Of course, only code meta-tagged for the current server is loaded.
Config.onfirst=trigger;command1;command2Same as passing "onfirst" as a URL parameter. On the first occurrence of "trigger", it will send "command1" and "command2" to the server. This is useful for automatic authentication of users, for example.
Config.collapse = ['#control-panel', '#chatter-box'];
An array of DOM id's for windows that should load in a collapsed state (e. g. Game Center has the id '#control-panel'). Note that this applies only for guest users and users who haven't changed the layout to their liking.
Config.separator= '|';
Config.separator= '';
Set the command separator to something other than semi-column, or disable it by setting it to an empty string. Equivalent to the &separator=URL_ENCODED_CHAR URL parameter.
Config.notrack = 1;Prevents other windows from following the ScrollView when it is moved by the user.
Config.nodrag = 1;Prevents all users from being able to drag the UI windows. Only enable if you're sure that's how you want to roll.
Config.notriggers = 1;Prevents triggers defined in Game Center from loading and executing for your game. Note that this is a soft switch that can be overridden by players if they so choose.
Config.nomacros = 1;Prevents macros defined in Game Center from taking effect in your game. Note that this is a soft switch that can be overridden by players.
Config.nocore = 1;Disables the default core code that starts up Game Center and initializes the ScrollView. Can be enabled to allow full customization of the default view.
Config.deviceAn object containing read-only information about the user's device:
Config.device.touchSet to 'true' if the user's device is touch-enabled (e. g. a tablet or a mobile phone). Set to 'false' for (most) desktop browsers.
Config.device.width | Config.device.heightRead-only values holding the screen / device horizontal and vertical resolution in pixels.
Config.device.lowres | Config.device.mobileThis is set to 'true' by the app if the horizontal resolution of the device is 640 pixels or less.
Config.settingsAn array of the user settings available under the Settings tab in Game Center. These are any profile-level settings overridden by any game-level settings.
Config.getSetting("mxp")
A method for getting the value of a given setting from the array of user settings by passing the setting's id string. Set "Config.debug = 1" or "&debug=1" to see the latest list of settings and their id's.
Last edit: 11 Sep 2014 20:53 by plamzi.
The topic has been locked.