Skip to content

Commit

Permalink
ToneOZ 澳聲通字典工具整合:加入滑鼠圈選查詢功能
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyxuan committed Jun 2, 2021
1 parent d420723 commit edeb275
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions ime/tzdic/tzlib/tzdicentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ $(document).ready(function () {
window.ivsdic = null;
}
if(tzdic){
let isPrevIVSCtl = false;
for(let qIdx=0; qIdx<tzQueryArray.length; qIdx++){
let item = tzQueryArray[qIdx];
let dicSlot = null;
if(item.id){
dicSlot = ""+item.id;
}
if(item.q){
let unsortPoyinArray = [];
for(let pi = 0; pi < poyinMaxCount; pi++){
// lookup each poyin option
let posfix = "";
Expand All @@ -64,6 +64,16 @@ $(document).ready(function () {
let qarray = null;
let yinarray = null;
let noivs = removeIVS(item.q);
if(item.q && !noivs){
isPrevIVSCtl = true;
break;;
}
if(isPrevIVSCtl){
isPrevIVSCtl = false;
if(HasIvsPair(item.q)){
break;
}
}
// check is the dictionary data tzdata loaded
if(tzdic[dicSlot]){
// dictionary lookup
Expand Down Expand Up @@ -102,7 +112,7 @@ $(document).ready(function () {
.append(dDom);
}
}
}
}
}
if(qIdx >= intMaxPhrase-1){
break;
Expand Down Expand Up @@ -135,6 +145,10 @@ function removeIVS(q){
return noivs;
}

function HasIvsPair(q){
return q.match(/([\ud800-\udfff])/g);
}

function chr(uni) {
if (String.fromCodePoint) return String.fromCodePoint(uni); // ES6
if (uni <= 0xffff) return String.fromCharCode(uni);
Expand Down

0 comments on commit edeb275

Please sign in to comment.