mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
ios/iphone: autoreplace smart-quotes with sane quotes,
as the iphone keyboard is not able to produce ' or "
This commit is contained in:
parent
0a0364e9f8
commit
1c0d978979
|
@ -4962,7 +4962,7 @@ document.onkeydown = function (e) {
|
||||||
search_in_progress = 0;
|
search_in_progress = 0;
|
||||||
|
|
||||||
function ev_search_input() {
|
function ev_search_input() {
|
||||||
var v = this.value,
|
var v = unsmart(this.value),
|
||||||
id = this.getAttribute('id');
|
id = this.getAttribute('id');
|
||||||
|
|
||||||
if (id.slice(-1) == 'v') {
|
if (id.slice(-1) == 'v') {
|
||||||
|
@ -4999,7 +4999,7 @@ document.onkeydown = function (e) {
|
||||||
if (search_in_progress)
|
if (search_in_progress)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var q = ebi('q_raw').value,
|
var q = unsmart(ebi('q_raw').value),
|
||||||
vq = ebi('files').getAttribute('q_raw');
|
vq = ebi('files').getAttribute('q_raw');
|
||||||
|
|
||||||
srch_msg(false, (q == vq) ? '' : L.sm_prev + (vq ? vq : '(*)'));
|
srch_msg(false, (q == vq) ? '' : L.sm_prev + (vq ? vq : '(*)'));
|
||||||
|
@ -5011,7 +5011,7 @@ document.onkeydown = function (e) {
|
||||||
for (var b = 1; b < sconf[a].length; b++) {
|
for (var b = 1; b < sconf[a].length; b++) {
|
||||||
var k = sconf[a][b][0],
|
var k = sconf[a][b][0],
|
||||||
chk = 'srch_' + k + 'c',
|
chk = 'srch_' + k + 'c',
|
||||||
vs = ebi('srch_' + k + 'v').value,
|
vs = unsmart(ebi('srch_' + k + 'v').value),
|
||||||
tvs = [];
|
tvs = [];
|
||||||
|
|
||||||
if (a == 1)
|
if (a == 1)
|
||||||
|
@ -5104,7 +5104,7 @@ document.onkeydown = function (e) {
|
||||||
xhr.setRequestHeader('Content-Type', 'text/plain');
|
xhr.setRequestHeader('Content-Type', 'text/plain');
|
||||||
xhr.onload = xhr.onerror = xhr_search_results;
|
xhr.onload = xhr.onerror = xhr_search_results;
|
||||||
xhr.ts = Date.now();
|
xhr.ts = Date.now();
|
||||||
xhr.q_raw = ebi('q_raw').value;
|
xhr.q_raw = unsmart(ebi('q_raw').value);
|
||||||
xhr.send(JSON.stringify({ "q": xhr.q_raw, "n": cap }));
|
xhr.send(JSON.stringify({ "q": xhr.q_raw, "n": cap }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -369,6 +369,15 @@ function import_js(url, cb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function unsmart(txt) {
|
||||||
|
return !IPHONE ? txt : (txt.
|
||||||
|
replace(/[\u2014]/g, "--").
|
||||||
|
replace(/[\u2022]/g, "*").
|
||||||
|
replace(/[\u2018\u2019]/g, "'").
|
||||||
|
replace(/[\u201c\u201d]/g, '"'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var crctab = (function () {
|
var crctab = (function () {
|
||||||
var c, tab = [];
|
var c, tab = [];
|
||||||
for (var n = 0; n < 256; n++) {
|
for (var n = 0; n < 256; n++) {
|
||||||
|
@ -1654,6 +1663,8 @@ function repl(e) {
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
return toast.inf(3, 'eval aborted');
|
return toast.inf(3, 'eval aborted');
|
||||||
|
|
||||||
|
cmd = unsmart(cmd);
|
||||||
|
|
||||||
if (cmd.startsWith(',')) {
|
if (cmd.startsWith(',')) {
|
||||||
evalex_fatal = true;
|
evalex_fatal = true;
|
||||||
return modal.alert(esc(eval(cmd.slice(1)) + ''));
|
return modal.alert(esc(eval(cmd.slice(1)) + ''));
|
||||||
|
|
Loading…
Reference in a new issue