From bf8c8f3b5a1e8d5ce1eea6053d607d265166765f Mon Sep 17 00:00:00 2001 From: Mahmoud Felfel Date: Tue, 16 Jun 2015 16:46:05 +0400 Subject: [PATCH 1/3] image_comparison: add twentytwenty library files --- css/twentytwenty.css | 216 ++++++++++++++ gallery.html | 4 + js/jquery.event.move.js | 586 ++++++++++++++++++++++++++++++++++++++ js/jquery.twentytwenty.js | 103 +++++++ lib/gallery.js | 31 +- package.json | 3 +- 6 files changed, 941 insertions(+), 2 deletions(-) create mode 100644 css/twentytwenty.css create mode 100644 js/jquery.event.move.js create mode 100644 js/jquery.twentytwenty.js diff --git a/css/twentytwenty.css b/css/twentytwenty.css new file mode 100644 index 0000000..f8944fd --- /dev/null +++ b/css/twentytwenty.css @@ -0,0 +1,216 @@ +.twentytwenty-horizontal .twentytwenty-handle:before, .twentytwenty-horizontal .twentytwenty-handle:after, .twentytwenty-vertical .twentytwenty-handle:before, .twentytwenty-vertical .twentytwenty-handle:after { + content: " "; + display: block; + background: white; + position: absolute; + z-index: 30; + -webkit-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); } + +.twentytwenty-horizontal .twentytwenty-handle:before, .twentytwenty-horizontal .twentytwenty-handle:after { + width: 3px; + height: 9999px; + left: 50%; + margin-left: -1.5px; } + +.twentytwenty-vertical .twentytwenty-handle:before, .twentytwenty-vertical .twentytwenty-handle:after { + width: 9999px; + height: 3px; + top: 50%; + margin-top: -1.5px; } + +.twentytwenty-before-label, .twentytwenty-after-label, .twentytwenty-overlay { + position: fixed; + top: 50%; + width: 50%; + height: 0; +} + +.twentytwenty-before-label, .twentytwenty-after-label, .twentytwenty-overlay { + -webkit-transition-duration: 0.5s; + -moz-transition-duration: 0.5s; + transition-duration: 0.5s; } + +.twentytwenty-before-label, .twentytwenty-after-label { + -webkit-transition-property: opacity; + -moz-transition-property: opacity; + transition-property: opacity; } + +.twentytwenty-before-label:before, .twentytwenty-after-label:before { + color: white; + font-size: 13px; + letter-spacing: 0.1em; } + +.twentytwenty-before-label:before, .twentytwenty-after-label:before { + position: absolute; + background: rgba(0, 0, 0, 0.2); + line-height: 38px; + padding: 0 20px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + display: block !important; +} + +.twentytwenty-horizontal .twentytwenty-before-label:before, .twentytwenty-horizontal .twentytwenty-after-label:before { + top: 50%; + margin-top: -19px; } + +.twentytwenty-vertical .twentytwenty-before-label:before, .twentytwenty-vertical .twentytwenty-after-label:before { + left: 50%; + margin-left: -45px; + text-align: center; + width: 90px; } + +.twentytwenty-left-arrow, .twentytwenty-right-arrow, .twentytwenty-up-arrow, .twentytwenty-down-arrow { + width: 0; + height: 0; + border: 6px inset transparent; + position: absolute; } + +.twentytwenty-left-arrow, .twentytwenty-right-arrow { + top: 50%; + margin-top: -6px; } + +.twentytwenty-up-arrow, .twentytwenty-down-arrow { + left: 50%; + margin-left: -6px; } + +.twentytwenty-container { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + z-index: 0; + overflow: scroll; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + width: 50%; + /* margin: 0 auto; */ + /*height: 600px !important;*/ +} + .twentytwenty-container img { + max-width: 100%; + position: absolute; + top: 0; + display: block; + width: 100%; +} + .twentytwenty-container.active .twentytwenty-overlay, .twentytwenty-container.active :hover.twentytwenty-overlay { + background: rgba(0, 0, 0, 0); } + .twentytwenty-container.active .twentytwenty-overlay .twentytwenty-before-label, + .twentytwenty-container.active .twentytwenty-overlay .twentytwenty-after-label, .twentytwenty-container.active :hover.twentytwenty-overlay .twentytwenty-before-label, + .twentytwenty-container.active :hover.twentytwenty-overlay .twentytwenty-after-label { + opacity: 0; } + .twentytwenty-container * { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; } + +.twentytwenty-before-label { + /* opacity: 0; */ } + .twentytwenty-before-label:before { + content: "Before"; } + +.twentytwenty-after-label { + /* opacity: 0; */ } + .twentytwenty-after-label:before { + content: "After"; } + +.twentytwenty-horizontal .twentytwenty-before-label:before { + left: 10px; } + +.twentytwenty-horizontal .twentytwenty-after-label:before { + right: 10px; } + +.twentytwenty-vertical .twentytwenty-before-label:before { + top: 10px; } + +.twentytwenty-vertical .twentytwenty-after-label:before { + bottom: 10px; } + +.twentytwenty-overlay { + -webkit-transition-property: background; + -moz-transition-property: background; + transition-property: background; + background: transparent; + z-index: 25; } + .twentytwenty-overlay:hover { + background: rgba(0, 0, 0, 0.5); } + .twentytwenty-overlay:hover .twentytwenty-after-label { + opacity: 1; } + .twentytwenty-overlay:hover .twentytwenty-before-label { + opacity: 1; } + +.twentytwenty-before { + z-index: 20; } + +.twentytwenty-after { + z-index: 10; } + +.twentytwenty-handle { + height: 38px; + width: 38px; + position: fixed; + left: 50%; + top: 50%; + margin-left: -22px; + margin-top: -22px; + border: 3px solid white; + -webkit-border-radius: 1000px; + -moz-border-radius: 1000px; + border-radius: 1000px; + -webkit-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0px 0px 12px rgba(51, 51, 51, 0.5); + z-index: 40; + cursor: pointer; + background: rgba(0, 0, 0, 0.51); +} + +.twentytwenty-horizontal .twentytwenty-handle:before { + bottom: 50%; + margin-bottom: 22px; + -webkit-box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0 3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } +.twentytwenty-horizontal .twentytwenty-handle:after { + top: 50%; + margin-top: 22px; + -webkit-box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 0 -3px 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } + +.twentytwenty-vertical .twentytwenty-handle:before { + left: 50%; + margin-left: 22px; + -webkit-box-shadow: 3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: 3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: 3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } +.twentytwenty-vertical .twentytwenty-handle:after { + right: 50%; + margin-right: 22px; + -webkit-box-shadow: -3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + -moz-box-shadow: -3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); + box-shadow: -3px 0 0 white, 0px 0px 12px rgba(51, 51, 51, 0.5); } + +.twentytwenty-left-arrow { + border-right: 6px solid white; + left: 50%; + margin-left: -17px; } + +.twentytwenty-right-arrow { + border-left: 6px solid white; + right: 50%; + margin-right: -17px; } + +.twentytwenty-up-arrow { + border-bottom: 6px solid white; + top: 50%; + margin-top: -17px; } + +.twentytwenty-down-arrow { + border-top: 6px solid white; + bottom: 50%; + margin-bottom: -17px; } diff --git a/gallery.html b/gallery.html index 48fa176..6447039 100644 --- a/gallery.html +++ b/gallery.html @@ -1,6 +1,10 @@ + + + + - Screenshots - {{project}} - - -
- -
-
-
-

