Paperli = window.Paperli || {};
Paperli.FRAME_NUMBER = Paperli.FRAME_NUMBER || 0;
Paperli.PaperFrame = function() { // hide the namespace
function min(val, min) {
if (/\d+%/.test(val) || !isNaN(val) && val >= min)
return val;
else
return min;
};
return {
Show: function(options) {
var domain = options.domain || (‘https:’ == document.location.protocol ? ‘https’ : ‘http’) + ‘://paper.li’,
id = ‘sr-paper-frame-‘ + (++Paperli.FRAME_NUMBER),
height = min(options.height, 480),
width = min(options.width, 390),
fontColor = encodeURIComponent(options.fontColor || ‘#666666’),
invertIcons = options.invertIcons || false,
src = domain + ‘/embeddable/index.html?id=’ + options.id + ‘&w=’ + encodeURIComponent(width) + ‘&h=’ + height + ‘&i=’ + invertIcons + ‘&fc=’ + fontColor + ‘&url=’ + encodeURIComponent(location.href),
// main background color for the iframe
iframeBg = options.background || ‘#FAFAFC’;
if (options.hide)
src += '&hide=' + encodeURIComponent(options.hide);
// border options for the iframe
if(options.border == false){
iframeBorder = 'none'
}else{
iframeBorderColor = options.borderColor || '#cccccc';
iframeBorder = '1px solid ' + iframeBorderColor;
}
// pass the URL of the current parent page to the iframe using location.hash
document.write('<a href="http://'+src+'">http://'+src+'</a>');
}
};
}();
Leave a ReplyCancel reply