From eb5ffdc40150e7db7e71e21f62415f9075fb3380 Mon Sep 17 00:00:00 2001 From: Leo McArdle Date: Mon, 14 Aug 2017 23:47:43 +0100 Subject: [PATCH] add 'sign up' to log in button --- .gitignore | 1 + common/head_tag.html | 4 ++++ gulpfile.js | 9 ++++++--- src/common/head_tag.html | 2 ++ src/common/head_tag.js | 1 - src/common/plugin.js | 9 +++++++++ 6 files changed, 22 insertions(+), 4 deletions(-) delete mode 100644 src/common/head_tag.js create mode 100644 src/common/plugin.js diff --git a/.gitignore b/.gitignore index 3c3629e..bea50ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +src/common/head_tag.js diff --git a/common/head_tag.html b/common/head_tag.html index d36eaf2..d69d004 100644 --- a/common/head_tag.html +++ b/common/head_tag.html @@ -3,3 +3,7 @@ + + diff --git a/gulpfile.js b/gulpfile.js index 806d87b..0d605f0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,8 +9,6 @@ gulp.task('concat', cb => { pump([ gulp.src('src/common/head_tag/*.js'), concat('head_tag.js'), - babel({ presets: ['es2015'] }), - uglify(), gulp.dest('src/common/') ], cb @@ -20,7 +18,12 @@ gulp.task('concat', cb => { gulp.task('inline', ['concat'], cb => { pump([ gulp.src('src/common/head_tag.html'), - inline(), + inline({ + js: [ + () => { return babel({ presets: ['es2015'] }) }, + uglify + ] + }), gulp.dest('common/') ], cb diff --git a/src/common/head_tag.html b/src/common/head_tag.html index db7f34f..c0f8530 100644 --- a/src/common/head_tag.html +++ b/src/common/head_tag.html @@ -1,3 +1,5 @@ + + diff --git a/src/common/head_tag.js b/src/common/head_tag.js deleted file mode 100644 index 24d0187..0000000 --- a/src/common/head_tag.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";function _dntEnabled(a,e){var t=a||navigator.doNotTrack||window.doNotTrack||navigator.msDoNotTrack,n=e||navigator.userAgent,o=["Windows NT 6.1","Windows NT 6.2","Windows NT 6.3"],i=n.match(/Firefox\/(\d+)/),s=/MSIE|Trident/i.test(n),d=n.match(/Windows.+?(?=;)/g);return(!s||"function"==typeof Array.prototype.indexOf)&&"Enabled"===(t=i&&parseInt(i[1],10)<32?"Unspecified":s&&d&&-1!==o.indexOf(""+d)?"Unspecified":{0:"Disabled",1:"Enabled"}[t]||"Unspecified")}function detect(a){return a.test(userAgent)}function displayBanner(a,e,t){if(!detect(/Mobi/i)){"string"===$.type(e)&&(e=[e]),"string"===$.type(t)&&(t=[t]);for(var n=!1,o=0;o .category-"+e+" .download-banner-"+a+" { display: block } ")})}}function sad_mayo(){$(".category-mozillians-nda").append('

What would Mark Mayo do?

')}function very_sad_mayo(){$(".category-mozillians-nda .sad-mayo").remove()}_dntEnabled()||function(a,e,t,n,o){a[n]=a[n]||[],a[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var i=e.getElementsByTagName(t)[0],s=e.createElement(t);s.async=!0,s.src="https://www.googletagmanager.com/gtm.js?id=GTM-TMGHNBJ",i.parentNode.insertBefore(s,i)}(window,document,"script","dataLayer");var userAgent=window.navigator&&navigator.userAgent||"";displayBanner("nightly","chrome","mozillians-nda"); \ No newline at end of file diff --git a/src/common/plugin.js b/src/common/plugin.js new file mode 100644 index 0000000..f40869a --- /dev/null +++ b/src/common/plugin.js @@ -0,0 +1,9 @@ +api.reopenWidget('header-buttons', { + html(attrs) { + if (this.currentUser) { return } + return this.attach('button', { contents: api.h('span.d-button-label', I18n.t('log_in') + " / " + I18n.t('sign_up')), + className: 'btn-primary btn-small login-button', + action: 'showLogin', + icon: 'user' }) + } +})