Customizing SMF > SMF Coding Discussion

[WIP] jQuery Mobile Mode

<< < (2/3) > >>

nend:
Having a little difficulty trying to figure out how to structure the browser history to make a more app like quality to the mode.

I tried BBQ but no go there so far. The BBQ API looks like it should do the trick though, but it is a new API to me and still trying to make sense of it all. http://benalman.com/projects/jquery-bbq-plugin/

I don't know if I am wasting my time here, trying to get this structure history behavior. It looks like the BBQ API can do it, just can't figure it out so far.

nend:
I haven't had the chance to touch anything lately. I am going to forget about the history structure for now, since it is really not needed. I will release the code later on today when I get to my PC as a hack so anyone here can test it for me and see if they can find any problems with it.

Joker™:
Can you explain a bit more what sort of history structure are you exactly looking for. In simple projects one can use "window.history.back();" and can float back. It'd be interesting to hear whats exactly in your mind :).

nend:

--- Quote from: Joker™ on March 09, 2012, 12:59:25 PM ---Can you explain a bit more what sort of history structure are you exactly looking for. In simple projects one can use "window.history.back();" and can float back. It'd be interesting to hear whats exactly in your mind :).

--- End quote ---

Say this is your browsing

Board Index -> Board1 -> Topic1 -> Board2 -> Topic3 -> Board1

As you can see if you go back from the first entry you end up going this route

Board1 -> Topic3 -> Board2 -> Topic1 -> Board1 -> Board Index

This is the natural behavior of the browser history. I want to rewrite or manipulate the history system where Topic will always take you to the board it is in when pressing back. As forth the board when pressing back will always take you to the parent board or board index.

On to the roll out of the hack now...

In the main index.php
Find

--- Code: ---// Determine if this is using WAP, WAP2, or imode.  Technically, we should check that wap comes before application/xhtml or text/html, but this doesn't work in practice as much as it should.
if (isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']))
--- End code ---
Replace

--- Code: ---// Determine if this is using WAP, WAP2, or imode.  Technically, we should check that wap comes before application/xhtml or text/html, but this doesn't work in practice as much as it should.
if (isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']) || isset($_REQUEST['jmobile']))
--- End code ---

Find

--- Code: ---if (!defined('WIRELESS'))
define('WIRELESS', isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']));
--- End code ---
Replace

--- Code: ---if (!defined('WIRELESS'))
define('WIRELESS', isset($_REQUEST['wap']) || isset($_REQUEST['wap2']) || isset($_REQUEST['imode']) || isset($_REQUEST['jmobile']));
--- End code ---

Find

--- Code: ---if (WIRELESS)
{
define('WIRELESS_PROTOCOL', isset($_REQUEST['wap']) ? 'wap' : (isset($_REQUEST['wap2']) ? 'wap2' : (isset($_REQUEST['imode']) ? 'imode' : '')));
--- End code ---
Replace

--- Code: ---if (WIRELESS)
{
define('WIRELESS_PROTOCOL', isset($_REQUEST['wap']) ? 'wap' : (isset($_REQUEST['wap2']) ? 'wap2' : (isset($_REQUEST['imode']) ? 'imode' : (isset($_REQUEST['jmobile']) ? 'jmobile' : ''))));
--- End code ---

Find

--- Code: --- // Wireless protocol header.
if (WIRELESS_PROTOCOL == 'wap')
header('Content-Type: text/vnd.wap.wml');
--- End code ---
Add After

--- Code: --- // jQuery Mobile most smartphones actually support output compression...
if (WIRELESS_PROTOCOL == 'jmobile') {
$modSettings['enableCompressedOutput'] = '1';
}
--- End code ---

After adding all this code download the attached file and open up your Wireless.template.php. Add the contents of this file to the end of your template file right before the ending ?>

Joker™:

--- Quote from: nend on March 09, 2012, 11:08:01 PM ---Say this is your browsing

Board Index -> Board1 -> Topic1 -> Board2 -> Topic3 -> Board1

--- End quote ---
Is it possible to surf like that?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version