Asem75 commited on
Commit
d60a2ca
·
verified ·
1 Parent(s): a905ddd

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +57 -7
index.html CHANGED
@@ -33,9 +33,9 @@ p{line-height:1.7;margin:.3rem 0}
33
  }
34
  .hour{
35
  direction:rtl;
36
- flex:0 0 150px;
37
- width:150px;
38
- min-height:126px;
39
  padding:12px 8px;
40
  border:1px solid currentColor;
41
  border-inline-start:0;
@@ -97,8 +97,9 @@ dialog::backdrop{background:rgba(0,0,0,.7)}
97
 
98
  const START_HOUR = 4;
99
  const TOTAL_HOURS = 48;
100
- const PX_PER_HOUR = 150;
101
  const REGISTRY_URL = "fiqh_time_registry.json";
 
102
 
103
  const ruler = document.getElementById("ruler");
104
  const rulerScroll = document.getElementById("rulerScroll");
@@ -109,6 +110,7 @@ const dialogText = document.getElementById("dialogText");
109
  const closeDialog = document.getElementById("closeDialog");
110
  let lastFocused = null;
111
  let timeRegistry = null;
 
112
 
113
  function ar12(hour){
114
  const h = hour % 24;
@@ -148,9 +150,44 @@ function buildRuler(){
148
  ruler.appendChild(frag);
149
  }
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  function openHour(button,label){
152
  lastFocused=button;
153
- dialogText.textContent=label + "؛ هذه المرحلة تعرض الزمن فقط. لم تُربط أحكام العبادات أو الألوان بعد.";
 
154
  if(typeof dialog.showModal==="function") dialog.showModal();
155
  else dialog.setAttribute("open","");
156
  closeDialog.focus();
@@ -182,13 +219,26 @@ function renderBoundaries(reg){
182
  }
183
 
184
  async function loadRegistry(){
 
185
  try{
186
  const res=await fetch(REGISTRY_URL,{cache:"no-store"});
187
  if(!res.ok) throw new Error(`HTTP ${res.status}`);
188
  timeRegistry=await res.json();
189
  renderBoundaries(timeRegistry);
190
- }catch(err){
191
- loadStatus.textContent="تعذر تحميل fiqh_time_registry.json. المسطرة نفسها ما زالت تعمل لاختبار اللمس وقارئ الشاشة.";
 
 
 
 
 
 
 
 
 
 
 
 
192
  }
193
  }
194
 
 
33
  }
34
  .hour{
35
  direction:rtl;
36
+ flex:0 0 190px;
37
+ width:190px;
38
+ min-height:150px;
39
  padding:12px 8px;
40
  border:1px solid currentColor;
41
  border-inline-start:0;
 
97
 
98
  const START_HOUR = 4;
99
  const TOTAL_HOURS = 48;
100
+ const PX_PER_HOUR = 190;
101
  const REGISTRY_URL = "fiqh_time_registry.json";
102
+ const WORSHIP_REGISTRY_URL = "worship_fiqh_registry.json";
103
 
104
  const ruler = document.getElementById("ruler");
105
  const rulerScroll = document.getElementById("rulerScroll");
 
110
  const closeDialog = document.getElementById("closeDialog");
111
  let lastFocused = null;
112
  let timeRegistry = null;
113
+ let worshipRegistry = null;
114
 
115
  function ar12(hour){
116
  const h = hour % 24;
 
150
  ruler.appendChild(frag);
151
  }
152
 
153
+ function boundaryLabel(id){
154
+ if(!id) return "";
155
+ const bounds=Array.isArray(timeRegistry?.boundaries)?timeRegistry.boundaries:[];
156
+ const x=bounds.find(v=>v.id===id);
157
+ return x ? (x.label || x.label_ar || x.id) : id;
158
+ }
159
+
160
+ function ruleText(rule){
161
+ const parts=[];
162
+ const common=rule.common || {};
163
+ if(common.start) parts.push(`البداية: ${boundaryLabel(common.start)}`);
164
+ if(common.end) parts.push(`النهاية: ${boundaryLabel(common.end)}`);
165
+ if(rule.note) parts.push(rule.note);
166
+ const madhhab=rule.madhhab || {};
167
+ for(const [key,value] of Object.entries(madhhab)){
168
+ const name=worshipRegistry?.madhhabs?.[key] || key;
169
+ if(value && typeof value === "object"){
170
+ const details=[];
171
+ if(value.start) details.push(`البداية ${boundaryLabel(value.start)}`);
172
+ if(value.end) details.push(`النهاية ${boundaryLabel(value.end)}`);
173
+ if(value.variant) details.push(value.variant);
174
+ if(value.late) details.push(value.late);
175
+ if(details.length) parts.push(`${name}: ${details.join("؛ ")}`);
176
+ }
177
+ }
178
+ return parts.join(". ");
179
+ }
180
+
181
+ function worshipSummary(){
182
+ const rules=Array.isArray(worshipRegistry?.rules)?worshipRegistry.rules:[];
183
+ if(!rules.length) return "لم تُحمّل أحكام العبادات بعد.";
184
+ return rules.map(r=>`${r.id}: ${ruleText(r)}`).join("\n\n");
185
+ }
186
+
187
  function openHour(button,label){
188
  lastFocused=button;
189
+ dialogText.style.whiteSpace="pre-line";
190
+ dialogText.textContent=label + "\n\nأحكام العبادات المحمّلة:\n" + worshipSummary();
191
  if(typeof dialog.showModal==="function") dialog.showModal();
192
  else dialog.setAttribute("open","");
193
  closeDialog.focus();
 
219
  }
220
 
221
  async function loadRegistry(){
222
+ const errors=[];
223
  try{
224
  const res=await fetch(REGISTRY_URL,{cache:"no-store"});
225
  if(!res.ok) throw new Error(`HTTP ${res.status}`);
226
  timeRegistry=await res.json();
227
  renderBoundaries(timeRegistry);
228
+ }catch(err){ errors.push("fiqh_time_registry.json"); }
229
+
230
+ try{
231
+ const res=await fetch(WORSHIP_REGISTRY_URL,{cache:"no-store"});
232
+ if(!res.ok) throw new Error(`HTTP ${res.status}`);
233
+ worshipRegistry=await res.json();
234
+ }catch(err){ errors.push("worship_fiqh_registry.json"); }
235
+
236
+ if(errors.length){
237
+ loadStatus.textContent=`تعذر تحميل: ${errors.join("، ")}. المسطرة نفسها ما زالت تعمل.`;
238
+ }else{
239
+ const bounds=Array.isArray(timeRegistry?.boundaries)?timeRegistry.boundaries:[];
240
+ const rules=Array.isArray(worshipRegistry?.rules)?worshipRegistry.rules:[];
241
+ loadStatus.textContent=`تم تحميل سجل الزمن وسجل فقه العبادات بنجاح. الحدود: ${bounds.length}، قواعد العبادات: ${rules.length}.`;
242
  }
243
  }
244