Add storage.VerifyCur().

This commit is contained in:
Kenshin 2017-01-10 13:32:38 +08:00
parent c1099dbabc
commit af6e257854
2 changed files with 15 additions and 2 deletions

View File

@ -61,7 +61,9 @@ function focuseMode() {
sel, range, node, tag,
target;
if ( (storage.current.mode && storage.current.mode != mode.focus) || $.isEmptyObject( storage.current )) storage.Setcur( mode.focus );
if ( storage.VerifyCur( mode.focus ) ) {
storage.Setcur( mode.focus );
}
target = selector( storage.current.site.include );
// uniqueness verification
@ -118,5 +120,7 @@ function fixFocus( $focus ) {
*/
function readMode() {
console.log( "=== simpread read mode active ===" )
if ( (storage.current.mode && storage.current.mode != mode.read ) || $.isEmptyObject( storage.current )) storage.Setcur( mode.read );
if ( storage.VerifyCur( mode.read ) ) {
storage.Setcur( mode.read );
}
}

View File

@ -162,6 +162,15 @@ class Storage {
}
}
/**
* Verity current changed
*
* @param {string} @see mode
*/
VerifyCur( type ) {
return ( current.mode && current.mode != type ) || $.isEmptyObject( current );
}
}
/**