dzayerJs is a Javascript front-end library for algeria cities , Build . search , calculate ...
<script type="text/javascript" src="path/to/dzayerjs.js"></script>
example
var setif = dzayer.wilaya(19);
console.log(setif.name);
var bejaia = dzayer.wilaya('bejaia');
console.log(bejaia.id);
console.log(bejaia.name);
example
var eulma = dzayer.commune('el eulma') ,
w = eulma.origin();
console.log(w.name); // return Sétif
var wilayaName =dzayer.commune('frenda').origin().name;
console.log(wilayaName); // return Tiaret
Instant Search
example
$('example').input(function(){
var val = $(this).val();
var results = dzayer.search(val); // rertun Object
});
example/* HTML*/ <select id="example3" > </select>
dzayer.build('#example3');
example 4/*HTML*/ <select id="example4" class="form-control" name=""></select> <select id="communes" class="form-control" name=""></select>
/*JavaScript*/ dzayer.build('#example4',{ showNumbers :true, select : 'tizi', // or 'tizi ouezzo' or 15 communes : '#communes', });
var annaba = dzayer.wilaya(23) ;
var tlemcen = dzayer.wilaya('tlemcen') ;
var distance = dzayer.distance(annaba , tlemcen); // 847 km
dzayer.distance(dzayer.wilaya(19) , dzayer.wilaya(25) , 'm'); // 107779.3877095163 metres
examples
// example 1
var w1 = dzayer.wilaya(16) ;
var w2 = dzayer.closest(w1);
console.log(w2.name); //return Blida
// example 2
var w = dzayer.commune('ferdjioua').origin() ;
var closest =dzayer.closest(w);
console.log(closest.name); //return Constantine
examples
// example 1
var w1 = dzayer.wilaya(11) ; // tamanrasset
var w2 = dzayer.furthest(w1);
console.log(w2.name); //return Annaba
// example 2
var w = dzayer.commune('adrar').origin() ;
var furthest =dzayer.furthest(w);
console.log(furthest.name); //return El Taref