Speeddial btc hack


SUBMITTED BY: erictibby

DATE: Feb. 27, 2017, 9:21 a.m.

FORMAT: Text only

SIZE: 2.7 kB

HITS: 26587

  1. $(document).ready(function() {
  2. $('.mdl-speed-dial__main-fab').mouseenter(openFAB);
  3. $('.mdl-speed-dial').mouseleave(closeFAB);
  4. $('.mdl-speed-dial__option').hover(showFABTooltip, hideFABTooltip);
  5. $('.mdl-speed-dial__tooltip--hidden').hide();
  6. $('.mdl-speed-dial_main-fab-icon--secondary').hide();
  7. });
  8. function rotateElement(el, deg, duration) {
  9. $(el).stop().animate({ rotation: deg }, {
  10. duration: duration,
  11. step: function(now, fx) {
  12. $(this).css({ "transform": "rotate(" + now + "deg)" });
  13. }
  14. });
  15. }
  16. function openFAB(e) {
  17. var $btn = $(this),
  18. $speedDialOptions = $btn.siblings('.mdl-speed-dial__options'),
  19. isSpeedDialOptionsHidden = $speedDialOptions.css('display') == 'none' ? true : false,
  20. $primaryIcon = $btn.children('.mdl-speed-dial_main-fab-icon--primary'),
  21. $secondaryIcon = $btn.children('.mdl-speed-dial_main-fab-icon--secondary'),
  22. isPrimaryIconNull = $primaryIcon.length > 0 ? false : true,
  23. isSecondaryIconNull = $secondaryIcon.length > 0 ? false : true,
  24. $primaryIcon = isPrimaryIconNull ? $btn.children('.mdl-speed-dial_main-fab-icon') : $primaryIcon,
  25. isPrimaryIconPlusSign = $primaryIcon.html() == 'add' ? true : false,
  26. rotationDegrees = 360,
  27. rotationSpeed = 300,
  28. rotate = $btn.hasClass('mdl-speed-dial__main-fab--spin');
  29. if (isSpeedDialOptionsHidden) {
  30. $speedDialOptions.fadeIn('fast');
  31. if (rotate) {
  32. if (isSecondaryIconNull && isPrimaryIconPlusSign) {
  33. rotationDegrees = 45;
  34. rotationSpeed = 100;
  35. }
  36. rotateElement($btn, rotationDegrees, rotationSpeed);
  37. if (!isPrimaryIconNull && !isSecondaryIconNull) {
  38. $primaryIcon.fadeOut('fast');
  39. $secondaryIcon.fadeIn('fast');
  40. }
  41. }
  42. }
  43. }
  44. function closeFAB(e) {
  45. var $btn = $(this).children('.mdl-speed-dial__main-fab'),
  46. $primaryIcon = $btn.children('.mdl-speed-dial_main-fab-icon--primary') || $btn.children('.mdl-speed-dial_main-fab-icon'),
  47. $secondaryIcon = $btn.children('.mdl-speed-dial_main-fab-icon--secondary'),
  48. isPrimaryIconNull = $primaryIcon.length > 0 ? false : true,
  49. isSecondaryIconNull = $secondaryIcon.length > 0 ? false : true,
  50. $primaryIcon = isPrimaryIconNull ? $btn.children('.mdl-speed-dial_main-fab-icon') : $primaryIcon,
  51. rotate = $btn.hasClass('mdl-speed-dial__main-fab--spin');
  52. $(this).children('.mdl-speed-dial__options').fadeOut('fast');
  53. if (rotate) {
  54. rotateElement($btn, 0, 100);
  55. if (!isPrimaryIconNull && !isSecondaryIconNull) {
  56. $primaryIcon.fadeIn('fast');
  57. $secondaryIcon.fadeOut('fast');
  58. }
  59. }
  60. }
  61. function showFABTooltip(e) {
  62. $(this).children('.mdl-speed-dial__tooltip--hidden').show();
  63. }
  64. function hideFABTooltip(e) {
  65. $(this).children('.mdl-speed-dial__tooltip--hidden').hide();
  66. }

comments powered by Disqus