Codoforum related discussions
Set yes by default of switch toggle

I'd like to set Hide topic messages and Enable infinite scrolling to "yes" by default.

I'd like to set Hide topic messages and Enable infinite scrolling to "yes" by default.

Hi,

Sorry we somehow missed this topic.
We remember seeing it but didn't reply.

To enable them, you can run following code:

$('#codo_sidebar_hide_msg_switch').trigger('switch_on');
$('#codo_sidebar_inf_scroll_switch').trigger('switch_on');

You can include these lines sites/default/assets/js/app.js

Hi, Sorry we somehow missed this topic. We remember seeing it but didn't reply. To enable them, you can run following code: ``` $('#codo_sidebar_hide_msg_switch').trigger('switch_on'); $('#codo_sidebar_inf_scroll_switch').trigger('switch_on'); ``` You can include these lines sites/default/assets/js/app.js

@adesh your code don't work but work fine this:


    $('.codo_switch').trigger('click');
    CODOF.hide_msg_switch = 'on';
    $('#codo_topics_body').find('.codo_topics_topic_message').addClass('hide');
    $('article').addClass('article_msg_hidden');
    CODOF.infiniteScrolling = true;
@adesh your code don't work but work fine this: ```` $('.codo_switch').trigger('click'); CODOF.hide_msg_switch = 'on'; $('#codo_topics_body').find('.codo_topics_topic_message').addClass('hide'); $('article').addClass('article_msg_hidden'); CODOF.infiniteScrolling = true; ````

the prev code create errors in same pages so the best thing to do is hide the messages with css

.codo_topics{ 
    .codo_topics_body>div>article>.codo_topics_topic_message{
        display: none;
    }
    .codo_readmore_container{
        display:none;
    }
    article>.codo_topics_topic_message{
        display: none;
    }
}
the prev code create errors in same pages so the best thing to do is hide the messages with css ```` .codo_topics{ .codo_topics_body>div>article>.codo_topics_topic_message{ display: none; } .codo_readmore_container{ display:none; } article>.codo_topics_topic_message{ display: none; } } ````

Hi trippo,
Did you get the default "yes" to " hide msg switch " to work? Or else where do you put the css code?

Hi trippo, Did you get the default "yes" to " hide msg switch " to work? Or else where do you put the css code?

Hi,
The following code worked for me on every pages :
(I only wanted to have "hide msg" set to On but you can adapt the code)
Placed on sites/default/assets/js/app.js at the beginning before 'CF = CODOF;'
I didn't put the code on a document ready because it was slower (it was waiting for the page to be fully loaded)

var el = $('#codo_sidebar_hide_msg_switch');
el.trigger('switch_on');
el.toggleClass('codo_switch_on').toggleClass('codo_switch_off');
CODOF.hide_msg_switch = 'on';
if($('#codo_topics_body').length) $('#codo_topics_body').find('.codo_topics_topic_message').addClass('hide');
if($('#codo_topics_list').length) $('#codo_topics_list').find('.codo_topics_topic_message').addClass('hide');
$('article').addClass('article_msg_hidden');
Hi, The following code worked for me on every pages : (I only wanted to have "hide msg" set to On but you can adapt the code) Placed on sites/default/assets/js/app.js at the beginning before 'CF = CODOF;' I didn't put the code on a document ready because it was slower (it was waiting for the page to be fully loaded) ```` var el = $('#codo_sidebar_hide_msg_switch'); el.trigger('switch_on'); el.toggleClass('codo_switch_on').toggleClass('codo_switch_off'); CODOF.hide_msg_switch = 'on'; if($('#codo_topics_body').length) $('#codo_topics_body').find('.codo_topics_topic_message').addClass('hide'); if($('#codo_topics_list').length) $('#codo_topics_list').find('.codo_topics_topic_message').addClass('hide'); $('article').addClass('article_msg_hidden'); ````

This solution is exactly what I wanted and works well.
thanks alot.

This solution is exactly what I wanted and works well. thanks alot.
374
8
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft