add hooks for other plugins to tap into qvitter

This commit is contained in:
Hannes Mannerheim 2015-03-03 00:33:18 +01:00
parent d34fac4a7f
commit 5ebe154879
3 changed files with 25 additions and 5 deletions

View File

@ -303,6 +303,12 @@ class QvitterAction extends ApiAction
}
</style>
<?php
// event for other plugins to use to add head elements to qvitter
Event::handle('QvitterEndShowHeadElements', array($this));
?>
</head>
<body style="background-color:<?php print QvitterPlugin::settings("defaultbackgroundcolor"); ?>">
<input id="upload-image-input" class="upload-image-input" type="file" name="upload-image-input" accept="image/*">
@ -493,6 +499,9 @@ class QvitterAction extends ApiAction
<script type="text/javascript" src="<?php print $qvitterpath; ?>js/qvitter.js?changed=<?php print date('YmdHis',filemtime(QVITTERDIR.'/js/qvitter.js')); ?>"></script>
<?php
// event for other plugins to add scripts to qvitter
Event::handle('QvitterEndShowScripts', array($this));
// we might have custom javascript in the config file that we want to add
if(QvitterPlugin::settings('js')) {
print '<script type="text/javascript">'.QvitterPlugin::settings('js').'</script>';

View File

@ -1029,6 +1029,17 @@ function expand_queet(q,doScrolling) {
q.children('.queet').find('.expanded-content').prepend('<div class="media"><iframe width="420" height="315" src="//www.youtube.com/embed/' + youtubeId + '" frameborder="0" allowfullscreen></iframe></div>');
}
}
else {
// other plugins, e.g. gotabulo, can check for other attachment file formats to expand
window.currentlyExpanding = {
"attachment_title":attachment_title,
"attachment_mimetype":attachment_mimetype,
"attachment_title_extension":attachment_title_extension,
"streamItem":q,
"thisAttachmentLink":$(this)
};
$(document).trigger('qvitterExpandOtherAttachments');
}
}
});

View File

@ -1860,11 +1860,11 @@ $('body').on('mousedown','.syntax-two',function () {
});
$('body').on('blur','.queet-box-syntax',function (e) {
// don't collapse if upload-image-button has been clicked
var uploadImageButton = $(this).siblings('.queet-toolbar').find('button.upload-image');
if(uploadImageButton.hasClass('clicked')) {
uploadImageButton.removeClass('clicked');
return true;
// don't collapse if a toolbar button has been clicked
var clickedToolbarButtons = $(this).siblings('.queet-toolbar').find('button.clicked');
if(clickedToolbarButtons.length>0) {
clickedToolbarButtons.removeClass('clicked');
return true;
}
// don't collapse if we're clicking around inside queet-box