Browse Source

RIP bower

pull/802/head
nanaya 2 years ago
parent
commit
827f9aa17a

+ 0
- 1
.gitignore View File

@@ -18,7 +18,6 @@ Icon*
18 18
 desktop.ini
19 19
 
20 20
 # Bower and node directories
21
-/bower_components
22 21
 /node_modules
23 22
 /npm-debug.log
24 23
 

+ 0
- 1
.travis.yml View File

@@ -2,7 +2,6 @@ cache:
2 2
   directories:
3 3
     - vendor
4 4
     - node_modules
5
-    - bower_components
6 5
     - $HOME/.yarn-cache
7 6
 
8 7
 addons:

+ 0
- 9
bower.json View File

@@ -1,9 +0,0 @@
1
-{
2
-  "name": "osu-web",
3
-  "version": "1.0.0",
4
-  "dependencies": {
5
-    "ResponsiveSlides.js": "latest",
6
-    "jquery-ujs": "~1.2.1",
7
-    "qtip2": "^2.2.1"
8
-  }
9
-}

+ 0
- 1
build.sh View File

@@ -28,5 +28,4 @@ php artisan laroute:generate
28 28
 
29 29
 npm install -g yarn
30 30
 yarn
31
-./node_modules/bower/bin/bower install --allow-root
32 31
 ./node_modules/gulp/bin/gulp.js --production

+ 6
- 6
gulpfile.js View File

@@ -18,10 +18,11 @@
18 18
 */
19 19
 var elixir = require('laravel-elixir');
20 20
 var path = require('path');
21
-var bower_root = '../../../bower_components/'; // relative from resources/assets/*
21
+var util = require('gulp-util');
22
+
23
+// relative from resources/assets/*/
22 24
 var composer_root = '../../../vendor/';
23 25
 var node_root = '../../../node_modules/';
24
-var util = require('gulp-util');
25 26
 
