Kami
Forum Cat
Posts: 40,201
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,201
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on May 22, 2020 13:53:52 GMT -8
This is where I get confused. A BReak is produced by a press of the return key. Yes? How do you produce a DIVision ? Thanks Kami There's a few ways. For line breaks you can either manually press the return key or type in the code. For divs, you can either type in the code, or sometimes creating empty lines will add in divs automatically.
|
|
inherit
219572
0
Oct 25, 2023 2:12:01 GMT -8
Gene Hunt
634
March 2015
genehunt
|
Post by Gene Hunt on May 23, 2020 0:26:31 GMT -8
This is where I get confused. A BReak is produced by a press of the return key. Yes? How do you produce a DIVision ? Thanks Kami There's a few ways. For line breaks you can either manually press the return key or type in the code. For divs, you can either type in the code, or sometimes creating empty lines will add in divs automatically. So how would you create the empty lines without pressing the return key? I'm sure I'm missing something simple here so sorry for the constant questions.
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on May 23, 2020 5:21:49 GMT -8
There's a few ways. For line breaks you can either manually press the return key or type in the code. For divs, you can either type in the code, or sometimes creating empty lines will add in divs automatically. So how would you create the empty lines without pressing the return key? I'm sure I'm missing something simple here so sorry for the constant questions. It would be a strange thing to do, but you can create a line break by typing [br] in the UBBC side of the editor.. No enter keys required. You can also force a line break by adding and empty div... [div][/div] would do the same thing.
|
|
inherit
219572
0
Oct 25, 2023 2:12:01 GMT -8
Gene Hunt
634
March 2015
genehunt
|
Post by Gene Hunt on May 23, 2020 5:48:10 GMT -8
The post I linked here contains many occurances. At least the code you provided is doing the job perfectly Todge - thank you once again.
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on May 23, 2020 6:48:55 GMT -8
Not a problem.. Got there in the end.
|
|
inherit
219572
0
Oct 25, 2023 2:12:01 GMT -8
Gene Hunt
634
March 2015
genehunt
|
Post by Gene Hunt on May 24, 2020 1:13:08 GMT -8
Hi TodgeI've found a glitch somewhere I think. The code was working perfectly, up until someone quoted one of the posts from this member. The original post I could see (when I clicked to edit it) had 12 blank lines at the foot of it. Then along came another member and quoted the post. THis caused the page to freeze and become unresponsive. I double checked that it was the code causing theissue by removing the code, then going back to view the quoted post. The page loaded immediately and was OK, but all the blak lines were showing in both the original post, and the quoted post. So I went back an put the code back in. Then when I checked the page, it was unresponsive again. Any ideas?
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on May 24, 2020 7:08:45 GMT -8
Hi TodgeI've found a glitch somewhere I think. The code was working perfectly, up until someone quoted one of the posts from this member. The original post I could see (when I clicked to edit it) had 12 blank lines at the foot of it. Then along came another member and quoted the post. THis caused the page to freeze and become unresponsive. I double checked that it was the code causing theissue by removing the code, then going back to view the quoted post. The page loaded immediately and was OK, but all the blak lines were showing in both the original post, and the quoted post. So I went back an put the code back in. Then when I checked the page, it was unresponsive again. Any ideas? Strange... It should have ignored the quote.. Can you please replace the code I gave you with this please.. <script> function remove_break_tags(post) { $(post).find('.quote').each(function(){ $(this).html($(this).html().replace(/<div class="quote_clear"><\/div>/i,'')); $(this).html($(this).html().replace(/((<\w{1,5}>)?(<br\/?>)?(<\/\w{1,5}>)?)+<\/div>$/i,'</div>')); }); $(post).html($(post).html().replace(/((<\w{1,5}>)?(<br\/?>)?(<\/\w{1,5}>)?)+$/i,'')); return; }
$(document).ready(function(){ $('article > .message').each(function(){ remove_break_tags($(this)); }); proboards.on('pageChange', function(){ $('article > .message').each(function(){ remove_break_tags($(this)); }); }); }); </script>
|
|
inherit
219572
0
Oct 25, 2023 2:12:01 GMT -8
Gene Hunt
634
March 2015
genehunt
|
Post by Gene Hunt on May 24, 2020 7:23:57 GMT -8
I'll give that a try Todge and report back - many thanks. GH.
|
|
inherit
219572
0
Oct 25, 2023 2:12:01 GMT -8
Gene Hunt
634
March 2015
genehunt
|
Post by Gene Hunt on May 24, 2020 7:29:21 GMT -8
I'll give that a try Todge and report back - many thanks. GH. Just tried it Todge and it has made the page with the aforementioned post and the following post that quotes it unresponsive again. I've tried loading the page in Edge & Firefox and it is unresponsive there too. I removed the code once more and the page loaded immediately (but obviously had the line breaks in)
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on May 24, 2020 12:56:14 GMT -8
I'll give that a try Todge and report back - many thanks. GH. Just tried it Todge and it has made the page with the aforementioned post and the following post that quotes it unresponsive again. I've tried loading the page in Edge & Firefox and it is unresponsive there too. I removed the code once more and the page loaded immediately (but obviously had the line breaks in) Does the thread you are looking at have nested quotes? And assuming it does, can I remove the nested ones?Scrap that.. Can you try this instead.. <script> function remove_break_tags(post) { var quotes = $(post).find('.quote'); for(q=quotes.length-1; q>-1; q--) { $(quotes[q]).html($(quotes[q]).html().replace(/<div class="quote_clear"><\/div>/i,'')); $(quotes[q]).html($(quotes[q]).html().replace(/((<\w{1,5}>)?(<br\/?>)?(<\/\w{1,5}>)?)+<\/div>$/i,'</div>')); } $(post).html($(post).html().replace(/((<\w{1,5}>)?(<br\/?>)?(<\/\w{1,5}>)?)+$/i,'')); return; }
$(document).ready(function(){ $('article > .message').each(function(){ remove_break_tags($(this)); }); proboards.on('pageChange', function(){ $('article > .message').each(function(){ remove_break_tags($(this)); }); }); }); </script>
|
|
inherit
219572
0
Oct 25, 2023 2:12:01 GMT -8
Gene Hunt
634
March 2015
genehunt
|
Post by Gene Hunt on May 24, 2020 14:04:10 GMT -8
Good news Todge - The new code seems to have done the trick and the line returns are hidden and pages are not unresponsive. If you don't mind my asking, whatdid you have to change in the code? What was causing the unresponsiveness? Many thanks Todge
|
|
#00AF33
Official Code Helper
19529
0
1
Nov 19, 2012 14:18:28 GMT -8
Todge
**
17,324
January 2004
todge
|
Post by Todge on May 24, 2020 15:58:03 GMT -8
Good news Todge - The new code seems to have done the trick and the line returns are hidden and pages are not unresponsive. If you don't mind my asking, whatdid you have to change in the code? What was causing the unresponsiveness? Many thanks Todge The issue was quotes. The code goes through your posts one at a time, then looks for and removes linebreaks and empty cells at the end of the posts' content. When it encountered a quote, the way the code looks at the content, it saw that the quote contained a line break at the end, but when it tried to remove it, it gor stuck, as all the linebreaks themselves are storen in another <div> cell, and so, for some reason, it got lost. The first code I gave you fixed the issue, but it only worked for a single quote, when quotes are nested the preblem re-occured, as it saw the line breaks in the nested quote, but again, couldn't find them to remove them, and again, got stuck. So, to fix the issue I had to reverse the code.. It now removes the line breaks from the nested quotes, then the main quote, and lastly for the post content.. So now the code shouldn't get stuck as it is fixing the problem causing cells first.
|
|
inherit
219572
0
Oct 25, 2023 2:12:01 GMT -8
Gene Hunt
634
March 2015
genehunt
|
Post by Gene Hunt on May 25, 2020 0:24:57 GMT -8
Brilliant! That makes perfect sense. Thanks again TodgeGH.
|
|