From db6eb04b492c8fe747b17ed65af4963004e5b08b Mon Sep 17 00:00:00 2001 From: Hao Nguyen Date: Sun, 14 Jul 2019 08:30:51 -0700 Subject: [PATCH] Add tips of the day. Update donation link. --- src/footer.tmpl.html | 6 ++++++ src/popup.html | 2 +- src/scripts/main.js | 46 +++++++++++++++++++++++++++++++++++++++++++- src/styles/style.css | 5 ++++- 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 src/footer.tmpl.html diff --git a/src/footer.tmpl.html b/src/footer.tmpl.html new file mode 100644 index 0000000..d2b1496 --- /dev/null +++ b/src/footer.tmpl.html @@ -0,0 +1,6 @@ + + {{ctrl.toastMessage}} + + {{ctrl.buttonText}} + + diff --git a/src/popup.html b/src/popup.html index a25dde4..16316c3 100644 --- a/src/popup.html +++ b/src/popup.html @@ -162,7 +162,7 @@

Cloud backup

- +

Donate

diff --git a/src/scripts/main.js b/src/scripts/main.js index 5736a14..84f8947 100644 --- a/src/scripts/main.js +++ b/src/scripts/main.js @@ -532,7 +532,7 @@ modHeader.controller('SortingController', function($filter, dataSource) { }); modHeader.controller('AppController', function( - $scope, $mdSidenav, $mdUtil, $window, $sce, + $scope, $mdSidenav, $mdUtil, $window, $mdToast, dataSource, profileService, autocompleteService) { $scope.toggleSidenav = $mdUtil.debounce(function() { $mdSidenav('left').toggle(); @@ -549,4 +549,48 @@ modHeader.controller('AppController', function( $scope.autocompleteService = autocompleteService; $scope.dataSource = dataSource; $scope.profileService = profileService; + + const tips = [ + {text: 'Tip: You can switch between multiple profile'}, + {text: 'Tip: You can export your profile to share with others'}, + {text: 'Tip: Tab lock will apply the modification only to locked tab'}, + {text: 'Tip: Add filter will let you use regex to limit modification'}, + {text: 'Tip: Use the checkbox to quickly toggle header modification'}, + {text: 'Tip: Click on the column name to sort'}, + {text: 'Tip: Add filter also allows you to filter by resource type'}, + {text: 'Tip: Go to profile setting to toggle comment column'}, + {text: 'Tip: Append header value to existing one in profile setting'}, + {text: 'Tip: Pause button will temporarily pause all modifications'}, + {text: 'Tip: Go to cloud backup to retrieve your auto-synced profile'}, + { + text: 'If you like ModHeader, please consider donating', + buttonText: 'Donate', + url: 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=3XFKZ8PCRB8P6¤cy_code=USD&amount=5&source=url' + }, + { + text: 'Enjoying ModHeader, leave us a review', + buttonText: 'Review', + url: navigator.userAgent.indexOf('Firefox') >= 0 + ? 'https://addons.mozilla.org/firefox/addon/modheader-firefox/' + : 'https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj' + }, + ]; + const tip = tips[Math.floor(Math.random() * tips.length)]; + $mdToast.show({ + position: 'bottom', + controller: 'ToastCtrl', + controllerAs: 'ctrl', + bindToController: true, + locals: {toastMessage: tip.text, buttonText: tip.buttonText, url: tip.url}, + templateUrl: 'footer.tmpl.html' + }); +}); + + +modHeader.controller('ToastCtrl', function($mdToast, $mdDialog, $document, $scope) { + let ctrl = this; + + ctrl.goToUrl = function(url) { + browser.tabs.create({url: url}); + }; }); diff --git a/src/styles/style.css b/src/styles/style.css index 48c0fb7..c6e6d74 100644 --- a/src/styles/style.css +++ b/src/styles/style.css @@ -37,8 +37,11 @@ body::-webkit-scrollbar { } .main-content { - height: 100%; margin-bottom: 60px; + max-height: 100%; + overflow: hidden; + position: absolute; + width: 100%; } .info-section {