mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
Merge branch 'staged' into dev
This commit is contained in:
commit
786fafded2
|
@ -1076,7 +1076,7 @@ void ArticleView::linkClicked( QUrl const & url_ )
|
|||
|
||||
if ( !popupView &&
|
||||
( ui.definition->isMidButtonPressed() ||
|
||||
( kmod & ( Qt::ControlModifier | Qt::ShiftModifier ) ) ) )
|
||||
( kmod & ( Qt::ControlModifier | Qt::ShiftModifier ) ) ) && !isAudioLink(url) )
|
||||
{
|
||||
// Mid button or Control/Shift is currently pressed - open the link in new tab
|
||||
ui.definition->resetMidButtonPressed();
|
||||
|
@ -1732,7 +1732,7 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
|||
followLink = new QAction( tr( "&Open Link" ), &menu );
|
||||
menu.addAction( followLink );
|
||||
|
||||
if ( !popupView )
|
||||
if( !popupView && !isAudioLink( targetUrl ) )
|
||||
{
|
||||
followLinkNewTab = new QAction( QIcon( ":/icons/addtab.svg" ),
|
||||
tr( "Open Link in New &Tab" ), &menu );
|
||||
|
@ -1764,8 +1764,7 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
|||
}
|
||||
}
|
||||
|
||||
if( !popupView && ( targetUrl.scheme() == "gdau"
|
||||
|| Dictionary::WebMultimediaDownload::isAudioUrl( targetUrl ) ) )
|
||||
if( !popupView && isAudioLink( targetUrl ) )
|
||||
{
|
||||
saveSoundAction = new QAction( tr( "Save s&ound..." ), &menu );
|
||||
menu.addAction( saveSoundAction );
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <QtCore5Compat/QRegExp>
|
||||
#endif
|
||||
#include "ankiconnector.h"
|
||||
#include "webmultimediadownload.hh"
|
||||
|
||||
class ResourceToSaveHandler;
|
||||
class ArticleViewAgent ;
|
||||
|
@ -324,6 +325,11 @@ private slots:
|
|||
void linkHovered( const QString & link);
|
||||
void contextMenuRequested( QPoint const & );
|
||||
|
||||
bool isAudioLink( QUrl & targetUrl )
|
||||
{
|
||||
return ( targetUrl.scheme() == "gdau" || Dictionary::WebMultimediaDownload::isAudioUrl( targetUrl ) );
|
||||
}
|
||||
|
||||
void resourceDownloadFinished();
|
||||
|
||||
/// We handle pasting by attempting to define the word in clipboard.
|
||||
|
|
|
@ -69,7 +69,9 @@ CONFIG += exceptions \
|
|||
stl \
|
||||
c++17 \
|
||||
lrelease \
|
||||
embed_translations
|
||||
embed_translations \
|
||||
utf8_source \
|
||||
force_debug_info
|
||||
|
||||
mac {
|
||||
DEBUG:CONFIG += app_bundle
|
||||
|
@ -80,15 +82,10 @@ OBJECTS_DIR = build
|
|||
UI_DIR = build
|
||||
MOC_DIR = build
|
||||
#RCC_DIR = build
|
||||
LIBS += \
|
||||
-lz \
|
||||
LIBS += -lz \
|
||||
-lbz2 \
|
||||
-llzo2
|
||||
|
||||
CONFIG+=utf8_source
|
||||
|
||||
CONFIG+=force_debug_info
|
||||
|
||||
win32 {
|
||||
TARGET = GoldenDict
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
//document ready
|
||||
(function($){
|
||||
$(function() {
|
||||
$(document).on("click","a",function(event) {
|
||||
(function ($) {
|
||||
$(function () {
|
||||
$(document).on("click", "a", function (event) {
|
||||
var link = $(this).attr("href");
|
||||
if ('string' != typeof(link)) {
|
||||
if ('string' != typeof (link)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(link.indexOf("javascript:")>=0){
|
||||
if (link.indexOf("javascript:") >= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(link.indexOf(":")>=0){
|
||||
if (link.indexOf(":") >= 0) {
|
||||
emitClickedEvent(link);
|
||||
return false;
|
||||
}
|
||||
|
@ -19,16 +19,15 @@ $(function() {
|
|||
|
||||
var newLink;
|
||||
var href = window.location.href;
|
||||
var index=-1;
|
||||
var index = -1;
|
||||
if (link.startsWith("#")) {
|
||||
//the href may contain # fragment already.remove them before append the new #fragment
|
||||
index = href.indexOf("#");
|
||||
if(index>-1)
|
||||
{
|
||||
if (index > -1) {
|
||||
newLink = href.substring(0, index) + link;
|
||||
}
|
||||
else{
|
||||
newLink= href+link;
|
||||
}
|
||||
else {
|
||||
newLink = href + link;
|
||||
}
|
||||
} else {
|
||||
index = href.indexOf("?");
|
||||
|
@ -49,26 +48,23 @@ $(function() {
|
|||
|
||||
});
|
||||
|
||||
//monitor iframe height.
|
||||
//monitor iframe height.
|
||||
|
||||
$( "iframe" ).on( "load", function() {
|
||||
var iframe = $( this );
|
||||
resizeIframe( iframe[ 0 ] );
|
||||
} );
|
||||
$("iframe").on("load", function () {
|
||||
var iframe = $(this);
|
||||
resizeIframe(iframe[0]);
|
||||
});
|
||||
|
||||
function resizeIframe(obj) {
|
||||
setInterval(function(){
|
||||
//in some cases ,the website in iframe will load result after document has been loaded. the height will continue to change.
|
||||
if($(obj).contents().height() <2000)
|
||||
{
|
||||
$(obj).height($(obj).contents().height());
|
||||
}
|
||||
else{
|
||||
$(obj).height(2000);
|
||||
obj.scrolling="yes";
|
||||
}
|
||||
},500);
|
||||
}
|
||||
function resizeIframe(obj) {
|
||||
setInterval(function () {
|
||||
//in some cases ,the website in iframe will load result after document has been loaded. the height will continue to change.
|
||||
var height = $(obj).contents().height();
|
||||
$(obj).height(Math.min(2000, height));
|
||||
if (height >= 2000) {
|
||||
obj.scrolling = "yes";
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
});
|
||||
})($_$);
|
||||
|
|
Loading…
Reference in a new issue