Repository navigation
Expand file tree
/
Copy path1.html
More file actions
239 lines (221 loc) · 14.6 KB
/
Copy path1.html
File metadata and controls
239 lines (221 loc) · 14.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>מחולל תמונות טקסט</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Heebo:wght@400;700;900&family=Assistant:wght@400;700&family=Rubik:wght@400;700&family=Frank+Ruhl+Libre:wght@400;700;900&family=Secular+One&family=Suez+One&family=Varela+Round&family=Alef:wght@400;700&family=David+Libre:wght@400;700&family=Miriam+Libre:wght@400;700&family=Amatic+SC:wght@400;700&family=Karantina:wght@400;700&family=Noto+Serif+Hebrew:wght@400;700;900&display=swap">
<style>
:root{--bg:#f3f1ec;--panel:#fff;--ink:#1d2326;--muted:#6a7378;--line:#d9d6cd;--accent:#0f766e;--accent-ink:#fff;color-scheme:light;box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--bg:#15191b;--panel:#1f2528;--ink:#eceae4;--muted:#98a2a7;--line:#363e42;--accent:#2dd4bf;--accent-ink:#06201d;color-scheme:dark}}
:root[data-theme="dark"]{--bg:#15191b;--panel:#1f2528;--ink:#eceae4;--muted:#98a2a7;--line:#363e42;--accent:#2dd4bf;--accent-ink:#06201d;color-scheme:dark}
*,*::before,*::after{box-sizing:inherit}
html{scroll-padding-top:env(safe-area-inset-top,0px)}
body{margin:0;background:var(--bg);color:var(--ink);font-family:"Heebo","Assistant",system-ui,sans-serif;line-height:1.5}
.app{display:grid;grid-template-columns:minmax(300px,380px) 1fr;gap:20px;max-width:1200px;margin:0 auto;padding:20px}
@media (max-width:820px){.app{grid-template-columns:1fr;padding:12px}}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:18px;display:flex;flex-direction:column;gap:16px;align-self:start}
h1{font-size:1.35rem;margin:0;font-weight:900}
.sub{margin:2px 0 0;color:var(--muted);font-size:.9rem}
label,.lbl{font-size:.88rem;font-weight:700;display:block;margin-bottom:6px}
textarea{width:100%;min-height:110px;resize:vertical;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:var(--bg);color:var(--ink);font:inherit;font-size:1rem}
textarea:focus-visible,button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.fonts{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.fonts button{padding:8px 0;border:1px solid var(--line);background:var(--bg);color:var(--ink);border-radius:8px;cursor:pointer;font-size:1.15rem;line-height:1.2}
.fonts button small{display:block;font:400 .65rem "Heebo",sans-serif;color:var(--muted);margin-top:2px}
.fonts button[aria-pressed="true"]{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
.row{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.row>div{flex:1;min-width:120px}
input[type=color]{width:100%;height:38px;padding:2px;border:1px solid var(--line);border-radius:8px;background:var(--bg);cursor:pointer}
input[type=range]{width:100%;accent-color:var(--accent)}
.sw{display:flex;gap:6px;margin-top:6px;flex-wrap:wrap}
.sw button{width:22px;height:22px;border-radius:50%;border:1px solid var(--line);cursor:pointer;padding:0}
.seg{display:flex;border:1px solid var(--line);border-radius:8px;overflow:hidden}
.seg button{flex:1;padding:7px 4px;border:0;background:var(--bg);color:var(--ink);cursor:pointer;font:inherit;font-size:.85rem;border-inline-start:1px solid var(--line)}
.seg button:first-child{border-inline-start:0}
.seg button[aria-pressed="true"]{background:var(--accent);color:var(--accent-ink);font-weight:700}
.grid3{display:grid;grid-template-columns:repeat(3,34px);gap:4px;direction:ltr}
.grid3 button{width:34px;height:34px;border:1px solid var(--line);background:var(--bg);border-radius:6px;cursor:pointer;color:var(--muted)}
.grid3 button:hover{border-color:var(--accent);color:var(--accent)}
.btn{padding:11px 14px;border-radius:10px;border:1px solid var(--accent);background:var(--accent);color:var(--accent-ink);font:inherit;font-weight:700;cursor:pointer}
.btn.ghost{background:transparent;color:var(--ink);border-color:var(--line);font-weight:400}
.hint{font-size:.8rem;color:var(--muted);margin:4px 0 0}
.stage{display:flex;flex-direction:column;gap:12px;align-items:center;min-width:0}
.frame{width:100%;display:flex;justify-content:center;background:repeating-conic-gradient(var(--line) 0 25%,transparent 0 50%) 0 0/16px 16px;border-radius:14px;padding:14px;border:1px solid var(--line)}
canvas{max-width:100%;max-height:78vh;height:auto;border-radius:4px;box-shadow:0 6px 24px rgba(0,0,0,.18);touch-action:none}
.wm-tools[hidden]{display:none}
</style>
</head>
<body>
<div class="app">
<section class="panel" aria-label="הגדרות">
<div><h1>מחולל תמונות טקסט</h1><p class="sub">כתבו טקסט, עצבו, והורידו כתמונה עם סימן מים.</p></div>
<div><label for="txt">הטקסט</label>
<textarea id="txt">כתבו כאן את הטקסט שלכם</textarea></div>
<div><span class="lbl">גופן</span><div class="fonts" id="fonts"></div></div>
<div class="row">
<div><label for="fg">צבע טקסט</label><input type="color" id="fg" value="#ffffff"></div>
<div><label for="bg">צבע רקע</label><input type="color" id="bg" value="#0f766e">
<div class="sw" id="sw"></div></div>
</div>
<div><label for="fs">גודל טקסט</label><input type="range" id="fs" min="20" max="220" value="90"></div>
<div class="row">
<div><span class="lbl">יישור</span>
<div class="seg" id="al"><button data-v="right" aria-pressed="false">ימין</button><button data-v="center" aria-pressed="true">מרכז</button><button data-v="left" aria-pressed="false">שמאל</button></div></div>
<div><span class="lbl">עובי</span>
<div class="seg" id="wt"><button data-v="400" aria-pressed="false">רגיל</button><button data-v="700" aria-pressed="true">מודגש</button></div></div>
</div>
<div><span class="lbl">גודל התמונה</span>
<div class="seg" id="ar">
<button data-w="1080" data-h="1080" aria-pressed="true">ריבוע</button>
<button data-w="1080" data-h="1350" aria-pressed="false">פוסט</button>
<button data-w="1080" data-h="1920" aria-pressed="false">סטורי</button>
<button data-w="1920" data-h="1080" aria-pressed="false">רחב</button>
</div></div>
<div style="border-top:1px solid var(--line);padding-top:14px">
<span class="lbl">סימן מים</span>
<div class="row">
<button class="btn ghost" id="up" type="button">העלאת תמונת סימן מים</button>
<button class="btn ghost" id="rm" type="button" hidden>הסרה</button>
</div>
<input type="file" id="file" accept="image/*" hidden>
<p class="hint" id="wmhint">לא הועלה סימן מים. בחרו קובץ תמונה מהמכשיר; הוא יישמר בדפדפן לפעם הבאה.</p>
<div class="wm-tools" id="wmtools" hidden>
<div class="row" style="margin-top:12px">
<div><label for="ws">גודל</label><input type="range" id="ws" min="6" max="60" value="20"></div>
<div><label for="wo">שקיפות</label><input type="range" id="wo" min="15" max="100" value="85"></div>
</div>
<div class="row" style="margin-top:12px;align-items:flex-start">
<div><span class="lbl">מיקום מהיר</span><div class="grid3" id="pos"></div></div>
<div><p class="hint">אפשר גם לגרור את סימן המים ישירות על התצוגה המקדימה.</p></div>
</div>
</div>
</div>
</section>
<section class="stage" aria-label="תצוגה מקדימה">
<div class="frame"><canvas id="cv" width="1080" height="1080" aria-label="תצוגה מקדימה של התמונה"></canvas></div>
<button class="btn" id="dl" type="button">הורדה כתמונה (PNG)</button>
</section>
</div>
<script>
(function(){
var FONTS=[["Heebo","היבו"],["Assistant","אסיסטנט"],["Rubik","רוביק"],["Frank Ruhl Libre","פרנק ריהל"],["Secular One","שקולר"],["Suez One","סואץ"],["Varela Round","וארלה"],["Alef","אלף"],["David Libre","דוד"],["Miriam Libre","מרים"],["Amatic SC","אמטיק"],["Karantina","קרנטינה"],["Noto Serif Hebrew","נוטו סריף"]];
var SW=["#0f766e","#1e3a8a","#7c2d12","#111111","#f5f0e6","#be185d","#facc15"];
var S={font:"Heebo",align:"center",weight:"700",W:1080,H:1080,wx:0.14,wy:0.92,wm:null,wmData:null};
var $=function(i){return document.getElementById(i)};
var cv=$("cv"),ctx=cv.getContext("2d"),tok=0;
// fonts chips
FONTS.forEach(function(f){
var b=document.createElement("button");b.type="button";b.setAttribute("aria-pressed",f[0]===S.font);
b.style.fontFamily='"'+f[0]+'",sans-serif';b.innerHTML="אבגד<small>"+f[1]+"</small>";
b.onclick=function(){S.font=f[0];[].forEach.call($("fonts").children,function(c){c.setAttribute("aria-pressed",c===b)});draw()};
$("fonts").appendChild(b);
});
// swatches
SW.forEach(function(c){var b=document.createElement("button");b.type="button";b.style.background=c;b.setAttribute("aria-label","צבע רקע "+c);b.onclick=function(){$("bg").value=c;draw()};$("sw").appendChild(b)});
// segmented
function seg(id,fn){var el=$(id);el.onclick=function(e){var b=e.target.closest("button");if(!b)return;[].forEach.call(el.children,function(c){c.setAttribute("aria-pressed",c===b)});fn(b);draw()}}
seg("al",function(b){S.align=b.dataset.v});
seg("wt",function(b){S.weight=b.dataset.v});
seg("ar",function(b){S.W=+b.dataset.w;S.H=+b.dataset.h;cv.width=S.W;cv.height=S.H});
["txt","fg","bg","fs","ws","wo"].forEach(function(i){$(i).addEventListener("input",draw)});
// watermark
function wmSize(){var w=S.W*$("ws").value/100;return S.wm?[w,w*S.wm.height/S.wm.width]:[0,0]}
function setWm(src,persist){
var im=new Image();
im.onload=function(){S.wm=im;S.wmData=src;$("wmtools").hidden=false;$("rm").hidden=false;$("up").textContent="החלפת סימן מים";$("wmhint").textContent="סימן המים נטען.";
if(persist){try{localStorage.setItem("wm_img",src)}catch(e){}}draw()};
im.src=src;
}
$("up").onclick=function(){$("file").click()};
$("file").onchange=function(){var f=this.files[0];if(!f)return;var r=new FileReader();r.onload=function(){setWm(r.result,true)};r.readAsDataURL(f)};
$("rm").onclick=function(){S.wm=null;S.wmData=null;$("wmtools").hidden=true;$("rm").hidden=true;$("up").textContent="העלאת תמונת סימן מים";$("wmhint").textContent="לא הועלה סימן מים. בחרו קובץ תמונה מהמכשיר; הוא יישמר בדפדפן לפעם הבאה.";try{localStorage.removeItem("wm_img")}catch(e){}draw()};
var DEFAULT_WM="img/1.png";
function tryDefault(){var t=new Image();t.onload=function(){setWm(encodeURI(DEFAULT_WM),false)};t.onerror=function(){};t.src=encodeURI(DEFAULT_WM)}
try{var saved=localStorage.getItem("wm_img");if(saved)setWm(saved,false);else tryDefault()}catch(e){tryDefault()}
// position presets (3x3)
var arrows=["↖","↑","↗","←","•","→","↙","↓","↘"];
arrows.forEach(function(a,i){
var b=document.createElement("button");b.type="button";b.textContent=a;b.setAttribute("aria-label","מיקום "+(i+1));
b.onclick=function(){
var s=wmSize(),m=S.W*0.04,col=i%3,row=Math.floor(i/3);
var cx=col===0?m+s[0]/2:col===1?S.W/2:S.W-m-s[0]/2;
var cy=row===0?m+s[1]/2:row===1?S.H/2:S.H-m-s[1]/2;
S.wx=cx/S.W;S.wy=cy/S.H;draw();
};
$("pos").appendChild(b);
});
// drag
var drag=null;
function pt(e){var r=cv.getBoundingClientRect();return[(e.clientX-r.left)*S.W/r.width,(e.clientY-r.top)*S.H/r.height]}
cv.addEventListener("pointerdown",function(e){
if(!S.wm)return;var p=pt(e),s=wmSize(),cx=S.wx*S.W,cy=S.wy*S.H,pad=20;
if(Math.abs(p[0]-cx)<=s[0]/2+pad&&Math.abs(p[1]-cy)<=s[1]/2+pad){drag=[p[0]-cx,p[1]-cy];cv.setPointerCapture(e.pointerId)}
});
cv.addEventListener("pointermove",function(e){
var p=pt(e);
if(!drag){if(S.wm){var s=wmSize();cv.style.cursor=(Math.abs(p[0]-S.wx*S.W)<=s[0]/2+20&&Math.abs(p[1]-S.wy*S.H)<=s[1]/2+20)?"grab":"default"}return}
var s=wmSize();
S.wx=Math.min(1-s[0]/2/S.W,Math.max(s[0]/2/S.W,(p[0]-drag[0])/S.W));
S.wy=Math.min(1-s[1]/2/S.H,Math.max(s[1]/2/S.H,(p[1]-drag[1])/S.H));
draw();
});
cv.addEventListener("pointerup",function(){drag=null});
cv.addEventListener("pointercancel",function(){drag=null});
// text layout
function hasHeb(t){return /[\u0590-\u05FF]/.test(t)}
function wrap(text,maxW){
var out=[];
text.split("\n").forEach(function(par){
if(!par.trim()){out.push("");return}
var words=par.split(/\s+/),line="";
words.forEach(function(w){
var t=line?line+" "+w:w;
if(ctx.measureText(t).width>maxW&&line){out.push(line);line=w}else line=t;
});
out.push(line);
});
return out;
}
async function draw(){
var my=++tok;
var fpx=$("fs").value*S.W/1080,fontStr=S.weight+" "+fpx+'px "'+S.font+'"';
var text=$("txt").value;
try{await document.fonts.load(fontStr,text||"א")}catch(e){}
if(my!==tok)return;
ctx.clearRect(0,0,S.W,S.H);
ctx.fillStyle=$("bg").value;ctx.fillRect(0,0,S.W,S.H);
ctx.font=fontStr;ctx.fillStyle=$("fg").value;ctx.textBaseline="middle";
var pad=S.W*0.09,maxW=S.W-pad*2,lh=fpx*1.35;
var lines=wrap(text,maxW),total=lines.length*lh,y=(S.H-total)/2+lh/2;
lines.forEach(function(l){
var rtl=hasHeb(l);ctx.direction=rtl?"rtl":"ltr";
var x;
if(S.align==="center"){ctx.textAlign="center";x=S.W/2}
else{var right=S.align==="right";ctx.textAlign=right?"right":"left";x=right?S.W-pad:pad}
ctx.fillText(l,x,y);y+=lh;
});
ctx.direction="ltr";
if(S.wm){
var s=wmSize(),w=s[0],h=s[1];
var x0=Math.min(S.W-w,Math.max(0,S.wx*S.W-w/2)),y0=Math.min(S.H-h,Math.max(0,S.wy*S.H-h/2));
ctx.save();ctx.globalAlpha=$("wo").value/100;
ctx.shadowColor="rgba(0,0,0,.28)";ctx.shadowBlur=S.W*0.012;
ctx.drawImage(S.wm,x0,y0,w,h);ctx.restore();
}
}
$("dl").onclick=function(){
cv.toBlob(function(b){
var a=document.createElement("a");a.href=URL.createObjectURL(b);a.download="text-image.png";
document.body.appendChild(a);a.click();a.remove();setTimeout(function(){URL.revokeObjectURL(a.href)},1000);
},"image/png");
};
if(document.fonts&&document.fonts.ready)document.fonts.ready.then(draw);
draw();
})();
</script>
</body>
</html>
<!-- Injection By NetFree -->
<script src="//netfree.link/injection-script/go-payment.js" type="text/javascript" async ></script>
<script src="//netfree.link/injection-script/popup-card-init.js" type="text/javascript" async ></script>