Skip to content

Commit

Permalink
fix bug of mouse gesture
Browse files Browse the repository at this point in the history
  • Loading branch information
woolition committed Jan 6, 2018
1 parent d7586a8 commit 8e0f2fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions mouseGesture/HY-MouseGesture.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
Fn = {
userDefine: function(argumentArr, data){
try {
new Function("mpArray", "mpData", decodeURI(argumentArr[0]))(data);
new Function("mpArray", "mpData", mpUnescape(argumentArr[0]))(data);
} catch(e) {
console.log(e);
}
Expand Down Expand Up @@ -653,6 +653,15 @@
return ['text', cfg.text[data.gesture]];
}

function mpEscape(str){
if(!str) return;
return str.replace(/"/g, """).replace(/'/g, "'");
}
function mpUnescape(str){
if(!str) return;
return str.replace(/"/g,'"').replace(/'/g, "'");
}

//========③Hinter====================
const Hinter = (function(){
let modul = {};
Expand Down Expand Up @@ -1645,7 +1654,7 @@
rand = Math.floor(Math.random()*1000);
switch (agrDetail[i].slice(0,5)) {
case 'texta':
html += `<span><textarea>${decodeURI(argValue[i])}</textarea><i></i></span>`;
html += `<span><textarea>${mpUnescape(argValue[i])}</textarea><i></i></span>`;
break;
case 'input':
html += '<span><input type="text"><i></i></span>';
Expand Down Expand Up @@ -1746,7 +1755,7 @@
console.log(item.firstElementChild.nodeName);
console.log('updateItem..');
if(item.firstElementChild.nodeName === "TEXTAREA")
argValue.push(encodeURI(item.firstElementChild.value));
argValue.push(mpEscape(item.firstElementChild.value));
else
argValue.push(item.firstElementChild.value);
} else{
Expand Down
2 changes: 1 addition & 1 deletion mouseGesture/userDefine functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/*img{position:absolute;left:0!important;top:0!important;}*/
#mousePosition{color:red!important;position:absolute!important;text-shadow:1px 0 1px cyan!important;}
#verticalLine{width:0!important;border-left:1px solid red!important;line-height:100!important;position:fixed!important;}
#horizontalLine{width:100%!important;border-top:1px solid red!important;position:fixed!important;}
#horizontalLine{width:100%!important;border-top:1px solid red!important;position:absolute!important;}
`;

document.body.appendChild(sty);
Expand Down

0 comments on commit 8e0f2fe

Please sign in to comment.