home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 2001 - Miguel Angel Rojas G.
- // @Modified build 497 cm20010225
-
- /**
- @Tool: moveFirst~goes to the first bookmark.
- */
-
- function DoCommand()
- {
- var bookmarkMap = getMapFile( "Bookmarks" );
- var list = getBookmarksAsList( bookmarkMap );
-
- if ( list == null || list.getCount() == 0 )
- {
- return;
- }
-
- setGlobal( "currentBookmark", 0 );
-
- var position = list.getPosition( 0 );
- var item = list.getAt( position );
-
- var currentMark = bookmarkMap.lookup( item.value.hashKey );
- if ( currentMark )
- {
- currentMark.go();
- }
- }
-
- function getBookmarksAsList( bookmarkMap )
- {
- if ( bookmarkMap.count == 0 )
- {
- return null;
- }
-
- var list = newList();
- var position = bookmarkMap.getHeadPosition();
-
- while ( position && position.valid )
- {
- var next = bookmarkMap.getNext( position );
- if (next.value.valid())
- {
- list.addTail(next);
- }
- else
- {
- bookmarkMap.remove(next.value.hashKey);
- }
- }
-
- list.sort(); // sort in order of creation
-
- return list;
- }
-
- !!/Script
-