Skip to content

Instantly share code, notes, and snippets.

@gre
Last active January 14, 2019 22:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gre/297512dde30b8c4082153dc68e26def9 to your computer and use it in GitHub Desktop.
Save gre/297512dde30b8c4082153dc68e26def9 to your computer and use it in GitHub Desktop.
Standalone minimal version of Google Photos Albums list in order for you to share photos with family and with link to multiple shared google photos albums

DWTFYW

Disclaimer:

  • no warranty this will work for you!
  • I'm not responsible of how you use this!
  • READ, VERIFY and TEST the CODE before using!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>...</title>
<style>
html,body {
padding: 0;
margin: 0;
background-color: #fff;
color: #000;
}
main {
padding: 20px;
}
h1 {
font: 400 32px Roboto,RobotoDraft,Helvetica,Arial,sans-serif;
padding: 0;
margin: 0;
margin-bottom: 20px;
}
a, a:hover {
color: inherit;
text-decoration: none;
}
* {
-webkit-tap-highlight-color: transparent;
user-select: none;
}
.albums {
flex-wrap: wrap;
display: flex;
}
.album, .album-empty {
flex: 1 0 384px;
margin: 0 4px 4px 0;
position: relative;
min-width: 384px;
min-height: 256px;
display: inline-block;
}
.album {
background-color: #eeeeee;
}
.album-image {
width: 100%;
height: 0;
padding-bottom: 66.67%;
background-size: cover;
}
.album-title-bg {
background-image: linear-gradient(to bottom,transparent,rgba(0,0,0,0.74));
bottom: 0;
content: '';
height: 160px;
position: absolute;
width: 100%;
}
.album-title {
position: absolute;
width: 100%;
bottom: 0;
left: 0;
color: #fff;
padding: 24px;
font-size: 20px;
font-family: Roboto,RobotoDraft,Helvetica,Arial,sans-serif;
font-weight: 500;
}
</style>
</head>
<body>
<main>
<h1>
Photos of ...
</h1>
<div id="photos"></div>
<script src="https://npmcdn.com/react@15.3.1/dist/react.min.js"></script>
<script src="https://npmcdn.com/react-dom@15.3.1/dist/react-dom.min.js"></script>
<script src="https://npmcdn.com/babel-core@5.8.38/browser.min.js"></script>
<script type="text/babel">
/*
CODE to exec to extract things on GOOGLE PHOTOS ALBUMS page
JSON.stringify(Array.prototype.slice.call(document.querySelectorAll('[jscontroller="BptC2e"]'), 0)
.map(n => ({
name: n.children[2].children[0].textContent,
img: /url\(([^)]+)\)/.exec(n.children[0].style.backgroundImage)[1],
src: n.href,
})), null, 2)
*/
const Album = ({ src, img, name }) => (
<a className="album" href={src}>
<div
style={{ backgroundImage: `url(${img})` }}
className="album-image" />
<div className="album-title-bg"></div>
<div className="album-title">
{name}
</div>
</a>
);
const Albums = ({ children }) => (
<div className="albums">
{children.map(Album)}
<div className="album-empty" />
<div className="album-empty" />
<div className="album-empty" />
<div className="album-empty" />
</div>
);
ReactDOM.render(
<Albums>{
..... PASTE THE CODE OBTAINED ON THE GOOGLE PHOTOS ALBUMS PAGE
}</Albums>,
document.getElementById("photos")
)
</script>
</main>
</body>
</html>
@bwelsher
Copy link

bwelsher commented Nov 7, 2018

Hi, I was hoping you could offer some guidance on how to use this code. Specifically which code is it that I need to paste from my google photos album page? Any help you could offer would be greatly appreciated.
Thanks.

@Marhc
Copy link

Marhc commented Jan 14, 2019

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment