Profiles.ORNG.Utilities.OpenSocialManager.GetGadgetJavascipt C# (CSharp) Method

GetGadgetJavascipt() private method

private GetGadgetJavascipt ( ) : string
return string
        private string GetGadgetJavascipt()
        {
            string gadgetScriptText = Environment.NewLine +
                    "var my = {};" + Environment.NewLine +
                    "my.gadgetSpec = function(appId, label, url, view, chrome_id, opt_params, secureToken) {" + Environment.NewLine +
                    "this.appId = appId;" + Environment.NewLine +
                    "this.label = label;" + Environment.NewLine +
                    "this.url = url;" + Environment.NewLine +
                    "this.view = view || 'default';" + Environment.NewLine +
                    "this.chrome_id = chrome_id;" + Environment.NewLine +
                    "this.opt_params = opt_params;" + Environment.NewLine +
                    "this.secureToken = secureToken;" + Environment.NewLine +
                    "};" + Environment.NewLine;
            gadgetScriptText += "my.openSocialURL = '" + shindigURL + "';" + Environment.NewLine +
                "my.guid = '" + guid.ToString() + "';" + Environment.NewLine +
                "my.containerSessionId = '" + new SessionManagement().Session().SessionID + "';" + Environment.NewLine +
                "my.debug = " + (IsDebug() ? "1" : "0") + ";" + Environment.NewLine +
                "my.noCache = " + (NoCache() ? "1" : "0") + ";" + Environment.NewLine +
                "my.noCache = " + (NoCache() ? "1" : "0") + ";" + Environment.NewLine +
                "my.gadgets = [";
            if (GetVisibleGadgets().Count > 0)
            {
                foreach (PreparedGadget gadget in GetVisibleGadgets())
                {
                    gadgetScriptText += "new my.gadgetSpec(" + gadget.GetAppId() + ",'" + gadget.GetLabel() + "','" + gadget.GetGadgetURL() + "','" +
                        gadget.GetView() + "','" + gadget.GetChromeId() + "'," +
                        gadget.GetOptParams() + ",'" + gadget.GetSecurityToken() + "'), " + Environment.NewLine;
                }
                gadgetScriptText = gadgetScriptText.Substring(0, gadgetScriptText.LastIndexOf(','));
            }
            gadgetScriptText += "];" + Environment.NewLine;

            // this uses jquery to kickstart the gadgets
            // better than using onload because this happens before the images finish
            /*** Either use this or the my.init call in LoadAssets!  Only use one.  This one is faster but seems to be having issues with Shindig 2.5.0 **/
            gadgetScriptText += "$(document).ready(function(){" + Environment.NewLine +
                                "my.init();" + Environment.NewLine +
                                "});" + Environment.NewLine;
            return gadgetScriptText;
        }