mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 12:42:58 +02:00
Keep hover status of both images in sync
This commit is contained in:
parent
b01bff061e
commit
b08d23924a
1 changed files with 20 additions and 11 deletions
|
@ -143,11 +143,11 @@ function createShareBar(parentID, isGif, blastButtonDisabled, hifiButtonDisabled
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'<div class="shareButtons" id="' + shareButtonsDivID + '" style="visibility:hidden">';
|
'<div class="shareButtons" id="' + shareButtonsDivID + '" style="visibility:hidden">';
|
||||||
if (canBlast) {
|
if (canBlast) {
|
||||||
shareBarInnerHTML += '<div class="shareButton blastToConnections' + (blastButtonDisabled ? ' disabled' : '') + '" id="' + blastToConnectionsButtonID + '" onmouseover="shareButtonHovered(\'blast\', ' + parentID + ')" onclick="' + (blastButtonDisabled ? '' : 'blastToConnections(' + parentID + ', ' + isGif + ')') + '"><img src="img/blast_icon.svg"></div>';
|
shareBarInnerHTML += '<div class="shareButton blastToConnections' + (blastButtonDisabled ? ' disabled' : '') + '" id="' + blastToConnectionsButtonID + '" onmouseover="shareButtonHovered(\'blast\', ' + parentID + ', true)" onclick="' + (blastButtonDisabled ? '' : 'blastToConnections(' + parentID + ', ' + isGif + ')') + '"><img src="img/blast_icon.svg"></div>';
|
||||||
}
|
}
|
||||||
shareBarInnerHTML += '<div class="shareButton shareWithEveryone' + (hifiButtonDisabled ? ' disabled' : '') + '" id="' + shareWithEveryoneButtonID + '" onmouseover="shareButtonHovered(\'hifi\', ' + parentID + ')" onclick="' + (hifiButtonDisabled ? '' : 'shareWithEveryone(' + parentID + ', ' + isGif + ')') + '"><img src="img/hifi_icon.svg" style="width:35px;height:35px;margin:2px 0 0 2px;"></div>' +
|
shareBarInnerHTML += '<div class="shareButton shareWithEveryone' + (hifiButtonDisabled ? ' disabled' : '') + '" id="' + shareWithEveryoneButtonID + '" onmouseover="shareButtonHovered(\'hifi\', ' + parentID + ', true)" onclick="' + (hifiButtonDisabled ? '' : 'shareWithEveryone(' + parentID + ', ' + isGif + ')') + '"><img src="img/hifi_icon.svg" style="width:35px;height:35px;margin:2px 0 0 2px;"></div>' +
|
||||||
'<a class="shareButton facebookButton" id="' + facebookButtonID + '" onmouseover="shareButtonHovered(\'facebook\', ' + parentID + ')" onclick="shareButtonClicked(\'facebook\', ' + parentID + ')"><img src="img/fb_icon.svg"></a>' +
|
'<a class="shareButton facebookButton" id="' + facebookButtonID + '" onmouseover="shareButtonHovered(\'facebook\', ' + parentID + ', true)" onclick="shareButtonClicked(\'facebook\', ' + parentID + ')"><img src="img/fb_icon.svg"></a>' +
|
||||||
'<a class="shareButton twitterButton" id="' + twitterButtonID + '" onmouseover="shareButtonHovered(\'twitter\', ' + parentID + ')" onclick="shareButtonClicked(\'twitter\', ' + parentID + ')"><img src="img/twitter_icon.svg"></a>' +
|
'<a class="shareButton twitterButton" id="' + twitterButtonID + '" onmouseover="shareButtonHovered(\'twitter\', ' + parentID + ', true)" onclick="shareButtonClicked(\'twitter\', ' + parentID + ')"><img src="img/twitter_icon.svg"></a>' +
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
||||||
shareBar.innerHTML = shareBarInnerHTML;
|
shareBar.innerHTML = shareBarInnerHTML;
|
||||||
|
@ -164,11 +164,11 @@ function appendShareBar(divID, isGif, blastButtonDisabled, hifiButtonDisabled, c
|
||||||
document.getElementById(divID).appendChild(createShareBar(divID, isGif, blastButtonDisabled, hifiButtonDisabled, canBlast));
|
document.getElementById(divID).appendChild(createShareBar(divID, isGif, blastButtonDisabled, hifiButtonDisabled, canBlast));
|
||||||
if (divID === "p0") {
|
if (divID === "p0") {
|
||||||
selectImageToShare(divID, true);
|
selectImageToShare(divID, true);
|
||||||
if (canBlast) {
|
}
|
||||||
shareButtonHovered('blast', divID);
|
if (canBlast) {
|
||||||
} else {
|
shareButtonHovered('blast', divID, false);
|
||||||
shareButtonHovered('hifi', divID);
|
} else {
|
||||||
}
|
shareButtonHovered('hifi', divID, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function shareForUrl(selectedID) {
|
function shareForUrl(selectedID) {
|
||||||
|
@ -382,7 +382,7 @@ function shareWithEveryone(selectedID, isGif) {
|
||||||
showUploadingMessage(selectedID, 'hifi');
|
showUploadingMessage(selectedID, 'hifi');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function shareButtonHovered(destination, selectedID) {
|
function shareButtonHovered(destination, selectedID, shouldAlsoModifyOther) {
|
||||||
if (selectedID.id) {
|
if (selectedID.id) {
|
||||||
selectedID = selectedID.id; // sometimes (?), `selectedID` is passed as an HTML object to these functions; we just want the ID
|
selectedID = selectedID.id; // sometimes (?), `selectedID` is passed as an HTML object to these functions; we just want the ID
|
||||||
}
|
}
|
||||||
|
@ -391,7 +391,6 @@ function shareButtonHovered(destination, selectedID) {
|
||||||
itr;
|
itr;
|
||||||
|
|
||||||
if (!shareBarHelp.classList.contains("uploading")) {
|
if (!shareBarHelp.classList.contains("uploading")) {
|
||||||
|
|
||||||
for (itr = 0; itr < shareButtonsDiv.length; itr += 1) {
|
for (itr = 0; itr < shareButtonsDiv.length; itr += 1) {
|
||||||
shareButtonsDiv[itr].style.backgroundColor = "rgba(0, 0, 0, 0)";
|
shareButtonsDiv[itr].style.backgroundColor = "rgba(0, 0, 0, 0)";
|
||||||
}
|
}
|
||||||
|
@ -441,6 +440,14 @@ function shareButtonHovered(destination, selectedID) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shouldAlsoModifyOther && imageCount > 1) {
|
||||||
|
if (selectedID === "p0" && !document.getElementById("p1").classList.contains("processingGif")) {
|
||||||
|
shareButtonHovered(destination, "p1", false);
|
||||||
|
} else if (selectedID === "p1") {
|
||||||
|
shareButtonHovered(destination, "p0", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function shareButtonClicked(destination, selectedID) {
|
function shareButtonClicked(destination, selectedID) {
|
||||||
if (selectedID.id) {
|
if (selectedID.id) {
|
||||||
|
@ -525,6 +532,7 @@ window.onload = function () {
|
||||||
message.image_data.forEach(function (element, idx) {
|
message.image_data.forEach(function (element, idx) {
|
||||||
addImage(element, idx === 1, idx === 0 && messageOptions.canShare, false);
|
addImage(element, idx === 1, idx === 0 && messageOptions.canShare, false);
|
||||||
});
|
});
|
||||||
|
document.getElementById("p1").classList.add("processingGif");
|
||||||
} else {
|
} else {
|
||||||
var gifPath = message.image_data[0].localPath,
|
var gifPath = message.image_data[0].localPath,
|
||||||
p1img = document.getElementById('p1img');
|
p1img = document.getElementById('p1img');
|
||||||
|
@ -534,6 +542,7 @@ window.onload = function () {
|
||||||
if (messageOptions.canShare) {
|
if (messageOptions.canShare) {
|
||||||
shareForUrl("p1");
|
shareForUrl("p1");
|
||||||
appendShareBar("p1", true, false, false, true);
|
appendShareBar("p1", true, false, false, true);
|
||||||
|
document.getElementById("p1").classList.remove("processingGif");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue