• Resolved MegaZ

    (@megaz)


    Dear Developers,

    I have basically every module of WpDiscuz deactivated. And yet every page that is loaded has the following inline-Javascript:

    var wpdiscuzAjaxObj={"wc_hide_replies_text":"Hide Replies","wc_show_replies_text":"View Replies","wc_msg_required_fields":"Please fill out required fields","wc_invalid_field":"Some of field value is invalid","wc_error_empty_text":"please fill out this field to comment","wc_error_url_text":"url is invalid","wc_error_email_text":"email address is invalid","wc_invalid_captcha":"Invalid Captcha Code","wc_login_to_vote":"You Must Be Logged In To Vote","wc_deny_voting_from_same_ip":"You are not allowed to vote for this comment","wc_self_vote":"You cannot vote for your comment","wc_vote_only_one_time":"You've already voted for this comment","wc_voting_error":"Voting Error","wc_comment_edit_not_possible":"Sorry, this comment is no longer possible to edit","wc_comment_not_updated":"Sorry, the comment was not updated","wc_comment_not_edited":"You've not made any changes","wc_msg_input_min_length":"Input is too short","wc_msg_input_max_length":"Input is too long","wc_spoiler_title":"Spoiler Title","wc_cannot_rate_again":"You cannot rate again","wc_not_allowed_to_rate":"You're not allowed to rate here","wc_follow_user":"Follow this user","wc_unfollow_user":"Unfollow this user","wc_follow_success":"You started following this comment author","wc_follow_canceled":"You stopped following this comment author.","wc_follow_email_confirm":"Please check your email and confirm the user following request.","wc_follow_email_confirm_fail":"Sorry, we couldn't send confirmation email.","wc_follow_login_to_follow":"Please login to follow users.","wc_follow_impossible":"We are sorry, but you can't follow this user.","wc_follow_not_added":"Following failed. Please try again later.","is_user_logged_in":"","commentListLoadType":"0","commentListUpdateType":"0","commentListUpdateTimer":"30","liveUpdateGuests":"0","wordpressThreadCommentsDepth":"10","wordpressIsPaginate":"","commentTextMaxLength":null,"commentTextMinLength":"1","storeCommenterData":"100000","isGoodbyeCaptchaActive":"","socialLoginAgreementCheckbox":"0","enableFbLogin":"0","enableFbShare":"0","facebookAppID":"","facebookUseOAuth2":"0","enableGoogleLogin":"0","googleClientID":"","googleClientSecret":"","cookiehash":"a527aee3e1ba36fa1b937925d29b39ee","isLoadOnlyParentComments":"0","commentFormView":"collapsed","enableDropAnimation":"0","isNativeAjaxEnabled":"0","enableBubble":"0","bubbleLiveUpdate":"0","bubbleHintTimeout":"45","bubbleHintHideTimeout":"10","cookieHideBubbleHint":"wpdiscuz_hide_bubble_hint","bubbleShowNewCommentMessage":"0","bubbleLocation":"left_corner","firstLoadWithAjax":"0","wc_copied_to_clipboard":"Copied to clipboard!","inlineFeedbackAttractionType":"disable","loadRichEditor":"0","wpDiscuzReCaptchaSK":"6LemxOoSAAAAAHL-pieRnyL0az6uijgbM7f2hoSA","wpDiscuztheme":"light","wpDiscuzReCaptchaVersion":"2.0","wc_captcha_show_for_guest":"0","wc_captcha_show_for_members":"0","wpDiscuzIsShowOnSubscribeForm":"0","wmuEnabled":"0","wmuInput":"wmu_files","wmuMaxFileCount":"1","wmuMaxFileSize":"2097152","wmuPostMaxSize":"67108864","wmuIsLightbox":"0","wmuMimeTypes":{"jpg|jpeg|jpe":"image\/jpeg","gif":"image\/gif","png":"image\/png","bmp":"image\/bmp","tiff|tif":"image\/tiff","ico":"image\/x-icon"},"wmuPhraseConfirmDelete":"Are you sure you want to delete this attachment?","wmuPhraseNotAllowedFile":"Not allowed file type","wmuPhraseMaxFileCount":"Maximum number of uploaded files is 1","wmuPhraseMaxFileSize":"Maximum upload file size is 2MB","wmuPhrasePostMaxSize":"Maximum post size is 64MB","msgEmptyFile":"File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.","msgPostIdNotExists":"Post ID not exists","msgUploadingNotAllowed":"Sorry, uploading not allowed for this post","msgPermissionDenied":"You do not have sufficient permissions to perform this action","wmuSecurity":"ee2985b45f","wmuKeyImages":"images","wmuSingleImageWidth":"auto","wmuSingleImageHeight":"200","version":"7.0.2","wc_post_id":"223362","loadLastCommentId":"0","isCookiesEnabled":"1","dataFilterCallbacks":[],"is_email_field_required":"1","url":"","customAjaxUrl":"","bubbleUpdateUrl":""};var wpdiscuzUCObj={"msgConfirmDeleteComment":"Are you sure you want to delete this comment?","msgConfirmCancelSubscription":"Are you sure you want to cancel this subscription?","msgConfirmCancelFollow":"Are you sure you want to cancel this follow?"};

    Please, only load the specific parts of the Javascript inline that are relevant – an “if” statement with the configuration from the database will easily accomplish the job.

    Thank you!!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter MegaZ

    (@megaz)

    Actually, the issue extends to the use of minified Javascript as well.

    You guys are loading the whole Javascript JQuery library into a single file, which is not right for those of us who are not using most of the functionality of the plugin. I have all the modules disabled, and yet the Javascript file contains the following:

    /* Media Uploader */
    JQuery code
    /* Lity */
    JQuery code
    /* Social */
    JQuery code

    I am not using Media uploader, social login, etc, and yet the above Javascript has to be loaded each time a person visits my page.

    Please feed only Javascript that the user has enabled.

    I love this plugin, but the clean-up it needs is pretty massive…

    • This reply was modified 4 years, 6 months ago by MegaZ.
    Plugin Author gVectors Team

    (@gvectors-team)

    Hi @megaz,
    Thank you for the information and suggestions. Currently, have many layers of JS optimization

    1. We do use KS minification. The option to enable minified JS files is located in wpDiscuz Settings > General Tab. Option name is “Load Min Versions”. But, yes, this is not related to the Inline JS code.

    2. We decided to create combo JS files instead of loading many JS files. The combo JS file collect all JS files in one minified JS file.

    3. We do check components before loading JS files. For example, we don’t load Rich Editor JS if it’s disable. And many other components are under control for sure. For the Media Uploader JS you’ve reported, please make sure the Image Attachment button is disabled on the rich editor. If it still there we’ll fix it too.

    4. By default, we don’t load rich editor for mobile devices.

    5. We’ve added an option to initiate comment section loading once the whole page is loading is complete.

    And many other optimizations are coming very soon…

    Thread Starter MegaZ

    (@megaz)

    Thank you @gvectors-team for your quick response.

    Yes, it is good that you are supplying a minified file, but that does not do anything to reduce Javascript / CSS file size, which is the issue with Google PageSpeed. Please keep in mind that Google now ranks every website according to how quickly it loads. Unfortunately, your plugin loads a bunch of unnecessary Javascript and CSS code, which is a problem. Try disabling your plugin, running Google PageSpeed Insights, then re-enable it and see for yourself.

    If I may suggest (and only in the interest of making this the best comment plugin on the Internet), I would kindly request the following:

    1) Only load Javascript as required by what is enabled in the plugin. It is totally OK to separate Javascript into many different .js files. Many of us are already using caching plugins like W3 Total Cache, Super Cache, etc, and we can easily put all the Javascript files into a single minified file. You don’t have to worry about providing more Javascript files, it is really not an issue. In fact, this is the preferred method of doing this going forward, in order to make the web pages load faster.
    2) Only load required CSS – also section it off to smaller files. There is no need to preload a giant CSS file containing everything, since 90% of that file is unused by the browsers, especially for those of us that have some or all of your features disabled. Don’t worry about making calls to many CSS files. As I said above, we can easily put them all into a single file using caching plugins.
    3) I have requested it a number of times, and will request it again – remove FontAwesome from your library, or make it completely optional. Move the most important icons as inline SVG, or CSS SVG (background-image). You are already doing this partially for some of the icons, so why not do the rest? I bet 99% of your user base does not care about icon customizations, especially once they find out how much faster their websites will get without loading a font library, and a giant FontAwesome CSS file.
    4) Completely avoid both inline CSS and Javascript to make HTML content lighter.

    I bought your whole suite because I like this plugin and I want to support it. If you can optimize the plugin with my suggestions, it will only make it shine! If you guys move your code to Github, I would be happy to contribute – I’m sure there will be others who are looking forward to bringing some good changes to your plugin…

    Absolutely agreed with MegaZ.

    Also, please, get rid of jQuery. Native JS x10 times faster. Google Speed now is very important factor and every detail make sense: minimum DOM tree depth, native JS, less CSS.

    You have very good plugin, but very overbloated.

    Anyway – thank you very much for your work!

    I agree. Kindly put down the jquery and quietly walk away

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WpDiscuz excessive inline Javascript’ is closed to new replies.