In English
Kasutamisjuhend.
HTMLi <head>
tagi sisse tuleb lisada järgmised read:
Kui käesolev leht on https'i kaudu saadaval, siis
<script type="text/javascript" src="https://itella.ee/widget/smartpost-terminals.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="https://itella.ee/widget/smartpost-terminals.css"/>
HTMLi body sisse, transportivaliku vormi alla - järgmine javascript:
<script type="text/javascript">
var smartLocation = new SmartLocation(
{
target_id: "target_id", // widget konteineri id (vaikimisi - "smartpost_widget_target")
// see konteiner peab kindlasti asuma vormis, mida hakatakse saatma
placeid_name: "sp_id", // pakkiautomati asukoha id sisaldava
// selecti nimi (selle asukoha id postitakse koos vormiga),
// vaikimisi - "smartpost_terminal_id"
placename_name: "sp_name", // pakkiautomati asukoha nimi sisaldava
// selecti nimi (postitakse koos vormiga),
// vaikimsi - "smartpost_terminal_name"
selected_id: 136, // kui seadistatud, valitakse vastava pakiautomaati
default_id: 0, // "Vali pakiautomaat" välja ID (Vaikimisi "-")
show_infotext: true, // kas näidata infoteksti
show_logo: true, // kas näidata logot
show_city: true, // kas näidata linna
show_address: true, // kas näidata asutuse aadressi
show_opened: true, // kas näidata millal on asutus avatud
show_description: false, // kas näidata kirjedust
show_default: false, // kas näidata vaikevalikut
//text_infotext: "Siia tuleb infotekst", //infoteksti väärtus (vaikimisi - kijeldus
//pakiautomaati asukohtade linkidega
text_place: "Asukoht", //asukoha label (vaikimisi - "Pakiautomaadi asukoht:")
text_city: "Linn", //linna label (vaikimisi - "Pakiautomaadi aadress:")
text_address: "Aadress", //aadressi label (vaikimisi - "Pakiautomaadi linn:")
text_opened: "Avatud", //avatud label (vaikimisi - "Pakiautomaadi lahtiolekuaeg:")
text_description: "Kirjeldus", //kirjelduse label (vaikimisi - "Kirjeldus:")
text_default_item:"- Vali PA -" //vaikevaliku tekst (vaikimisi - "- Vali PA -")
}
);
</script>
Ülevalolev kood tekitab sellise widget'i
Minimaalne variant
<script type="text/javascript">
var smartLocation = new SmartLocation(
{
target_id: "target_id2",
placeid_name: "sp_id2",
placename_name: "sp_name2",
show_infotext: false,
show_logo: false,
show_city: false,
show_address: false,
show_opened: false,
show_description: false,
show_default: true,
text_place: "Pakiautomaat",
text_default_item: "-- Vali Pakiautomaat --"
}
);
</script>
Usage
The following content should be added to HTML <head>
:
If the webpage is accessed through https
<script type="text/javascript" src="https://itella.ee/widget/smartpost-terminals.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="https://itella.ee/widget/smartpost-terminals.css"/>
Following javascript should be added in the body below transport choice form:
(Note: default values are in estonian language)
<script type="text/javascript">
var smartLocation = new SmartLocation(
{
target_id: "target_id", // widget container id (default - "smartpost_widget_target")
// this container must be in the form to be sent
placeid_name: "sp_id", // the name of select element which contains
// parcel terminal id value (POSTed with the form),
// default - "smartpost_terminal_id"
placename_name: "sp_name", // the name of select element which contains
// parcel terminal name value (POSTed with the form),
// default - "smartpost_terminal_name"
selected_id: 136, // if set, corresponding parcel terminal will be selected
default_id: 0, // Default ID (default - "-")
show_infotext: true, // whether to show infotext
show_logo: true, // whether to show logo
show_city: true, // whether to show city
show_address: true, // whether to show address
show_opened: true, // whether to show opened time
show_description: false, // whether to show description
show_default: false, // whether to show default "unselected" selection
//text_infotext: "Siia tuleb infotekst", // infotext value (default - simple decription with
// links to parcel terminal locations
text_place: "Asukoht", // place label (default - "Pakiautomaadi asukoht:")
text_city: "Linn", // city label (default - "Pakiautomaadi aadress:")
text_address: "Aadress", // address label (default - "Pakiautomaadi linn:")
text_opened: "Avatud", // opened label (default - "Pakiautomaadi lahtiolekuaeg:")
text_description: "Kirjeldus", // description label (default - "Kirjeldus:")
text_default_item:"- Vali PA -" // "unselected" item title (default - "- Vali PA -")
}
);
</script>
Abovementioned code creates the following widget
Minimal variant
<script type="text/javascript">
var smartLocation = new SmartLocation(
{
target_id: "target_id2",
placeid_name: "sp_id2",
placename_name: "sp_name2",
show_infotext: false,
show_logo: false,
show_city: false,
show_address: false,
show_opened: false,
show_description: false,
show_default: true,
text_place: "Pakiautomaat",
text_default_item: "-- Vali Pakiautomaat --"
}
);
</script>