Screenshots:

- -
-
-
- {{#images}} - {{#dir}} -
- -

/{{#resolve}}{{dir}}{{/resolve}}

-
- {{/dir}} -
-

{{size}}px

-
- - - -

{{#resolve}}{{base}}{{/resolve}}

-
-
- - - -

{{#resolve}}{{compare}}{{/resolve}}

-
-
- - - -

diff

-

{{#contents}}{{diff}}{{/contents}}%

-
-
- {{/images}} -
-
-
- + + + + + + + + + Screenshots - {{project}} + + + +
+
+ +
+
+
+

Screenshots:

+ +
+
+
+ {{#images}} {{#dir}} +
+ +

/{{#resolve}}{{dir}}{{/resolve}}

+
+ {{/dir}} +
+

{{size}}px

+
+ + + +

{{#resolve}}{{base}}{{/resolve}}

+
+
+ + + +

{{#resolve}}{{compare}}{{/resolve}}

+
+
+ + + +

diff

+

{{#contents}}{{diff}}{{/contents}}%

+
+
+ {{/images}} +
+
+
+ + + From 6876a50a4dd04358603a3806791dd9803eb84b13 Mon Sep 17 00:00:00 2001 From: Mahmoud Felfel Date: Sun, 9 Aug 2015 14:43:46 +0400 Subject: [PATCH 3/3] minor fix in package.json file --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c66ac95..4cc03c6 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "rimraf": "~2.2.6", "w3counter": "^1.0.3", "webshot": "^0.15.3", - "mkdirp": "^0.3.5", + "mkdirp": "^0.3.5" }, "devDependencies": { "jshint": "^2.5.11",