From 5d8dca746fae550fcd3f112f9a0ea88301a11df4 Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Sun, 18 Dec 2016 12:49:26 -0800 Subject: [PATCH] Add tooltips --- src/Podsync/Views/Home/Index.cshtml | 12 ++++--- src/Podsync/wwwroot/css/site.css | 12 +++++++ src/Podsync/wwwroot/js/site.js | 49 ++++++++++++++++++++++++++++- 3 files changed, 67 insertions(+), 6 deletions(-) diff --git a/src/Podsync/Views/Home/Index.cshtml b/src/Podsync/Views/Home/Index.cshtml index 48d3e80..fb8ddbc 100644 --- a/src/Podsync/Views/Home/Index.cshtml +++ b/src/Podsync/Views/Home/Index.cshtml @@ -34,12 +34,14 @@

- - @* *@ - + + Selected format video audio, - quality best worst, - episode count 50 100 150 + quality best worst, + + + + episode count 50 100 150

diff --git a/src/Podsync/wwwroot/css/site.css b/src/Podsync/wwwroot/css/site.css index 7243931..29fbb9f 100644 --- a/src/Podsync/wwwroot/css/site.css +++ b/src/Podsync/wwwroot/css/site.css @@ -186,6 +186,18 @@ a { :-ms-input-placeholder { color: rgb(171, 163, 149); } /* IE 10+ */ :-moz-placeholder { color: rgb(171, 163, 149); } /* Firefox 18- */ +/* Tooltips */ + +.tooltip { + display: none; + position: absolute; + background: rgb(171, 163, 149); + border: 1px rgb(244, 236, 218) solid; + padding: 10px; + color: #4a4030; + max-width: 350px; +} + @media screen and (max-width: 640px) { .background-image { background-image: url('../img/mobile_bg.png') diff --git a/src/Podsync/wwwroot/js/site.js b/src/Podsync/wwwroot/js/site.js index 8fde0e8..9974795 100644 --- a/src/Podsync/wwwroot/js/site.js +++ b/src/Podsync/wwwroot/js/site.js @@ -8,7 +8,6 @@ $(function () { function createFeed(data, done) { if (!data.url) { - err('Please fill the URL field first'); return; } @@ -46,9 +45,57 @@ $(function () { alert(link); } + /* + Tooltips + */ + + $(document).on('mouseenter', 'i', function() { + var title = $(this).attr('title'); + if (!title) { + return; + } + $(this).data('tipText', title).removeAttr('title'); + $('

').text(title).appendTo('body').fadeIn('fast'); + }); + + $(document).on('mouseleave', 'i', function() { + var text = $(this).data('tipText'); + $(this).attr('title', text); + $('.tooltip').remove(); + }); + + $(document).on('mousemove', 'i', function(e) { + var x = e.pageX + 10; + var y = e.pageY + 5; + $('.tooltip').css({ top: y, left: x }); + }); + + /* + Control panel + */ + + function enableControls(enable) { + if (enable) { + $('#control-panel') + .removeClass('locked'); + $('#control-icon') + .removeClass('fa-question-circle master-tooltip') + .addClass('fa-wrench') + .removeAttr('title'); + } else { + $('#control-panel').addClass('locked'); + $('#control-icon') + .removeClass('fa-wrench') + .addClass('fa-question-circle master-tooltip') + .attr('title', 'This features are available for patrons only (please, login with your Patreon account). You may support us and unlock this features'); + } + } + $('#get-link').click(function(e) { var url = $('#url-input').val(); createFeed({ url: url, quality: 'VideoHigh' }, displayLink); e.preventDefault(); }); + + enableControls(true); }); \ No newline at end of file