Browse code

Remove old version 5

Benjamin Roth authored on14/03/2021 15:27:00
Showing1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,60 +0,0 @@
1
-/// Urlencode the SVG string
2
-/// @param {String} $svg - SVG image to encode
3
-/// @return {String} - Encoded SVG data uri
4
-@function swiper-svg-uri($svg) {
5
-  $encoded: '';
6
-  $chunkSize: 2048;
7
-  $index: 0;
8
-  $loops: ceil(str-length($svg) / $chunkSize);
9
-
10
-  $map: (
11
-   "%": "%25",
12
-   "<": "%3C",
13
-   ">": "%3E",
14
-   " ": "%20",
15
-   "!": "%21",
16
-   "*": "%2A",
17
-   '"': "%22",
18
-   ";": "%3B",
19
-   ":": "%3A",
20
-   "@": "%40",
21
-   "&": "%26",
22
-   "=": "%3D",
23
-   "+": "%2B",
24
-   "$": "%24",
25
-   ",": "%2C",
26
-   "/": "%2F",
27
-   "?": "%3F",
28
-   "#": "%23",
29
-   "[": "%5B",
30
-   "]": "%5D"
31
-  );
32
-
33
-  @for $i from 1 through $loops {
34
-    $chunk: str-slice($svg, $index, $index + $chunkSize - 1);
35
-    @each $search, $replace in $map {
36
-      $chunk: swiper-str-replace($chunk, $search, $replace);
37
-    }
38
-    $encoded: #{$encoded}#{$chunk};
39
-    $index: $index + $chunkSize;
40
-  }
41
-
42
-  @return url("data:image/svg+xml;charset=utf-8,#{$encoded}");
43
-}
44
-
45
-/// Replace `$search` with `$replace` in `$string`
46
-/// @author Hugo Giraudel
47
-/// @link http://sassmeister.com/gist/1b4f2da5527830088e4d
48
-/// @param {String} $string - Initial string
49
-/// @param {String} $search - Substring to replace
50
-/// @param {String} $replace ('') - New value
51
-/// @return {String} - Updated string
52
-@function swiper-str-replace($string, $search, $replace: '') {
53
-  $index: str-index($string, $search);
54
-
55
-  @if $index {
56
-    @return str-slice($string, 1, $index - 1) + $replace + swiper-str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
57
-  }
58
-
59
-  @return $string;
60
-}
Browse code

Initial commit

Benjamin Roth authored on19/05/2020 21:59:44
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,60 @@
1
+/// Urlencode the SVG string
2
+/// @param {String} $svg - SVG image to encode
3
+/// @return {String} - Encoded SVG data uri
4
+@function swiper-svg-uri($svg) {
5
+  $encoded: '';
6
+  $chunkSize: 2048;
7
+  $index: 0;
8
+  $loops: ceil(str-length($svg) / $chunkSize);
9
+
10
+  $map: (
11
+   "%": "%25",
12
+   "<": "%3C",
13
+   ">": "%3E",
14
+   " ": "%20",
15
+   "!": "%21",
16
+   "*": "%2A",
17
+   '"': "%22",
18
+   ";": "%3B",
19
+   ":": "%3A",
20
+   "@": "%40",
21
+   "&": "%26",
22
+   "=": "%3D",
23
+   "+": "%2B",
24
+   "$": "%24",
25
+   ",": "%2C",
26
+   "/": "%2F",
27
+   "?": "%3F",
28
+   "#": "%23",
29
+   "[": "%5B",
30
+   "]": "%5D"
31
+  );
32
+
33
+  @for $i from 1 through $loops {
34
+    $chunk: str-slice($svg, $index, $index + $chunkSize - 1);
35
+    @each $search, $replace in $map {
36
+      $chunk: swiper-str-replace($chunk, $search, $replace);
37
+    }
38
+    $encoded: #{$encoded}#{$chunk};
39
+    $index: $index + $chunkSize;
40
+  }
41
+
42
+  @return url("data:image/svg+xml;charset=utf-8,#{$encoded}");
43
+}
44
+
45
+/// Replace `$search` with `$replace` in `$string`
46
+/// @author Hugo Giraudel
47
+/// @link http://sassmeister.com/gist/1b4f2da5527830088e4d
48
+/// @param {String} $string - Initial string
49
+/// @param {String} $search - Substring to replace
50
+/// @param {String} $replace ('') - New value
51
+/// @return {String} - Updated string
52
+@function swiper-str-replace($string, $search, $replace: '') {
53
+  $index: str-index($string, $search);
54
+
55
+  @if $index {
56
+    @return str-slice($string, 1, $index - 1) + $replace + swiper-str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
57
+  }
58
+
59
+  @return $string;
60
+}