Skip to content

Commit

Permalink
fix the docs and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kariminf committed Aug 30, 2016
1 parent 4f19c8a commit 9a2fc98
Show file tree
Hide file tree
Showing 15 changed files with 270 additions and 1,738 deletions.
6 changes: 6 additions & 0 deletions docs/call.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//var path = "../dist/";
var path = "https://unpkg.com/jslingua@latest/dist/";

function addScript(name){
document.write('<script type="text/javascript" src="' + path + name + '"><\/script>');
}
28 changes: 23 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,24 @@ <h1>JsLingua</h1>
<div class="content-wrapper">
<div class="content">
<h1>Modules:</h1>

<!-- Module 1: Lang -->
<div class="pure-g">
<!-- Module 1: Info -->

<div class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-4">
<h3>
Lang module:
</h3>
<p>
This module is responsible of language information.
It affords information such as the name, family, writing direction, etc. of a language.
</p>
<p>
<a href="lang.html" class="pure-button pure-button-secondary">Test it</a>
</p>
</div>

<!-- Module 2: Lang -->

<div class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-4">
<h3>
Lang module:
Expand All @@ -63,7 +78,7 @@ <h3>
</p>
</div>

<!-- Module 2: Trans -->
<!-- Module 3: Trans -->
<div class="l-box pure-u-1 pure-u-md-1-2 pure-u-lg-1-4">
<h3 class="info-subhead">
Trans module:
Expand All @@ -76,11 +91,14 @@ <h3 class="info-subhead">
<a href="trans.html" class="pure-button pure-button-secondary">Test it</a>
</p>
</div>



</div>

<h1>Showcases:</h1>
<h1>Use Cases:</h1>

<!-- Showcase 1: Morse -->
<!-- usecase 1: Morse -->
<div class="l-box pure-u-1 pure-u-md-1-2 pure-u-lg-1-4">
<h3 class="info-subhead">
Morse code:
Expand Down
160 changes: 160 additions & 0 deletions docs/info.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Language test</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="use/pure-min.css">
<link rel="stylesheet" href="use/grids-responsive-min.css">
<link rel="stylesheet" href="use/jslingua.css">

<script type="text/javascript" src="call.js"></script>
<script type="text/javascript">
addScript("jslingua.min.js");
addScript("info.min.js");
addScript("ara.info.min.js");
addScript("jpn.info.min.js");
</script>

<script type="text/javascript">

function loading(){
var e = document.getElementById("l");

var langIDs = JsLingua.serviceLanguages("Info");
var i;
for (i = 0; i < langIDs.length; i++){
var option = document.createElement("option");
option.text = langIDs[i];
e.add(option);
}

update();

}

function setTester (){
var e = document.getElementById("l");
var langID = e.options[e.selectedIndex].text;
var LangClass = JsLingua.getService("Lang", langID);
tester = new LangClass();
cs = tester.availableCharSets();
}

function update(){
var e = document.getElementById("l");
var langID = e.options[e.selectedIndex].text;
var LangClass = JsLingua.getService("Info", langID);
var info = new LangClass();

document.getElementById("name").innerHTML = info.getName();
document.getElementById("family").innerHTML = info.getFamily();
document.getElementById("branch").innerHTML =
(info.getBranch() === "")? "None": info.getBranch();
document.getElementById("dir").innerHTML =
(info.getDir() === "rtl")? "Right to Left": "Left to Right";
document.getElementById("wo").innerHTML =
info.getWordOrder().replace("s", "Subject ").replace("o", "Object ").replace("v", "Verb ");
document.getElementById("pop").innerHTML = info.getPopulation() + " persons";
document.getElementById("loc").innerHTML = info.getLocations().join(", ");
document.getElementById("dia").innerHTML = info.getDialects(). join(", ");

}

function htmlEntities(str) {
return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}

</script>

</head>
<body>
<div class="pure-menu pure-menu-horizontal pure-menu-fixed">
<a class="pure-menu-heading" href="index.html">home</a>
</div>


<div class="content-wrapper">
<div class="content pure-g">

<div class="pure-u-1">
<fieldset class="k-fieldset">
<legend>Language</legend>
<label>Choose the language:</label>
<select id="l" class="k-select" onchange="update()">
</select>
</fieldset>
</div>

<div class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-3">
<fieldset class="k-fieldset">
<legend>Language name</legend>
<div id="name"></div>
</fieldset>
</div>

<div class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-3">
<fieldset class="k-fieldset">
<legend>Language family</legend>
<div id="family"></div>
</fieldset>
</div>

<div class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-3">
<fieldset class="k-fieldset">
<legend>Language branch</legend>
<div id="branch"></div>
</fieldset>
</div>

<div class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-3">
<fieldset class="k-fieldset">
<legend>Writing direction</legend>
<div id="dir"></div>
</fieldset>
</div>

<div class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-3">
<fieldset class="k-fieldset">
<legend>Words order</legend>
<div id="wo"></div>
</fieldset>
</div>

<div class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-3">
<fieldset class="k-fieldset">
<legend>Native speakers approx.</legend>
<div id="pop"></div>
</fieldset>
</div>

<div class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-3">
<fieldset class="k-fieldset">
<legend>Official in</legend>
<div id="loc"></div>
</fieldset>
</div>

<div class="pure-u-1 pure-u-md-1-2 pure-u-lg-1-3">
<fieldset class="k-fieldset">
<legend>Dialects</legend>
<div id="dia"></div>
</fieldset>
</div>



</div>

<div class="footer">
<div class="footer-vcenter">
Copyright 2016 Abdelkrime Aries.
</div>
</div>
</div>

<script>
loading();
</script>
</body>
</html>
62 changes: 0 additions & 62 deletions docs/js/ara.info.js

This file was deleted.

Loading

0 comments on commit 9a2fc98

Please sign in to comment.