From 6da04d16bdaf0dc4694e8e850daa0b8e54ce9323 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Mon, 28 Dec 2015 18:07:31 +0100 Subject: [PATCH 1/3] get rid of unwanted
s in items with oembed fix video thumbnail in quattro, vier, duepuntozero themes --- include/bbcode.php | 4 +--- include/oembed.php | 14 ++++---------- view/templates/oembed_video.tpl | 3 +-- view/theme/duepuntozero/style.css | 4 ++++ view/theme/quattro/dark/style.css | 13 ++++++------- view/theme/quattro/green/style.css | 13 ++++++------- view/theme/quattro/lilac/style.css | 19 +++++++++---------- view/theme/quattro/quattro.less | 6 ++++-- view/theme/vier/style.css | 19 +++++++++++++++++++ 9 files changed, 54 insertions(+), 41 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 100c3b930..b68a7c5b1 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -301,14 +301,12 @@ function bb_onelinecode_cb($match) { } function tryoembed($match){ - //$url = ((count($match)==2)?$match[1]:$match[2]); $url = $match[1]; // Always embed the SSL version $url = str_replace(array("http://www.youtube.com/", "http://player.vimeo.com/"), array("https://www.youtube.com/", "https://player.vimeo.com/"), $url); - //logger("tryoembed: $url"); $o = oembed_fetch_url($url); @@ -318,7 +316,7 @@ function tryoembed($match){ if ($o->type=="error") return $match[0]; $html = oembed_format_object($o); - return $html; //oembed_iframe($html,$o->width,$o->height); + return $html; } diff --git a/include/oembed.php b/include/oembed.php index 0e1238360..c848a4580 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -1,12 +1,9 @@ width,$j->height); - - + return $s; } @@ -144,15 +141,12 @@ function oembed_format_object($j){ } else { $ret=$jhtml; } - $ret.="
"; + //$ret.="
"; }; break; case "photo": { $ret.= ""; - //$ret.= ""; - $ret.="
"; }; break; case "link": { - //$ret = "".$j->title.""; }; break; case "rich": { // not so safe.. @@ -194,10 +188,10 @@ function oembed_format_object($j){ } else { // add for html2bbcode conversion $ret .= "$embedurl"; - $ret .= "
"; } $ret.=""; - return mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret)); + $ret = str_replace("\n","",$ret); + return mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret)); } function oembed_iframe($src,$width,$height) { diff --git a/view/templates/oembed_video.tpl b/view/templates/oembed_video.tpl index 4aa135154..8392c469c 100644 --- a/view/templates/oembed_video.tpl +++ b/view/templates/oembed_video.tpl @@ -1,5 +1,4 @@ - -
+
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 76bbab8e0..c004eb53d 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -1221,6 +1221,10 @@ input#dfrn-url { } .type-link .oembed { } +.oembed.video .embed_video > div { + position: absolute; top: 0px; left: 0px; + background: rgba(0, 0, 0, 0.5) url(shiny.png) no-repeat scroll center center; +} .shared_header { height: 32px; diff --git a/view/theme/quattro/dark/style.css b/view/theme/quattro/dark/style.css index 1b021687c..847017ee5 100644 --- a/view/theme/quattro/dark/style.css +++ b/view/theme/quattro/dark/style.css @@ -463,7 +463,7 @@ a:hover { text-decoration: underline; } blockquote { - background: #ffffff; + background: #FFFFFF; padding: 1em; margin-left: 1em; border-left: 1em solid #e6e6e6; @@ -544,7 +544,6 @@ header { margin: 0; padding: 0; /*width: 100%; height: 12px; */ - z-index: 110; color: #ffffff; } @@ -922,7 +921,6 @@ aside .posted-date-selector-months { overflow: auto; height: auto; /*.contact-block-div { width:60px; height: 60px; }*/ - } #contact-block .contact-block-h4 { float: left; @@ -1004,7 +1002,6 @@ aside .posted-date-selector-months { margin-bottom: 2em; /*.action .s10 { width: 10px; overflow: hidden; padding: 0;} .action .s16 { width: 16px; overflow: hidden; padding: 0;}*/ - } .widget h3 { padding: 0; @@ -1308,7 +1305,6 @@ section { height: 32px; margin-left: 16px; /*background: url(../../../images/icons/22/user.png) no-repeat center center;*/ - } .comment-edit-preview .contact-photo-menu-button { top: 15px !important; @@ -1447,9 +1443,13 @@ blockquote.shared_content { } .oembed.video > a.embed_video { display: block; - float: none; + float: left; + position: relative; } .oembed.video > a.embed_video > div { + position: absolute; + top: 0px; + left: 0px; background: rgba(255, 255, 255, 0.36) url(../../../images/icons/48/play.png) no-repeat center center !important; } /* threaded comments */ @@ -2241,7 +2241,6 @@ ul.tabs li .active { min-height: 22px; padding-top: 6px; /* a { display: block;}*/ - } #photo-caption { display: block; diff --git a/view/theme/quattro/green/style.css b/view/theme/quattro/green/style.css index 4c50fb35f..4cfcb5927 100644 --- a/view/theme/quattro/green/style.css +++ b/view/theme/quattro/green/style.css @@ -463,7 +463,7 @@ a:hover { text-decoration: underline; } blockquote { - background: #ffffff; + background: #FFFFFF; padding: 1em; margin-left: 1em; border-left: 1em solid #e6e6e6; @@ -544,7 +544,6 @@ header { margin: 0; padding: 0; /*width: 100%; height: 12px; */ - z-index: 110; color: #ffffff; } @@ -922,7 +921,6 @@ aside .posted-date-selector-months { overflow: auto; height: auto; /*.contact-block-div { width:60px; height: 60px; }*/ - } #contact-block .contact-block-h4 { float: left; @@ -1004,7 +1002,6 @@ aside .posted-date-selector-months { margin-bottom: 2em; /*.action .s10 { width: 10px; overflow: hidden; padding: 0;} .action .s16 { width: 16px; overflow: hidden; padding: 0;}*/ - } .widget h3 { padding: 0; @@ -1308,7 +1305,6 @@ section { height: 32px; margin-left: 16px; /*background: url(../../../images/icons/22/user.png) no-repeat center center;*/ - } .comment-edit-preview .contact-photo-menu-button { top: 15px !important; @@ -1447,9 +1443,13 @@ blockquote.shared_content { } .oembed.video > a.embed_video { display: block; - float: none; + float: left; + position: relative; } .oembed.video > a.embed_video > div { + position: absolute; + top: 0px; + left: 0px; background: rgba(255, 255, 255, 0.36) url(../../../images/icons/48/play.png) no-repeat center center !important; } /* threaded comments */ @@ -2241,7 +2241,6 @@ ul.tabs li .active { min-height: 22px; padding-top: 6px; /* a { display: block;}*/ - } #photo-caption { display: block; diff --git a/view/theme/quattro/lilac/style.css b/view/theme/quattro/lilac/style.css index 7fb505dec..2ff7cfcb0 100644 --- a/view/theme/quattro/lilac/style.css +++ b/view/theme/quattro/lilac/style.css @@ -420,7 +420,7 @@ body { font-family: Liberation Sans, helvetica, arial, clean, sans-serif; font-size: 11px; - background-color: #f6ecf9; + background-color: #F6ECF9; color: #2d2d2d; margin: 50px 0 0 0; display: table; @@ -463,7 +463,7 @@ a:hover { text-decoration: underline; } blockquote { - background: #ffffff; + background: #FFFFFF; padding: 1em; margin-left: 1em; border-left: 1em solid #e6e6e6; @@ -544,7 +544,6 @@ header { margin: 0; padding: 0; /*width: 100%; height: 12px; */ - z-index: 110; color: #ffffff; } @@ -922,7 +921,6 @@ aside .posted-date-selector-months { overflow: auto; height: auto; /*.contact-block-div { width:60px; height: 60px; }*/ - } #contact-block .contact-block-h4 { float: left; @@ -1004,7 +1002,6 @@ aside .posted-date-selector-months { margin-bottom: 2em; /*.action .s10 { width: 10px; overflow: hidden; padding: 0;} .action .s16 { width: 16px; overflow: hidden; padding: 0;}*/ - } .widget h3 { padding: 0; @@ -1308,7 +1305,6 @@ section { height: 32px; margin-left: 16px; /*background: url(../../../images/icons/22/user.png) no-repeat center center;*/ - } .comment-edit-preview .contact-photo-menu-button { top: 15px !important; @@ -1447,9 +1443,13 @@ blockquote.shared_content { } .oembed.video > a.embed_video { display: block; - float: none; + float: left; + position: relative; } .oembed.video > a.embed_video > div { + position: absolute; + top: 0px; + left: 0px; background: rgba(255, 255, 255, 0.36) url(../../../images/icons/48/play.png) no-repeat center center !important; } /* threaded comments */ @@ -1753,7 +1753,7 @@ span[id^="showmore-wrap"] { height: 20px; width: 500px; font-weight: bold; - border: 1px solid #f6ecf9; + border: 1px solid #F6ECF9; } #jot #jot-title:-webkit-input-placeholder { font-weight: normal; @@ -1780,7 +1780,7 @@ span[id^="showmore-wrap"] { margin: 0; height: 20px; width: 200px; - border: 1px solid #f6ecf9; + border: 1px solid #F6ECF9; } #jot #jot-category:hover { border: 1px solid #999999; @@ -2241,7 +2241,6 @@ ul.tabs li .active { min-height: 22px; padding-top: 6px; /* a { display: block;}*/ - } #photo-caption { display: block; diff --git a/view/theme/quattro/quattro.less b/view/theme/quattro/quattro.less index d47263b50..681cfcc37 100644 --- a/view/theme/quattro/quattro.less +++ b/view/theme/quattro/quattro.less @@ -745,7 +745,7 @@ section { margin: 1em 0; max-height: 160px; overflow: hidden; - padding-left: 1em; + padding-left: 1em; } .oembed {} } @@ -780,8 +780,10 @@ blockquote.shared_content { .oembed.video { > a.embed_video { display: block; - float: none; + float: left; + position: relative; > div { + position: absolute; top: 0px; left: 0px; background: rgba(255, 255, 255, 0.36) url(../../../images/icons/48/play.png) diff --git a/view/theme/vier/style.css b/view/theme/vier/style.css index 7d0c36be1..e53ac45f7 100644 --- a/view/theme/vier/style.css +++ b/view/theme/vier/style.css @@ -2522,6 +2522,25 @@ blockquote { display: block; } +.oembed.video .embed_video > div { + position: absolute; top: 0px; left: 0px; + background-color: rgba(0,0,0,0.5); +} +.oembed.video .embed_video > div::before { + font-family: FontAwesome; + font-weight: normal; + font-style: normal; + display: inline-block; + text-decoration: inherit; + vertical-align: top; + font-size: 3em; + content: "\f01d"; /* icon-play-circle */ + color: #fff; + bottom: 10px; + right: 10px; + position: absolute; +} + /* ================== */ /* = Contacts Block = */ /* ================== */ From 7965f72c8c42c5dac8c954ca446d806fb2c83104 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Mon, 28 Dec 2015 18:27:24 +0100 Subject: [PATCH 2/3] don't resize iframe if we can't find a final size greater than 0 --- js/main.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/js/main.js b/js/main.js index f106b3daf..ca4cc770c 100644 --- a/js/main.js +++ b/js/main.js @@ -1,22 +1,22 @@ - function resizeIframe(obj) { - obj.style.height = 0; - _resizeIframe(obj, 0); - } - - function _resizeIframe(obj, desth) { - var h = obj.style.height; - var ch = obj.contentWindow.document.body.scrollHeight + 'px'; - if (h==ch) { - return; + function resizeIframe(obj) { + //obj.style.height = 0; + _resizeIframe(obj, 0); } - console.log("_resizeIframe", obj, desth, ch); - if (desth!=ch) { - setTimeout(_resizeIframe, 500, obj, ch); - } else { - obj.style.height = ch; - setTimeout(_resizeIframe, 1000, obj, ch); + + function _resizeIframe(obj, desth) { + var h = obj.style.height; + var ch = obj.contentWindow.document.body.scrollHeight + 'px'; + if (h==ch) { + return; + } + console.log("_resizeIframe", obj, desth, ch); + if (desth!=ch) { + setTimeout(_resizeIframe, 500, obj, ch); + } else { + if (ch>0) obj.style.height = ch; + setTimeout(_resizeIframe, 1000, obj, ch); + } } - } function openClose(theID) { if(document.getElementById(theID).style.display == "block") { From a1c1a6cae81e2be2b8096e0d99826ae3dcd20c97 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Mon, 28 Dec 2015 18:28:02 +0100 Subject: [PATCH 3/3] workaround for media.ccc.de oembed with size 0 --- mod/oembed.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mod/oembed.php b/mod/oembed.php index f79f66a48..cb478cb86 100644 --- a/mod/oembed.php +++ b/mod/oembed.php @@ -21,6 +21,12 @@ function oembed_content(&$a){ $url = base64url_decode($a->argv[1]); $j = oembed_fetch_url($url); + // workaround for media.ccc.de (and any other endpoint that return size 0) + if (substr($j->html, 0, 7) == "html, 'width="0"')) { + $j->html = ''. $j->html; + $j->html = str_replace('width="0"', '', $j->html); + $j->html = str_replace('height="0"', '', $j->html); + } echo $j->html; // logger('mod-oembed ' . $j->html, LOGGER_ALL); echo "";