summaryrefslogtreecommitdiff
path: root/priv/static/metrics-graphics-3.0-alpha3/examples/js/main.js
diff options
context:
space:
mode:
authorhref <href@random.sh>2021-09-02 08:06:50 +0200
committerhref <href@random.sh>2021-09-02 08:06:50 +0200
commit1fbd63419355e8ddd482c3cb62641bed1366763b (patch)
tree370ce63fcf19f2fd8b1f5136fc19a317050ba0f3 /priv/static/metrics-graphics-3.0-alpha3/examples/js/main.js
parenttxt: don't search in files with dot, display them below in web (diff)
Phoenix 1.6rc0 & Use proper Esbuild/Tailwind/Npm
Diffstat (limited to 'priv/static/metrics-graphics-3.0-alpha3/examples/js/main.js')
-rw-r--r--priv/static/metrics-graphics-3.0-alpha3/examples/js/main.js125
1 files changed, 0 insertions, 125 deletions
diff --git a/priv/static/metrics-graphics-3.0-alpha3/examples/js/main.js b/priv/static/metrics-graphics-3.0-alpha3/examples/js/main.js
deleted file mode 100644
index a123f92..0000000
--- a/priv/static/metrics-graphics-3.0-alpha3/examples/js/main.js
+++ /dev/null
@@ -1,125 +0,0 @@
-var theme = 'light';
-
-(function() {
- 'use strict';
-
- //set the active pill and section on first load
- var section = (document.location.hash) ? document.location.hash.slice(1) : 'lines';
-
- $('#trunk').load('charts/' + section + '.htm', function() {
- $('pre code').each(function(i, block) {
- hljs.highlightBlock(block);
- });
- });
-
- $('.examples li a#goto-' + section).addClass('active');
-
- //handle mouse clicks and so on
- assignEventListeners();
-
- function assignEventListeners() {
- $('ul.examples li a.pill').on('click', function(event) {
- event.preventDefault();
- $('ul.examples li a.pill').removeClass('active');
- $(this).addClass('active');
-
- var section = $(this).attr('id').slice(5);
- $('#trunk').load('charts/' + section + '.htm', function() {
- $('pre code').each(function(i, block) {
- hljs.highlightBlock(block);
- });
- });
-
- document.location.hash = section;
-
- return false;
- })
-
- $('#dark-css').on('click', function () {
- theme = 'dark';
-
- $('.missing')
- .css('background-image', 'url(images/missing-data-dark.png)');
-
- $('.wip')
- .css('background-color', '#3b3b3b');
-
- $('.trunk-section')
- .css('border-top-color', '#5e5e5e');
-
- $('.mg-missing-background')
- .css('stroke', '#ccc');
-
- $('.head ul li a.pill').removeClass('active');
- $(this).toggleClass('active');
- $('#dark').attr({href : 'css/metricsgraphics-demo-dark.css'});
- $('#dark-code').attr({href : 'css/railscasts.css'});
- $('#accessible').attr({href : ''});
-
- return false;
- });
-
- $('#light-css').on('click', function () {
- theme = 'light';
-
- $('.missing')
- .css('background-image', 'url(images/missing-data.png)');
-
- $('.wip')
- .css('background-color', '#f1f1f1');
-
- $('.trunk-section')
- .css('border-top-color', '#ccc');
-
- $('.mg-missing-background')
- .css('stroke', 'blue');
-
- $('.head ul li a.pill').removeClass('active');
- $(this).toggleClass('active');
- $('#dark').attr({href : ''});
- $('#dark-code').attr({href : ''});
- $('#accessible').attr({href : ''});
-
- return false;
- });
-
- $('#accessible-css').on('click', function () {
- $('.head ul li a.pill').removeClass('active');
- $(this).toggleClass('active');
- $('#accessible').attr({href : 'css/metricsgraphics-demo-accessible.css'});
-
- return false;
- });
- }
-
- // replace all SVG images with inline SVG
- // http://stackoverflow.com/questions/11978995/how-to-change-color-of-svg
- // -image-using-css-jquery-svg-image-replacement
- $('img.svg').each(function() {
- var $img = jQuery(this);
- var imgID = $img.attr('id');
- var imgClass = $img.attr('class');
- var imgURL = $img.attr('src');
-
- $.get(imgURL, function(data) {
- // Get the SVG tag, ignore the rest
- var $svg = jQuery(data).find('svg');
-
- // Add replaced image's ID to the new SVG
- if (typeof imgID !== 'undefined') {
- $svg = $svg.attr('id', imgID);
- }
- // Add replaced image's classes to the new SVG
- if (typeof imgClass !== 'undefined') {
- $svg = $svg.attr('class', imgClass + ' replaced-svg');
- }
-
- // Remove any invalid XML tags as per http://validator.w3.org
- $svg = $svg.removeAttr('xmlns:a');
-
- // Replace image with new SVG
- $img.replaceWith($svg);
-
- }, 'xml');
- });
-})();