26 27
 /*
27 28
  * The merge rules plugin is kind of buggy and broke safari.
@@ -81,10 +82,9 @@ elixir(function(mix) {
81 82
   ], 'resources/assets/js/build/app-main.js')
82 83
   .scripts([
83 84
     path.join(node_root, 'turbolinks/dist/turbolinks.js'),
84
-    path.join(node_root, 'jquery/dist/jquery.js'),
85
-    path.join(bower_root, 'jquery-ujs/src/rails.js'),
86
-    path.join(bower_root, 'ResponsiveSlides.js/responsiveslides.js'),
87
-    path.join(bower_root, 'qtip2/jquery.qtip.js'),
85
+    path.join(node_root, 'jquery/dist/jquery' + min + '.js'),
86
+    path.join(node_root, 'jquery-ujs/src/rails.js'),
87
+    path.join(node_root, 'qtip2/dist/jquery.qtip' + min + '.js'),
88 88
     path.join(node_root, 'jquery.scrollto/jquery.scrollTo.js'),
89 89
     path.join(node_root, 'jquery-ui/ui/data.js'),
90 90
     path.join(node_root, 'jquery-ui/ui/scroll-parent.js'),

+ 1
- 1
osu!web.sublime-project View File

@@ -3,7 +3,7 @@
3 3
 	[
4 4
 		{
5 5
 			"follow_symlinks": true,
6
-			"folder_exclude_patterns": ["logs", "storage", "bower_components", "public/build", "public/js", ".module-cache", "vendor"],
6
+			"folder_exclude_patterns": ["logs", "storage", "public/build", "public/js", ".module-cache", "vendor"],
7 7
 			"file_exclude_patterns": ["*.css*", "*.min*"],
8 8
 			"path": "."
9 9
 		}

+ 2
- 1
package.json View File

@@ -5,12 +5,12 @@
5 5
     "babel-preset-react": "^6.3.13",
6 6
     "blueimp-file-upload": "^9.11.2",
7 7
     "bootstrap": "^3.3.6",
8
-    "bower": "^1.7.4",
9 8
     "d3": "^3.5.14",
10 9
     "font-awesome": "^4.5.0",
11 10
     "gulp": "^3.9.0",
12 11
     "jquery": "^2.2.0",
13 12
     "jquery-ui": "^1.12.0",
13
+    "jquery-ujs": "^1.2.2",
14 14
     "jquery.scrollto": "^2.1.2",
15 15
     "js-cookie": "^2.1.2",
16 16
     "laravel-elixir": "^5.0.0",
@@ -18,6 +18,7 @@
18 18
     "lodash": "^4.0.0",
19 19
     "moment": "^2.11.1",
20 20
     "photoswipe": "^4.1.1",
21
+    "qtip2": "^3.0.3",
21 22
     "react": "^15.1.0",
22 23
     "react-addons-pure-render-mixin": "^15.1.0",
23 24
     "react-dom": "^15.1.0",

+ 22
- 1
resources/assets/coffee/_classes/gallery.coffee View File

@@ -19,7 +19,11 @@ class @Gallery
19 19
   constructor: ->
20 20
     @pswp = document.getElementsByClassName('pswp')
21 21
 
22
-    $(document).on 'click', '.js-gallery', (e) =>
22
+    $(document).on 'click', '.js-gallery', @initiateOpen
23
+    $(document).on 'click', '.js-gallery-thumbnail', @switchPreview
24
+
25
+
26
+  initiateOpen: (e) =>
23 27
       $target = $(e.currentTarget)
24 28
       return if $target.parents('a').length
25 29
 
@@ -83,3 +87,20 @@ class @Gallery
83 87
         y: center[1] - scaledImageDim[1] / 2
84 88
         w: scaledImageDim[0]
85 89
       }
90
+
91
+
92
+  switchPreview: (e) =>
93
+    e.preventDefault()
94
+
95
+    $link = $(e.currentTarget)
96
+    {galleryId, index} = $link[0].dataset
97
+    $previews = $(".js-gallery[data-gallery-id='#{galleryId}']")
98
+    $links = $(".js-gallery-thumbnail[data-gallery-id='#{galleryId}']")
99
+
100
+    for pair in _.zip($links, $previews)
101
+      if index == pair[0].dataset.index
102
+        pair[0].classList.add 'js-gallery-thumbnail--active'
103
+        Fade.in pair[1]
104
+      else
105
+        pair[0].classList.remove 'js-gallery-thumbnail--active'
106
+        Fade.out pair[1]

+ 0
- 7
resources/assets/coffee/shared.coffee View File

@@ -79,13 +79,6 @@ $(document).on 'click', '#popup-container, #overlay', (e) ->
79 79
 $(document).on 'click', '.pswp a', (e) -> e.preventDefault()
80 80
 
81 81
 
82
-# image slider
83
-$(document).on 'turbolinks:load', ->
84
-  $('.rslides').responsiveSlides
85
-    auto: false
86
-    manualControls: '.rslides-nav'
87
-
88
-
89 82
 ###
90 83
 # Add `disabled` attribute to form element with value _disabled.
91 84
 # Currently used to work around Form::select (in store checkout -

+ 19
- 20
resources/assets/less/app.less View File

@@ -1,22 +1,22 @@
1 1
 /**
2
-*    Copyright 2015 ppy Pty. Ltd.
3
-*
4
-*    This file is part of osu!web. osu!web is distributed with the hope of
5
-*    attracting more community contributions to the core ecosystem of osu!.
6
-*
7
-*    osu!web is free software: you can redistribute it and/or modify
8
-*    it under the terms of the Affero GNU General Public License version 3
9
-*    as published by the Free Software Foundation.
10
-*
11
-*    osu!web is distributed WITHOUT ANY WARRANTY; without even the implied
12
-*    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
-*    See the GNU Affero General Public License for more details.
14
-*
15
-*    You should have received a copy of the GNU Affero General Public License
16
-*    along with osu!web.  If not, see <http://www.gnu.org/licenses/>.
17
-*
18
-*/
19
-@bower_root: "../../../bower_components";
2
+ *    Copyright 2015-2016 ppy Pty. Ltd.
3
+ *
4
+ *    This file is part of osu!web. osu!web is distributed with the hope of
5
+ *    attracting more community contributions to the core ecosystem of osu!.
6
+ *
7
+ *    osu!web is free software: you can redistribute it and/or modify
8
+ *    it under the terms of the Affero GNU General Public License version 3
9
+ *    as published by the Free Software Foundation.
10
+ *
11
+ *    osu!web is distributed WITHOUT ANY WARRANTY; without even the implied
12
+ *    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ *    See the GNU Affero General Public License for more details.
14
+ *
15
+ *    You should have received a copy of the GNU Affero General Public License
16
+ *    along with osu!web.  If not, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ */
19
+
20 20
 @node_root: "../../../node_modules";
21 21
 
22 22
 @import "@{node_root}/font-awesome/less/font-awesome";
@@ -28,8 +28,7 @@
28 28
 @import "@{node_root}/slick-carousel/slick/slick";
