Last active
August 29, 2015 14:13
-
-
Save francescoagati/d5835132960f5ef6c074 to your computer and use it in GitHub Desktop.
panel-embed.ly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The widget use jsonp for loading the code of the panel. | |
The object panel consist of 2 methods: | |
initialize: | |
initialize the panel. The unique parameter is the reference to the dom elememnt of the panel. This method is used to start the parts of the panel (dependencies,render,...) | |
render: | |
called for every vote. | |
This method has 2 params: | |
element: the DOM element of the panel | |
response: a javascript object with the properties: | |
average: the average vote | |
total: the total of tags | |
voted: the total of tags voted | |
The object panel must be returned from an anonymous function passed as function argument of JSONPANEL. | |
*/ | |
JSONPANEL(function() { | |
return { | |
initialize: function(element) { | |
var custom = veespo.get.custom(); | |
var html = '<style>#dashboard iframe {margin-top:-7px !important;width:100% !important;height:227px !important}</style>'; | |
html += '<style>#dashboard {margin-top:-21px !important}</style>'; | |
html += '<a data-card-theme="light" data-card-chrome="0" x-data-card-type="image" class="embedly-card" href="{url}">-</a><script async src="//cdn.embedly.com/widgets/platform.js" charset="UTF-8"></script>'; | |
$(element) | |
.html(html.replace("{url}",custom.panel.url)) | |
.css({"margin-top":"-21px",height:"140px"}); | |
}, | |
render: function(element, response) { | |
//$("#panel-total").html(response.total); | |
//$("#panel-voted").html(response.voted); | |
//$("#panel-average").html(response.average); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment