mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-16 20:05:14 +02:00
update oembed plugin. embed preview in editor
This commit is contained in:
parent
3ea145fae7
commit
570a22de74
4 changed files with 81 additions and 43 deletions
|
@ -1,10 +1,6 @@
|
|||
function oembed(){
|
||||
$("#oembed").toggleClass('hide');
|
||||
}
|
||||
|
||||
function oembed_do(){
|
||||
embed = "[embed]"+$('#oembed_url').attr('value')+"[/embed]";
|
||||
|
||||
tinyMCE.execCommand('mceInsertRawHTML',false,embed);
|
||||
oembed();
|
||||
var reply = prompt("$oembed_message:");
|
||||
if(reply && reply.length) {
|
||||
tinyMCE.execCommand('mceInsertRawHTML',false, "[embed]"+reply+"[/embed]" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
* http://www.oembed.com/
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
require_once('include/oembed.php');
|
||||
|
||||
function oembed_install() {
|
||||
register_hook('jot_tool', 'addon/oembed/oembed.php', 'oembed_hook_jot_tool');
|
||||
register_hook('page_header', 'addon/oembed/oembed.php', 'oembed_hook_page_header');
|
||||
|
@ -18,32 +20,7 @@ function oembed_uninstall() {
|
|||
}
|
||||
|
||||
function oembed_hook_page_header($a, &$b){
|
||||
|
||||
if(($a->module !== 'network') && ($a->module !== 'profile'))
|
||||
return;
|
||||
|
||||
$b .= '<script src="addon/oembed/oembed.js"></script>
|
||||
<style>#oembed.hide { display: none }
|
||||
#oembed {
|
||||
display:block; position: absolute; width: 300px; height:200px;
|
||||
background-color:#fff; color: #000;
|
||||
border:2px solid #8888FF; padding: 1em;
|
||||
top: 200px; left: 400px; z-index:2000;
|
||||
}
|
||||
#oembed_url { width: 100%; margin-bottom:3px;}
|
||||
</style>';
|
||||
|
||||
$b .= '
|
||||
<div id="oembed" class="hide"><input id="oembed_url">
|
||||
<input type="button" value="Embed" onclick="oembed_do()" style="float:left;">
|
||||
<a onclick="oembed(); return false;" style="float:right;"><img onmouseout="imgdull(this);" onmouseover="imgbright(this);" class="wall-item-delete-icon" src="images/b_drophide.gif" style="width: 16px; height: 16px;"></a>
|
||||
<div style="clear:both">Paste a link from 5min.com, Amazon Product Image, blip.tv, Clikthrough, CollegeHumor Video,
|
||||
Daily Show with Jon Stewart, Dailymotion, dotSUB.com, Flickr Photos, Funny or Die Video,
|
||||
Google Video, Hulu, Kinomap, LiveJournal UserPic, Metacafe, National Film Board of Canada,
|
||||
Phodroid Photos, Photobucket, Qik Video, Revision3, Scribd, SlideShare, TwitPic, Twitter Status,
|
||||
Viddler Video, Vimeo, Wikipedia, Wordpress.com, XKCD Comic, YFrog, YouTube</div>
|
||||
</div>
|
||||
';
|
||||
$a->page['htmlhead'] .= sprintf('<script src="%s/oembed/oembed.js"></script>', $a->get_baseurl());
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,6 +33,30 @@ function oembed_hook_jot_tool($a, &$b) {
|
|||
}
|
||||
|
||||
|
||||
function oembed_module() {
|
||||
return;
|
||||
}
|
||||
|
||||
function oembed_init(&$a) {
|
||||
if ($a->argv[1]=='oembed.js'){
|
||||
$tpl = file_get_contents('addon/oembed/oembed.js');
|
||||
echo replace_macros($tpl, array(
|
||||
'$oembed_message' => t('URL to embed:'),
|
||||
));
|
||||
}
|
||||
|
||||
if ($a->argv[1]=='b2h'){
|
||||
$url = array( "", trim(hex2bin($_GET['url'])));
|
||||
echo "<span class='oembed'>".oembed_replacecb($url)."</span>";
|
||||
}
|
||||
|
||||
if ($a->argv[1]=='h2b'){
|
||||
$text = trim(hex2bin($_GET['text']));
|
||||
echo oembed_html2bbcode($text);
|
||||
}
|
||||
|
||||
killme();
|
||||
|
||||
}
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue