Subversion Repositories Kolibri OS

Rev

Rev 6366 | Rev 6678 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. //HTML Viewer in C--
  2. //Copyright 2007-2013 by Veliant & Leency
  3. //Asper, lev, Lrz, Barsuk, Nable...
  4. //home icon - rachel fu, GPL licence
  5.  
  6. #ifndef AUTOBUILD
  7.         #include "lang.h--"
  8. #endif
  9.  
  10. //libraries
  11. #define MEMSIZE 1060000
  12. #include "..\lib\gui.h"
  13. #include "..\lib\draw_buf.h"
  14. #include "..\lib\list_box.h"
  15. #include "..\lib\cursor.h"
  16. #include "..\lib\collection.h"
  17. #include "..\lib\font.h"
  18. #include "..\lib\menu.h"
  19.  
  20. //*.obj libraries
  21. #include "..\lib\obj\box_lib.h"
  22. #include "..\lib\obj\libio_lib.h"
  23. #include "..\lib\obj\libimg_lib.h"
  24. #include "..\lib\obj\http.h"
  25. #include "..\lib\obj\iconv.h"
  26. //useful patterns
  27. #include "..\lib\patterns\libimg_load_skin.h"
  28. #include "..\lib\patterns\history.h"
  29. #include "..\lib\patterns\http_downloader.h"
  30.  
  31. char homepage[] = FROM "html\\homepage.htm";
  32.  
  33. #ifdef LANG_RUS
  34. char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.48";
  35. ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
  36. ?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
  37. char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
  38. char page_not_found[] = FROM "html\page_not_found_ru.htm";
  39. char accept_language[]= "Accept-Language: ru\n";
  40. char rmb_menu[] =
  41. "®á¬®âà¥âì ¨á室­¨ª
  42. ¥¤ ªâ¨à®¢ âì ¨á室­¨ª
  43. ˆáâ®à¨ï
  44. Žç¨áâ¨âì ªíè ª à⨭®ª
  45. Œ¥­¥¤¦¥à § £à㧮ª";
  46. #else
  47. char version[]=" Text-based Browser 1.48";
  48. ?define IMAGES_CACHE_CLEARED "Images cache cleared"
  49. ?define T_LAST_SLIDE "This slide is the last"
  50. char loading[] = "Loading...<br>";
  51. char page_not_found[] = FROM "html\page_not_found_en.htm";
  52. char accept_language[]= "Accept-Language: en\n";
  53. char rmb_menu[] =
  54. "View source
  55. Edit source
  56. History
  57. Free image cache
  58. Download Manager";
  59. #endif
  60.  
  61. #define URL_SERVICE_HISTORY "WebView://history"
  62. #define URL_SERVICE_HOME "WebView://home"
  63. #define URL_SERVICE_SOURCE "WebView://source:"
  64.  
  65. proc_info Form;
  66.  
  67. //char search_path[]="http://nigma.ru/index.php?s=";
  68. int redirected = 0;
  69.  
  70. char stak[4096];
  71.  
  72. int action_buf;
  73.  
  74. dword http_transfer = 0;
  75. dword http_buffer;
  76.  
  77. dword TOOLBAR_H = 33;
  78. dword STATUSBAR_H = 15;
  79. dword col_bg;
  80. dword panel_color;
  81. dword border_color;
  82.  
  83. progress_bar wv_progress_bar;
  84. byte souce_mode = false;
  85.  
  86. enum {
  87.         BACK_BUTTON=1000,
  88.         FORWARD_BUTTON,
  89.         REFRESH_BUTTON,
  90.         GOTOURL_BUTTON,
  91.         SANDWICH_BUTTON
  92. };
  93.  
  94. enum {
  95.         VIEW_SOURCE=1100,
  96.         EDIT_SOURCE,
  97.         VIEW_HISTORY,
  98.         FREE_IMG_CACHE,
  99.         DOWNLOAD_MANAGER
  100. };
  101.  
  102. #include "..\TWB\TWB.c"
  103. #include "history.h"
  104. #include "show_src.h"
  105. #include "download_manager.h"
  106.  
  107. char editURL[sizeof(URL)];
  108. int     mouse_twb;
  109. edit_box address_box = {250,56,34,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(URL),#editURL,#mouse_twb,2,19,19};
  110.  
  111.  
  112. void main()
  113. {
  114.         dword btn;
  115.         int half_scroll_size;
  116.         int scroll_used=0, show_menu;
  117.         CursorPointer.Load(#CursorFile);
  118.         load_dll(boxlib, #box_lib_init,0);
  119.         load_dll(libio, #libio_init,1);
  120.         load_dll(libimg, #libimg_init,1);
  121.         load_dll(libHTTP, #http_lib_init,1);
  122.         load_dll(iconv_lib, #iconv_open,0);
  123.         Libimg_LoadImage(#skin, abspath("wv_skin.png"));
  124.         SetSkinColors();
  125.         CreateDir("/tmp0/1/downloads");
  126.         if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);
  127.         WB1.DrawBuf.zoom = 1;
  128.         WB1.list.SetFont(8, 14, 10011000b);
  129.         WB1.list.no_selection = true;
  130.         label.init(DEFAULT_FONT);
  131.         SetEventMask(0xa7);
  132.         BEGIN_LOOP_APPLICATION:
  133.                 WaitEventTimeout(2);
  134.                 switch(EAX & 0xFF)
  135.                 {
  136.                         CASE evMouse:
  137.                                 if (!CheckActiveProcess(Form.ID)) break;
  138.                                 edit_box_mouse stdcall (#address_box);
  139.                                 mouse.get();
  140.                                 if (WB1.list.MouseOver(mouse.x, mouse.y))
  141.                                 {
  142.                                         PageLinks.Hover(mouse.x, WB1.list.first*WB1.list.item_h + mouse.y, link_color_inactive, link_color_active, bg_color);
  143.                                         if (bufsize) && (mouse.pkm) && (mouse.up) {
  144.                                                 menu.show(Form.left+mouse.x-6,Form.top+mouse.y+skin_height+3, 180, #rmb_menu, VIEW_SOURCE);
  145.                                                 break;
  146.                                         }
  147.                                         if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
  148.                                 }
  149.                                 scrollbar_v_mouse (#scroll_wv);
  150.                                 if (WB1.list.first != scroll_wv.position)
  151.                                 {
  152.                                         WB1.list.first = scroll_wv.position;
  153.                                         WB1.DrawPage();
  154.                                         break;
  155.                                 }
  156.                                 break;
  157.  
  158.                         case evButton:
  159.                                 btn=GetButtonID();
  160.                                 if (btn==1)     ExitProcess();
  161.                                 Scan(btn);
  162.                                 break;
  163.  
  164.                         case evKey:
  165.                                 GetKeys();
  166.                                 if (address_box.flags & 0b10)  
  167.                                 {
  168.                                         if (key_ascii == ASCII_KEY_ENTER) Scan(key_scancode); else {
  169.                                                 EAX = key_editbox;
  170.                                                 edit_box_key stdcall(#address_box);
  171.                                         }
  172.                                 }
  173.                                 else
  174.                                 {
  175.                                         Scan(key_scancode);
  176.                                 }
  177.                                 break;
  178.  
  179.                         case evReDraw:
  180.                                 if (menu.list.cur_y) {
  181.                                         Scan(menu.list.cur_y);
  182.                                         menu.list.cur_y = 0;
  183.                                 }
  184.                                 DefineAndDrawWindow(GetScreenWidth()-800/2,GetScreenHeight()-600/2,800,600,0x73,col_bg,0,0);
  185.                                 GetProcessInfo(#Form, SelfInfo);
  186.                                 if (Form.status_window>2) { DrawTitle(#header); break; }
  187.                                 if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; }
  188.                                 if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; }
  189.                                 Draw_Window();
  190.                                 break;
  191.                                
  192.                         case evNetwork:
  193.                                 if (http_transfer > 0) {
  194.                                         http_receive stdcall (http_transfer);
  195.                                         $push EAX
  196.                                         ESI = http_transfer;
  197.                                         wv_progress_bar.max = ESI.http_msg.content_length;
  198.                                         if (wv_progress_bar.value != ESI.http_msg.content_received)
  199.                                         {
  200.                                                 wv_progress_bar.value = ESI.http_msg.content_received; 
  201.                                                 DrawProgress();
  202.                                         }
  203.                                         $pop EAX
  204.                                         if (EAX == 0) {
  205.                                                 ESI = http_transfer;
  206.                                                 // Handle redirects
  207.                                                 if (ESI.http_msg.status >= 300) && (ESI.http_msg.status < 400)
  208.                                                 {
  209.                                                         redirected++;
  210.                                                         if (redirected<=5)
  211.                                                         {
  212.                                                                 http_find_header_field stdcall (http_transfer, "location\0");
  213.                                                                 if (EAX!=0) {
  214.                                                                         ESI = EAX;
  215.                                                                         EDI = #URL;
  216.                                                                         do {
  217.                                                                                 $lodsb;
  218.                                                                                 $stosb;
  219.                                                                         } while (AL != 0) && (AL != 13) && (AL != 10));
  220.                                                                         DSBYTE[EDI-1]='\0';
  221.                                                                 }
  222.                                                         }
  223.                                                         else
  224.                                                         {
  225.                                                                 notify("Too many redirects");
  226.                                                                 StopLoading();
  227.                                                                 break;
  228.                                                         }
  229.                                                 }
  230.                                                 else
  231.                                                 {
  232.                                                         redirected = 0;
  233.                                                 }
  234.                                                 // Loading the page is complete, free resources
  235.                                                 if (redirected>0)
  236.                                                 {
  237.                                                         http_free stdcall (http_transfer);
  238.                                                         http_transfer=0;
  239.                                                         GetAbsoluteURL(#URL);
  240.                                                         history.back();
  241.                                                         strcpy(#editURL, #URL);
  242.                                                         DrawEditBoxWebView();
  243.                                                         OpenPage();
  244.                                                 }
  245.                                                 else
  246.                                                 {
  247.                                                         history.add(#URL);
  248.                                                         ESI = http_transfer;
  249.                                                         bufpointer = ESI.http_msg.content_ptr;
  250.                                                         bufsize = ESI.http_msg.content_received;
  251.                                                         http_free stdcall (http_transfer);
  252.                                                         http_transfer=0;
  253.                                                         SetPageDefaults();
  254.                                                         ShowPage();
  255.                                                 }
  256.                                         }
  257.                                 }
  258.                 }
  259.         goto BEGIN_LOOP_APPLICATION;
  260. }
  261.  
  262. void SetElementSizes()
  263. {
  264.         address_box.top = TOOLBAR_H/2-7;
  265.         address_box.width = Form.cwidth - address_box.left - 25 - 22;
  266.         WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom,
  267.                 Form.cheight - TOOLBAR_H - STATUSBAR_H, WB1.list.font_h + WB1.DrawBuf.zoom + WB1.DrawBuf.zoom * WB1.DrawBuf.zoom);
  268.         WB1.list.wheel_size = 7;
  269.         WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
  270.         WB1.list.visible = WB1.list.h - 5 / WB1.list.item_h;
  271.         if (WB1.list.w!=WB1.DrawBuf.bufw) {
  272.                 WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 30);
  273.                 Scan(REFRESH_BUTTON);
  274.         }
  275. }
  276.  
  277.  
  278.  
  279. void Draw_Window()
  280. {
  281.         int list__w, list__h;
  282.         DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color);
  283.         DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
  284.         DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
  285.         SetElementSizes();
  286.         DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 20,border_color);
  287.         DefineButton(address_box.left-50, address_box.top-2, 23, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
  288.         DefineButton(address_box.left-26, address_box.top-2, 23, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
  289.         img_draw stdcall(skin.image, address_box.left-51, address_box.top-3, 48, skin.h, 3, 0);
  290.         DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
  291.         DefineButton(Form.cwidth-24, address_box.top-3, 19, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
  292.         img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-3, 16, skin.h, 85, 0);
  293.         DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
  294.         DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
  295.         if (!header) OpenPage(); else { WB1.DrawPage(); DrawEditBoxWebView(); }
  296.         DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
  297.         DrawProgress();
  298.  
  299.         /*
  300.         list__w = 200;
  301.         list__h = 200;
  302.         label.raw_size = 0;
  303.         label.write_buf(10,10, list__w, list__h, 0xFFFFFF, 0, 11, "Hello World!");
  304.         label.write_buf(10,23, list__w, list__h, 0xFFFFFF, 0xFF00FF, 12, "How are you?");
  305.         label.write_buf(11,40, list__w, list__h, 0xFFFFFF, 0x2E74BB, 15, "Fine");
  306.         label.apply_smooth();
  307.         label.show_buf(0,0);
  308.         */
  309. }
  310.  
  311.  
  312. void Scan(dword id__)
  313. {
  314.         action_buf=0;
  315.         if (WB1.list.ProcessKey(id__)) WB1.DrawPage();
  316.         else switch (id__)
  317.         {
  318.                 case SCAN_CODE_BS:
  319.                 case BACK_BUTTON:
  320.                         if (history.back()) {
  321.                                 strcpy(#URL, history.current());
  322.                                 OpenPage();
  323.                         }
  324.                         return;
  325.                 case FORWARD_BUTTON:
  326.                         if (history.forward()) {
  327.                                 strcpy(#URL, history.current());
  328.                                 OpenPage();
  329.                         }
  330.                         return;
  331.                 case GOTOURL_BUTTON:
  332.                 case SCAN_CODE_ENTER:
  333.                         if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') || (!strncmp(#editURL,"WebView:",9))
  334.                         {
  335.                                 strcpy(#URL, #editURL);
  336.                         }
  337.                         else
  338.                         {
  339.                                 strlcpy(#URL,"http://",7);
  340.                                 strcat(#URL, #editURL);
  341.                         }
  342.                         OpenPage();
  343.                         return;
  344.                 case 063: //F5
  345.                         IF(address_box.flags & 0b10) return;
  346.                 case REFRESH_BUTTON:
  347.                         if (http_transfer > 0)
  348.                         {
  349.                                 StopLoading();
  350.                                 Draw_Window();
  351.                         }
  352.                         else OpenPage();
  353.                         return;
  354.                 case SANDWICH_BUTTON:
  355.                         mouse.y = TOOLBAR_H-6;
  356.                         mouse.x = Form.cwidth - 167;
  357.                         menu.show(Form.left+mouse.x-6,Form.top+mouse.y+skin_height+3, 180, #rmb_menu, VIEW_SOURCE);
  358.                         return;
  359.                 case VIEW_SOURCE:
  360.                         WB1.list.first = 0;
  361.                         ShowSource();
  362.                         WB1.LoadInternalPage(bufpointer, bufsize);
  363.                         break;
  364.                 case EDIT_SOURCE:
  365.                         if (!strncmp(#URL,"http:",5))
  366.                         {
  367.                                 WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
  368.                                 if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
  369.                         }
  370.                         else RunProgram("/rd/1/tinypad", #URL);
  371.                         return;
  372.                 case FREE_IMG_CACHE:
  373.                         ImgCache.Free();
  374.                         notify(IMAGES_CACHE_CLEARED);
  375.                         WB1.DrawPage();
  376.                         return;
  377.                 case VIEW_HISTORY:
  378.                         strcpy(#URL, URL_SERVICE_HISTORY);
  379.                         OpenPage();
  380.                         return;
  381.                 case DOWNLOAD_MANAGER:
  382.                         if (!downloader_opened) {
  383.                                 downloader_edit = NULL;
  384.                                 CreateThread(#Downloader,#downloader_stak+4092);
  385.                         }
  386.                         return;
  387.         }
  388. }
  389.  
  390.  
  391. void StopLoading()
  392. {
  393.         if (http_transfer)
  394.         {
  395.                 EAX = http_transfer;
  396.                 EAX = EAX.http_msg.content_ptr;         // get pointer to data
  397.                 $push   EAX                                                     // save it on the stack
  398.                 http_free stdcall (http_transfer);      // abort connection
  399.                 $pop    EAX                                                    
  400.                 free(EAX);                                              // free data
  401.                 http_transfer=0;
  402.                 bufsize = 0;
  403.                 bufpointer = free(bufpointer);
  404.         }
  405.         wv_progress_bar.value = 0;
  406.         img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 52, 0);
  407. }
  408.  
  409. void SetPageDefaults()
  410. {
  411.         strcpy(#header, #version);
  412.         WB1.list.count = WB1.list.first = 0;
  413.         stroka = 0;
  414.         cur_encoding = CH_NULL;
  415.         if (o_bufpointer) o_bufpointer = free(o_bufpointer);
  416.         anchor_line_num=WB1.list.first;
  417.         anchor[0]='|';
  418. }
  419.  
  420. void OpenPage()
  421. {
  422.         StopLoading();
  423.         souce_mode = false;
  424.         strcpy(#editURL, #URL);
  425.         history.add(#URL);
  426.         if (!strncmp(#URL,"WebView:",8))
  427.         {
  428.                 SetPageDefaults();
  429.                 if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
  430.                 else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
  431.                 DrawEditBoxWebView();
  432.                 return;
  433.         }
  434.         if (!strncmp(#URL,"http:",5))
  435.         {
  436.                 img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 131, 0);
  437.                 http_get stdcall (#URL, 0, 0, #accept_language);
  438.                 http_transfer = EAX;
  439.                 if (!http_transfer)
  440.                 {
  441.                         StopLoading();
  442.                         bufsize = 0;
  443.                         bufpointer = free(bufpointer);
  444.                         ShowPage();
  445.                         return;
  446.                 }
  447.         }
  448.         else
  449.         {
  450.                 file_size stdcall (#URL);
  451.                 bufsize = EBX;
  452.                 if (bufsize)
  453.                 {
  454.                         free(bufpointer);
  455.                         bufpointer = malloc(bufsize);
  456.                         SetPageDefaults();
  457.                         ReadFile(0, bufsize, bufpointer, #URL);
  458.                 }
  459.                 ShowPage();
  460.         }
  461. }
  462.  
  463. DrawEditBoxWebView()
  464. {
  465.         DrawWideRectangle(address_box.left-2, address_box.top-2, address_box.width+3, 19, 2, address_box.color);
  466.         address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
  467.         address_box.offset = 0;
  468.         edit_box_draw stdcall(#address_box);
  469.         if (http_transfer > 0) EAX = 131; else EAX = 52;
  470.         img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, EAX, 0);
  471. }
  472.  
  473.  
  474. void ShowPage()
  475. {
  476.         DrawEditBoxWebView();
  477.         if (!bufsize)
  478.         {
  479.                 if (http_transfer) WB1.LoadInternalPage(#loading, sizeof(loading));
  480.                 else WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
  481.         }
  482.         else
  483.         {
  484.                 WB1.Prepare();
  485.         }
  486.         //if (!header) strcpy(#header, #version);
  487.         if (!strcmp(#version, #header)) DrawTitle(#header);
  488. }
  489.  
  490. byte UrlExtIs(dword ext)
  491. {
  492.         if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
  493.         return false;
  494. }
  495.  
  496. int SetSkinColors()
  497. {
  498.         dword image_data;
  499.         image_data = DSDWORD[skin.image+24];
  500.         col_bg = DSDWORD[image_data];
  501.         panel_color  = DSDWORD[skin.w*4*4 + image_data];
  502.         border_color = DSDWORD[skin.w*4*7 + image_data];
  503.         wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
  504.         $and col_bg, 0x00ffffff
  505.         $and panel_color, 0x00ffffff
  506.         $and border_color, 0x00ffffff
  507.         $and wv_progress_bar.progress_color, 0x00ffffff
  508. }
  509.  
  510. void DrawProgress()
  511. {
  512.         unsigned long btn;
  513.         if (http_transfer == 0) return;
  514.         if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30;
  515.         DrawBar(address_box.left-2, address_box.top+15, btn, 2, wv_progress_bar.progress_color);
  516. }
  517.  
  518. void ClickLink()
  519. {
  520.         if (http_transfer > 0)
  521.         {
  522.                 StopLoading();
  523.                 history.back();
  524.         }
  525.  
  526.         strcpy(#URL, PageLinks.GetURL(PageLinks.active));      
  527.         //#1
  528.         if (URL[0] == '#')
  529.         {
  530.                 strcpy(#anchor, #URL+strrchr(#URL, '#'));              
  531.                 strcpy(#URL, history.current());
  532.                 WB1.list.first=WB1.list.count-WB1.list.visible;
  533.                 ShowPage();
  534.                 return;
  535.         }
  536.         //liner.ru#1
  537.         if (strrchr(#URL, '#')!=-1)
  538.         {
  539.                 strcpy(#anchor, #URL+strrchr(#URL, '#'));
  540.                 URL[strrchr(#URL, '#')-1] = 0x00;
  541.         }
  542.        
  543.         GetAbsoluteURL(#URL);
  544.        
  545.         if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1) || (UrlExtIs(".kex")==1)
  546.         || (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1)
  547.         {
  548.                 //notify(#URL);
  549.                 if (!strncmp(#URL,"http://", 7))
  550.                 {
  551.                         strcpy(#downloader_edit, #URL);
  552.                         CreateThread(#Downloader,#downloader_stak+4092);
  553.                 }
  554.                 else RunProgram("@open", #URL);
  555.                 strcpy(#editURL, history.current());
  556.                 strcpy(#URL, history.current());
  557.                 return;
  558.         }
  559.         if (!strncmp(#URL,"mailto:", 7))
  560.         {
  561.                 notify(#URL);
  562.                 strcpy(#editURL, history.current());
  563.                 strcpy(#URL, history.current());
  564.                 return;
  565.         }
  566.         OpenPage();
  567.         return;
  568. }
  569.  
  570. stop: