Jump to content

Community

Please remove white space from quotes, messy posts a problem


Recommended Posts

  • Replies 51
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Quotes have looked messy since 3.4. yes the editor is WYSIWYG but when you quote someone, you don't intend to also quote any extra white space that is used in the original post, and sometimes white sp

IPS4 has a lot of small aesthetic issues, and this is definitely one of them. And also the unfiltered white-space at the end of posts.

Yes, this please. I asked for this so many times.                                        

Posted Images

I've already posted a quick fix some post ago, and it work!

eg: https://laltroweb.it/_script/test.html

 

Put this in "Search engine optimization; Google analitics" (yes, i use this place for many script...)

<script type="text/javascript">
$('p').each(function() {
    var $this = $(this);
    if($this.html().replace(/\s|&nbsp;/g, '').length == 0)
        $this.remove();
});
</script>

and test result.

 

Edited by laltroweb.it
Link to post
Share on other sites
1 minute ago, chilihead said:

So it would change it visually and not the database post? That may be a better solution even. Does it mess with whitespace in the body? Because I don't want to do that. Just the ends in posts and quotes (top/bottom). Thanks a lot!

The code in this post

2 hours ago, laltroweb.it said:

I've already posted a quick fix some post ago, and it work!

eg: https://laltroweb.it/_script/test.html

 

Put this in "Search engine optimization; Google analitics" (yes, i use this place for many script...)


<script type="text/javascript">
$('p').each(function() {
    var $this = $(this);
    if($this.html().replace(/\s|&nbsp;/g, '').length == 0)
        $this.remove();
});
</script>

and test result.

 

Would mess with the body of posts - it removes every blank paragraph on the page, which might lead to some unintended side effects.

Link to post
Share on other sites

If you only want to strip blank lines from the start and end of the quotes, and you only want to run it client side (so it will only work on browsers with js enabled, will show up differently in the editor, and can't be easily bypassed, the following script should what you want.

$(".ipsComment .ipsType_richText .ipsQuote_contents").each(function() {
  //Whitespace at start
  while (true) {
    var p = $(this).children("p:first-child");
    if (p.length && !p.children().length && !p.text().trim().length) {
      p.remove();
    } else {
      break;
    }
  }
  //Whitespace at end
  while (true) {
    var p = $(this).children("p:last-child");
    if (p.length && !p.children().length && !p.text().trim().length) {
      p.remove();
    } else {
      break;
    }
  }
});

 

Link to post
Share on other sites

Thanks! I suppose you could do that for the post body as well (that covers all apps and statuses?) with an edit? And where does that file go?

I'll see where this suggestion goes and probably utilize the best solution when that time comes but that looks promising thanks for doing that.

Link to post
Share on other sites
1 hour ago, chilihead said:

Thanks! I suppose you could do that for the post body as well (that covers all apps and statuses?) with an edit? And where does that file go?

I'll see where this suggestion goes and probably utilize the best solution when that time comes but that looks promising thanks for doing that.

Currently, it's set up for quotes on anything that is classed as a comment (including status update comments, if you have quotes in there).

To use it, wrap it with

(function ($) {
  $(document).ready(function() {
  	//Put the code here
  });
})(jQuery);

Then you have a few options

  • If you've got an installation with dev mode enabled, you can convert it into a plugin by creating a new plugin, then saving the above content to a file with a .js extension in /plugins/<your plugin>/dev/js
  • If not, you could add the code to the Google Analytics section, wrapped in
    <script> /*The code here*/ </script>

     

Link to post
Share on other sites

7$ for a mod for white space? .... so, i prefer white space (or simple jquery. or css...) :|

sometime i ask to myself why i don't migrate to wordpress :/

EG: This is a plugin (dev by me) with more than 20k active installations: https://it.wordpress.org/plugins/my-custom-css/

Here, instead, we pay for ipb (ok, grat app ip great support - i'm happy to pay for this), themes (mmm... many themes now want 6months renew and many other as asked new feed with ips4 - imho, this is not a great way), and many many plugin (yes, i know, some plugins need many hours of work and support, but many others are very little apps and isn't possible to ask ***$ for any little plugins in marketplace)!

-

a big "bravo" to all user who make free apps (or donationware etc) - eg: BIM41 and his chatbox app!

i am real sorry for this, but this is my opinion.

Link to post
Share on other sites

May have to buy this one, thanks @motomac ! Would prefer that it only apply to the forum though, if it went back and changed the way existing articles on other parts of the suite looked it could potentially take some clean up time. Not sure if that would be the case though.

For some reason around 75% of posts come though with many of these extra paragraphs from what we're seeing and all have to be manually edited constantly. I'm not sure why it's happening with the WYSIWYG editor here but regardless it must be intuitive to add these extra returns for many members. 

Link to post
Share on other sites
3 hours ago, IP15.5 said:

if it went back and changed the way existing articles on other parts of the suite looked it could potentially take some clean up time. Not sure if that would be the case though.

Not sure if this is retroactive, but even so, I'm more interested in the setting that removes the top and bottom and not the middle. Blogs and statuses have this issue too with members posting embeds, etc. Mostly the tailing line. 

I could see having it not work with articles though, with databases and fields and such and someone might want the full white space setting on but to not affect articles with special formatting. But he didn't mention articles, only blogs and statuses for the future, possibly. Maybe gallery image body.

Of course the biggest problem is the forum and comments of apps and this takes care of it brilliantly!

One more question @motomac, will this work for reviews? They use the comment container correct?

Edited by chilihead
Link to post
Share on other sites

@chilihead no, this plugin doesn't rebuild old posts currently. It cleans comments content before putting it into the DB. So even if you uninstall this plugin, posts which where created when it was installed, will stay beautiful :) 

I'm working on an update, where an admin can choose, which type of content to clean (comments and posts, blog entries, gallery image descriptions, statuses).

Edited by motomac
Link to post
Share on other sites

Woot! What about article/database comments are those the regular comment container? And not sure if you saw my question about reviews, are those the comment container as well? I'm not sure. Great work sir!

And this is a modest fee, the cost of a cheap beer. Keep up the good work. One of the best mods out there because it fixes a seriously annoying problem.

Link to post
Share on other sites
  • Recently Browsing   0 members

    No registered users viewing this page.


×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy