Wedge

Public area => The Pub => Features => Topic started by: pivotraze on March 23rd, 2012, 02:13 AM

Title: This would be an interesting feature :)
Post by: pivotraze on March 23rd, 2012, 02:13 AM
I did a search for this, and didn't find this exactly, so I thought I would add this real quick. See what Arantor and Nao think!

So, basically, I was reading a... rather long topic and thought of this for quick navigating. Why not make the arrow keys navigate the pages? I don't know if it possible with PHP or any web language (it might be? I am not too smart with that)

It would be sweet in my opinion. I'm kind of a keyboard-shortcut guy haha
Title: Re: This would be an interesting feature :)
Post by: Arantor on March 23rd, 2012, 02:19 AM
Possible, yes. Practical? Doubtful.

Firstly, you'd have to make sure that it only ever applied when you weren't typing in the quick reply box, or the search box, or quick login if you're not already logged in.

Then there's the matter of how usable such a thing would actually be. Certainly it wouldn't affect mobile users, which leaves desktop. I'm also not sure how many of the desktop users routinely have their hands on the keyboard when browsing forums (unless they're hunched over, poised to reply, like vultures over a carcass), so I'm not sure there's much there either.

In short, it's an interesting idea, but I'm really not convinced it's that practical most of the time. That said, there's no reason it couldn't be whipped up as a plugin of some kind should someone really want to experiment with the idea.
Title: Re: This would be an interesting feature :)
Post by: pivotraze on March 23rd, 2012, 02:23 AM
I will take on the feat of learning PHP to make this plugin! I'm the vulture you mentioned :P

I regularly scroll using the keyboard since Linux + My mousepad on my laptop don't really like the scrolling using it. :)

Once I get to take a look at any hooks I might need and anything else, I will get looking at it :)
Title: Re: This would be an interesting feature :)
Post by: Arantor on March 23rd, 2012, 02:28 AM
Actually, there's almost zero PHP involved. You'd do pretty much all of it in JavaScript. All the event binding etc. would be done client-side, determining whether there's another page or not is going to involve the code that works with template_page_index(), which has to figure that out anyway, since it has to generate << prev and next >> links anyway.
Title: Re: This would be an interesting feature :)
Post by: pivotraze on March 23rd, 2012, 02:32 AM
Sweet. I know a bit of JavaScript. So the only (hook?/thing?) I would have to use is the template_page_index function? I don't know how quickly it would be made, but it will be a fun project for me to work on :)
Title: Re: This would be an interesting feature :)
Post by: Arantor on March 23rd, 2012, 02:42 AM
No, it's a *lot* more complex than that, sadly.

The way it works is basically thus:
* create a function whose job it is to include or push the relevant JavaScript onto the page
* attach it to the display_main hook

The template_page_index function creates the 'Pages: [1]' thing you see at the top and bottom of content. But for multiple pages, it also adds << prev and next >>, which means it has to know how many pages there are and what page you're on currently. The same logic that uses would be borrowed for the above mentioned function that you'd add.
Title: Re: This would be an interesting feature :)
Post by: pivotraze on March 23rd, 2012, 03:09 AM
:niark: I should of known that. Programming anything is never that easy! :P