Skip to content

Commit

Permalink
fixed linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JaySunSyn committed Apr 14, 2018
1 parent 39c6577 commit 602a4ec
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 29 deletions.
4 changes: 3 additions & 1 deletion demo/all.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

<title>iron-swiper demo</title>

<script>Polymer = { dom: 'shadow' };</script>
<script>
Polymer = {dom: 'shadow'};
</script>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>

<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
Expand Down
4 changes: 3 additions & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

<title>iron-swiper demo</title>

<script>Polymer = { dom: 'shadow' };</script>
<script>
Polymer = {dom: 'shadow'};
</script>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>

<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
Expand Down
4 changes: 3 additions & 1 deletion demo/selected.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

<title>iron-swiper demo</title>

<script>Polymer = { dom: 'shadow' };</script>
<script>
Polymer = {dom: 'shadow'};
</script>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>

<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
Expand Down
51 changes: 25 additions & 26 deletions iron-swiper.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@

<script>
/**
* @polymer
* @extends HTMLElement
*/
* @polymer
* @extends HTMLElement
*/
class IronSwiper extends Polymer.Element {
static get is() {
return 'iron-swiper';
Expand All @@ -163,7 +163,7 @@
type: String,
value: 0,
notify: true,
observer: "setSelected"
observer: 'setSelected'
},

/**
Expand All @@ -172,7 +172,7 @@
slideToClickedSlide: {
type: Boolean,
value: false,
// observer: "_setOptions"
// observer: "_setOptions"
},

/**
Expand Down Expand Up @@ -204,14 +204,14 @@
*/
nextIcon: {
type: String,
value: "iron-swiper:arrow-forward"
value: 'iron-swiper:arrow-forward'
},
/**
* If `navigationButtons` then the prev button icon can be set
*/
prevIcon: {
type: String,
value: "iron-swiper:arrow-back"
value: 'iron-swiper:arrow-back'
},

/**
Expand Down Expand Up @@ -259,7 +259,7 @@
*/
options: {
type: Object,
value: function(){ return {}; }
value: function() {return {};}
}
};
}
Expand All @@ -284,12 +284,12 @@
}

getOptions() {
return Object.keys(IronSwiper.properties).reduce(function (options, key) {
// if (this.$[key]) {
// if (this[key]) {
// options[key] = this.$[key];
// }
// }
return Object.keys(IronSwiper.properties).reduce(function(options, key) {
// if (this.$[key]) {
// if (this[key]) {
// options[key] = this.$[key];
// }
// }
if (key === 'navigationButtons') {
options.navigation = options.navigation || {};
options.navigation.prevEl = this.$.prev;
Expand Down Expand Up @@ -319,15 +319,15 @@
return options;
}.bind(this), {
on: {
slideChangeTransitionStart: function(){
slideChangeTransitionStart: function() {
if (this._swiper && this._swiper.realIndex>=0) {
this.selected = this._swiper.realIndex;
}
this.stopPlayers();
}.bind(this)
}

});
});
}

stopPlayers() {
Expand All @@ -353,17 +353,17 @@

init() {
clearTimeout(this._initializer);
this._initializer = setTimeout(function () {
this._initializer = setTimeout(function() {
// First clone real nodes into the wrapper
var _nodes = [];

let slides = Polymer.FlattenedNodesObserver.getFlattenedNodes(this)
.filter(
function (node) {
return node.tagName &&
function(node) {
return node.tagName &&
node.tagName !== 'TEMPLATE' &&
!node.classList.contains('swiper-slide');
});
});

var wrapper = this.$.wrapper;

Expand All @@ -378,7 +378,7 @@

var node = wrapper.appendChild(slides[i].cloneNode(true));
node.classList.add('swiper-slide');
node.setAttribute('index',i.toString());
node.setAttribute('index', i.toString());
node.removeEventListener('click', this._nodeClicked);
node.addEventListener('click', this._nodeClicked);

Expand All @@ -387,14 +387,14 @@
url = url.replace(/^url\(['"]?([^'"\)]*).*?$/, '$1');
var img = new window.Image();

img.addEventListener('error', function () {
img.addEventListener('error', function() {
this.dispatchEvent(new CustomEvent('error', {
composed: true,
detail: {img: img, url: url}
}));
}.bind(this));

img.addEventListener('load', function (e) {
img.addEventListener('load', function(e) {
this.dispatchEvent(new CustomEvent('load', {
composed: true,
detail: {img: img, url: url}
Expand Down Expand Up @@ -428,7 +428,6 @@

this._swiper = new window.Swiper(this.$.swiper, this.getOptions());
// this.scopeSubtree(this.$.swiper); // for polymer 2.x this process should be automatic now. See https://github.com/webcomponents/shadycss/issues/114#issuecomment-321936467

}

_nodeClicked(e) {
Expand All @@ -449,8 +448,8 @@
if (this.selected != index) {
this.selected=index;
}
if(this._swiper && this._swiper.realIndex != index) {
this._swiper.slideTo(index);//,300,false);
if (this._swiper && this._swiper.realIndex != index) {
this._swiper.slideTo(index);// ,300,false);
}
}
}
Expand Down

0 comments on commit 602a4ec

Please sign in to comment.