29 29
 @import "@{node_root}/slick-carousel/slick/slick-theme";
30 30
 
31
-@import (inline) "@{bower_root}/ResponsiveSlides.js/responsiveslides.css";
32
-@import (inline) "@{bower_root}/qtip2/jquery.qtip.css";
31
+@import (inline) "@{node_root}/qtip2/dist/jquery.qtip.css";
33 32
 @import (inline) "@{node_root}/photoswipe/dist/photoswipe.css";
34 33
 @import "photoswipe-fix";
35 34
 

+ 3
- 2
resources/assets/less/bem-index.less View File

@@ -64,10 +64,10 @@
64 64
 @import "bem/btn-osu-lite";
65 65
 @import "bem/chart";
66 66
 @import "bem/contest";
67
+@import "bem/contest-art-list";
67 68
 @import "bem/contest-list";
68 69
 @import "bem/contest-list-item";
69 70
 @import "bem/contest-list-legend";
70
-@import "bem/contest-art-list";
71 71
 @import "bem/contest-user-entry";
72 72
 @import "bem/contest-user-entry-list";
73 73
 @import "bem/detail-row";
@@ -93,8 +93,9 @@
93 93
 @import "bem/forum-topic-nav";
94 94
 @import "bem/forum-topic-reply";
95 95
 @import "bem/forum-topics";
96
+@import "bem/gallery-previews";
97
+@import "bem/gallery-thumbnails";
96 98
 @import "bem/js-editor-zoom";
97
-@import "bem/js-gallery";
98 99
 @import "bem/js-spoilerbox";
99 100
 @import "bem/kudosu-box";
100 101
 @import "bem/kudosu-entries";

resources/assets/less/bem/js-gallery.less → resources/assets/less/bem/gallery-previews.less View File

@@ -17,10 +17,25 @@
17 17
  *
18 18
  */
19 19
 
20
-.js-gallery {
21
-  cursor: zoom-in;
20
+.gallery-previews {
21
+  @top: gallery-previews;
22 22
 
23
-  a & {
24
-    cursor: inherit;
23
+  padding: 0;
24
+  margin: 0;
25
+
26
+  // mystery number
27
+  height: 390px;
28
+
29
+  &__item {
30
+    .full-size();
31
+    .fade-element(0.5s);
32
+    display: block;
33
+    background-size: cover;
34
+    background-position: 50%;
35
+
36
+    &.js-gallery {
37
+      cursor: zoom-in;
38
+      will-change: opacity;
39
+    }
25 40
   }
26 41
 }

+ 43
- 0
resources/assets/less/bem/gallery-thumbnails.less View File

@@ -0,0 +1,43 @@
1
+/**
2
+ *    Copyright 2015 ppy Pty. Ltd.
3
+ *
4
+ *    This file is part of osu!web. osu!web is distributed with the hope of
5
+ *    attracting more community contributions to the core ecosystem of osu!.
6
+ *
7
+ *    osu!web is free software: you can redistribute it and/or modify
8
+ *    it under the terms of the Affero GNU General Public License version 3
9
+ *    as published by the Free Software Foundation.
10
+ *
11
+ *    osu!web is distributed WITHOUT ANY WARRANTY; without even the implied
12
+ *    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ *    See the GNU Affero General Public License for more details.
14
+ *
15
+ *    You should have received a copy of the GNU Affero General Public License
16
+ *    along with osu!web.  If not, see <http://www.gnu.org/licenses/>.
17
+ *
18
+ */
19
+
20
+.gallery-thumbnails {
21
+  margin: (@spacing / 2) (-@spacing / 2);
22
+  padding: 0;
23
+  display: flex;
24
+  flex-wrap: wrap;
25
+
26
+  &__item {
27
+    .fade-element(0.5s);
28
+    margin: (@spacing / 2);
29
+    display: inline-block;
30
+    width: 50px;
31
+    height: 50px;
32
+    flex: none;
33
+    background-size: cover;
34
+    background-position: center;
35
+
36
+    opacity: 0.5;
37
+
38
+    &:hover,
39
+    &.js-gallery-thumbnail--active {
40
+      opacity: 1;
41
+    }
42
+  }
43
+}

+ 0
- 31
resources/assets/less/store/base.less View File

@@ -273,34 +273,3 @@ table.order-line-items {
273 273
 #new-address-switch {
274 274
   margin-top: 20px;
275 275
 }
276
-
277
-#product-slides {
278
-  a {
279
-    display: block;
280
-    height: 390px;
281
-    background-size: cover;
282
-    background-position: 50%;
283
-  }
284
-}
285
-#product-slides-nav {
286
-  list-style-type: none;
287
-  margin: @grid-gutter-width/4 -@grid-gutter-width/8;
288
-
289
-  padding: 0px;
290
-
291
-  li {
292
-    padding: 0px @grid-gutter-width/8;
293
-    display: inline-block;
294
-
295
-    opacity: 0.5;
296
-    &:hover, &.rslides_here { opacity: 1; }
297
-    .fade-element(0.5s);
298
-
299
-    div {
300
-      width: 50px;
301
-      height: 50px;
302
-      background-size: cover;
303
-      background-position: 50%;
304
-    }
305
-  }
306
-}

