Skip to content

Commit

Permalink
fix(embed all): Changed selector from attribute name to class name
Browse files Browse the repository at this point in the history
  • Loading branch information
ritz078 committed Nov 7, 2015
1 parent e4a3fc2 commit 5d72dc8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 21 deletions.
6 changes: 3 additions & 3 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<h1>Loading embed.js in a block</h1>

<div id="block">
<div id="block" class="block">
**Pulchritudines** nocere, :heart: tanquam ~~talis~~ hibrida.A falsis, brodium :+1: salvus gabalium.Nunquam
promissio @(iit roorkee) http://iitr.ac.in caesium.Cum rumor https://twitter.com/IGN/status/652941146054881281
peregrinationes https://www.flickr.com/photos/xdjio/226228060/, omnes ususes http://www.sample-videos.com/video/mp4/240/big_buck_bunny_240p_50mb.mp4 https://soundcloud.com/the-bugle/bugle-179-playas-gon-play
Expand All @@ -48,7 +48,7 @@ <h1>Loading embed.js in a block</h1>
```
Flavum, ferox http://open.spotify.com/track/4th1RQAelzqgY7wL53UGQt torquiss vix aperto de http://plnkr.co/edit/AK732k bi-color, http://www.iitr.ac.in/Main/assets/images/topold.jpg audax nixus.Pol, alter devatio!Crescere aliquando ducunt ad noster lixa. :smile: :P https://www.youtube.com/watch?v=bQRLVxZHKPs http://www.liveleak.com/view?i=42a_1426999994 https://gist.github.com/jeremiahlee/1748966 https://gist.github.com/thomasmb/7132686 https://twitter.com/ProductHunt/status/652826210666418176/photo/1 http://www.ted.com/talks/monica_lewinsky_the_price_of_shame http://www.dailymotion.com/video/x2k8un2_2015-wc-nz-vs-wi-holder-reacts-on-guptills-237_sport https://vine.co/v/bjHh0zHdgZT https://vimeo.com/119199079 http://www.w3schools.com/html/horse.mp3
</div>
<div id="block2">
<div id="block2" class="block">
Cur rumor nocere?Emeritis adelphis satis perderes domina est.Gloss cadunt in bi-color brema!
@(IIT Roorkee) Bi-color habitio virtualiter imitaris amicitia est.Teres tatas ducunt ad racana.Genetrixs
prarere in
Expand Down Expand Up @@ -85,7 +85,7 @@ <h1>Loading embed.js in a block</h1>
})


// ejs.applyEmbedJS();
// ejs.applyEmbedJS("block");
</script>

</body>
Expand Down
2 changes: 1 addition & 1 deletion dist/embed.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/embed.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/embed.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/js/embed.es6
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,12 @@ const helper = require('./modules/video/helper.es6');

let ejs = {
instances: [],
elements: utils.getElementsByAttributeName('data-embed-js'),
elements: [],
setOptions: function(options) {
globalOptions = utils.deepExtend(defaultOptions, options)
},
applyEmbedJS: function() {
applyEmbedJS: function(className) {
this.elements = document.getElementsByClassName(className)
for (let i = 0; i < this.elements.length; i++) {
let option = {
element: this.elements[i]
Expand Down
12 changes: 0 additions & 12 deletions src/js/modules/utils.es6
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,6 @@ var utils = {
}
},

getElementsByAttributeName: (attribute) => {
let matchingElements = [];
let allElements = document.getElementsByTagName('*');
for (let i = 0, n = allElements.length; i < n; i++) {
if (allElements[i].getAttribute(attribute) !== null) {
// Element exists with attribute. Add to array.
matchingElements.push(allElements[i]);
}
}
return matchingElements;
},

/**
* Returns a cloned object
* @param {object} obj
Expand Down

0 comments on commit 5d72dc8

Please sign in to comment.