From aafb9b6cdd3654ae89703212b1185872921abd35 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Wed, 28 Aug 2013 13:16:53 -0400 Subject: [PATCH] rewrite: move to google ads --- assets/js/controllers/rootCtrl.js | 2 +- assets/js/directives/directives.js | 10 ++++++++++ views/tasks/ads.jade | 28 ++++++++++++++++++++++++++++ views/tasks/index.jade | 17 +---------------- 4 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 views/tasks/ads.jade diff --git a/assets/js/controllers/rootCtrl.js b/assets/js/controllers/rootCtrl.js index 1bc77068b5..9dda986fd2 100644 --- a/assets/js/controllers/rootCtrl.js +++ b/assets/js/controllers/rootCtrl.js @@ -28,7 +28,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', }; $rootScope.authenticated = function() { - User.settings.auth.apiId !== ""; + return User.settings.auth.apiId !== ""; }; $rootScope.dismissAlert = function() { diff --git a/assets/js/directives/directives.js b/assets/js/directives/directives.js index ba291f51db..3c49187426 100644 --- a/assets/js/directives/directives.js +++ b/assets/js/directives/directives.js @@ -18,6 +18,16 @@ habitrpg.directive('taskFocus', } ]); +habitrpg.directive('habitrpgAdsense', function() { + return { + restrict: 'A', + transclude: true, + replace: true, + template: '
', + link: function ($scope, element, attrs) {} + } +}) + /** * Directive that executes an expression when the element it is applied to loses focus. */ diff --git a/views/tasks/ads.jade b/views/tasks/ads.jade new file mode 100644 index 0000000000..9c5e1fad59 --- /dev/null +++ b/views/tasks/ads.jade @@ -0,0 +1,28 @@ +div(ng-if='authenticated() && user.flags.ads!="hide"') + span.pull-right + a(x-bind='click:showStripe', tooltip='Remove Ads') + i.icon-remove + br + a(href='#', data-target='#why-ads-modal', data-toggle='modal', tooltip='Why Ads?') + i.icon-question-sign + + div(ng-if='list.type=="habit"', habitrpg-adsense) + script(async='async', src='//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js') + // Habit3 + ins.adsbygoogle(style='display: inline-block; width: 234px; height: 60px;', data-ad-client='ca-pub-3242350243827794', data-ad-slot='9529624576') + script. + (adsbygoogle = window.adsbygoogle || []).push({}); + + div(ng-if='list.type=="daily"', habitrpg-adsense) + script(async='async', src='//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js') + // Habit3 + ins.adsbygoogle(style='display: inline-block; width: 234px; height: 60px;', data-ad-client='ca-pub-3242350243827794', data-ad-slot='9529624576') + script. + (adsbygoogle = window.adsbygoogle || []).push({}); + + div(ng-if='list.type=="todo"', habitrpg-adsense) + script(async='async', src='//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js') + // Habit3 + ins.adsbygoogle(style='display: inline-block; width: 234px; height: 60px;', data-ad-client='ca-pub-3242350243827794', data-ad-slot='9529624576') + script. + (adsbygoogle = window.adsbygoogle || []).push({}); \ No newline at end of file diff --git a/views/tasks/index.jade b/views/tasks/index.jade index 4f2b64ca16..5b6e985efc 100644 --- a/views/tasks/index.jade +++ b/views/tasks/index.jade @@ -56,22 +56,7 @@ div(ng-controller='TasksCtrl') br - // Ads - div(ng-if='authenticated() && user.flags.ads != "hide" && list.main') - span.pull-right - a(x-bind='click:showStripe', tooltip='Remove Ads') - i.icon-remove - br - a(href='#', data-target='#why-ads-modal', data-toggle='modal', tooltip='Why Ads?') - i.icon-question-sign - a(ng-if='list.type=="habit"', href='http://www.amazon.com/gp/product/1400069289/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1400069289&linkCode=as2&tag=ha0d2-20') The Power of Habit: Why We Do What We Do in Life and Business - img(src='//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=1400069289', width='1', height='1', border='0', alt='', style='border:none !important; margin:0px !important;') - a(ng-if='list.type=="daily"', href='http://www.amazon.com/gp/product/0142000280/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0142000280&linkCode=as2&tag=ha0d2-20') Getting Things Done: The Art of Stress-Free Productivity - img(src='//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=0142000280', width='1', height='1', border='0', alt='', style='border:none !important; margin:0px !important;') - a(ng-if='list.type=="todo"', href='http://www.amazon.com/gp/product/0312430000/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=0312430000&linkCode=as2&tag=ha0d2-20') The Checklist Manifesto: How to Get Things Right - img(src='//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=0312430000', width='1', height='1', border='0', alt='', style='border:none !important; margin:0px !important;') - a(ng-if='list.type=="reward"', href='http://www.amazon.com/gp/product/1594484805/ref=as_li_tf_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1594484805&linkCode=as2&tag=ha0d2-20') Drive: The Surprising Truth About What Motivates Us - img(src='//www.assoc-amazon.com/e/ir?t=ha0d2-20&l=as2&o=1&a=1594484805', width='1', height='1', border='0', alt='', style='border:none !important; margin:0px !important;') + include ./ads // Todo Tabs div(ng-if='list.type=="todo"', ng-class='{"tabbable tabs-below": list.type=="todo"}')