It's working!

This commit is contained in:
Zach Fox 2017-04-11 16:37:28 -07:00
parent e296383b1b
commit 2579ac1baa
2 changed files with 12 additions and 9 deletions

View file

@ -21,6 +21,7 @@ function addImage(data) {
img = document.createElement("IMG"), img = document.createElement("IMG"),
div2 = document.createElement("DIV"), div2 = document.createElement("DIV"),
id = "p" + idCounter++; id = "p" + idCounter++;
img.id = id + "img";
function toggle() { data.share = input.checked; } function toggle() { data.share = input.checked; }
div.style.height = "" + Math.floor(100 / imageCount) + "%"; div.style.height = "" + Math.floor(100 / imageCount) + "%";
if (imageCount > 1) { if (imageCount > 1) {
@ -31,7 +32,7 @@ function addImage(data) {
if (imageCount > 1) { // I'd rather use css, but the included stylesheet is quite particular. if (imageCount > 1) { // I'd rather use css, but the included stylesheet is quite particular.
// Our stylesheet(?) requires input.id to match label.for. Otherwise input doesn't display the check state. // Our stylesheet(?) requires input.id to match label.for. Otherwise input doesn't display the check state.
label.setAttribute('for', id); // cannot do label.for = label.setAttribute('for', id); // cannot do label.for =
input.id = id; input.id = id + "check";
input.type = "checkbox"; input.type = "checkbox";
input.checked = false; input.checked = false;
data.share = input.checked; data.share = input.checked;
@ -81,15 +82,14 @@ window.onload = function () {
handleShareButtons(messageOptions); handleShareButtons(messageOptions);
if (messageOptions.containsGif) { if (messageOptions.containsGif) {
var gifCheckbox = document.getElementById('p0');
if (messageOptions.processingGif) { if (messageOptions.processingGif) {
gifCheckbox.disabled = true;
imageCount = message.action.length + 1; // "+1" for the GIF that'll finish processing soon imageCount = message.action.length + 1; // "+1" for the GIF that'll finish processing soon
message.action.unshift({ localPath: 'http://lorempixel.com/1512/1680' }); message.action.unshift({ localPath: '../../../resources/icons/profilePicLoading.gif' });
message.action.forEach(addImage); message.action.forEach(addImage);
document.getElementById('p0check').disabled = true;
} else { } else {
gifCheckbox.disabled = false; document.getElementById('p0check').disabled = false;
gifCheckbox.img.src = message.action.localPath; document.getElementById('p0img').src = message.action[0].localPath;
} }
} else { } else {
imageCount = message.action.length; imageCount = message.action.length;

View file

@ -212,6 +212,7 @@ function snapshotTaken(pathStillSnapshot, notify) {
{ localPath: pathStillSnapshot, href: href }, { localPath: pathStillSnapshot, href: href },
{ {
containsGif: false, containsGif: false,
processingGif: false,
canShare: !!isDomainOpen(domainId), canShare: !!isDomainOpen(domainId),
openFeedAfterShare: shouldOpenFeedAfterShare() openFeedAfterShare: shouldOpenFeedAfterShare()
}]; }];
@ -222,7 +223,7 @@ function snapshotTaken(pathStillSnapshot, notify) {
HMD.openTablet(); HMD.openTablet();
} }
function processingGifStarted() { function processingGifStarted(pathStillSnapshot) {
Window.processingGifStarted.disconnect(processingGifStarted); Window.processingGifStarted.disconnect(processingGifStarted);
button.clicked.disconnect(onClicked); button.clicked.disconnect(onClicked);
buttonConnected = false; buttonConnected = false;
@ -248,7 +249,7 @@ function processingGifStarted() {
HMD.openTablet(); HMD.openTablet();
} }
function processingGifCompleted() { function processingGifCompleted(pathAnimatedSnapshot) {
Window.processingGifCompleted.disconnect(processingGifCompleted); Window.processingGifCompleted.disconnect(processingGifCompleted);
button.clicked.connect(onClicked); button.clicked.connect(onClicked);
buttonConnected = true; buttonConnected = true;
@ -257,7 +258,9 @@ function processingGifCompleted() {
{ localPath: pathAnimatedSnapshot, href: href }, { localPath: pathAnimatedSnapshot, href: href },
{ {
containsGif: true, containsGif: true,
processingGif: false processingGif: false,
canShare: !!isDomainOpen(domainId),
openFeedAfterShare: shouldOpenFeedAfterShare()
}]; }];
readyData = confirmShareContents; readyData = confirmShareContents;