-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from hatnote/dev
version 17.04.01
- Loading branch information
Showing
45 changed files
with
1,882 additions
and
461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import './image.scss'; | ||
import imageTemplate from './image.tpl.html'; | ||
|
||
const ImageService = ($mdDialog, $timeout) => { | ||
const service = { | ||
openImage, | ||
}; | ||
|
||
return service; | ||
|
||
// | ||
|
||
function openImage(params) { | ||
return $mdDialog.show({ | ||
parent: angular.element(document.body), | ||
targetEvent: params.event, | ||
clickOutsideToClose: true, | ||
template: imageTemplate, | ||
controller: ($scope) => { | ||
const list = params.list; | ||
const vm = $scope; | ||
|
||
vm.close = () => $mdDialog.hide(); | ||
vm.image = params.image; | ||
vm.keyDown = keyDown; | ||
vm.nextImage = nextImage; | ||
vm.prevImage = prevImage; | ||
|
||
init(); | ||
$timeout(() => { vm.loaded = true; }, 150); | ||
|
||
function init() { | ||
vm.author = vm.image.extmetadata.Artist ? vm.image.extmetadata.Artist.value : ''; | ||
vm.date = vm.image.extmetadata.DateTime ? new Date(vm.image.extmetadata.DateTime.value) : ''; | ||
vm.description = vm.image.extmetadata.ImageDescription ? vm.image.extmetadata.ImageDescription.value : ''; | ||
vm.license = vm.image.extmetadata.LicenseShortName ? vm.image.extmetadata.LicenseShortName.value : ''; | ||
} | ||
|
||
function keyDown(key) { | ||
if (key.keyCode === 39) { nextImage(); } | ||
if (key.keyCode === 37) { prevImage(); } | ||
} | ||
|
||
function nextImage() { | ||
let currentIndex = list.indexOf(vm.image); | ||
if (currentIndex > -1) { | ||
currentIndex = currentIndex + 1 === list.length ? 0 : currentIndex + 1; | ||
vm.image = list[currentIndex]; | ||
init(); | ||
} | ||
} | ||
|
||
function prevImage() { | ||
let currentIndex = list.indexOf(vm.image); | ||
if (currentIndex > -1) { | ||
currentIndex = currentIndex ? currentIndex - 1 : list.length - 1; | ||
vm.image = list[currentIndex]; | ||
init(); | ||
} | ||
} | ||
}, | ||
}); | ||
} | ||
}; | ||
|
||
export default () => { | ||
angular | ||
.module('monumental') | ||
.factory('imageService', ImageService) | ||
.filter('htmlToPlaintext', () => text => angular.element(`<div>${text}</div>`).text()); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
@import '../../styles/variables'; | ||
@import '../../styles/responsive'; | ||
|
||
.dialog__image { | ||
min-width: 80%; | ||
border-radius: 0 !important; | ||
|
||
@include x-small { | ||
width: 100vw; min-width: 100vw; max-width: 100vw; | ||
height: 100%; min-height: 100%; max-height: 100%; | ||
} | ||
|
||
md-dialog-content { | ||
overflow: hidden; | ||
|
||
@include x-small { overflow: visible; } | ||
} | ||
|
||
.dialog__close { | ||
position: absolute; | ||
width: 70px; | ||
height: 70px; | ||
top: 0; | ||
right: 0; | ||
margin: 0; | ||
padding: 15px; | ||
opacity: .75; | ||
} | ||
|
||
.dialog__image-container { | ||
position: relative; | ||
background: black; | ||
min-height: 80vh; | ||
text-align: center; | ||
|
||
@include x-small { min-height: 100vh; } | ||
|
||
img { | ||
max-width: 100%; | ||
max-height: 100%; | ||
width: auto; | ||
height: auto; | ||
} | ||
|
||
.md-button md-icon.material-icons { | ||
width: 40px; | ||
height: 40px; | ||
color: white; | ||
font-size: 40px; | ||
} | ||
|
||
.md-button[disabled] md-icon.material-icons { | ||
opacity: .5; | ||
} | ||
} | ||
|
||
.dialog__image-description { | ||
background: white; | ||
width: 250px; | ||
padding: 20px; | ||
overflow: scroll; | ||
|
||
@include x-small { | ||
width: auto; | ||
overflow: visible; | ||
} | ||
|
||
.md-title { | ||
margin-top: 0; | ||
} | ||
|
||
.md-2-line { | ||
padding: 0; | ||
|
||
.material-icons { | ||
margin-right: 20px; | ||
margin-left: 5px; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<md-dialog class="dialog__image" ng-keydown="keyDown($event)"> | ||
<form ng-cloak> | ||
<md-dialog-content layout="row" layout-align="start stretch" | ||
layout-xs="column" layout-align-xs="start stretch"> | ||
<div class="dialog__image-container" flex flex-xs="none" | ||
layout="row" layout-align="center center" | ||
ng-swipe-right="nextImage()" | ||
ng-swipe-left="prevImage()"> | ||
<md-button class="md-icon-button dialog__close" ng-click="close()"> | ||
<md-icon>close</md-icon> | ||
</md-button> | ||
<img load-src="{{ image.thumburlbig }}"> | ||
</div> | ||
<div class="dialog__image-description" | ||
layout="column" layout-align="start stretch"> | ||
<h2 class="md-title">{{ (description || image.canonicaltitle) | htmlToPlaintext }}</h2> | ||
<div>{{ author | htmlToPlaintext }} / {{ license }}</div> | ||
<md-list flex> | ||
<md-list-item class="md-2-line"> | ||
<md-icon> | ||
cloud_upload | ||
<md-tooltip>File upload date</md-tooltip> | ||
</md-icon> | ||
<div class="md-list-item-text"> | ||
<h3>{{ date | date }}</h3> | ||
<p>{{ date | date:'EEEE' }}, {{ date | date:'H:mm' }}</p> | ||
</div> | ||
</md-list-item> | ||
<md-list-item class="md-2-line"> | ||
<md-icon> | ||
image | ||
<md-tooltip>File resolution</md-tooltip> | ||
</md-icon> | ||
<div class="md-list-item-text"> | ||
<h3>{{ (image.width * image.height) / 1000000 | number:2 }} Mpix</h3> | ||
<p>{{ image.width }} × {{ image.height }}</p> | ||
</div> | ||
</md-list-item> | ||
<md-divider></md-divider> | ||
<md-list-item class="md-2-line"> | ||
<md-button class="md-primary" flex | ||
ng-href="{{ image.descriptionurl }}" target="_blank"> | ||
Wikimedia Commons | ||
</md-button> | ||
</md-list-item> | ||
</md-list> | ||
<div flex></div> | ||
</div> | ||
</md-dialog-content> | ||
</form> | ||
</md-dialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.