Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
fix #182, context menu action cant get link's url
Browse files Browse the repository at this point in the history
  • Loading branch information
zimocode committed Jan 23, 2022
1 parent c284325 commit b9c66d6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
7 changes: 4 additions & 3 deletions change.log
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"log": [
{
"ver":"7.0.146.1135",
"ver":"7.0.146.1136",
"date":"2022.01.23",
"content":[
"new action: Reopen in Incognito Window",
"fix bugs: #190, #191, #183",
"action zoom: add new options, Reset default zoom factor as(%) and set the factor when page loaded or reloaded as default one"
"action zoom: add new options, Reset default zoom factor as(%) and set the factor when page loaded or reloaded as default one",
"fix bugs: #190, #191, #183, #182",
"fix bugs: context menu action cant get link's url"
]
},
{
Expand Down
27 changes: 26 additions & 1 deletion js/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ var sue={
if(sue.inDrg&&config.drg.settings.clickcancel){console.log("cancel");sue.break=true;sue.stopMges(e);}
break;
case"keydown":
console.log(e.keyCode);
// console.log(e.keyCode);
if(!editMode&&config.general.fnswitch.fnksa){
sue.ksa.action(e);
}
Expand Down Expand Up @@ -251,6 +251,13 @@ var sue={
e.preventDefault();
sue.cons.switchtab.contextmenu=false;
}
// fix context menu selected elements
sue.selEle={};
sue.selEle.txt=window.getSelection().toString();
sue.selEle.lnk=document.activeElement.href;
sue.selEle.img=document.activeElement.src;
sue.selEle.str=document.activeElement.text;
sue.startEle=e.target;

break;
case"mousemove":
Expand Down Expand Up @@ -400,6 +407,12 @@ var sue={

sue.selEle={};
sue.selEle.txt=window.getSelection().toString();
// fix firefox get selection frome textbox
if(browserType=="fx"){
if(e.target.tagName.toLowerCase=="textarea"||(e.target.tagName.toLowerCase=="input"&&e.target.type=="text")){
sue.selEle.txt=e.target.value.substring(e.target.selectionStart,e.target.selectionEnd);
}
}
sue.selEle.lnk=e.href||e.target.href;
sue.selEle.img=sue.selEle.img?sue.selEle.img:e.target.src;
sue.selEle.str=e.target.innerText;
Expand Down Expand Up @@ -544,6 +557,12 @@ var sue={

//sue.selEle={};
sue.selEle.txt=window.getSelection().toString();
// fix firefox get selection frome textbox
if(browserType=="fx"){
if(e.target.tagName.toLowerCase()=="textarea"||(e.target.tagName.toLowerCase()=="input"&&e.target.type.toLowerCase()=="text")){
sue.selEle.txt=e.target.value.substring(e.target.selectionStart,e.target.selectionEnd);
}
}
sue.selEle.lnk=e.href||e.target.href;
sue.selEle.img=sue.selEle.img?sue.selEle.img:e.target.src;
sue.selEle.str=e.target.innerText;
Expand Down Expand Up @@ -967,6 +986,12 @@ chrome.runtime.onMessage.addListener(function(message,sender,sendResponse) {
if(message.type=="icon"||message.type=="pop"){//icon action
sue.selEle={};
sue.selEle.txt=window.getSelection().toString();
// fix firefox get selection frome textbox
if(browserType=="fx"){
if(e.target.tagName.toLowerCase=="textarea"||(e.target.tagName.toLowerCase=="input"&&e.target.type=="text")){
sue.selEle.txt=e.target.value.substring(e.target.selectionStart,e.target.selectionEnd);
}
}
console.log(sue.selEle)
sendResponse({type:"action_"+message.type,selEle:sue.selEle});
}
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"minimum_chrome_version": "22",
"name": "smartUp Gestures(Beta)",
"short_name":"smartUp",
"version": "7.0.146.1135",
"version": "7.0.146.1136",
"description": "__MSG_ext_des__",
"default_locale": "en",
"author":"zimo",
Expand Down

0 comments on commit b9c66d6

Please sign in to comment.