2022-01-12 14:30:43 +00:00
|
|
|
// seperate from cpp code.
|
2022-02-25 14:48:43 +00:00
|
|
|
var gdAudioLinks = {
|
|
|
|
"first": null,
|
|
|
|
"current": null
|
|
|
|
};
|
2022-01-12 14:30:43 +00:00
|
|
|
|
2022-02-25 14:48:43 +00:00
|
|
|
function gdMakeArticleActive(newId,noEvent) {
|
|
|
|
var gdCurrentArticle = $_$(".gdactivearticle").attr("id")
|
2022-01-17 13:50:54 +00:00
|
|
|
if (gdCurrentArticle !== 'gdfrom-' + newId) {
|
2022-02-25 14:48:43 +00:00
|
|
|
$_$(".gdactivearticle").removeClass("gdactivearticle")
|
|
|
|
var newFormId = 'gdfrom-' + newId
|
|
|
|
$_$("#" + newFormId).addClass("gdactivearticle")
|
|
|
|
gdCurrentArticle = 'gdfrom-' + newId
|
|
|
|
gdAudioLinks.current = newId
|
|
|
|
if(!noEvent)
|
|
|
|
articleview.onJsActiveArticleChanged('gdfrom-' + newId);
|
2022-01-12 14:30:43 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-25 14:48:43 +00:00
|
|
|
|
2022-01-12 14:30:43 +00:00
|
|
|
var overIframeId = null;
|
|
|
|
|
|
|
|
function gdSelectArticle(id) {
|
2022-02-25 14:48:43 +00:00
|
|
|
var selection = window.getSelection()
|
|
|
|
var range = document.createRange()
|
|
|
|
range.selectNodeContents(document.getElementById('gdfrom-' + id))
|
|
|
|
selection.removeAllRanges()
|
|
|
|
selection.addRange(range)
|
2022-01-12 14:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function processIframeMouseOut() {
|
2022-02-25 14:48:43 +00:00
|
|
|
overIframeId = null
|
|
|
|
top.focus()
|
2022-01-12 14:30:43 +00:00
|
|
|
}
|
|
|
|
|
2022-02-25 14:48:43 +00:00
|
|
|
function processIframeMouseOver(newId) {
|
|
|
|
overIframeId = newId
|
|
|
|
}
|
2022-01-12 14:30:43 +00:00
|
|
|
|
|
|
|
function processIframeClick() {
|
|
|
|
if (overIframeId != null) {
|
2022-02-25 14:48:43 +00:00
|
|
|
overIframeId = overIframeId.replace('gdexpandframe-', '')
|
2022-01-12 14:30:43 +00:00
|
|
|
gdMakeArticleActive(overIframeId)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-25 14:48:43 +00:00
|
|
|
function init() {
|
|
|
|
window.addEventListener('blur', processIframeClick, false)
|
|
|
|
}
|
|
|
|
window.addEventListener('load', init, false)
|
2022-01-12 14:30:43 +00:00
|
|
|
|
|
|
|
function gdExpandOptPart(expanderId, optionalId) {
|
2022-02-25 14:48:43 +00:00
|
|
|
var d1 = document.getElementById(expanderId)
|
|
|
|
var i = 0
|
2022-01-12 14:30:43 +00:00
|
|
|
if (d1.alt == '[+]') {
|
2022-02-25 14:48:43 +00:00
|
|
|
d1.alt = '[-]'
|
2023-03-05 20:20:05 +00:00
|
|
|
d1.src = 'qrc:///icons/collapse_opt.png'
|
2022-01-12 14:30:43 +00:00
|
|
|
for (i = 0; i < 1000; i++) {
|
2022-02-25 14:48:43 +00:00
|
|
|
var d2 = document.getElementById(optionalId + i)
|
|
|
|
if (!d2)
|
|
|
|
break
|
|
|
|
d2.style.display = 'inline'
|
2022-01-12 14:30:43 +00:00
|
|
|
}
|
|
|
|
} else {
|
2022-02-25 14:48:43 +00:00
|
|
|
d1.alt = '[+]'
|
2023-03-05 20:20:05 +00:00
|
|
|
d1.src = 'qrc:///icons/expand_opt.png'
|
2022-01-12 14:30:43 +00:00
|
|
|
for (i = 0; i < 1000; i++) {
|
2022-02-25 14:48:43 +00:00
|
|
|
var d2 = document.getElementById(optionalId + i)
|
|
|
|
if (!d2)
|
|
|
|
break
|
|
|
|
d2.style.display = 'none'
|
2022-01-12 14:30:43 +00:00
|
|
|
}
|
|
|
|
}
|
2022-02-16 13:17:29 +00:00
|
|
|
}
|
2022-01-12 14:30:43 +00:00
|
|
|
|
2022-03-16 14:29:04 +00:00
|
|
|
function emitClickedEvent(link) {
|
2022-02-25 14:48:43 +00:00
|
|
|
try {
|
2022-04-21 00:11:40 +00:00
|
|
|
if ('string' != typeof(link)) {
|
|
|
|
return;
|
|
|
|
}
|
2022-03-16 14:29:04 +00:00
|
|
|
articleview.linkClickedInHtml(link)
|
2022-02-25 14:48:43 +00:00
|
|
|
} catch (error) {
|
|
|
|
console.error(error)
|
2022-01-20 12:43:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-12 14:30:43 +00:00
|
|
|
function gdExpandArticle(id) {
|
2022-02-25 14:48:43 +00:00
|
|
|
emitClickedEvent()
|
|
|
|
elem = document.getElementById('gdarticlefrom-' + id)
|
|
|
|
ico = document.getElementById('expandicon-' + id)
|
|
|
|
art = document.getElementById('gdfrom-' + id)
|
|
|
|
ev = window.event
|
|
|
|
t = null
|
|
|
|
if (ev)
|
|
|
|
t = ev.target || ev.srcElement
|
|
|
|
if (elem.style.display == 'inline') {
|
|
|
|
elem.style.display = 'none'
|
|
|
|
ico.className = 'gdexpandicon'
|
|
|
|
art.className = art.className + ' gdcollapsedarticle'
|
|
|
|
nm = document.getElementById('gddictname-' + id)
|
|
|
|
nm.style.cursor = 'pointer'
|
|
|
|
if (ev)
|
|
|
|
ev.stopPropagation()
|
|
|
|
ico.title = tr("Expand article")
|
|
|
|
nm.title = ''
|
2022-01-12 14:30:43 +00:00
|
|
|
} else if (elem.style.display == 'none') {
|
2022-02-25 14:48:43 +00:00
|
|
|
elem.style.display = 'inline'
|
|
|
|
ico.className = 'gdcollapseicon'
|
|
|
|
art.className = art.className.replace(' gdcollapsedarticle', '')
|
|
|
|
nm = document.getElementById('gddictname-' + id)
|
|
|
|
nm.style.cursor = 'default'
|
|
|
|
nm.title = ''
|
|
|
|
ico.title = tr("Collapse article")
|
2022-01-12 14:30:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function gdCheckArticlesNumber() {
|
2022-02-25 14:48:43 +00:00
|
|
|
elems = document.getElementsByClassName('gddictname')
|
2022-01-12 14:30:43 +00:00
|
|
|
if (elems.length == 1) {
|
2022-02-25 14:48:43 +00:00
|
|
|
el = elems.item(0)
|
|
|
|
s = el.id.replace('gddictname-', '')
|
|
|
|
el = document.getElementById('gdfrom-' + s)
|
|
|
|
if (el && el.className.search('gdcollapsedarticle') > 0)
|
|
|
|
gdExpandArticle(s)
|
2022-01-12 14:30:43 +00:00
|
|
|
}
|
2022-01-17 13:50:54 +00:00
|
|
|
}
|