Kos nating, yu save senisim wiset bilong websait bilong yu
Nidim tru gutpela klok long websait bilong yu? O yu nidim de bilong tude, taim bilong sankamap, taim bilong sandaun o hau longpela de bin stap? Kisim bilong ol opsen andanit na yusim kod! I stap kos nating!
Ol opsen
Tem bilong yusim
- A link bek long Time.is nidim save soim long web pes bilong yu. Yu save riraitim o transletim link tekst, tasol em nidim gat Time.is, taim, long nem bilong ples (New York), o nem bilong taimsoen (EST). Gutpela link teks: "Time in New York", "New York", "Taim nau". Nogat link teks: "Klikim hia"
- Web pes bilong yu no save rilodim otometikli.
- Yus long ap na skript i stap nogat larim.
- Widset save nogat woranti.
- Widset kostim nating, tasol kostim mani sapos bikpela fokas bilong websait bilong yu i stap dispela widset.
- Time.is bin blokim widset bilong yu sapos dispela kandisen bin nogat rait.
Bikpela yus
I stap tu widset skrip: Wanpela besik kain, t.js, tasol i soim taim, na bikpela widset skript, tpi.js, i save soim taim, de, sankamap, sandaun na hau long de stap. Bikpela widset skript i stap long plenti toktok. Long narapela toktok, senisim tpi long skript nem bilong kod bilong toktok yu yusim. (Ekasmpol: pl.js bilong Tok Polan, o tr.js bilong Tok Teki.)
Paremita bilong init fanksen:
Paremita | Wed larim | Nomal valyu |
template | TIME, DATE, SUN | TIME |
time_format | hours, minutes, seconds, 12hours, AMPM | hours:minutes:seconds |
date_format | dayname, dname, daynum, dnum, day_in_y, week, monthname, monthnum, mnum, yy, year | year-monthnum-daynum |
sun_format | srhour, srminute, sr12hour, srAMPM, sshour, ssminute, ss12hour, ssAMPM, dlhours, dlminutes | srhour:srminute-sshour:ssminute |
coords | Letitud na longtitud bilong ples. Nidim bilong soim taim bilong san na hau long de stap. | |
id | Bilong painim ples na taimsoen long seva said. Nidim sapos ples nem gat non-ASCII leta, na sapos yu senisim HTML element id. | |
callback | Nem bilong fanksen em bin kolim ol sekan, gat renderim templet long paremita. (Opsenel) |
Ol paremita nem na kiwed bin kes sensitiv. Yu save yusim HTML na narapela kontent long templet, time_format, date_format na sun_format paremita.
Plas wan klok bin mekim laik dis:
UTC time: <span id="UTC_za00"></span><br/> New York sunrise time: <span id="New_York_z161"></span><br/> Tokyo sunrise time: <span id="Tokyo_z444"></span><br/> Find the <a href="https://time.is/" id="time_is_link" rel="nofollow">current time for any location or time zone on Time.is!</a> <script src="//widget.time.is/tpi.js"></script> <script> time_is_widget.init({ UTC_za00 : {}, New_York_z161 : { template: "SUN", sun_format: "srhour:srminute", coords: "40.71427,-74.00597" }, Tokyo_z444 : { coords: "59.33258,18.06490" } }); </script>
Resalt:
Ol valyu bilong time_format, date_format, sun_format na template paremita save inheritin, na yu nogat nidim long ripitim sapos valyu i stap long bilong bipo defainim widset.