home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2000 July / macformat-092.iso / Dreamweaver 3 / Configuration / Menus / MM / File_RecentFiles.js < prev    next >
Encoding:
Text File  |  1999-12-01  |  1.3 KB  |  51 lines

  1.    function receiveArguments()
  2.    {
  3.     var recentFiles = null;
  4.     var i;
  5.       var menuItem = arguments[0];
  6.  
  7.       i=parseInt(menuItem);
  8.       recentFiles = dw.getRecentFileList();
  9.       dw.openDocument(recentFiles[i]);
  10.    }
  11.  
  12.    function canAcceptCommand()
  13.    {
  14.     var recentFiles = null;
  15.       recentFiles = dw.getRecentFileList();
  16.     return (recentFiles && recentFiles.length > 0 && arguments[0] != 'dummy');
  17.    }
  18.  
  19.    function getDynamicContent(itemID)
  20.    {
  21.     var recentFiles = null;
  22.       var i=0;
  23.       var separatorChar='/';
  24.  
  25.       recentFiles = new Array(4);
  26.       var recentFilesList = dw.getRecentFileList();
  27.  
  28.       if (recentFilesList.length > 0)
  29.       {
  30.          for (i=0; i<recentFilesList.length; i++)
  31.          {
  32.             recentFiles[i] = new String(recentFilesList[i].substring(recentFilesList[i].lastIndexOf(separatorChar)+1));
  33.             recentFiles[i] += ";id='"+i+"'";
  34.             
  35.             // if the filename contains an underscore, we need to put a % sign
  36.             // in front of it so that it doesn't get removed.
  37.             recentFiles[i] = recentFiles[i].replace(/_/g,"%_");
  38.          }
  39.      for (i=recentFilesList.length; i < 4; i++){
  40.              recentFiles[i] = new String(MENU_RecentFile);
  41.                recentFiles[i] += ";id='dummy'";
  42.      }
  43.       }else{
  44.         for (i=0; i < recentFiles.length; i++){
  45.           recentFiles[i] = new String(MENU_RecentFile);
  46.             recentFiles[i] += ";id='dummy'";
  47.         }
  48.       }
  49.       return recentFiles;
  50.    }
  51.