Add ReplyNew TopicNew Poll

 Additional macro for mobile
#
Here's my mobile site, as an example and you can see I've put my chat up there which is snazzy (I love that macro, and it's a million times better than nothing) but it would be helpful to move the chat to the bottom of the site, so that mobile users didn't have to scroll past it on every page. Having an additional macro that interjects things at the bottom (maybe directly before the copyright notice) would be extremely helpful.

Alternatively, is there some Javascript that would accomplish something similar? I tried to append it to the bottom with #boardstats as a test (since, had it worked, it would have only done so on the index, but I figured I'd work out something from there) but I couldn't get it to work. Then again, I can't rule out that it just might be that I've made some sort of mistake cause historically append and I rarely see eye to eye for some unknowable reason.
Thanks for reading. http://files.b1.jcink.com/html/emoticons/smile.gif

signature
user posted image
#
I agree that something like this is might be needed.
PM
#
Couldn't you use .insertBefore() on the last tableborder? Since that has the copyright information and all. If you want it for mobile only, it's easy enough to check for in the URL.

This post has been edited by Dusty: May 21 2017, 02:13 AM
PM
#
QUOTE (Dusty @ May 21 2017, 02:12 AM)
Couldn't you use .insertBefore() on the last tableborder? Since that has the copyright information and all. If you want it for mobile only, it's easy enough to check for in the URL.


To be honest with you, my Javascript knowledge is incredibly limited, andI can't say for sure, but in terms of checking for the URL do you mean adding something to the board wrapper that would do this? Because it's my understanding that mobile ignores the wrappers and pulls from the CSS (at least it seems that way, because when I tried to use external CSS in the wrappers it was a mess) but I could be mistaken at any point along the way here.

Is there something I could potentially add to the mobile macro that would do what you mention here? Because I did try and append it fruitlessly, but I can't be sure if the positioning of the macro on the page has something to do with it not working.

signature
user posted image
#
Apologies, I wasn't aware of the intricacies of mobile skinning. If the mobile banner/logo macro is still a thing, you may be able to pack the script into that. Since that macro should only load with the mobile site, you won't need to check the URL.

.insertBefore() can be used very similarly to appendTo, etc, like so:
CODE
$(function() {
$('#cboxdiv').insertBefore('.tableborder:last-of-type')
})


No promises, though!

This post has been edited by Dusty: May 22 2017, 01:17 AM
PM
#
Scripts like the above won't work unless you also include jquery which isn't available on mobile.

I'll definitely look into adding some type of footer macro.

signature
email: admin@jcink.com :: blog: John C.
#
Whoops, I'm an idiot. Regular Javascript should work, though.
PM
#
Thanks John and thanks Dusty - you're not an idiot, you're incredibly helpful and I really appreciate it. Any tips on how to translate that into regular Javascript? No worries and feel free to ignore if you don't have the time or inclination to answer. ^^

signature
user posted image
#
owl

Sorry I didn't get around to this earlier!
CODE
<script>
document.addEventListener("DOMContentLoaded", function(event) {
   var chat = document.getElementById("cboxdiv"),
 tableborder = document.getElementsByClassName("tableborder"),
 last = tableborder[tableborder.length-1],
 parentnode = last.parentNode;
parentnode.insertBefore(chat, last);
});
</script>


That should work. Plain Javascript is suuuuch a mess.
PM
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Share this topic:
« Next Oldest | Feature Requests | Next Newest »

Options Add ReplyNew TopicNew Poll