aboutsummaryrefslogtreecommitdiffstats
path: root/tinymce
diff options
context:
space:
mode:
authorfabrixxm <fabrix.xm@gmail.com>2011-05-22 21:56:47 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2011-05-23 09:13:35 +0200
commit570a22de7425e2a486b02e3b43a4b4b1ece552af (patch)
treeeb49ca1007beb339edad8b21d2f519d1a70dd576 /tinymce
parent3ea145fae7defaf959b04797afc8482bd0190352 (diff)
downloadvolse-hubzilla-570a22de7425e2a486b02e3b43a4b4b1ece552af.tar.gz
volse-hubzilla-570a22de7425e2a486b02e3b43a4b4b1ece552af.tar.bz2
volse-hubzilla-570a22de7425e2a486b02e3b43a4b4b1ece552af.zip
update oembed plugin. embed preview in editor
Diffstat (limited to 'tinymce')
-rw-r--r--tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js44
1 files changed, 42 insertions, 2 deletions
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 class=\"oembed\">(.*?)<\/span>/gi, _h2b_cb);
+ /* /oembed */
+
// example: <strong> to [b]
rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
@@ -55,8 +76,8 @@
rep(/<font>(.*?)<\/font>/gi,"$1");
rep(/<img.*?width=\"(.*?)\".*?height=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$1x$2]$3[/img]");
rep(/<img.*?height=\"(.*?)\".*?width=\"(.*?)\".*?src=\"(.*?)\".*?\/>/gi,"[img=$2x$1]$3[/img]");
- rep(/<img.*?src=\"(.*?)\".*?height=\"(.*?)\".*?width=\"(.*?)\".*?\/>/gi,"[img=$3x$2]$1[/img]");
- rep(/<img.*?src=\"(.*?)\".*?width=\"(.*?)\".*?height=\"(.*?)\".*?\/>/gi,"[img=$2x$3]$1[/img]");
+ rep(/<img.*?src=\"(.*?)\".*?height=\"(.*?)\".*?width=\"(.*?)\".*?\/>/gi,"[img=$3x$2]$1[/img]");
+ rep(/<img.*?src=\"(.*?)\".*?width=\"(.*?)\".*?height=\"(.*?)\".*?\/>/gi,"[img=$2x$3]$1[/img]");
rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");
rep(/<code>(.*?)<\/code>/gi,"[code]$1[/code]");
rep(/<\/(strong|b)>/gi,"[/b]");
@@ -106,6 +127,25 @@
rep(/\[size=(.*?)\](.*?)\[\/size\]/gi,"<span style=\"font-size: $1;\">$2</span>");
rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");
+
+ /* 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;
}