Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Fix IE 10 related errors
Browse files Browse the repository at this point in the history
- Remove 'publish' block
- `hidden` property not respected by IE 10, use attribute
  • Loading branch information
dfreedm committed Sep 13, 2013
1 parent 93246bf commit 6b81e2a
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions speech-mic/speech-mic.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,36 @@
display: inline-block;
}
}

#mic {
width: 40px;
height: 40px;
border-radius: 50%;
background: url(images/mic.png) center no-repeat;
cursor: pointer;
}

#mic[recognizing=true] {
background-color: red;
-webkit-animation: zoom 0.75s linear infinite;
}

@-webkit-keyframes zoom {
0% {-webkit-transform: scale(0.75);}
100% {-webkit-transform: scale(1);}
}

[hidden] {
display: none;
}
</style>
<div id="mic" recognizing="{{recognizing}}" on-click="toggleRecognition"></div>
</template>
<script>
Polymer('speech-mic', {
publish: {
language: 'en-US',
transcript: '',
completeTranscript: ''
},
language: 'en-US',
transcript: '',
completeTranscript: '',
stop: function() {
this.recognition && this.recognition.stop();
},
Expand All @@ -50,20 +52,21 @@
this.recognition.continuous = true;
this.recognition.interimResults = true;
this.recognition.lang = this.language;

this.recognition.onstart = this.start.bind(this);
this.recognition.onresult = this.result.bind(this);
this.recognition.onerror = this.error.bind(this);
this.recognition.onend = this.end.bind(this);
} else {
this.$.mic.hidden = true;
this.$.mic.setAttribute('hidden');
}
},
toggleRecognition: function() {
if (this.recognizing) {
this.recognition.stop();
} else {
this.recognition.start();
if (this.recognition) {
if (this.recognizing) {
this.recognition.stop();
} else {
this.recognition.start();
}
}
},
start: function(e) {
Expand All @@ -78,7 +81,7 @@
}
this.transcript = t;
this.completeTranscript = ct;
this.fire('result', {results: e.results, transcript: t,
this.fire('result', {results: e.results, transcript: t,
finalTranscript: ft, completeTranscript: ct});
},
error: function(e) {
Expand Down

0 comments on commit 6b81e2a

Please sign in to comment.