From d1dff7606cc779a802c54dbc999649dd80a17adf Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 2 May 2017 14:10:24 -0700 Subject: [PATCH] Lint cleanup; Immediate share button visibility; --- interface/src/ui/SnapshotUploader.cpp | 2 + scripts/system/html/css/SnapshotReview.css | 24 +- scripts/system/html/img/fb_logo72.png | Bin 0 -> 1587 bytes scripts/system/html/img/twitter_logo72.png | Bin 0 -> 1394 bytes scripts/system/html/js/SnapshotReview.js | 421 +++++++++++++-------- scripts/system/snapshot.js | 5 +- 6 files changed, 289 insertions(+), 163 deletions(-) create mode 100644 scripts/system/html/img/fb_logo72.png create mode 100644 scripts/system/html/img/twitter_logo72.png diff --git a/interface/src/ui/SnapshotUploader.cpp b/interface/src/ui/SnapshotUploader.cpp index aa37608476..3408cb8512 100644 --- a/interface/src/ui/SnapshotUploader.cpp +++ b/interface/src/ui/SnapshotUploader.cpp @@ -31,6 +31,7 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) { auto dataObject = doc.object().value("data").toObject(); QString thumbnailUrl = dataObject.value("thumbnail_url").toString(); QString imageUrl = dataObject.value("image_url").toString(); + QString snapshotID = dataObject.value("id").toString(); auto addressManager = DependencyManager::get(); QString placeName = _inWorldLocation.authority(); // We currently only upload shareable places, in which case this is just host. QString currentPath = _inWorldLocation.path(); @@ -43,6 +44,7 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) { if (dataObject.contains("shareable_url")) { detailsObject.insert("shareable_url", dataObject.value("shareable_url").toString()); } + detailsObject.insert("snapshot_id", snapshotID); QString pickledDetails = QJsonDocument(detailsObject).toJson(); userStoryObject.insert("details", pickledDetails); userStoryObject.insert("thumbnail_url", thumbnailUrl); diff --git a/scripts/system/html/css/SnapshotReview.css b/scripts/system/html/css/SnapshotReview.css index ccc9386d13..0aa422ca84 100644 --- a/scripts/system/html/css/SnapshotReview.css +++ b/scripts/system/html/css/SnapshotReview.css @@ -104,7 +104,7 @@ input[type=button].naked:active { */ /* -// START styling of share bar +// START styling of share overlay */ .shareControls { display: flex; @@ -212,6 +212,28 @@ input[type=button].naked:active { // END styling of share overlay */ +/* +// START styling of uploading message +*/ +.uploadingMessage { + width: 100%; + height: 100%; + position: absolute; + text-align: center; + background-color: rgba(0, 0, 0, 0.8); + left: 0; + top: 0; +} +.uploadingMessage > img { + width: 72px; + height: 72px; + display: block; + margin: 60px auto 10px auto; +} +/* +// END styling of uploading message +*/ + /* // START styling of snapshot controls (bottom panel) and its contents */ diff --git a/scripts/system/html/img/fb_logo72.png b/scripts/system/html/img/fb_logo72.png new file mode 100644 index 0000000000000000000000000000000000000000..8e3a2370dd2bab99c363f5bf5d06d8e89ee30e5c GIT binary patch literal 1587 zcmbVMeM}Q)7(Y=F4GtK@PgstVZElmc*DtOoEwpz9Di*p@uoI(P+oNsD_3HJY2P_-- zfgke&L`)o_Btz%?V#w5>PIM}cIMiS^6#=JNK#Vw*MFjkMhhQ>VDWdcd8RRqJJTrPm6GPxX{2Z}|oSSS(;Me^D9^hK@rfS29!+PQcBh-j!)a?iMY>rXu7o(sBd|Gb zs7Qv0U^q@HiW7_E2n-`4M1oGgM(&iuY>l0ScV*&t0$~Z zHy`+fzo1uoaguQskhUa-rohn&qt3TVqg35ecu>X zL25j?YLCTb-O|&sWMSU$&fJRb>YcTFT9qO3UpzoIg*-j=^wfk)-p7w)V!GPvSo5sX z6B*^Is_t#42C|m-)D@qu9V%I}^*!Ar>0nc8uMz~12&Mbt#aI&RL!bB>J+n41odYc#bKHLUn$@#Gts;TN~(|4`a` zq5j+1dwV_eTLkAT?ka)J7e*qx_Une%u6p6PHGQbxd^MnNNYFV$pYvDVbZOOw>@{XX zSsL>qc&Ny-qwZK|UC)`CYV2jy_e9B|rAXNbH)+{G!MdYm%c+=4`Q@K}*IRtMvUPi+ z{L%B1h;Jx#QTx7sqBcfHJPb>z3h!z-e(UU}rIVr**Y7>+tS=1DNbk-O94WcHEI6W# z85rNc8GXL;!^+R@44n(kI_!Ed%TiI^IM{oJy|?Sn`&?~KqL1yqXzHk`{ORh{zV`LE z9~^8cxN*HRCiI$mbQb4A_eMXl2=}zyEBLuMr1z2IiEI~`sj6#?v>bW-Rdh0#`I~WK z>h^%rt!G{EnuM;SO;he#(aYDqY#X%0skI&0hV(1)`e%`)ropU{P3af+Z*17|!Aa(2 z{h{)jrJIZ4fUvcRe4!bBCkO}2Mk7Hu7!daB?}>pkx5D#k?X01vX`(c`?W!epUS;;Q sE7^S|?6hW8Memb{eba`wwS|le1lD8gSC&6Z!uW4or%l5TX>wNl3u=i}%K!iX literal 0 HcmV?d00001 diff --git a/scripts/system/html/img/twitter_logo72.png b/scripts/system/html/img/twitter_logo72.png new file mode 100644 index 0000000000000000000000000000000000000000..862f2452285534cc699d9b8cd50ede0e92c2c083 GIT binary patch literal 1394 zcmV-&1&#WNP)3WXL}mU6Q! zd!4HfH9!}ZopW{;GGxBDo$Sm%-<)&)^UuGFHrD%LHNvd)4WtS~Om7%sdczRY8-|$P zFvRqRA*MGBF}<;B#n_b%@8D2=I+I~RVFCL6vNtGeb>)>2!w4!p?EWHdXBKAA-0=aw z+|Va{`?nAfl$cZQ&BpzHc_I>fJRXR&HBgqzwvLKI5>M7?Lm!t~OId8ViY2iu9=EEsAl5?I~BjG<-+H~aDH z9=_2l0ssO~8Ivq4?#%vw{!|s3J}j|tggLc(E4M9^>>LH4u7^L|8NJVm4;Gv6bf`U@ zEKII#ZlyoF#dPdpn{(cgr7>fuF5(h@?{>TaxgZ_?`ApjJy|&??a&=nm;wBSAw_Dur z#6LZ5-@8%Od@jjhGc9VL!Ymuom{J#ZaHy__uj}U3pGYP)8j79aSyohAVLe)I-IQqM z+`XQ%7*GI?UgqCD7bRNJWXYp*LRxqb0X*hm_qg%#KC!l&zdp10Y{|CLhzT;h-4^-2 zcfr1v2(n;JBhoa#cnC8_FBX`7f689J$NJ!@}I2nb38xfPI(SV&aruL$!K zaSRNC3O8HfX2T+MPDtm*rLIY--!FTE%6M3_a!C!uCDrF$e5HrYPfsw^Ru)Qfa7oTw zc_C7H1!+bLfOINu%fy1LRR0$Cg@|vHrOF-ulBJ9}$fDKk;F_McR~K;&y#n>KB*Gh{ zj6yaQug}Pp9`>bz<$H_kRlOs}Kz55~M;A%=DWz+YG9sB+vrinMof{O0GIWeDiZQ+MS&9o^igQ? zTSS6a8pH2(L>G1@G^EKV4#p`v)j*lJIR?Jz;dh@59`1}zs&25TM**nqPHMtacBzV; z>{sPhURKgf2ot|#C8qs`)Z$BOwo{H+i%q@5F#m-56HiolOWYK}~bSALm_` zh-AyzGhT7`$>67#_~hH}vH}O%BFRs}TM)On@0dA-&9pdWu?IT=c8YAX=VkQh^@DveR-yri@0^X)u1P%D;gMXzn=wq{@x0}eBC*^re* z$!yM13F>^&?kTB#O!~to zbxlc{S1R$)W*@@{Tz1B3MQb@^#vm#X5@0GKkAxIW$_NUy*~cUWh6D0&K$DAU!>awC zhasjn3^Bc7i0KVOOm7%sdczRY8-|$PShZsR0V1^GX^jP^B>(^b07*qoM6N<$f{Z' + - '

This app lets you take and share snaps and GIFs with your connections in High Fidelity.

' + - "

Setup Instructions

" + - "

Before you can begin taking snaps, please choose where you'd like to save snaps on your computer:

" + - '
' + - '
' + - '' + - '
'; + '
' + + '

This app lets you take and share snaps and GIFs with your connections in High Fidelity.

' + + "

Setup Instructions

" + + "

Before you can begin taking snaps, please choose where you'd like to save snaps on your computer:

" + + '
' + + '
' + + '' + + '
'; document.getElementById("snap-button").disabled = true; } function showSetupComplete() { var snapshotImagesDiv = document.getElementById("snapshot-images"); snapshotImagesDiv.className = "snapshotInstructions"; snapshotImagesDiv.innerHTML = 'Snapshot Instructions' + - '
' + - "

You're all set!

" + - '

Try taking a snapshot by pressing the red button below.

'; + '
' + + "

You're all set!

" + + '

Try taking a snapshot by pressing the red button below.

'; } function chooseSnapshotLocation() { EventBridge.emitWebEvent(JSON.stringify({ @@ -52,68 +54,71 @@ function clearImages() { imageCount = 0; idCounter = 0; } -function addImage(image_data, isGifLoading, canShare, isShowingPreviousImages, blastButtonDisabled, hifiButtonDisabled) { - if (!image_data.localPath) { - return; + +function selectImageToShare(selectedID, isSelected) { + if (selectedID.id) { + selectedID = selectedID.id; // sometimes (?), `selectedID` is passed as an HTML object to these functions; we just want the ID } - var id = "p" + idCounter++; - // imageContainer setup - var imageContainer = document.createElement("DIV"); - imageContainer.id = id; - imageContainer.style.width = "95%"; - imageContainer.style.height = "240px"; - imageContainer.style.margin = "5px auto"; - imageContainer.style.display = "flex"; - imageContainer.style.justifyContent = "center"; - imageContainer.style.alignItems = "center"; - imageContainer.style.position = "relative"; - // img setup - var img = document.createElement("IMG"); - img.id = id + "img"; - if (imageCount > 1) { - img.setAttribute("class", "multiple"); - } - img.src = image_data.localPath; - imageContainer.appendChild(img); - document.getElementById("snapshot-images").appendChild(imageContainer); - paths.push(image_data.localPath); - var isGif = img.src.split('.').pop().toLowerCase() === "gif"; - if (isGif) { - imageContainer.innerHTML += 'GIF'; - } - if (!isGifLoading && !isShowingPreviousImages && canShare) { - shareForUrl(id); - } else if (isShowingPreviousImages && canShare && image_data.story_id) { - appendShareBar(id, image_data.story_id, isGif, blastButtonDisabled, hifiButtonDisabled) + var imageContainer = document.getElementById(selectedID), + image = document.getElementById(selectedID + 'img'), + shareBar = document.getElementById(selectedID + "shareBar"), + shareButtonsDiv = document.getElementById(selectedID + "shareButtonsDiv"), + showShareButtonsButton = document.getElementById(selectedID + "showShareButtonsButton"), + itr, + containers = document.getElementsByClassName("shareControls"); + + if (isSelected) { + showShareButtonsButton.onclick = function () { selectImageToShare(selectedID, false); }; + showShareButtonsButton.classList.remove("inactive"); + showShareButtonsButton.classList.add("active"); + + image.onclick = function () { selectImageToShare(selectedID, false); }; + imageContainer.style.outline = "4px solid #00b4ef"; + imageContainer.style.outlineOffset = "-4px"; + + shareBar.style.backgroundColor = "rgba(0, 0, 0, 0.5)"; + + shareButtonsDiv.style.visibility = "visible"; + + for (itr = 0; itr < containers.length; itr += 1) { + var parentID = containers[itr].id.slice(0, 2); + if (parentID !== selectedID) { + selectImageToShare(parentID, false); + } + } + } else { + showShareButtonsButton.onclick = function () { selectImageToShare(selectedID, true); }; + showShareButtonsButton.classList.remove("active"); + showShareButtonsButton.classList.add("inactive"); + + image.onclick = function () { selectImageToShare(selectedID, true); }; + imageContainer.style.outline = "none"; + + shareBar.style.backgroundColor = "rgba(0, 0, 0, 0.0)"; + + shareButtonsDiv.style.visibility = "hidden"; } } -function appendShareBar(divID, story_id, isGif, blastButtonDisabled, hifiButtonDisabled) { - var story_url = "https://highfidelity.com/user_stories/" + story_id; - var parentDiv = document.getElementById(divID); - parentDiv.setAttribute('data-story-id', story_id); - document.getElementById(divID).appendChild(createShareBar(divID, isGif, story_url, blastButtonDisabled, hifiButtonDisabled)); - if (divID === "p0") { - selectImageToShare(divID, true); - } -} -function createShareBar(parentID, isGif, shareURL, blastButtonDisabled, hifiButtonDisabled) { - var shareBar = document.createElement("div"); +function createShareBar(parentID, isGif, blastButtonDisabled, hifiButtonDisabled) { + var shareBar = document.createElement("div"), + shareButtonsDivID = parentID + "shareButtonsDiv", + showShareButtonsButtonDivID = parentID + "showShareButtonsButtonDiv", + showShareButtonsButtonID = parentID + "showShareButtonsButton", + showShareButtonsLabelID = parentID + "showShareButtonsLabel", + blastToConnectionsButtonID = parentID + "blastToConnectionsButton", + shareWithEveryoneButtonID = parentID + "shareWithEveryoneButton", + facebookButtonID = parentID + "facebookButton", + twitterButtonID = parentID + "twitterButton"; + shareBar.id = parentID + "shareBar"; shareBar.className = "shareControls"; - var shareButtonsDivID = parentID + "shareButtonsDiv"; - var showShareButtonsButtonDivID = parentID + "showShareButtonsButtonDiv"; - var showShareButtonsButtonID = parentID + "showShareButtonsButton"; - var showShareButtonsLabelID = parentID + "showShareButtonsLabel"; - var blastToConnectionsButtonID = parentID + "blastToConnectionsButton"; - var shareWithEveryoneButtonID = parentID + "shareWithEveryoneButton"; - var facebookButtonID = parentID + "facebookButton"; - var twitterButtonID = parentID + "twitterButton"; - shareBar.innerHTML += '' + - '