inherit
140147
0
Mar 26, 2024 17:20:16 GMT -8
Nscalerr 🐺
Throw me to the wolves and I'll return leading the pack!
2,991
May 2009
nscalerr
|
Post by Nscalerr 🐺 on Mar 3, 2019 19:27:59 GMT -8
After a bit of testing it would appear the '#wrapper header, ' is the trouble part of the script. toetapping did you delete the script from your Global Header ??
|
|
inherit
133488
0
Mar 28, 2024 15:54:40 GMT -8
toetapping
1,583
November 2008
toetapping
|
Post by toetapping on Mar 3, 2019 19:33:14 GMT -8
nscalerr Here is my Global Header. I am not good with codes.
<script type="text/javascript"> // Back to top onclick fix function scrollClick(){ $('.to-top').click(function(){ console.log('click!'); scroll(0,0); }); $('.to-bottom').click(function(){ scroll(0,document.body.scrollHeight); }); } $(document).ready(function(){ scrollClick(); console.log('hi!'); }); proboards.on('afterSearch',function(){ scrollClick(); }); </script>
<script> $(document).ready(function() { if(proboards.data('route').name == "user" && proboards.data('user').is_logged_in != 1) { $('div.container.show-user').html('<div class="title-bar"><h2>Error</h2></div><div class="content cap-bottom" style="padding:5px;">You do not have permission to view this page</div>'); } }); </script>
<style type="text/css"> /* Resize All in One Images - Global Header */ /* Signature - Posting Images - Avatar Quote */ div.signature img {max-width:320px !important; max-height:240px !important;} div.message img {max-width:640px !important; max-height:480px !important;} div.message .avatar_size_quote img {max-width:30px !important; max-height:30px !important;} </style>
<div style="text-align: right;"> <ul class="controls">
</ul> </div> <script> $(document).ready( function() {
if(pb.data('route').name == "members" && !pb.data('user').is_staff){
$('.container.members').css('display', 'none');
pb.window.alert('Sorry!', 'We respect our Members\' privacy. I am sure you understand.');
}
}); </script>
<script>
$(function(){ var recent = $("a.recent-threads-button"); recent.clone().attr("href", "/threads/recent").html("Recent Threads").insertBefore($("#navigation-tree")); recent.clone().attr("href", "/posts/recent").html("Recent Posts").insertBefore($("#navigation-tree")); });
</script> <style> img[src*="photobucket.com"] {display: none;} </style> <script type="text/javascript"> // Remove "Drop files here to upload" on posting page $(document).ready(function(){ $(this).unbind('dragenter.attachments').unbind('dragover').unbind('drop'); }); </script> <script>
$(function(){
var ad = $("#ad1"); var elements = $("#wrapper header, #wrapper a.recent-threads-button, #wrapper #navigation-tree");
if(ad && elements.length){ elements.insertAfter(ad); } });
</script>
<script>
(function(){
/* Hide Quick Reply Except on Last Page (GLOBAL HEADER)*/
if(pb.data('proboards.post') && pb.data('quick_reply'))
$(document).on('paginationcreate', function(ev){
pageData = $(ev.target).data('pagination');
showLastReply();
pb.events.on('afterSearch',showLastReply )
function showLastReply(){
$('.container.quick-reply').toggle(pageData.pages === pageData.page)
}
})
})()
</script>
|
|
inherit
140147
0
Mar 26, 2024 17:20:16 GMT -8
Nscalerr 🐺
Throw me to the wolves and I'll return leading the pack!
2,991
May 2009
nscalerr
|
Post by Nscalerr 🐺 on Mar 3, 2019 20:05:06 GMT -8
Hi toetappingI have removed the offending bit of javascript, so just copy and paste the following back to where it came from, no need to change anything! <script type="text/javascript"> // Back to top onclick fix function scrollClick(){ $('.to-top').click(function(){ console.log('click!'); scroll(0,0); }); $('.to-bottom').click(function(){ scroll(0,document.body.scrollHeight); }); } $(document).ready(function(){ scrollClick(); console.log('hi!'); }); proboards.on('afterSearch',function(){ scrollClick(); }); </script>
<script> $(document).ready(function() { if(proboards.data('route').name == "user" && proboards.data('user').is_logged_in != 1) { $('div.container.show-user').html('<div class="title-bar"><h2>Error</h2></div><div class="content cap-bottom" style="padding:5px;">You do not have permission to view this page</div>'); } }); </script>
<style type="text/css"> /* Resize All in One Images - Global Header */ /* Signature - Posting Images - Avatar Quote */ div.signature img {max-width:320px !important; max-height:240px !important;} div.message img {max-width:640px !important; max-height:480px !important;} div.message .avatar_size_quote img {max-width:30px !important; max-height:30px !important;} </style> <div style="text-align: right;"> <ul class="controls"> </ul> </div>
<script type="text/javascript"> $(document).ready( function() { if(pb.data('route').name == "members" && !pb.data('user').is_staff){ $('.container.members').css('display', 'none'); pb.window.alert('Sorry!', 'We respect our Members\' privacy. I am sure you understand.'); } }); </script>
<script type="text/javascript"> $(function(){ var recent = $("a.recent-threads-button"); recent.clone().attr("href", "/threads/recent").html("Recent Threads").insertBefore($("#navigation-tree")); recent.clone().attr("href", "/posts/recent").html("Recent Posts").insertBefore($("#navigation-tree")); }); </script>
<style> img[src*="photobucket.com"] {display: none;} </style>
<script type="text/javascript"> // Remove "Drop files here to upload" on posting page $(document).ready(function(){ $(this).unbind('dragenter.attachments').unbind('dragover').unbind('drop'); }); </script>
<script type="text/javascript"> /* Hide Quick Reply Except on Last Page (GLOBAL HEADER)*/ (function(){ if(pb.data('proboards.post') && pb.data('quick_reply')) $(document).on('paginationcreate', function(ev){ pageData = $(ev.target).data('pagination'); showLastReply(); pb.events.on('afterSearch',showLastReply ) function showLastReply(){ $('.container.quick-reply').toggle(pageData.pages === pageData.page) } }) })() </script>
|
|
inherit
133488
0
Mar 28, 2024 15:54:40 GMT -8
toetapping
1,583
November 2008
toetapping
|
Post by toetapping on Mar 3, 2019 20:12:41 GMT -8
Thank you so much nscalerr. It is just so appreciated and especially you putting the code there so I could just copy it into the Global Header.
I notice the ads are now below the logo is there another way to put them above the logo as I did have them in the Global Head.
|
|
inherit
140147
0
Mar 26, 2024 17:20:16 GMT -8
Nscalerr 🐺
Throw me to the wolves and I'll return leading the pack!
2,991
May 2009
nscalerr
|
Post by Nscalerr 🐺 on Mar 3, 2019 20:42:33 GMT -8
I notice the ads are now below the logo is there another way to put them above the logo as I did have them in the Global Head. As far as I know, it is not possible. I have had a fiddle with the script and can't get it to work nicely with the greetings script.
|
|
inherit
133488
0
Mar 28, 2024 15:54:40 GMT -8
toetapping
1,583
November 2008
toetapping
|
Post by toetapping on Mar 3, 2019 21:55:56 GMT -8
That is ok nscalerr just a shame as the code is fantastic but I don't like the ads there. Be nice if there was another plugin like there used to be.
Thank you so much for your time. It is appreciated.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Mar 4, 2019 1:24:04 GMT -8
Just to clarify on the issue with blank pages, The reason for the issue is a conflict with mine and the script by Scott . There is nothing wrong with both scripts, they just will not work with each other due to how document.write works. Because the script is inside the element that is about to be moved (by mine) when the DOM is ready, it performs the document.write again on appending back to the document. Because the document stream has already been closed, it clears the document, which causes a blank page. developer.mozilla.org/en-US/docs/Web/API/Document/write
|
|
Violette
Full Member
Chocolate Makes My Day
Posts: 901
inherit
199370
0
Sept 2, 2013 10:32:50 GMT -8
Violette
Chocolate Makes My Day
901
September 2013
violette
|
Post by Violette on Mar 4, 2019 9:31:28 GMT -8
Thank you, Peter, for describing how the blank page happens.
Love your code to place the ad above the banner!
Scott's code is fun, but I only have it on a test forum, because of the resulting placement of the ad.
|
|
inherit
133488
0
Mar 28, 2024 15:54:40 GMT -8
toetapping
1,583
November 2008
toetapping
|
Post by toetapping on Mar 4, 2019 10:32:12 GMT -8
Thank you Peter. They are two great codes but it is a shame the ad moves down. Like Violette have it on my test.
|
|
inherit
140147
0
Mar 26, 2024 17:20:16 GMT -8
Nscalerr 🐺
Throw me to the wolves and I'll return leading the pack!
2,991
May 2009
nscalerr
|
Post by Nscalerr 🐺 on Mar 5, 2019 6:58:24 GMT -8
Pity there isn't a way to combine both scripts and use just the one document.write to do both things.
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,768
January 2015
msg
|
Post by Lynx on Mar 5, 2019 8:40:01 GMT -8
Violette , toetapping , Nscalerr 🐺 (and anyone else interested): I've modified Scott 's code to work with Peter 's ad code. It does require a small change in the Forum Wrapper template, but this works on my test forum using a vanilla theme. Modified code by Scott: <script type="text/javascript"> var message = ""; var day = new Date(); var hr = day.getHours(); if (hr == 1) {message = "Do you ever sleep";} if (hr == 2) {message = "Do you ever sleep";} if (hr == 3) {message = "Are you a vampire";} if (hr == 4) {message = "So you up early or late";} if (hr == 5) {message = "You know the sun ain't up yet";} if (hr == 6) {message = "You're up early";} if ((hr == 7) || (hr == 8) || (hr == 9)) {message = "Good Morning!";} if (hr == 10) {message = "Time for a morning break";} if (hr == 11) {message = "Good morning!";} if (hr == 12) {message = "Don't forget to grab lunch";} if (hr == 13) {message = "Good afternoon";} if (hr == 14) {message = "Take a break and stretch";} if ((hr == 15) || (hr == 16)) {message = "Good Afternoon!";} if ((hr == 17) || (hr == 18) || (hr == 19) || (hr == 20) || (hr == 21) || (hr == 22)) {message = "Good Evening";} if (hr == 23) {message = "Wow you're up late";} if (hr == 0) {message = "Psst, it's past midnight";} $('.cust_greet').html(message); </script>
That goes in your Global Header ABOVE Peter's code. Template change ( Admin > Themes > Layout Templates > Forum Wrapper) - this is the ENTIRE forum wrapper template code for a vanilla theme. The added part is highlighted: Notice the extra <span> that has been placed. This is where the message will be placed (same place Scott had it in his code, basically). It also has a class of .cust_greet to which you can target with CSS to style it. I cannot guarantee this will work on highly customized themes, but it works without a hitch on a vanilla theme. Just be sure to place Scott's modified code ABOVE Peter's code. It should look like this (minus any other scripts you have in your Global Header): Both codes: <script type="text/javascript"> var message = ""; var day = new Date(); var hr = day.getHours(); if (hr == 1) {message = "Do you ever sleep";} if (hr == 2) {message = "Do you ever sleep";} if (hr == 3) {message = "Are you a vampire";} if (hr == 4) {message = "So you up early or late";} if (hr == 5) {message = "You know the sun ain't up yet";} if (hr == 6) {message = "You're up early";} if ((hr == 7) || (hr == 8) || (hr == 9)) {message = "Good Morning!";} if (hr == 10) {message = "Time for a morning break";} if (hr == 11) {message = "Good morning!";} if (hr == 12) {message = "Don't forget to grab lunch";} if (hr == 13) {message = "Good afternoon";} if (hr == 14) {message = "Take a break and stretch";} if ((hr == 15) || (hr == 16)) {message = "Good Afternoon!";} if ((hr == 17) || (hr == 18) || (hr == 19) || (hr == 20) || (hr == 21) || (hr == 22)) {message = "Good Evening";} if (hr == 23) {message = "Wow you're up late";} if (hr == 0) {message = "Psst, it's past midnight";} $('.cust_greet').html(message); </script>
<script type="text/javascript"> $(function(){ var ad = $("#ad1"); var elements = $("#wrapper header, #wrapper a.recent-threads-button, #wrapper #navigation-tree"); if(ad && elements.length){ elements.insertAfter(ad); } }); </script>
The messages in Scott's code can still be changed to your liking - just remember to keep the message within the quotes (and be sure to keep the quotes).
|
|
Violette
Full Member
Chocolate Makes My Day
Posts: 901
inherit
199370
0
Sept 2, 2013 10:32:50 GMT -8
Violette
Chocolate Makes My Day
901
September 2013
violette
|
Post by Violette on Mar 5, 2019 9:40:47 GMT -8
Perfect, Lynx! Nicely done! Thank you!
|
|
inherit
133488
0
Mar 28, 2024 15:54:40 GMT -8
toetapping
1,583
November 2008
toetapping
|
Post by toetapping on Mar 5, 2019 12:32:04 GMT -8
MSG thank you so much but I seem to have something wrong, the bracket before "You're up early". I tried it on my Default and a theme I have on my test. Same result. It is the test forum you kindly joined the other day to help me out. testingsssss.proboards.com/
|
|
#e61919
Support Staff
224482
0
Member is Online
1
Mar 28, 2024 16:07:05 GMT -8
Scott
23,131
August 2015
socalso
|
Post by Scott on Mar 5, 2019 12:38:05 GMT -8
toetapping, if you look at Lynx's code above, the yellow highlighted part... looks like there's a stray ] (closing bracket). Just remove that.
|
|
inherit
133488
0
Mar 28, 2024 15:54:40 GMT -8
toetapping
1,583
November 2008
toetapping
|
Post by toetapping on Mar 5, 2019 12:47:34 GMT -8
Scott thank you so much for helping me that was the culprit and once again MSG you have spent so much time helping me the last few days and it is so much appreciated.
|
|