autocomplete, continued
This commit is contained in:
parent
2f233c28e4
commit
8f18c726b6
6 changed files with 21 additions and 3 deletions
|
@ -4,6 +4,10 @@ body.OxThemeClassic {
|
||||||
.OxThemeClassic div {
|
.OxThemeClassic div {
|
||||||
color: rgb(16, 16, 16);
|
color: rgb(16, 16, 16);
|
||||||
}
|
}
|
||||||
|
.OxThemeClassic .OxHighlight {
|
||||||
|
background: rgb(255, 255, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
|
@ -20,6 +20,7 @@ div, input {
|
||||||
td {
|
td {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================================================================================
|
================================================================================
|
||||||
Core
|
Core
|
||||||
|
|
|
@ -4,6 +4,10 @@ body.OxThemeModern {
|
||||||
.OxThemeModern div {
|
.OxThemeModern div {
|
||||||
color: rgb(240, 240, 240);
|
color: rgb(240, 240, 240);
|
||||||
}
|
}
|
||||||
|
.OxThemeModern .OxHighlight {
|
||||||
|
background: rgb(255, 255, 0);
|
||||||
|
color: rgb(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
|
@ -1360,6 +1360,14 @@ Ox.startsWith = function(str, sub) {
|
||||||
return str.substr(0, sub.length) === sub;
|
return str.substr(0, sub.length) === sub;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Ox.stripTags = function(str) {
|
||||||
|
/*
|
||||||
|
>>> Ox.stripTags("f<span>o</span>o")
|
||||||
|
foo
|
||||||
|
*/
|
||||||
|
return str.replace(/(<.*?>)/gi, "");
|
||||||
|
};
|
||||||
|
|
||||||
Ox.toCamelCase = function(str) {
|
Ox.toCamelCase = function(str) {
|
||||||
/*
|
/*
|
||||||
>>> Ox.toCamelCase("foo-bar-baz")
|
>>> Ox.toCamelCase("foo-bar-baz")
|
||||||
|
|
|
@ -1629,7 +1629,7 @@ requires
|
||||||
}
|
}
|
||||||
function onClick(event, data) {
|
function onClick(event, data) {
|
||||||
Ox.print("onClick", data)
|
Ox.print("onClick", data)
|
||||||
that.focus().val(data.title);
|
that.focus().val(Ox.stripTags(data.title));
|
||||||
self.menu.hideMenu();
|
self.menu.hideMenu();
|
||||||
}
|
}
|
||||||
function selection() {
|
function selection() {
|
||||||
|
|
|
@ -330,7 +330,8 @@
|
||||||
id: "state",
|
id: "state",
|
||||||
autocomplete: function(value, callback) {
|
autocomplete: function(value, callback) {
|
||||||
value = value.toLowerCase();
|
value = value.toLowerCase();
|
||||||
var items = [];
|
var items = [],
|
||||||
|
regexp = new RegExp("(" + value + ")", "ig"),
|
||||||
states = [
|
states = [
|
||||||
"Alabama", "Alaska", "Arizona", "Arkansas", "California",
|
"Alabama", "Alaska", "Arizona", "Arkansas", "California",
|
||||||
"Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida",
|
"Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida",
|
||||||
|
@ -349,7 +350,7 @@
|
||||||
} else {
|
} else {
|
||||||
$.each(states, function(i, state) {
|
$.each(states, function(i, state) {
|
||||||
if (state.toLowerCase().indexOf(value) > -1) {
|
if (state.toLowerCase().indexOf(value) > -1) {
|
||||||
items.push(state);
|
items.push(state.replace(regexp, "<span class=\"OxHighlight\">$1</span>"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue