window.top.addEventListener('popstate', function(event) { if(!!event.state) window.location = event.state; }); $(document).ready(function() { window.top.history.replaceState(window.location.pathname, null, '/mc' + window.location.pathname); $(document).on('click', '.stag_rhs_toggle', function() { var state = window.top.toggleRHS(), icon = $(this).find('i'); if(state === 'collapsed') { icon.removeClass().addClass('fa fa-arrow-left'); } else { icon.removeClass().addClass('fa fa-arrow-right'); } }); var body = $(window.top.document.body), icon = $(this).find('i'); if(body.is('.stag_rhs_collapsed')) { icon.removeClass().addClass('fa fa-arrow-left'); } }); function openInRHS(_url) { window.top.showRHS(); var icon = $('.stag_rhs_toggle i'); icon.removeClass().addClass('fa fa-arrow-right'); window.top.openInRHS(_url); return false; }