Skip to content

Commit

Permalink
Merge branch 'BenLubar-strawpoll.me' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nleush committed Apr 11, 2017
2 parents f69c39c + 407ee02 commit 6f284d0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions plugins/domains/strawpoll.me.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var $ = require('cheerio');
var entities = require('entities');

module.exports = {

re: /^https?:\/\/(?:www\.)?strawpoll\.me\/([0-9]+)$/i,

mixins: ["*"],

getLink: function(urlMatch, cheerio) {

var embed = entities.decodeHTML(cheerio('#embed-field-' + urlMatch[1]).attr('value'));
var iframe = $('<div>').html(embed).children('iframe');
var height = parseInt(iframe.css('height').replace(/px$/, ''), 10) || 300;
var width = parseInt(iframe.css('width').replace(/px$/, ''), 10) || 690;

return [{
type: CONFIG.T.text_html,
rel: [CONFIG.R.survey, CONFIG.R.ssl, CONFIG.R.html5],
href: '//www.strawpoll.me/embed_1/' + urlMatch[1],
height: height,
"max-width": width
}];

},

tests: [
"http://www.strawpoll.me/1696",
"https://strawpoll.me/136"
]
};

0 comments on commit 6f284d0

Please sign in to comment.