Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Optimizing 2.0.18.8 for mobile/tablets - cleditor issues

timotidestimotides New
edited November 2013 in Vanilla 2.0 - 2.8

Okay after doing a lot of reading around and still not finding a clear cut answer, I'd like to post (hopefully) one last question.

I am trying to optimise my forum for both desktop (already done with default theme) and mobile (ideally with mobile theme).

What I can report so far with the following mobile devices accessing Vanilla 2.0.18.8 with CLEditor is this:

-Blackberry BB10 browser: loads default theme but won't allow use with CLEditor (but works with stock editor)

-Window Phone 8 IE browser: same as above

-iPhone Safari browser: This works the best of all. The theme (automatically) defaults to mobile theme and reverts to stock editor automatically.

So ideally I would like to keep the cleditor for desktop users but am more than happy to revert to stock editor for mobile.

To provide optimisation at both levels (mobile/desktop), I can see 3 options:

Preferred 1/ Make the default theme detected for desktop = vanilla 'default' theme with cleditor and make the default theme detected for mobile = the vanilla mobile theme with stock editor (like the iPhone seems to do automatically).

2/ The 2nd option would be to make some exceptions in the default.php file of cleditor for all mobile devices where the keyboard won't interact with cleditor following the example in this thread: http://vanillaforums.org/discussion/comment/190732#Comment_190732

In fact I've already altered the default.php and added some exceptions, but the one's I added for both the blackberry and WP8 device have not worked.

Interestingly, in this case, iPhone is not affected by the exception and will override to the stock editor regardless of whether CLEditor is enabled or not and regardless of any custom code in default.php.

3/ The third option is simple but gives those desktop users less features: remove cleditor altogether!

Any thoughts on this would be most appreciated although I'm already swaying towards the simple option 3 TBH and saving any further sweat!

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Hmmm... You shouldn't need to do this, but try it anyway. In your /plugins/cleditor/default.php file add 'MobileFriendly' => FALSE, to the plugin info array.

    Should end up looking like this:

    $PluginInfo['cleditor'] = array(
       'Name' => 'WYSIWYG (CLEditor)',
       'Description' => 'Adds a <a href="http://en.wikipedia.org/wiki/WYSIWYG">WYSIWYG</a> editor to your forum so that your users can enter rich text comments.',
       'Version' => '1.1',
       'Author' => "Mirabilia Media",
       'AuthorEmail' => 'info@mirabiliamedia.com',
       'AuthorUrl' => 'http://mirabiliamedia.com',
       'RequiredApplications' => array('Vanilla' => '>=2'),
       'RequiredTheme' => FALSE, 
       'RequiredPlugins' => FALSE,
       'MobileFriendly' => FALSE,
       'HasLocale' => FALSE,
       'RegisterPermissions' => FALSE,
       'SettingsUrl' => FALSE,
       'SettingsPermission' => FALSE
    );
    

    That should prevent the plugin from loading on the mobile theme.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • timotidestimotides New
    edited November 2013

    Hi and thanks for the much appreciated advice. I'm currently running with option 3 (with stock editor + buttons plugin) and tbh it's working like a charm across both desktop/mobile platforms.

    I tried adding that code you mentioned to the script but it didn't help I think because both browsers in question (BB10/WP8) load the standard 'default' vanilla theme and not the 'mobile' theme (which the iPhone for some reason loads automatically).

    If there was a way to get both the BB10/WP8 browser to automatically recognise the forum as a mobile site and act like the safari browser does on the iphone that would be great, but I think this may be a browser-related shortfall unfortunately.

    The iphone safari browser defaults to 'mobile' theme but has a 'full site' link at the bottom of the page where you could switch to the 'default' theme if you prefer. That seems like the best of both worlds.

    Do you think it is browser related or is there something else I could try modding in the Vanilla files ?

  • TamaTama United Kingdom ✭✭✭
    edited November 2013

    Try adding (or create with) this to class.defaultthemehooks.php in the default theme folder

     <?php if (!defined('APPLICATION')) exit();
    
    class DefaultThemeHooks implements Gdn_IPlugin {
        /** No setup required. */
        public function Setup() { }
    
        /** Remove plugins that are not mobile friendly! */
        public function Gdn_Dispatcher_AfterAnalyzeRequest_Handler($Sender) {
          // Remove plugins so they don't mess up layout or functionality.
            if (in_array($Sender->Application(), array('vanilla', 'conversations')) && isMobile() || ($Sender->Application() == 'dashboard' && in_array($Sender->Controller(), array('Activity', 'Profile', 'Search')))&& isMobile()) {
                Gdn::PluginManager()->RemoveMobileUnfriendlyPlugins();
            }
      }
    }
    

    There was an error rendering this rich post.

  • hgtonighthgtonight ∞ · New Moderator

    @timotides said:
    I tried adding that code you mentioned to the script but it didn't help I think because both browsers in question (BB10/WP8) load the standard 'default' vanilla theme and not the 'mobile' theme (which the iPhone for some reason loads automatically).

    I misread your initial post; I am sorry.

    You will probably need to override the IsMobile function. I actually just detailed what you need to do here: http://vanillaforums.org/discussion/comment/195879/#Comment_195879

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.