Advanced HTML: Reset States Button

Discuss techniques and workflows for ProtoShare.
Josh Kristof
Posts: 525
Joined: Tue Mar 31, 2009 3:40 pm

Advanced HTML: Reset States Button

Postby Josh Kristof » Mon Jan 09, 2012 7:52 am

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>

Return to “Tips & Tricks”

Who is online

Users browsing this forum: No registered users and 1 guest