paulam
New Member
Dodgerslist.com .... There is hope for dogs with disc disease!
Posts: 120
inherit
190606
0
Dec 30, 2022 13:04:15 GMT -8
paulam
Dodgerslist.com .... There is hope for dogs with disc disease!
120
February 2013
paulam
|
Post by paulam on Jul 31, 2017 14:11:55 GMT -8
Can’t get the code to cause any message at all to appear on my testing board here: ADMIN board: dodgerslist.boards.net/board/11/admin Coding stuff is not my bailiwick so any specific details you can give would be very much appreciated. My desire is to have a message that appears in three places from any board: quick reply, reply and create a thread. This is the text of the message: Helpful hints: - Use exact name of all meds. Give the dose in mgs. Give the frequency of dosing 1x/day, 2x/day, etc. - Use dates rather than Tuesday, last week, etc.The code is from a Brian O. post on “Predifined text: support.proboards.com/thread/542742/predifined-text?page=1&scrollTo=6233392 I installed the code here: Structure > Headers & Footers> Admin Area board (visible only to staff) <!-BEGIN Reply page message --> <script type="text/javascript"> // Reply page message $(document).ready(function(){ if(pb.data('route').name == "new_thread" || pb.data('route').name == "new_post" || pb.data('route').name == "quote_posts") { $('.subject_line').after('<div class="content-box support-reply-info" style="padding: 10px; font-size: 14px; border-width: 3px;"></div>'); if(pb.data('route').name == "new_thread") $('.support-reply-info').append(‘ Helpful hint’); else $('.support-reply-info').css('border-color','#a00').append(' Use exact name of all meds. Give the dose in mgs. <br /><br /Give the frequency of dosing 1x/day, 2x/day, etc. Use dates rather than Tuesday, last week, etc.'); } }); </script> <!- END Reply page message --> If I can get the code to work, then I would like all boards to have the "Predifined text." So then the code should go where? — Gobal Header & Footer? — Main Header & Footer? — must be installed separately for each board wanted? — Does the code work best in a footer or a header? Thank you.
|
|
inherit
I need a new CT, thinking.... [insert Jeopardy theme song here]
110769
0
Aug 21, 2021 0:07:21 GMT -8
Tumbleweed
20,825
September 2007
tumbleweed
|
Post by Tumbleweed on Jul 31, 2017 16:39:47 GMT -8
paulam , Just a couple mistakes made in your coding: First the single quotes in red should be like the blue: $('.support-reply-info').append(‘Helpful hint’);
but it might not be the above and is only this: Missing the closing > in your break which I added in red.
$('.support-reply-info').css('border-color','#a00').append('Use exact name of all meds. Give the dose in mgs. <br /><br />Give the frequency of dosing 1x/day, 2x/day, etc. Use dates
|
|
paulam
New Member
Dodgerslist.com .... There is hope for dogs with disc disease!
Posts: 120
inherit
190606
0
Dec 30, 2022 13:04:15 GMT -8
paulam
Dodgerslist.com .... There is hope for dogs with disc disease!
120
February 2013
paulam
|
Post by paulam on Aug 1, 2017 5:30:39 GMT -8
Thanks, Tumbleweed, for your suggestions. I did make those changes so the code now reads as below.
Unfortunately, the preformatted text still does not appear.
<!-BEGIN predefined text --> <script type="text/javascript"> // Reply page message $(document).ready(function(){ if(pb.data('route').name == "new_thread" || pb.data('route').name == "new_post" || pb.data('route').name == "quote_posts") { $('.subject_line').after('<div class="content-box support-reply-info" style="padding: 10px; font-size: 14px; border-width: 3px;"></div>'); if(pb.data('route').name == "new_thread") $('.support-reply-info').append('Helpful hint'); else $('.support-reply-info').css('border-color','#a00').append('Use exact name of all meds. Give the dose in mgs. <br /><br />Give the frequency of dosing 1x/day, 2x/day, etc. Use the date rather than Tuesday, last week, etc.'); } }); </script> <!- END predefined text -->
|
|
Kami
Forum Cat
Posts: 40,032
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,032
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Aug 1, 2017 8:05:35 GMT -8
can you try replacing the <br> tags with \n
|
|
paulam
New Member
Dodgerslist.com .... There is hope for dogs with disc disease!
Posts: 120
inherit
190606
0
Dec 30, 2022 13:04:15 GMT -8
paulam
Dodgerslist.com .... There is hope for dogs with disc disease!
120
February 2013
paulam
|
Post by paulam on Aug 1, 2017 11:30:24 GMT -8
Kami, /n did not cause the predefined text to appear.
Brian O. or anyone figure out where I've gone wrong??
Coding stuff is not my expertise. An example is always welcomed.
My desire is to have a message that appears in three places from any board: quick reply, reply and create a thread. This is the text of the message:
Helpful hints: - Use exact name of all meds. Give the dose in mgs. Give the frequency of dosing 1x/day, 2x/day, etc. - Use dates rather than Tuesday, last week, etc.
<!-BEGIN predefined text for reply --> <script type="text/javascript"> // Reply page message $(document).ready(function(){ if(pb.data('route').name == "new_thread" || pb.data('route').name == "new_post" || pb.data('route').name == "quote_posts") { $('.subject_line').after('<div class="content-box support-reply-info" style="padding: 10px; font-size: 14px; border-width: 3px;"></div>'); if(pb.data('route').name == "new_thread") $('.support-reply-info').append('Helpful hint'); else $('.support-reply-info').css('border-color','#a00').append('Use exact name of all meds. Give the dose in mgs./n Give the frequency of dosing 1x/day, 2x/day, etc. Use the date rather than Tuesday, last week, etc.'); } }); </script> <!- END predefined text for reply -->
|
|
Kami
Forum Cat
Posts: 40,032
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,032
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Aug 1, 2017 12:26:00 GMT -8
not /n
\n
they are different.
|
|
paulam
New Member
Dodgerslist.com .... There is hope for dogs with disc disease!
Posts: 120
inherit
190606
0
Dec 30, 2022 13:04:15 GMT -8
paulam
Dodgerslist.com .... There is hope for dogs with disc disease!
120
February 2013
paulam
|
Post by paulam on Aug 1, 2017 18:25:31 GMT -8
Kami, thank YOU! The devil IS in the detail! Reply and Create thread predefined text appears!!!! The "quick reply" does not. Am I missing some code for that to happen? <!-BEGIN predefined text for reply --> <script type="text/javascript"> // Reply page message $(document).ready(function(){ if(pb.data('route').name == "new_thread" || pb.data('route').name == "new_post" || pb.data('route').name == "quote_posts") { $('.subject_line').after('<div class="content-box support-reply-info" style="padding: 10px; font-size: 14px; border-width: 3px;"></div>'); if(pb.data('route').name == "new_thread") $('.support-reply-info').append(' Helpful HINTS:<br> \n • Use exact name of all meds.<br> \n • Give the dose in mgs.<br>\n • Give the frequency of dosing 1x/day, 2x/day, etc. <br> \n • Use the date rather than Tuesday, last week, etc. \n'); else $('.support-reply-info').css('border-color','#a00').append(' Helpful hint:<br> \n • Use exact name of all meds.<br> \n • Give the dose in mgs.<br>\n • Give the frequency of dosing 1x/day, 2x/day, etc. <br> \n • Use the date rather than Tuesday, last week, etc.'); } }); </script> <!- END predefined text for reply -->
|
|
Kami
Forum Cat
Posts: 40,032
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,032
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Aug 1, 2017 19:11:10 GMT -8
You're welcome!
I would surmise because this doesn't append the content to the quick reply box in particular. If you notice, the route names on the first if statement specify the following: new thread, new post, and quote post. The nested if statement then specifies that if the page is the "new thread" page to display one message, and otherwise (else) display the secondary messages for the the non-"new thread" pages originally specified.
None of this would affect the quick reply in particular; in the post that you referenced, the first code affects the quick reply textarea (.quick-reply textarea) but it wouldn't cause the same box to appear like on the other pages.
I'm not actually sure how to target the quick reply in particular, since it's not its own route. Perhaps someone with more javascript knowledge can step in here, sorry I can't be more helpful!
Edit: Also if the <br> tags aren't working there's no need to keep them in as well as the \n
|
|
inherit
I need a new CT, thinking.... [insert Jeopardy theme song here]
110769
0
Aug 21, 2021 0:07:21 GMT -8
Tumbleweed
20,825
September 2007
tumbleweed
|
Post by Tumbleweed on Aug 1, 2017 21:52:16 GMT -8
|
|
Kami
Forum Cat
Posts: 40,032
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,032
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Aug 1, 2017 22:07:50 GMT -8
Sorry Tumbleweed i hope i didn't step on any toes!
|
|
inherit
I need a new CT, thinking.... [insert Jeopardy theme song here]
110769
0
Aug 21, 2021 0:07:21 GMT -8
Tumbleweed
20,825
September 2007
tumbleweed
|
Post by Tumbleweed on Aug 1, 2017 22:14:25 GMT -8
Sorry Tumbleweed i hope i didn't step on any toes! No, not at all. I'm glad you jumped in because I wasn't available. Just kind of weird it didn't work for them but your way is obviously better so all is good.
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,862
December 2005
horace
|
Post by Chris on Aug 2, 2017 0:16:07 GMT -8
You can add the QUICK REPLY to your target list with the following additions (in red) $(document).ready(function () { if (pb.data('route').name == "new_thread" || pb.data('route').name == "new_post" || pb.data('route').name == "quote_posts" || pb.data('quick_reply')) { $('.subject_line, input[name="reply_mode"][value="quick_reply"]').after('<div class="content-box support-reply-info" style="padding: 10px; font-size: 14px; border-width: 3px;margin-bottom:3px;"></div>'); if (pb.data('route').name == "new_thread") $('.support-reply-info').append('Helpful HINTS:<br> • Use exact name of all meds.<br> • Give the dose in mgs.<br> • Give the frequency of dosing 1x/day, 2x/day, etc. <br> • Use the date rather than Tuesday, last week, etc.'); else $('.support-reply-info').css('border-color', '#a00').append('<h3>Helpful hint:</h3><ul style="list-style:disc inside;"><li> Use exact name of all meds.</li><li> Give the dose in mgs.</li><li> Give the frequency of dosing 1x/day, 2x/day, etc. </li><li> Use the date rather than Tuesday, last week, etc.</li></ul>'); } });
|
|
paulam
New Member
Dodgerslist.com .... There is hope for dogs with disc disease!
Posts: 120
inherit
190606
0
Dec 30, 2022 13:04:15 GMT -8
paulam
Dodgerslist.com .... There is hope for dogs with disc disease!
120
February 2013
paulam
|
Post by paulam on Aug 2, 2017 12:20:39 GMT -8
I’m a happy camper now!!
Thanks everyone who added to the solution and to Chris for the quick reply code. I had problems with <ul> unordered list and with <li> bulleted list item and took the easy way to keep Kami’s suggestion of \n
The text on my boards looks fabulous to me and provides my members guidance in their posting. OK, not being a coder maybe it is not perfect in that way. For example, the green font message does not appear anywhere. I had such a time figuring out things that when the red font message worked, I hesitated to adjust any other coding causing myself more work figuring out what else might go wrong.
Here is the code I’m using that works to cause pre-defined text to appear above “create thread, reply, and quick reply:
<!-BEGIN predefined text for quick reply, new thread, and reply --> <script type="text/javascript"> // Reply page message $(document).ready(function(){ if(pb.data('route').name == "new_thread" || pb.data('route').name == "new_post" || pb.data('route').name == "quote_posts"|| pb.data('quick_reply')) { $('.subject_line, input[name="reply_mode"][value="quick_reply"]').after('<div class="content-box support-reply-info" style="padding: 10px; font-size: 14px; border-width: 3px;"></div>'); if(pb.data('route').name == "new_thread") $('.support-reply-info').append('Helpful HINTS:<br> \n • Use exact name of all meds.<br> \n • Give the dose in mgs.<br>\n • Give the frequency of dosing 1x/day, 2x/day, etc. <br> \n • Use the date rather than Tuesday, last week, etc. \n'); else $('.support-reply-info').css('border-color','#a00').append('Helpful hint:<br> \n • Use exact name of all meds.<br> \n • Give the dose in mgs.<br>\n • Give the frequency of dosing 1x/day, 2x/day, etc. <br> \n • Use the date rather than Tuesday, last week, etc.'); } }); </script> <!- END predefined text for quick reply, new thread, and reply -->
I placed the code on each of the selected boards I wanted my message to appear: Admin > Structure > Headers & Footers> Headers
|
|