Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.

Commit 9a80316

Browse files
committed
Adding more languages and JS logic
* More languages to support other search and added logic. * TODO: Need to fix a bug to check JSON key before doing and operation. Signed-off-by: Alangi Derick <alangiderick@gmail.com>
1 parent f03cc29 commit 9a80316

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
<option value="de">German</option>
5151
<option value="pl">Polish</option>
5252
<option value="he">Hebrew</option>
53-
<option value="un">Unknown</option>
54-
<option value="un">Unknown</option>
55-
<option value="un">Unknown</option>
56-
<option value="un">Unknown</option>
53+
<option value="io">Ido</option>
54+
<option value="pt">Portugese</option>
55+
<option value="it">Italian</option>
56+
<option value="tw">Twi</option>
5757
</select>
5858
</div>
5959
<div class="form-group col-lg-12">
@@ -73,7 +73,7 @@ <h1 align="center" id="title"> Article name </h1>
7373
</div>
7474
</div>
7575
</div>
76-
76+
7777
<script src="https://code.jquery.com/jquery-1.12.4.js" integrity="sha256-Qw82+bXyGq6MydymqBxNPYTaUXXq7c8v3CwiYwLLNXU=" crossorigin="anonymous"></script>
7878
<script type="text/javascript" src="script.js"></script>
7979
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>

script.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ $(document).ready(function () {
1515
url: url,
1616
dataType: 'jsonp',
1717
success: function(data) {
18-
console.log(data);
19-
if(data.hasOwnProperty('parse.title')){
18+
if(data.parse.title != undefined){
2019
//Hide default title placeholder and show title after search
2120
$('#title').hide();
2221
document.getElementById('title').innerHTML = data.parse.title;
@@ -26,7 +25,7 @@ $(document).ready(function () {
2625
$('#content').hide();
2726
document.getElementById('content').innerHTML = data.parse.text['*'];
2827
$('#content').show();
29-
} else if(data.hasOwnProperty('error')) {
28+
} else if(data.error != undefined) {
3029
$('#title').hide();
3130
document.getElementById('title').innerHTML = "Error Occured :(";
3231
$('#title').show();

0 commit comments

Comments
 (0)