Forum Discussion

james_scee's avatar
11 years ago

Huge amount of seemingly iterable JS on thread pages

For each message on a thread page, the below JS seems to get output (with IDs etc changed) - this appears to follow a format and therefore should be iterable vs the current addition of (in our standard case) nearly 2000 lines of in-line JS. If people have a higher number of messages set to display, the amount of JS will increase accordingly.

 

I'd suggest creating an object containing the values, and iterating over the rest of the JS therefore removing the amount of in-line JS on the page.

 

LITHIUM.MessageViewDisplay({"confimationText":"You have other message editors open and your data inside of them might be lost. Are you sure you want to proceed?","editEvent":"LITHIUM:editMessageViaAjax","collapseEvent":"LITHIUM:collapseInlineMessageEditor","loaderSelector":"#lineardisplaymessageviewwrapper_17 .lia-message-body-loader .lia-loader","renderInlineFormEvent":"LITHIUM:renderInlineEditForm","messageId":21275691,"expandedRepliesSelector":".lia-inline-message-reply-form-expanded","componentId":"lineardisplaymessageviewwrapper_17","openEditsSelector":".lia-inline-message-edit","componentSelector":"#lineardisplaymessageviewwrapper_17"});
LITHIUM.AjaxSupport({"feedbackSelector":"#lineardisplaymessageviewwrapper_17","tokenId":"ajax","token":"","ajaxOptionsParam":{"event":"LITHIUM:renderInlineEditForm"},"ajaxErrorEventName":"LITHIUM:ajaxError","action":"renderInlineEditForm","elementSelector":"#lineardisplaymessageviewwrapper_17","url":"/t5/forums/forumtopicpage.lineardisplay.lineardisplaymessageviewwrapper:renderinlineeditform?t:ac=board-id/70/thread-id/1245577&ticket=1RUnaX9tCleU_634598"});
LITHIUM.InformationBox({"feedbackSelector":".InfoMessage","updateFeedbackEvent":"LITHIUM:updateAjaxFeedback","componentSelector":"#informationbox_135"});
LITHIUM.InformationBox({"feedbackSelector":".InfoMessage","updateFeedbackEvent":"LITHIUM:updateAjaxFeed</ak","componentSelector":"#informationbox_136"});
LITHIUM.InformationBox({"feedbackSelector":".InfoMessage","updateFeedbackEvent":"LITHIUM:updateAjaxFeedback","componentSelector":"#informationbox_137"});
LITHIUM.AjaxSupport({"feedbackSelector":false,"tokenId":"ajax","token":"","ajaxOptionsParam":{"event":"LITHIUM:lightboxRenderComponent","trackableEvent":false,"parameters":{"componentParams":"{\n \"userIp\" : {\n \"value\" : \"81.156.130.24\",\n \"class\" : \"java.lang.String\"\n },\n \"userId\" : {\n \"value\" : \"2047641\",\n \"class\" : \"java.lang.Integer\"\n },\n \"triggerSelector\" : {\n \"value\" : \"rO0ABXNyABxsaXRoaXVtLnV0aWwuY3NzLkNzc1NlbGVjdG9ybVqnCRPimmYCAAB4cgAnbGl0aGl1bS51dGlsLnN0cmluZy5BYnN0cmFjdFR5cGVkU3RyaW5nkDwl-iWjh3sCAAFMAAZzdHJWYWx0ABJMamF2YS9sYW5nL1N0cmluZzt4cHQAESNjcmVhdGVCYW5MaW5rXzE4\",\n \"class\" : \"lithium.util.css.CssSelector\"\n },\n \"userEmail\" : {\n \"value\" : \"_SMR_~2DIy2SK8oc1OyM962~_zuN3YH8fNm8-3Wi3pY5KkPO7_ZYn8ywJ7zaAFc21CKVtdoM10WgwCp4ASlwWkBj@smr.eu.playstation.com\",\n \"class\" : \"java.lang.String\"\n },\n \"userLogin\" : {\n \"value\" : \"opeth12\",\n \"class\" : \"java.lang.String\"\n }\n}","componentId":"profile.widget.bans-ide-form"}},"ajaxErrorEventName":"LITHIUM:ajaxError","action":"lightboxRenderComponent","elementSelector":"#createBanLink_18","url":"/t5/forums/forumtopicpage.banuser.createbanlink:lightboxrendercomponent?t:ac=board-id/70/thread-id/1245577&t:cp=user/contributions/adminactions"});
LITHIUM.MessageBodyDisplay('#messagebodydisplay_18', '.lia-truncated-body-container', '#viewMoreLink', '.lia-full-body-container');
LITHIUM.InformationBox({"feedbackSelector":".InfoMessage","updateFeedbackEvent":"LITHIUM:updateAjaxFeedback","componentSelector":"#informationbox_138"});
LITHIUM.InformationBox({"feedbackSelector":".InfoMessage","updateFeedbackEvent":"LITHIUM:updateAjaxFeedback","componentSelector":"#informationbox_139"});
LITHIUM.InformationBox({"feedbackSelector":".InfoMessage","updateFeedbackEvent":"LITHIUM:updateAjaxFeedback","componentSelector":"#informationbox_140"});
LITHIUM.AjaxSupport.fromForm('#form_18', 'QuickReply', '#ajaxfeedback_18', 'LITHIUM:ajaxError', {"httpMethod":"POST","event":"submit","useLoader":true}, false);
LITHIUM.InputEditForm('form_18', {"enableFormEvent":"LITHIUM:enableForm","submitOnChange":false,"enableFormButtonEvent":"LITHIUM:enableFormButton","swallowEnterEvent":true,"ignoreOnChangeCssClasses":[],"ignoreDisableFormDuringSubmitCssClasses":[],"unloadMessage":"Unsaved information will be lost.","useUnsavedDataWarning":true,"buttonWrapperSelector":".lia-button-wrapper","disableFormEvent":"LITHIUM:disableForm","warnUnsavedDataActionCssClasses":["lia-form-action-ignore-unsaved-data","lia-button-Cancel-action"],"disableFormButtonEvent":"LITHIUM:disableFormButton","showUnsavedDataWarningDataKey":"showUnsavedDataWarning"});
LITHIUM.AjaxSupport.fromLink('#kudoEntity_18', 'kudoEntity', '#ajaxfeedback_18', 'LITHIUM:ajaxError', {}, '', 'ajax');
LITHIUM.AjaxSupport.ComponentEvents.set({
"selector" : "#kudosButtonV2_18",
"eventActions" : [
{
"event" : "kudoEntity",
"actions" : [
{
"context" : "envParam:entity",
"action" : "rerender"
}
]
}
],
"initiatorBinding" : true,
"parameters" : {
"displayStyle" : "horizontal",
"kudosable" : "true",
"entity" : "21275775",
"disallowZeroCount" : "false",
"showCountOnly" : "false"
},
"componentId" : "kudos.widget.button"
});
LITHIUM.InformationBox({"feedbackSelector":".InfoMessage","updateFeedbackEvent":"LITHIUM:updateAjaxFeedback","componentSelector":"#informationbox_141"});
LITHIUM.AjaxSupport.ComponentEvents.set({
"selector" : "#messageview_18",
"eventActions" : [
{
"event" : "approveMessage",
"actions" : [
{
"context" : "",
"action" : "rerender"
},
{
"context" : "",
"action" : "pulsate"
}
]
},
{
"event" : "unapproveMessage",
"actions" : [
{
"context" : "",
"action" : "rerender"
},
{
"context" : "",
"action" : "pulsate"
}
]
},
{
"event" : "deleteMessage",
"actions" : [
{
"context" : "lia-deleted-state",
"action" : "addClassName"
},
{
"context" : "",
"action" : "pulsate"
}
]
},
{
"event" : "QuickReply",
"actions" : [
{
"context" : "envParam:feedbackData",
"action" : "rerender"
}
]
}
],
"initiatorBinding" : true,
"parameters" : {
"message" : "21275775",
"messageViewOptions" : "1111110111111111111110111110100101101",
"useSimpleView" : "false"
},
"componentId" : "forums.widget.message-view"
});