Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

69 rindas
1.7 KiB

  1. function dec2bin(x:integer):string;
  2. var s:string;
  3. begin
  4. s:='';
  5. repeat
  6. s:=chr($30 + x and 1) + s;
  7. x:=x shr 1;
  8. until x=0;
  9. result:=s;
  10. end;
  11. var binX,binY:string;
  12. i,posSRC,posDATE,posTYPE,posFirstAND:integer;
  13. begin
  14. posFirstAND:=pos('&',GetUrlBase)-1;
  15. if posFirstAND<=0 then begin
  16. posFirstAND:=length(GetUrlBase);
  17. end;
  18. posSRC:=pos('&src=',GetUrlBase);
  19. posDATE:=pos('&date=',GetUrlBase);
  20. posTYPE:=pos('&type=',GetUrlBase);
  21. ResultURL:=copy(GetUrlBase,1,posFirstAND);
  22. if posSRC>0 then begin
  23. i:=posSRC+5;
  24. while (GetUrlBase[i]<>'&') do begin
  25. inc(i);
  26. if (i>length(GetUrlBase)) then break;
  27. end;
  28. ResultURL:=ResultURL+copy(GetUrlBase,posSRC+5,i-(posSRC+5));
  29. end;
  30. ResultURL:=ResultURL+'/'+inttostr(GetZ-1)+'/';
  31. if posDATE>0 then begin
  32. i:=posDATE+6;
  33. while (GetUrlBase[i]<>'&') do begin
  34. inc(i);
  35. if (i>length(GetUrlBase)) then break;
  36. end;
  37. if (i-(posDATE+6))>0 then begin
  38. ResultURL:=ResultURL+copy(GetUrlBase,posDATE+6,i-(posDATE+6))+'/';
  39. end;
  40. end;
  41. binX:='0'+dec2bin(GetX);
  42. binY:='0'+dec2bin(GetY);
  43. binX:=copy(binX,length(binX)-(GetZ-1)+1,GetZ-1);
  44. binY:=copy(binY,length(binY)-(GetZ-1)+1,GetZ-1);
  45. for i:=7 to GetZ-1 do begin
  46. ResultURL:=ResultURL+copy(binY,1,i-6)+'-'+copy(binX,1,i-6)+'/';
  47. end;
  48. ResultURL:=ResultURL+binY+'-'+binX;
  49. if posTYPE>0 then begin
  50. i:=posTYPE+6;
  51. while (GetUrlBase[i]<>'&') do begin
  52. inc(i);
  53. if (i>length(GetUrlBase)) then break;
  54. end;
  55. if (i-(posTYPE+6))>0 then begin
  56. ResultURL:=ResultURL+'.'+copy(GetUrlBase,posTYPE+6,i-(posTYPE+6));
  57. end;
  58. end else begin
  59. ResultURL:=ResultURL+'.jpg';
  60. end;
  61. end.