IP15.5 Posted January 18, 2016 Posted January 18, 2016 I would agree that many members somehow inadvertently add the spacing and a high percentage of posts and quotes need to be manually edited on a daily basis to remove the gaps - sometimes many lines.
ipbfuck Posted January 18, 2016 Posted January 18, 2016 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| /g, '').length == 0) $this.remove(); }); </script> and test result.
chilihead Posted January 18, 2016 Author Posted January 18, 2016 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!
Colonel_mortis Posted January 18, 2016 Posted January 18, 2016 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| /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.
chilihead Posted January 18, 2016 Author Posted January 18, 2016 Yeah I don't want to do that. I want to keep the space above this, as it could likely be intended or mess up formatting, and remove the below space
ipbfuck Posted January 18, 2016 Posted January 18, 2016 Empty "p" at the end, end empty "p" at start of post are the same: So, isn't simple to make a regex to remove only empty paragraph at the end :|
chilihead Posted January 18, 2016 Author Posted January 18, 2016 What about remove end and beginning... so remove above and below here but not in between. Does that make it easier or harder? lol thanks
ipbfuck Posted January 19, 2016 Posted January 19, 2016 Sorry, but i don't know... anyway, if u want, atm, u can fix just for blockquote (like from object in this topic): https://laltroweb.it/_script/test.html <script type="text/javascript"> $('blockquote p').each(function() { var $this = $(this); if($this.html().replace(/\s| /g, '').length == 0) $this.remove(); });
Colonel_mortis Posted January 19, 2016 Posted January 19, 2016 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; } } });
chilihead Posted January 19, 2016 Author Posted January 19, 2016 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.
Colonel_mortis Posted January 19, 2016 Posted January 19, 2016 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>
Jed Rosenzweig Posted January 20, 2016 Posted January 20, 2016 Oh neat. My guy has been swamped so he hasn't had chance to tackle this. Is this approach generally preferred to server side? Some observations: Neat! Edit notices will break the bottom routine, would need to wrap the post content in another div and apply to that to overcome this br would be good to add to this
motomac Posted January 22, 2016 Posted January 22, 2016 Ugly empty indents everywhere! I'm really tired of this. @Lindy, please, pay attention to this.
Martin1980 Posted January 28, 2016 Posted January 28, 2016 No reply from the IPS devs so far... Not good.
chilihead Posted February 3, 2016 Author Posted February 3, 2016 This mod looks like it will take care of posts and quotes and you can select top and bottom only, YES! Thanks @motomac! Does it work with all apps and status updates?
ipbfuck Posted February 3, 2016 Posted February 3, 2016 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.
motomac Posted February 3, 2016 Posted February 3, 2016 @chilihead currently it cleans only comments (posts technically are comments too). I will try to add statuses and blog posts soon.
chilihead Posted February 3, 2016 Author Posted February 3, 2016 I will buy it when I finally upgrade. Thanks for creating it and taking suggestions.
motomac Posted February 3, 2016 Posted February 3, 2016 About the price. I reduced it. Hope you will enjoy this plugin. @chilihead you are welcome!
Shariq Ansari Posted February 3, 2016 Posted February 3, 2016 On 1/28/2016 at 5:46 PM, Martin1980 said: No reply from the IPS devs so far... Not good. Seriously, this thread seems unanimous & rather popular... would be nice to get an official nod that this is being looked at....
IP15.5 Posted February 4, 2016 Posted February 4, 2016 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.
chilihead Posted February 4, 2016 Author Posted February 4, 2016 @motomac is the mod is retroactive, if not, will running the rebuild tool fix on all posts? (Not even sure if there is an IPS rebuild tool.) And does this changes posts in the db, or the look of posts only, like another mod that was posted using js? Thanks a lot!
chilihead Posted February 4, 2016 Author Posted February 4, 2016 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?
motomac Posted February 4, 2016 Posted February 4, 2016 @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).
chilihead Posted February 4, 2016 Author Posted February 4, 2016 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.