Skip to content

Commit

Permalink
Merge pull request #813 from erwinmombay/arrow-switch
Browse files Browse the repository at this point in the history
switch to fat arrow
  • Loading branch information
erwinmombay committed Nov 10, 2015
2 parents dc90f36 + 6fbfe9e commit bcaac9b
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions extensions/amp-pinterest/0.1/amp-pinterest.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ class AmpPinterest extends AMP.BaseElement {
return ret;
};

// save our outside context so we can return properly after rendering
const that = this;

const makePin = function() {
const makePin = () => {

// make an embedded pin widget
// pinId will be inferred from pinUrl
Expand All @@ -179,7 +176,7 @@ class AmpPinterest extends AMP.BaseElement {
return;
}

const width = that.element.getAttribute('data-width');
const width = this.element.getAttribute('data-width');

const structure = make({'span': {}});

Expand Down Expand Up @@ -341,9 +338,9 @@ class AmpPinterest extends AMP.BaseElement {
});

// fill it
that.applyFillContent(structure);
this.applyFillContent(structure);
// append it
that.element.appendChild(structure);
this.element.appendChild(structure);
// done
return loadPromise(img);
}
Expand All @@ -357,31 +354,31 @@ class AmpPinterest extends AMP.BaseElement {
});
};

const makeButton = function() {
const makeButton = () => {

// render a Pin It button
// required: media and description
// optional: round, color, tall, lang, count

const pinMedia =
AMP.assert(that.element.getAttribute('data-media'),
AMP.assert(this.element.getAttribute('data-media'),
'The data-media attribute is required when <amp-pinterest> ' +
'makes a Pin It button %s', that.element);
'makes a Pin It button %s', this.element);

const pinDescription =
AMP.assert(that.element.getAttribute('data-description'),
AMP.assert(this.element.getAttribute('data-description'),
'The data-description attribute is required when <amp-pinterest> ' +
'makes a Pin It button %s', that.element);
'makes a Pin It button %s', this.element);

// options
const round = that.element.getAttribute('data-round');
let color = that.element.getAttribute('data-color');
const tall = that.element.getAttribute('data-tall');
let lang = that.element.getAttribute('data-lang');
const count = that.element.getAttribute('data-count');
const round = this.element.getAttribute('data-round');
let color = this.element.getAttribute('data-color');
const tall = this.element.getAttribute('data-tall');
let lang = this.element.getAttribute('data-lang');
const count = this.element.getAttribute('data-count');

// pass a known guid when testing
const theGuid = that.element.getAttribute('data-volkswagen-guid') || guid;
const theGuid = this.element.getAttribute('data-volkswagen-guid') || guid;

// build our link
let link = 'https://www.pinterest.com/pin/create/button/';
Expand All @@ -397,7 +394,7 @@ class AmpPinterest extends AMP.BaseElement {
}});

// built it
const render = function(r) {
const render = r => {

// shorten the pin count so it will fit in our bubble
const prettyPinCount = function(n) {
Expand Down Expand Up @@ -501,9 +498,9 @@ class AmpPinterest extends AMP.BaseElement {
});

// fill it
that.applyFillContent(a);
this.applyFillContent(a);
// append it
that.element.appendChild(a);
this.element.appendChild(a);
// done
return loadPromise(a);
};
Expand Down

0 comments on commit bcaac9b

Please sign in to comment.