aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/css/core/_base.scss
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-19 09:47:05 -0700
committerGitHub <noreply@github.com>2017-08-19 09:47:05 -0700
commit84bf883a47b956865d31b1b618d5495fcd7d4876 (patch)
tree0fb0f83af4862a127bca7d8451ef2c7188a08d83 /app/src/main/assets/css/core/_base.scss
parent5d9a3fd7fb8f2f9d0f592c89446824980c9841c6 (diff)
downloadfrost-84bf883a47b956865d31b1b618d5495fcd7d4876.tar.gz
frost-84bf883a47b956865d31b1b618d5495fcd7d4876.tar.bz2
frost-84bf883a47b956865d31b1b618d5495fcd7d4876.zip
v1.4.7 (#195)v1.4.7
* Add try catch (#179) * Add checks before injections (#180) * Enhancement/url redirect manager (#182) * Initial blacklist * Move js checks to java * Optimize imports and clean up request interceptor * Misc (#190) * Update play store description * Finalize description * Update kotlin and bg2 for custom themes * Update to Android Studio 3.0 beta 2 * Update test dependencies and add logging to image activity * Rename throwable to errorRef * Update searchview and media picker through kau * Update themes (#183) * Theme content now found view * Update verified bg and bg2 for transparent themes * Fix check in star text * Various fixes * Create base svg sass images * Feature/theme accent (#192) * Add lots of theming components * Optimize and add * Update accents * Misc 2 (#191) * Add further checks for iab and remove generic error dialog * Theme all snackbars * Add dynamic media action tile * Enhancement/media-camera-picker (#194) * Update kau * Update changelog
Diffstat (limited to 'app/src/main/assets/css/core/_base.scss')
-rw-r--r--app/src/main/assets/css/core/_base.scss71
1 files changed, 71 insertions, 0 deletions
diff --git a/app/src/main/assets/css/core/_base.scss b/app/src/main/assets/css/core/_base.scss
index a715d8bc..de625fa6 100644
--- a/app/src/main/assets/css/core/_base.scss
+++ b/app/src/main/assets/css/core/_base.scss
@@ -33,3 +33,74 @@
@content;
}
}
+
+// SVG optimization thanks to https://codepen.io/jakob-e/pen/doMoML
+// Function to create an optimized svg url
+// Version: 1.0.6
+@function svg-url($svg) {
+ //
+ // Add missing namespace
+ //
+ @if not str-index($svg, xmlns) {
+ $svg: str-replace($svg, "<svg", '<svg xmlns="http://www.w3.org/2000/svg"');
+ }
+
+ //
+ // Chunk up string in order to avoid
+ // "stack level too deep" error
+ //
+ $encoded: "";
+ $slice: 2000;
+ $index: 0;
+ $loops: ceil(str-length($svg) / $slice);
+
+ @for $i from 1 through $loops {
+ $chunk: str-slice($svg, $index, $index + $slice - 1);
+
+ //
+ // Encode
+ //
+ $chunk: str-replace($chunk, '"', "'");
+ $chunk: str-replace($chunk, "%", "%25");
+ $chunk: str-replace($chunk, "#", "%23");
+ $chunk: str-replace($chunk, "{", "%7B");
+ $chunk: str-replace($chunk, "}", "%7D");
+ $chunk: str-replace($chunk, "<", "%3C");
+ $chunk: str-replace($chunk, ">", "%3E");
+
+ //
+ // The maybe list
+ //
+ // Keep size and compile time down
+ // ... only add on documented fail
+ //
+ // $chunk: str-replace($chunk, '&', '%26');
+ // $chunk: str-replace($chunk, '|', '%7C');
+ // $chunk: str-replace($chunk, '[', '%5B');
+ // $chunk: str-replace($chunk, ']', '%5D');
+ // $chunk: str-replace($chunk, '^', '%5E');
+ // $chunk: str-replace($chunk, '`', '%60');
+ // $chunk: str-replace($chunk, ';', '%3B');
+ // $chunk: str-replace($chunk, '?', '%3F');
+ // $chunk: str-replace($chunk, ':', '%3A');
+ // $chunk: str-replace($chunk, '@', '%40');
+ // $chunk: str-replace($chunk, '=', '%3D');
+
+ $encoded: #{$encoded}#{$chunk};
+ $index: $index + $slice;
+ }
+
+ @return url("data:image/svg+xml,#{$encoded}");
+}
+
+// Background svg mixin
+@mixin background-svg($svg, $extra: "no-repeat") {
+ background: svg-url($svg) unquote($extra) !important;
+}
+
+// Helper function to replace characters in a string
+@function str-replace($string, $search, $replace: "") {
+ $index: str-index($string, $search);
+
+ @return if($index, str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace), $string);
+}