+ 20
- 13
resources/views/store/product.blade.php View File

@@ -50,29 +50,36 @@
50 50
             @else
51 51
             <div class="row">
52 52
                 <div class="col-md-6">
53
-                    <ul id="product-slides" class="rslides">
53
+                    <div class="gallery-previews">
54 54
                         @foreach($product->images() as $i => $image)
55
-                        <li>
56 55
                             <?php $imageSize = fast_imagesize($image[1]); ?>
57 56
                             <a
58
-                                class="js-gallery"
57
+                                class="gallery-previews__item js-gallery"
59 58
                                 data-width="{{ $imageSize[0] }}"
60 59
                                 data-height="{{ $imageSize[1] }}"
61 60
                                 data-gallery-id="product-{{ $product->product_id }}"
62 61
                                 data-index="{{ $i }}"
63 62
                                 href="{{ $image[1] }}"
64
-                                style="background-image: url('{{ $image[1] }}');">
65
-                            </a>
66
-                        </li>
63
+                                style="background-image: url('{{ $image[1] }}');"
64
+                                data-visibility="{{ $loop->first ? '' : 'hidden' }}"
65
+                            ></a>
67 66
                         @endforeach
68
-                    </ul>
69
-                    <ul id="product-slides-nav" class="rslides-nav">
70
-                        @foreach($product->images() as $image)
71
-                        <li>
72
-                            <a href="#"><div style="background-image: url('{{ $image[0] }}');"></div></a>
73
-                        </li>
67
+                    </div>
68
+                    <div class="gallery-thumbnails">
69
+                        @foreach($product->images() as $i => $image)
70
+                            <a
71
+                                href="#"
72
+                                style="background-image: url('{{ $image[0] }}');"
73
+                                class="
74
+                                    gallery-thumbnails__item
75
+                                    js-gallery-thumbnail
76
+                                    {{ $loop->first ? 'js-gallery-thumbnail--active' : '' }}
77
+                                "
78
+                                data-gallery-id="product-{{ $product->product_id }}"
79
+                                data-index="{{ $i }}"
80
+                            ></a>
74 81
                         @endforeach
75
-                    </ul>
82
+                    </div>
76 83
                 </div>
77 84
                 <div class="col-md-6">
78 85
                     <div class="row">

+ 28
- 9
yarn.lock View File

@@ -862,10 +862,6 @@ bootstrap@^3.3.6:
862 862
   version "3.3.7"
863 863
   resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-3.3.7.tgz#5a389394549f23330875a3b150656574f8a9eb71"
864 864
 
865
-bower@^1.7.4:
866
-  version "1.7.9"
867
-  resolved "https://registry.yarnpkg.com/bower/-/bower-1.7.9.tgz#b7296c2393e0d75edaa6ca39648132dd255812b0"
868
-
869 865
 brace-expansion@^1.0.0:
870 866
   version "1.1.6"
871 867
   resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9"
@@ -1963,6 +1959,10 @@ etag@^1.7.0, etag@~1.7.0:
1963 1959
   version "1.7.0"
1964 1960
   resolved "https://registry.yarnpkg.com/etag/-/etag-1.7.0.tgz#03d30b5f67dd6e632d2945d30d6652731a34d5d8"
1965 1961
 
1962
+ev-emitter@~1.0.0:
1963
+  version "1.0.3"
1964
+  resolved "https://registry.yarnpkg.com/ev-emitter/-/ev-emitter-1.0.3.tgz#ee5ef74b6ed28d911b32ddcbfc97867f580937bc"
1965
+
1966 1966
 eventemitter3@1.x.x:
1967 1967
   version "1.2.0"
1968 1968
   resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-1.2.0.tgz#1c86991d816ad1e504750e73874224ecf3bec508"
