Page 1 of 1

Advanced HTML: Reset States Button

Posted: Mon Jan 09, 2012 7:52 am
by Josh Kristof
Often while reviewing a project you will want to reset all states to their default. This is commonly the case if your project contains any type of user privilege simulation. The code below will allow you to create an advanced HTML component that resets all states.

Code: Select all

<!DOCTYPE html>
<html>
    <head><title></title>
        <script type="text/javascript">
            function go() {
                if ( isEditing() ) {
                    parent.site9.StateMgr.set( 'ps' );
                } else {
                    window.parent.site9.StateMgr.set( 'ps' );
                }
            }
           
            function isEditing() {
                try {
                    if ( window.parent.frameElement.s9_workspace ) {
                        return true;
                    }
                }
                catch ( e ) {
                }
               
                return false;
            }
        </script>
    </head>
    <body style="background:transparent">
         <input type="button" onclick="go();return false;" value="Reset States"/>
    </body>
</html>

Re: Advanced HTML: Reset States Button

Posted: Mon Oct 30, 2017 6:25 am
by Mullett
That's pretty useful. Thanks a lot for sharing Josh.