[INTERFACE]
DIALOG, "Диалог", 672, 272;
STATIC, "Глобальные переменные JavaScript. Указывать построчно в формате с обязательной инициализацией:", 4, 4, 532, 20;
STATIC, "var NameVar1 = 0;", 544, 4, 116, 20;
STATIC, "var NameVar2=5;", 544, 24, 116, 20;
EDIT_CODE, 4, 28, 532, 188, string VAR;
STATIC, "var NameVar3 = "text";", 544, 44, 116, 20;
BUTTON_OK, "Принять", 456, 220, 100, 20;
BUTTON_CANCEL, "Закрыть", 564, 220, 100, 20;
[END]

[APPEARANCE]
COLOR = 128, 150, 150;
SIZE_X = 10;
SIZE_Y =4;
[END]

[ASSOC_VAR]
VAR=;
v_VAR_v=~%34~Q@@D%@~VAR~W@&&@2@~%34~;
[END]

[GLOBAL_VAR]
string Script_JS="";
string Global_Var_C_JS="";
string Global_Var_B_JS="";
string Send_Global_Var_JS="";
string Call_Get_Fun_JS="";
string Get_Global_Var_JS="";
string Send_Back_Global_Var_JS = "";
string Get_Back_Global_Var_JS = "";
string All_Call_Send="";
string Global_Reflesh_Var_JS = "";
[END]

[REGEXPLACE_CODE]
W@&&@2@=;
Q@@D%@=;
[<Q@@D%@>] ~%13~~%10~="^r^n"[<W@&&@2@>];
[<Q@@D%@>] ~%39~=~%94~~%39~[<W@&&@2@>];
[<Q@@D%@>] ~%34~=~%94~~%34~[<W@&&@2@>];
[END]

[GLOBAL_SINGLE_CODE_BOTTOM]
ERROR_MARK:;
[END]

[FUNCTION_BODY]
function(string S)
{
S=S+"^r^n";
string masS[100];
int kml;
kml=regexsearch(100, #masS[0], S, "(.*)+(?=\r\n)");
string var, t, t1, t2;
int p;
  for (int n=0; n<kml; n++)
  {
    if (regexsearch(1, #var, masS[n], "(?<=\s)(.*?)(?=\s|=)"))
    {
      if (regexsearch(1, #t1, masS[n], "(?<=\s)(.*?)+"))
      {
        if (regexsearch(1, #t, Global_Var_C_JS, "( "+var+" | "+var+"=| "+var+";)")==0)
        {
        Global_Var_C_JS=Global_Var_C_JS+masS[n]+"^r^n";
        p=0;
          if (regexsearch(1, #t2, masS[n], "(?<==)(.*?)+"))
          {
            if (regexsearch(1, #t2, t2, "^"|^'")==0)
            {
              if (regexsearch(1, #t2, masS[n], "(?<==)(.*?)+(?=\s|;)")==1)
              {
              regexreplace(-1, #t2, t2, " ", "");
              regexreplace(1, #masS[n], masS[n], "(?<==)(.*?)+(?=\s|;)", "^""+t2+"^"");
              p=1;
              }
            }
          }
        Global_Var_B_JS=Global_Var_B_JS+masS[n]+"^r^n";
        if (p==0) Send_Global_Var_JS=Send_Global_Var_JS+"function Send"+var+"()^r^n{chrome.runtime.sendMessage({T"+var+":"+var+"}, function(response) {var tst=response.farewell;});}^r^n";
        else Send_Global_Var_JS=Send_Global_Var_JS+"function Send"+var+"()^r^n{chrome.runtime.sendMessage({T"+var+":String("+var+")}, function(response) {var tst=response.farewell;});}^r^n";
        Call_Get_Fun_JS=Call_Get_Fun_JS+"Get"+var+"();^r^n";
        if (p==0) Get_Global_Var_JS=Get_Global_Var_JS+"function Get"+var+"()^r^n{chrome.runtime.sendMessage({greeting:^"GlobalVar_"+var+"^"},function(response){"+var+"=response.farewell;});}^r^n";
        else Get_Global_Var_JS=Get_Global_Var_JS+"function Get"+var+"()^r^n{chrome.runtime.sendMessage({greeting:^"GlobalVar_"+var+"^"},function(response){"+var+"=Number(response.farewell);});}^r^n";
        Get_Back_Global_Var_JS=Get_Back_Global_Var_JS+"if (request.greeting==^"GlobalVar_"+var+"^"){sendResponse({farewell:"+var+"});S=1;}^r^n";
        Send_Back_Global_Var_JS=Send_Back_Global_Var_JS+"if (request.T"+var+"){"+var+"=request.T"+var+";}^r^n";
        All_Call_Send=All_Call_Send+"Send"+var+"();^r^n";
        if (p==0) Global_Reflesh_Var_JS=Global_Reflesh_Var_JS+t1+"^r^n";
          else 
          {
          regexreplace(-1, #t2, t2, " ", "");
          regexreplace(1, #t1, t1, "(?<==)(.*?)+(?=\s|;)", "^""+t2+"^"");
          Global_Reflesh_Var_JS=Global_Reflesh_Var_JS+t1+"^r^n";
          }
        }
      }
    }
    else {messagebox ("Переменная "+masS[n]+" не инициализированна данными."); goto global ERROR_MARK;}
  }
}
[END]

[CALL]
(v_VAR_v)
[END]

