mirror of
https://github.com/pinry/pinry.git
synced 2025-11-16 09:55:50 +01:00
Ease code readability (and be closer to original too).
This commit is contained in:
@@ -25,6 +25,11 @@
|
|||||||
src = src.substr(0, src.indexOf('/static/js'));
|
src = src.substr(0, src.indexOf('/static/js'));
|
||||||
return src + '/pins/pin-form/?pin-image-url=';
|
return src + '/pins/pin-form/?pin-image-url=';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setCSS(el, css) {
|
||||||
|
for (var k in css)
|
||||||
|
el.style[k] = css[k];
|
||||||
|
}
|
||||||
// End Helper Functions
|
// End Helper Functions
|
||||||
|
|
||||||
|
|
||||||
@@ -32,29 +37,33 @@
|
|||||||
function pageView() {
|
function pageView() {
|
||||||
var pinryImages = document.createElement('div');
|
var pinryImages = document.createElement('div');
|
||||||
pinryImages.id = 'pinry-images';
|
pinryImages.id = 'pinry-images';
|
||||||
pinryImages.style.position = 'fixed';
|
setCSS(pinryImages, {
|
||||||
pinryImages.style.zIndex = 9001;
|
position: 'fixed',
|
||||||
pinryImages.style.background = 'rgba(0, 0, 0, 0.7)';
|
zIndex: 9001,
|
||||||
pinryImages.style.paddingTop = '70px';
|
background: 'rgba(0, 0, 0, 0.7)',
|
||||||
pinryImages.style.top = 0;
|
paddingTop: '70px',
|
||||||
pinryImages.style.bottom = 0;
|
top: 0,
|
||||||
pinryImages.style.left = 0;
|
bottom: 0,
|
||||||
pinryImages.style.right = 0;
|
left: 0,
|
||||||
pinryImages.style.textAlign = 'center';
|
right: 0,
|
||||||
pinryImages.style.overflowX = 'hidden';
|
textAlign: 'center',
|
||||||
pinryImages.style.overflowY = 'auto';
|
overflowX: 'hidden',
|
||||||
|
overflowY: 'auto'
|
||||||
|
});
|
||||||
var pinryBar = document.createElement('div');
|
var pinryBar = document.createElement('div');
|
||||||
pinryBar.id = 'pinry-bar';
|
pinryBar.id = 'pinry-bar';
|
||||||
pinryBar.style.background = 'black';
|
setCSS(pinryBar, {
|
||||||
pinryBar.style.padding = '15px';
|
background: 'black',
|
||||||
pinryBar.style.position = 'absolute';
|
padding: '15px',
|
||||||
pinryBar.style.zIndex = 9002;
|
position: 'absolute',
|
||||||
pinryBar.style.width = '100%';
|
zIndex: 9002,
|
||||||
pinryBar.style.top = 0;
|
width: '100%',
|
||||||
pinryBar.style.borderBottom = '1px solid #555';
|
top: 0,
|
||||||
pinryBar.style.color = 'white';
|
borderBottom: '1px solid #555',
|
||||||
pinryBar.style.textAlign = 'center';
|
color: 'white',
|
||||||
pinryBar.style.fontSize = '22px';
|
textAlign: 'center',
|
||||||
|
fontSize: '22px'
|
||||||
|
});
|
||||||
pinryBar.textContent = 'Pinry Bookmarklet';
|
pinryBar.textContent = 'Pinry Bookmarklet';
|
||||||
pinryBar.onclick = closePinry;
|
pinryBar.onclick = closePinry;
|
||||||
pinryImages.appendChild(pinryBar);
|
pinryImages.appendChild(pinryBar);
|
||||||
@@ -68,18 +77,20 @@
|
|||||||
function imageView(imageUrl) {
|
function imageView(imageUrl) {
|
||||||
// Requires that pageView has been created already
|
// Requires that pageView has been created already
|
||||||
var image = document.createElement('div');
|
var image = document.createElement('div');
|
||||||
image.style.backgroundImage = 'url('+imageUrl+')';
|
setCSS(image, {
|
||||||
image.style.backgroundPosition = 'center center';
|
backgroundImage: 'url('+imageUrl+')',
|
||||||
image.style.backgroundRepeat = 'no-repeat';
|
backgroundPosition: 'center center',
|
||||||
image.style.backgroundSize = 'cover';
|
backgroundRepeat: 'no-repeat',
|
||||||
image.style.display = 'inline-block';
|
backgroundSize: 'cover',
|
||||||
image.style.color = 'blue';
|
display: 'inline-block',
|
||||||
image.style.textShadow = 'yellow 0px 0px 2px, yellow 0px 0px 3px, yellow 0px 0px 4px';
|
color: 'blue',
|
||||||
image.style.width = '200px';
|
textShadow: 'yellow 0px 0px 2px, yellow 0px 0px 3px, yellow 0px 0px 4px',
|
||||||
image.style.height = '200px';
|
width: '200px',
|
||||||
image.style.margin = '15px';
|
height: '200px',
|
||||||
image.style.cursor = 'pointer';
|
margin: '15px',
|
||||||
image.style.border = '1px solid #555';
|
cursor: 'pointer',
|
||||||
|
border: '1px solid #555'
|
||||||
|
});
|
||||||
image.onclick = function() {
|
image.onclick = function() {
|
||||||
var popUrl = getFormUrl()+encodeURIComponent(imageUrl);
|
var popUrl = getFormUrl()+encodeURIComponent(imageUrl);
|
||||||
window.open(popUrl);
|
window.open(popUrl);
|
||||||
|
|||||||
Reference in New Issue
Block a user