From 570a22de7425e2a486b02e3b43a4b4b1ece552af Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Sun, 22 May 2011 21:56:47 +0200 Subject: update oembed plugin. embed preview in editor --- .../tiny_mce/plugins/bbcode/editor_plugin_src.js | 44 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'tinymce/jscripts') diff --git a/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js b/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js index aad83280d..997bc54fa 100644 --- a/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +++ b/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js @@ -47,6 +47,27 @@ function rep(re, str) { s = s.replace(re, str); }; + + + + + /* oembed */ + function _h2b_cb(match) { + text = bin2hex(match); + function s_h2b(data) { + match = data; + } + $.ajax({ + url: 'oembed/h2b?text=' + text, + async: false, + success: s_h2b, + dataType: 'html' + }); + return match; + } + s = s.replace(/(.*?)<\/span>/gi, _h2b_cb); + /* /oembed */ + // example: to [b] rep(/(.*?)<\/a>/gi,"[url=$1]$2[/url]"); @@ -55,8 +76,8 @@ rep(/(.*?)<\/font>/gi,"$1"); rep(//gi,"[img=$1x$2]$3[/img]"); rep(//gi,"[img=$2x$1]$3[/img]"); - rep(//gi,"[img=$3x$2]$1[/img]"); - rep(//gi,"[img=$2x$3]$1[/img]"); + rep(//gi,"[img=$3x$2]$1[/img]"); + rep(//gi,"[img=$2x$3]$1[/img]"); rep(//gi,"[img]$1[/img]"); rep(/(.*?)<\/code>/gi,"[code]$1[/code]"); rep(/<\/(strong|b)>/gi,"[/b]"); @@ -106,6 +127,25 @@ rep(/\[size=(.*?)\](.*?)\[\/size\]/gi,"$2"); rep(/\[code\](.*?)\[\/code\]/gi,"$1"); rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"
$1
"); + + /* oembed */ + function _b2h_cb(match) { + url = match.replace(/\[\/*embed\]/gi, "") + url = bin2hex(url); + function s_b2h(data) { + match = data; + } + $.ajax({ + url: 'oembed/b2h?url=' + url, + async: false, + success: s_b2h, + dataType: 'html' + }); + return match; + } + s = s.replace(/\[embed\](.*?)\[\/embed\]/gi, _b2h_cb); + + /* /oembed */ return s; } -- cgit v1.2.3