diff --git a/web/react/components/view_image.jsx b/web/react/components/view_image.jsx
index be25aa10c2..2b7f64030a 100644
--- a/web/react/components/view_image.jsx
+++ b/web/react/components/view_image.jsx
@@ -6,6 +6,13 @@ var utils = require('../utils/utils.jsx');
module.exports = React.createClass({
displayName: 'ViewImageModal',
+ propTypes: {
+ filenames: React.PropTypes.array,
+ modalId: React.PropTypes.string,
+ channelId: React.PropTypes.string,
+ userId: React.PropTypes.string,
+ startId: React.PropTypes.number
+ },
canSetState: false,
handleNext: function() {
var id = this.state.imgId + 1;
@@ -56,8 +63,8 @@ module.exports = React.createClass({
progress[id] = img.completedPercentage;
self.setState({progress: progress});
});
- img.onload = function(imgid) {
- return function() {
+ img.onload = function onload(imgid) {
+ return function onloadReturn() {
var loaded = self.state.loaded;
loaded[imgid] = true;
self.setState({loaded: loaded});
@@ -83,21 +90,21 @@ module.exports = React.createClass({
},
componentDidMount: function() {
var self = this;
- $('#' + this.props.modalId).on('shown.bs.modal', function() {
+ $('#' + this.props.modalId).on('shown.bs.modal', function onModalShow() {
self.setState({viewed: true});
self.loadImage(self.state.imgId);
});
- $(this.refs.modal.getDOMNode()).click(function(e) {
+ $(this.refs.modal.getDOMNode()).click(function onModalClick(e) {
if (e.target === this || e.target === self.refs.imageBody.getDOMNode()) {
$('.image_modal').modal('hide');
}
});
$(this.refs.imageWrap.getDOMNode()).hover(
- function() {
+ function onModalHover() {
$(self.refs.imageFooter.getDOMNode()).addClass('footer--show');
- }, function() {
+ }, function offModalHover() {
$(self.refs.imageFooter.getDOMNode()).removeClass('footer--show');
}
);
@@ -117,10 +124,14 @@ module.exports = React.createClass({
data.user_id = this.props.userId;
data.filename = this.props.filenames[this.state.imgId];
Client.getPublicLink(data,
- function(serverData) {
- window.open(serverData.public_link);
+ function sucess(serverData) {
+ if (utils.isMobile()) {
+ window.location.href = serverData.public_link;
+ } else {
+ window.open(serverData.public_link);
+ }
},
- function() {
+ function error() {
}
);
},
@@ -145,7 +156,7 @@ module.exports = React.createClass({
getInitialState: function() {
var loaded = [];
var progress = [];
- for (var i = 0; i < this.props.filenames.length; i ++) {
+ for (var i = 0; i < this.props.filenames.length; i++) {
loaded.push(false);
progress.push(0);
}
@@ -198,7 +209,7 @@ module.exports = React.createClass({
if (!(filename in this.state.fileSizes)) {
var self = this;
- utils.getFileSize(utils.getFileUrl(filename), function(fileSize) {
+ utils.getFileSize(utils.getFileUrl(filename), function fileSizeOp(fileSize) {
if (self.canSetState) {
var fileSizes = self.state.fileSizes;
fileSizes[filename] = fileSize;
@@ -210,14 +221,20 @@ module.exports = React.createClass({
} else {
// display a progress indicator when the preview for an image is still loading
var percentage = Math.floor(this.state.progress[this.state.imgId]);
- content = (
-
-

- { percentage > 0 ?
-
{'Previewing ' + percentage + '%'}
- : ''}
-
- );
+ if (percentage) {
+ content = (
+
+

+
{'Previewing ' + percentage + '%'}
+
+ );
+ } else {
+ content = (
+
+

+
+ );
+ }
bgClass = 'black-bg';
}
diff --git a/web/sass-files/sass/partials/_base.scss b/web/sass-files/sass/partials/_base.scss
index 78006ff189..5b68b488f5 100644
--- a/web/sass-files/sass/partials/_base.scss
+++ b/web/sass-files/sass/partials/_base.scss
@@ -24,6 +24,7 @@ body {
height: 100%;
> .row.main {
height: 100%;
+ position: relative;
}
}
> .container-fluid {
diff --git a/web/sass-files/sass/partials/_files.scss b/web/sass-files/sass/partials/_files.scss
index 65775f01ee..9bf6fd83a5 100644
--- a/web/sass-files/sass/partials/_files.scss
+++ b/web/sass-files/sass/partials/_files.scss
@@ -194,11 +194,12 @@
border-right: 1px solid #ddd;
vertical-align: center;
- // helper to center the image icon in the preview window
- .file-details__preview-helper {
- height: 100%;
- display: inline-block;
- vertical-align: middle;
- }
- }
+ // helper to center the image icon in the preview window
+ .file-details__preview-helper {
+ height: 100%;
+ display: inline-block;
+ vertical-align: middle;
}
+ }
+}
+
diff --git a/web/sass-files/sass/partials/_post.scss b/web/sass-files/sass/partials/_post.scss
index 98b17120d4..bbf36ea934 100644
--- a/web/sass-files/sass/partials/_post.scss
+++ b/web/sass-files/sass/partials/_post.scss
@@ -106,6 +106,39 @@ body.ios {
}
}
+.file-overlay {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ background-color: rgba(0, 0, 0, 0.6);
+ text-align: center;
+ color: #FFF;
+ display: table;
+ font-size: 1.7em;
+ font-weight: 600;
+ z-index: 6;
+
+ > div {
+ display: table-cell;
+ vertical-align: middle;
+ }
+
+ .fa {
+ display: block;
+ font-size: 2em;
+ margin: 0 0 0.3em;
+ }
+
+ .invisible {
+ visibility: hidden;
+ }
+ .visible {
+ visibility: visible;
+ }
+}
+
#post-list {
.post-list-holder-by-time {
background: #fff;
diff --git a/web/sass-files/sass/partials/_responsive.scss b/web/sass-files/sass/partials/_responsive.scss
index 47b2b6bd74..52bb5eae64 100644
--- a/web/sass-files/sass/partials/_responsive.scss
+++ b/web/sass-files/sass/partials/_responsive.scss
@@ -189,6 +189,9 @@
}
@media screen and (max-width: 960px) {
+ .center-file-overlay {
+ font-size: 1.5em;
+ }
.post {
.post-header .post-header-col.post-header__reply {
.comment-icon__container__hide {
@@ -240,6 +243,9 @@
}
}
@media screen and (max-width: 768px) {
+ .center-file-overlay {
+ font-size: 1.3em;
+ }
.date-separator, .new-separator {
&.hovered--after {
&:before {
diff --git a/web/static/js/jquery-dragster/LICENSE b/web/static/js/jquery-dragster/LICENSE
new file mode 100644
index 0000000000..b8b51dc0bc
--- /dev/null
+++ b/web/static/js/jquery-dragster/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Jan Martin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/web/static/js/jquery-dragster/README.md b/web/static/js/jquery-dragster/README.md
new file mode 100644
index 0000000000..1c28adaf09
--- /dev/null
+++ b/web/static/js/jquery-dragster/README.md
@@ -0,0 +1,17 @@
+Include [jquery.dragster.js](https://rawgithub.com/catmanjan/jquery-dragster/master/jquery.dragster.js) in page.
+
+Works in IE.
+
+```javascript
+$('.element').dragster({
+ enter: function (dragsterEvent, event) {
+ $(this).addClass('hover');
+ },
+ leave: function (dragsterEvent, event) {
+ $(this).removeClass('hover');
+ },
+ drop: function (dragsterEvent, event) {
+ $(this).removeClass('hover');
+ }
+});
+```
\ No newline at end of file
diff --git a/web/static/js/jquery-dragster/jquery.dragster.js b/web/static/js/jquery-dragster/jquery.dragster.js
new file mode 100644
index 0000000000..db73fe3f09
--- /dev/null
+++ b/web/static/js/jquery-dragster/jquery.dragster.js
@@ -0,0 +1,85 @@
+// 1.0.3
+/*
+The MIT License (MIT)
+
+Copyright (c) 2015 Jan Martin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+(function ($) {
+
+ $.fn.dragster = function (options) {
+ var settings = $.extend({
+ enter: $.noop,
+ leave: $.noop,
+ over: $.noop,
+ drop: $.noop
+ }, options);
+
+ return this.each(function () {
+ var first = false,
+ second = false,
+ $this = $(this);
+
+ $this.on({
+ dragenter: function (event) {
+ if (first) {
+ second = true;
+ return;
+ } else {
+ first = true;
+ $this.trigger('dragster:enter', event);
+ }
+ event.preventDefault();
+ },
+ dragleave: function (event) {
+ if (second) {
+ second = false;
+ } else if (first) {
+ first = false;
+ }
+ if (!first && !second) {
+ $this.trigger('dragster:leave', event);
+ }
+ event.preventDefault();
+ },
+ dragover: function (event) {
+ $this.trigger('dragster:over', event);
+ event.preventDefault();
+ },
+ drop: function (event) {
+ if (second) {
+ second = false;
+ } else if (first) {
+ first = false;
+ }
+ if (!first && !second) {
+ $this.trigger('dragster:drop', event);
+ }
+ event.preventDefault();
+ },
+ 'dragster:enter': settings.enter,
+ 'dragster:leave': settings.leave,
+ 'dragster:over': settings.over,
+ 'dragster:drop': settings.drop
+ });
+ });
+ };
+
+}(jQuery));
diff --git a/web/templates/head.html b/web/templates/head.html
index 7a7d4fe8e8..dd5e9f46e6 100644
--- a/web/templates/head.html
+++ b/web/templates/head.html
@@ -32,6 +32,8 @@
+
+