Просмотр исходного кода

Parse vegas.*.css to find available transitions

Jay Salvat 10 лет назад
Родитель
Сommit
618e7a1b30
4 измененных файлов с 10 добавлено и 6 удалено
  1. 5 3
      dist/vegas.js
  2. 1 1
      dist/vegas.min.js
  3. 0 0
      dist/vegas.min.js.map
  4. 4 2
      src/vegas.js

+ 5 - 3
dist/vegas.js

@@ -1,6 +1,6 @@
 /*!-----------------------------------------------------------------------------
  * Vegas - Fullscreen Backgrounds and Slideshows.
- * v2.0.0-wip - built 2015-01-18
+ * v2.0.0-wip - built 2015-01-20
  * Licensed under the MIT License.
  * http://vegas.jaysalvat.com/
  * ----------------------------------------------------------------------------
@@ -71,13 +71,15 @@
             var sheet = document.styleSheets[i],
                 rules = sheet.rules ? sheet.rules : sheet.cssRules;
 
-            if (/vegas(\.min)?\.css$/.test(sheet.href)) {
+            if (/vegas(\..*?)?(\.min)?\.css$/.test(sheet.href)) {
                 for (var j = 0; j < rules.length; j++) {
                     var rule  = rules[j],
                         match = /vegas\-transition\-(.*)-|\b/gi.exec(rule.selectorText);
                 
                     if (match && match[1]) {
-                        this.transitions.push(match[1]);
+                        if (this.transitions.indexOf(match[1]) === -1) {
+                            this.transitions.push(match[1]);
+                        }
                     }
                 }
             }

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/vegas.min.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
dist/vegas.min.js.map


+ 4 - 2
src/vegas.js

@@ -62,13 +62,15 @@
             var sheet = document.styleSheets[i],
                 rules = sheet.rules ? sheet.rules : sheet.cssRules;
 
-            if (/vegas(\.min)?\.css$/.test(sheet.href)) {
+            if (/vegas(\..*?)?(\.min)?\.css$/.test(sheet.href)) {
                 for (var j = 0; j < rules.length; j++) {
                     var rule  = rules[j],
                         match = /vegas\-transition\-(.*)-|\b/gi.exec(rule.selectorText);
                 
                     if (match && match[1]) {
-                        this.transitions.push(match[1]);
+                        if (this.transitions.indexOf(match[1]) === -1) {
+                            this.transitions.push(match[1]);
+                        }
                     }
                 }
             }

Некоторые файлы не были показаны из-за большого количества измененных файлов