This is my first post here. I apologize if the content has been answered. I did my best to search, but the search terms I used kept pulling in unrelated information.
I am creating an extension to integrate Flickr into the message window. I have it all built and working with one exception- mobile devices. It would seem that my call to $(window).load(function(){}); doesn't happen. It works fine on desktops, but not on mobile devices. To circumvent the issue I am placing a button to just call the function directly. I will do my best to show what the extension looks like below without boring everyone with the details.
1. listener
Code: Select all
'core.posting_modify_template_vars' => 'setup_flickr',
...
public function setup_flickr()
{
$this->template->assign_vars(array(
'NSID' => $this->user->data['user_flickr_nsid'],
'KEY' => $this->config['BFRD_FLICKR_APIKEY'],
));
}
Code: Select all
<!-- IF NSID -->
<script type="text/javascript">
// <![CDATA[
var _nsid = '{NSID}';
var _key = '{KEY}';
//]]>
</script>
{% INCLUDECSS '@BFRD_bfrdFlickr/bfrd_flickr.css' %}
{% INCLUDEJS '@BFRD_bfrdFlickr/js/bfrd_flickr.js' %}
<div style="width: 800px;">
<div class="FlickStripInfo">
<div style="float: left">Flickr Integration</div> <div style="float: right; margin-left: 0px;"><select id="album-dropdown" name="album" ></select></div>
</div>
<div class="FlickStrip" id="FlickrIntegratedImages">
<!-- For Mobile -->
<input type="button" onClick="myStream.init(); return;" value="Load Flickr Information" />
</div>
</div>
<!-- ENDIF -->
Code: Select all
(function($) { // Avoid conflicts with other libraries
'use strict';
$('#album-dropdown').change(function(){ myStream.loadAlbum($(this).val());});
$(window).load(function(){});
var myStream = (function()
{
return{
init: function()
{
myStream.loadAlbumList();
myStream.loadStream();
},
loadStream: function()
{
SNIPPED FOR BREVITY
},
loadAlbum: function(albumid)
{
if(albumid == 0){
return myStream.loadStream();
}
SNIPPED FOR BREVITY
},
loadAlbumList: function()
{
SNIPPED FOR BREVITY
}
};
})();
var base58 = (function() {
SNIPPED FOR BREVITY
})();
})(jQuery); // Avoid conflicts with other libraries
So after a lot of rambling, how would I call myStream.init() from the Event Template? A bonus answer might include why mobile devices don't work, but I am actually less concerned about that part.
If I failed to include anything, please forgive my ignorance. I would be happy to provide any additional details if requested/required.
Thanks in advance!