@@ -2131,7 +2131,7 @@ for-in@^0.1.5:
2131 2131
   version "0.1.6"
2132 2132
   resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.6.tgz#c9f96e89bfad18a545af5ec3ed352a1d9e5b4dc8"
2133 2133
 
2134
-for-own@^0.1.3:
2134
+for-own@^0.1.4:
2135 2135
   version "0.1.4"
2136 2136
   resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.4.tgz#0149b41a39088c7515f51ebe1c1386d45f935072"
2137 2137
   dependencies:
@@ -2807,6 +2807,12 @@ image-size@~0.5.0:
2807 2807
   version "0.5.0"
2808 2808
   resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.0.tgz#be7aed1c37b5ac3d9ba1d66a24b4c47ff8397651"
2809 2809
 
2810
+imagesloaded@>=3.0.0:
2811
+  version "4.1.1"
2812
+  resolved "https://registry.yarnpkg.com/imagesloaded/-/imagesloaded-4.1.1.tgz#53b5b66615360850a5a264b1293e7f4d06d3bd51"
2813
+  dependencies:
2814
+    ev-emitter "~1.0.0"
2815
+
2810 2816
 immutable@3.8.1, immutable@^3.7.6:
2811 2817
   version "3.8.1"
2812 2818
   resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.1.tgz#200807f11ab0f72710ea485542de088075f68cd2"
@@ -3113,13 +3119,19 @@ jquery-ui@^1.12.0:
3113 3119
   version "1.12.1"
3114 3120
   resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.12.1.tgz#bcb4045c8dd0539c134bc1488cdd3e768a7a9e51"
3115 3121
 
3122
+jquery-ujs:
3123
+  version "1.2.2"
3124
+  resolved "https://registry.yarnpkg.com/jquery-ujs/-/jquery-ujs-1.2.2.tgz#6a8ef1020e6b6dda385b90a4bddc128c21c56397"
3125
+  dependencies:
3126
+    jquery ">=1.8.0"
3127
+
3116 3128
 jquery.scrollto@^2.1.2:
3117 3129
   version "2.1.2"
3118 3130
   resolved "https://registry.yarnpkg.com/jquery.scrollto/-/jquery.scrollto-2.1.2.tgz#e7580d9c7ac46ef5bb25319483f6f45713fd7c6c"
3119 3131
   dependencies:
3120 3132
     jquery ">=1.8"
3121 3133
 
3122
-jquery@>=1.2.3, jquery@>=1.7.2, jquery@>=1.8:
3134
+jquery@>=1.2.3, jquery@>=1.6.0, jquery@>=1.7.2, jquery@>=1.8, jquery@>=1.8.0:
3123 3135
   version "3.1.1"
3124 3136
   resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.1.1.tgz#347c1c21c7e004115e0a4da32cece041fad3c8a3"
3125 3137
 
@@ -3977,10 +3989,10 @@ object-path@^0.9.0:
3977 3989
   resolved "https://registry.yarnpkg.com/object-path/-/object-path-0.9.2.tgz#0fd9a74fc5fad1ae3968b586bda5c632bd6c05a5"
3978 3990
 
3979 3991
 object.omit@^2.0.0:
3980
-  version "2.0.0"
3981
-  resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.0.tgz#868597333d54e60662940bb458605dd6ae12fe94"
3992
+  version "2.0.1"
3993
+  resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa"
3982 3994
   dependencies:
3983
-    for-own "^0.1.3"
3995
+    for-own "^0.1.4"
3984 3996
     is-extendable "^0.1.1"
3985 3997
 
3986 3998
 on-finished@~2.3.0:
@@ -4521,6 +4533,13 @@ qs@~5.2.0:
4521 4533
   version "5.2.1"
4522 4534
   resolved "https://registry.yarnpkg.com/qs/-/qs-5.2.1.tgz#801fee030e0b9450d6385adc48a4cc55b44aedfc"
4523 4535
 
4536
+qtip2@^3.0.3:
4537
+  version "3.0.3"
4538
+  resolved "https://registry.yarnpkg.com/qtip2/-/qtip2-3.0.3.tgz#7df088ae4412c24a4064de69e824cb3cf76210dc"
4539
+  dependencies:
4540
+    imagesloaded ">=3.0.0"
4541
+    jquery ">=1.6.0"
4542
+
4524 4543
 query-string@^4.1.0:
4525 4544
   version "4.2.3"
4526 4545
   resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.2.3.tgz#9f27273d207a25a8ee4c7b8c74dcd45d556db822"

Loading…
Cancel
Save