Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
soko
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bitsoko services
soko
Commits
1b740bfd
Commit
1b740bfd
authored
Dec 05, 2018
by
gaseema.n
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autocomplete images added
parent
6afe19d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
61 deletions
+69
-61
bitsoko.js
js/bitsoko.js
+69
-61
No files found.
js/bitsoko.js
View file @
1b740bfd
...
...
@@ -732,7 +732,10 @@ function userNamesInput() {
for
(
var
iii
in
e
.
users
)
{
var
nm
=
e
.
users
[
iii
].
name
;
var
icn
=
e
.
users
[
iii
].
icon
;
deliveryGuysNames
.
push
(
nm
)
deliveryGuysNames
.
push
({
name
:
nm
,
pic
:
icn
})
//var id = e.users[iii].id;
dat
[
nm
]
=
icn
;
...
...
@@ -744,69 +747,74 @@ function userNamesInput() {
}
function
autocomplete
(
inp
,
arr
)
{
var
currentFocus
;
inp
.
addEventListener
(
"input"
,
function
(
e
)
{
var
a
,
b
,
i
,
val
=
this
.
value
;
closeAllLists
();
if
(
!
val
)
{
return
false
;}
currentFocus
=
-
1
;
a
=
document
.
createElement
(
"DIV"
);
a
.
setAttribute
(
"id"
,
this
.
id
+
"autocomplete-list"
);
a
.
setAttribute
(
"class"
,
"autocomplete-items"
);
this
.
parentNode
.
appendChild
(
a
);
for
(
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
].
substr
(
0
,
val
.
length
).
toUpperCase
()
==
val
.
toUpperCase
())
{
b
=
document
.
createElement
(
"DIV"
);
b
.
innerHTML
=
"<strong>"
+
arr
[
i
].
substr
(
0
,
val
.
length
)
+
"</strong>"
;
b
.
innerHTML
+=
arr
[
i
].
substr
(
val
.
length
);
b
.
innerHTML
+=
"<input type='hidden' value='"
+
arr
[
i
]
+
"'>"
;
b
.
addEventListener
(
"click"
,
function
(
e
)
{
inp
.
value
=
this
.
getElementsByTagName
(
"input"
)[
0
].
value
;
closeAllLists
();
});
a
.
appendChild
(
b
);
var
currentFocus
;
inp
.
addEventListener
(
"input"
,
function
(
e
)
{
var
a
,
b
,
i
,
val
=
this
.
value
;
closeAllLists
();
if
(
!
val
)
{
return
false
;
}
}
});
inp
.
addEventListener
(
"keydown"
,
function
(
e
)
{
var
x
=
document
.
getElementById
(
this
.
id
+
"autocomplete-list"
);
if
(
x
)
x
=
x
.
getElementsByTagName
(
"div"
);
if
(
e
.
keyCode
==
40
)
{
currentFocus
++
;
addActive
(
x
);
}
else
if
(
e
.
keyCode
==
38
)
{
currentFocus
--
;
addActive
(
x
);
}
else
if
(
e
.
keyCode
==
13
)
{
e
.
preventDefault
();
if
(
currentFocus
>
-
1
)
{
if
(
x
)
x
[
currentFocus
].
click
();
currentFocus
=
-
1
;
a
=
document
.
createElement
(
"DIV"
);
a
.
setAttribute
(
"id"
,
this
.
id
+
"autocomplete-list"
);
a
.
setAttribute
(
"class"
,
"autocomplete-items"
);
this
.
parentNode
.
appendChild
(
a
);
for
(
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
if
(
arr
[
i
].
name
.
substr
(
0
,
val
.
length
).
toUpperCase
()
==
val
.
toUpperCase
())
{
b
=
document
.
createElement
(
"DIV"
);
b
.
innerHTML
=
"<strong>"
+
arr
[
i
].
name
.
substr
(
0
,
val
.
length
)
+
"</strong>"
;
b
.
innerHTML
+=
arr
[
i
].
name
.
substr
(
val
.
length
);
b
.
innerHTML
+=
"<input type='hidden' value='"
+
arr
[
i
].
name
+
"'><img src='"
+
arr
[
i
].
pic
+
"' style='width: 30px; height: 30px; float: right; margin-top: -3px; border-radius: 50%;'/>"
;
b
.
addEventListener
(
"click"
,
function
(
e
)
{
inp
.
value
=
this
.
getElementsByTagName
(
"input"
)[
0
].
value
;
closeAllLists
();
});
a
.
appendChild
(
b
);
}
}
}
});
function
addActive
(
x
)
{
if
(
!
x
)
return
false
;
removeActive
(
x
);
if
(
currentFocus
>=
x
.
length
)
currentFocus
=
0
;
if
(
currentFocus
<
0
)
currentFocus
=
(
x
.
length
-
1
);
x
[
currentFocus
].
classList
.
add
(
"autocomplete-active"
);
}
function
removeActive
(
x
)
{
for
(
var
i
=
0
;
i
<
x
.
length
;
i
++
)
{
x
[
i
].
classList
.
remove
(
"autocomplete-active"
);
});
inp
.
addEventListener
(
"keydown"
,
function
(
e
)
{
var
x
=
document
.
getElementById
(
this
.
id
+
"autocomplete-list"
);
if
(
x
)
x
=
x
.
getElementsByTagName
(
"div"
);
if
(
e
.
keyCode
==
40
)
{
currentFocus
++
;
addActive
(
x
);
}
else
if
(
e
.
keyCode
==
38
)
{
currentFocus
--
;
addActive
(
x
);
}
else
if
(
e
.
keyCode
==
13
)
{
e
.
preventDefault
();
if
(
currentFocus
>
-
1
)
{
if
(
x
)
x
[
currentFocus
].
click
();
}
}
});
function
addActive
(
x
)
{
if
(
!
x
)
return
false
;
removeActive
(
x
);
if
(
currentFocus
>=
x
.
length
)
currentFocus
=
0
;
if
(
currentFocus
<
0
)
currentFocus
=
(
x
.
length
-
1
);
x
[
currentFocus
].
classList
.
add
(
"autocomplete-active"
);
}
}
function
closeAllLists
(
elmnt
)
{
var
x
=
document
.
getElementsByClassName
(
"autocomplete-items"
);
for
(
var
i
=
0
;
i
<
x
.
length
;
i
++
)
{
if
(
elmnt
!=
x
[
i
]
&&
elmnt
!=
inp
)
{
x
[
i
].
parentNode
.
removeChild
(
x
[
i
]);
}
function
removeActive
(
x
)
{
for
(
var
i
=
0
;
i
<
x
.
length
;
i
++
)
{
x
[
i
].
classList
.
remove
(
"autocomplete-active"
);
}
}
}
document
.
addEventListener
(
"click"
,
function
(
e
)
{
closeAllLists
(
e
.
target
);
});
function
closeAllLists
(
elmnt
)
{
var
x
=
document
.
getElementsByClassName
(
"autocomplete-items"
);
for
(
var
i
=
0
;
i
<
x
.
length
;
i
++
)
{
if
(
elmnt
!=
x
[
i
]
&&
elmnt
!=
inp
)
{
x
[
i
].
parentNode
.
removeChild
(
x
[
i
]);
}
}
}
document
.
addEventListener
(
"click"
,
function
(
e
)
{
closeAllLists
(
e
.
target
);
});
}
function
persistentFunc
()
{
...
...
@@ -894,7 +902,7 @@ function insufficientOrder() {
if
(
e
.
status
==
"ok"
)
{
$
(
"#insufficientOrderStatus"
).
html
(
'Transaction code confirmed successfully'
);
$
(
"#insufficientOrderStatus"
).
css
(
"color"
,
"green"
);
$
(
"#buyStoreTokens"
).
modal
(
"close"
);
$
(
"#buyStoreTokens"
).
modal
(
"close"
);
}
else
{
$
(
"#insufficientOrderStatus"
).
html
(
'Error! Enter transaction code again.'
);
$
(
"#insufficientOrderStatus"
).
css
(
"color"
,
"red"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment