it is really uncomfortable not being able to use such an useful feature pls add the feature
You can achieve that with a script.
I found this one in one of my templates, though you could try searching for better ones.
<div id="popup-container">
<button id="close-popup-btn" onclick="closePopup(true)">×</button>
<a id="open-wiki-btn" href="">↪</a>
<div id="tc"></div> <div id="fadebottom_v"></div>
<div id="ic"><img id="popup-image"></div>
</div>
<style>
#tc {
color: #222222;
position:absolute;
top: 16px;
margin:0px;
left:15px;
text-decoration: none;
height:320px;
overflow:hidden;
overflow-y:scroll;
white-space:pre-wrap;
width: 300px;
}
#tc p{
margin:0px;
}
#tc::-webkit-scrollbar{
display:none;
}
#fadebottom_v {
height: 30px;
width: 300px;
background: -webkit-linear-gradient(270deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 1));
z-index: 111;
position:absolute;
bottom:0px;
left:15px;
}
#hc{
color: #666;
font-weight: bold;
}
#ic {
right:0px;
top:30px;
position:absolute;
}
#ic img{
width: 160px;
height:auto;
object-fit: cover;
overflow:hidden;
}
#popup-image {
width: 140px;
height: auto;
}
#popup-container {
background: #fff;
position: absolute;
bottom:30px;
right:10px;
z-index: 110;
-webkit-box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3), 0 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.3), 0 0 1px 1px rgba(0, 0, 0, 0.05);
padding: 0;
display: none;
font-size: 17px;
line-height: 20px;
border-radius: 2px;
width: 480px;
height:340px;
overflow:hidden;
font-family: Arial;
text-align:left;
border: 1px solid #d0d0d0;
border-radius: 5px;
}
#close-popup-btn{
position:absolute;
top: 1px;
right:5px;
width: 32px;
height: 32px;
background: none;
border: 0;
cursor: pointer;
font-family: 'Josefin Sans', sans-serif;
font-size: 20px;
outline: none;
text-align:right;
z-index:112;
}
#open-wiki-btn{
position:absolute;
top: 10px;
right:30px;
width: 15px;
height: 32px;
background: none;
border: 0;
cursor: pointer;
text-decoration: none;
color:#222222;
font-family: 'Josefin Sans', sans-serif;
font-size: 17px;
outline: none;
text-align: left;
z-index:112;
}
</style>
<script>
function getSummaryFor(word) {
word = word.replace(/^[\.,\/#\!$%\^&\*;:{}=\-_`~()\'\s]+|[\.,\/#\!$%\^&\*;:{}=\-_`~()\'\s]+$/g, "");
var pc = document.getElementById("popup-container");
var hc = document.getElementById("hc");
var tc = document.getElementById("tc");
var ic = document.getElementById("ic");
var imgelem = document.getElementById("popup-image");
imgelem.src = "";
var shortsum ="";
fetch("https://en.wikipedia.org/api/rest_v1/page/summary/" + word).then(function(response) {return response.json();}).then(function(response) {
shortsum = response.description;
shortsum = shortsum.replace(/(Disambiguation.*)/g, "Disambiguation");
tc.innerHTML = "<span id='hc'>" +capfl(shortsum) + "</span>" +"\n" +response.extract_html + "\n";
tc.style.width = "420px";
if (response.extract_html && !response.extract.endsWith("to:")){
pc.style.display = "block";
document.getElementById("open-wiki-btn").href = response.content_urls.desktop.page;
}else{pc.style.display = "none";}
if (!response.thumbnail.source || response.type ==="disambiguation"){
tc.style.width = "420px";
}else{tc.style.width="300px";imgelem.src = response.thumbnail.source;}
}).catch(function(error) {console.log(error);});}
function closePopup(deselectAlso=false){
pcc.style.display = 'none';
if (deselectAlso){clearSelection();}
}
var pcc = document.getElementById("popup-container");
var prevSel = "";
document.addEventListener('click', function() {
var currentSelection = getSelectionText();
if (currentSelection !==""){prevSel = currentSelection;}
if (currentSelection && !mustClickW ){
getSummaryFor(currentSelection);
}else{closePopup();}
});
document.addEventListener('keyup', function(e) {
if(e.key =="w"){
if(pcc.style.display ==="block"){closePopup();}else{getSummaryFor(prevSel);}
}
});
function getSelectionText() {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") { text = document.selection.createRange().text;}
return text;
}
function capfl(s) {
return s.charAt(0).toUpperCase() + s.slice(1);
}
function clearSelection(){
if (window.getSelection) {window.getSelection().removeAllRanges();}
else if (document.selection) {document.selection.empty();}
}
//CUSTOMIZATION
//this is a variable controlling whether user must click the "w" key to open the popup.
//if set to true: user must select text, then click the "w" key to open wikipedia popup. Clicking "w" key again will close the popup.
//if set to false: user only needs to select text. popup will open automatically. Clicking "w" is an alternative but not obligatory way of opening/closing the popup in this mode.
//BELOW SET to true or to false.
var mustClickW = true;
//END CUSTOMIZATION
</script>
Add it all at the end of the back template of your note type.
1 Like
it is interesting but I am suggesting a native app change though it is imposible, but I just want to express it jajajajaja
-------- Melchor Lázaro
The tools Anki is built on don’t currently support the Mac lookup feature, sorry.
Okey I want to ask a feature request
-------- Melchor Lázaro