fixed rel tag js
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
// 8. | abc def -> abc -- not supported by this code but a pretty rare case
|
// 8. | abc def -> abc -- not supported by this code but a pretty rare case
|
||||||
|
|
||||||
var $field = $("#upload_tag_string,#post_tag_string");
|
var $field = $("#upload_tag_string,#post_tag_string");
|
||||||
var string = $field.val();
|
var string = $field.val().trim();
|
||||||
var n = string.length;
|
var n = string.length;
|
||||||
var a = $field.get(0).selectionStart;
|
var a = $field.get(0).selectionStart;
|
||||||
var b = $field.get(0).selectionStart;
|
var b = $field.get(0).selectionStart;
|
||||||
@@ -46,27 +46,24 @@
|
|||||||
|
|
||||||
while ((b < n) && (string[b] !== " ")) {
|
while ((b < n) && (string[b] !== " ")) {
|
||||||
b++;
|
b++;
|
||||||
console.log("1. a=%s b=%s", a, b);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while ((a > 0) && ((string[a] === " ") || (string[a] === undefined))) {
|
while ((a > 0) && ((string[a] === " ") || (string[a] === undefined))) {
|
||||||
a--;
|
a--;
|
||||||
b--;
|
b--;
|
||||||
console.log("2. a=%s b=%s", a, b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((a > 0) && (string[a - 1] !== " ")) {
|
while ((a > 0) && (string[a - 1] !== " ")) {
|
||||||
a--;
|
a--;
|
||||||
b--;
|
b--;
|
||||||
console.log("3. a=%s b=%s", a, b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((b < (n - 1)) && (string[b] !== " ")) {
|
while ((b < (n - 1)) && (string[b] !== " ")) {
|
||||||
b++;
|
b++;
|
||||||
console.log("4. a=%s b=%s", a, b);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b++;
|
||||||
return string.slice(a, b);
|
return string.slice(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user