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>
Josh Kristof
customerservice@protoshare.com
Site9, Inc. / Customer Support
blog.protoshare.com | twitter.com/protoshare

Mullett
Posts: 1
Joined: Sat Oct 21, 2017 2:11 am

Re: Advanced HTML: Reset States Button

Postby Mullett » Mon Oct 30, 2017 6:25 am

That's pretty useful. Thanks a lot for sharing Josh.


Return to “Tips & Tricks”

Who is online

Users browsing this forum: No registered users and 2 guests

cron