aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-05-11 17:38:22 -0700
committerfriendica <info@friendica.com>2014-05-11 17:38:22 -0700
commit045d23a27c26d9d6daec7412c8726eba068f594a (patch)
tree97c7663ed3def47191a09a52ab0bfff76e65bf09
parentb5372f81523bafdf5f7f0191f08c775c4d60dcfd (diff)
parentc455663509a094c22116be60034028378aa07100 (diff)
downloadvolse-hubzilla-045d23a27c26d9d6daec7412c8726eba068f594a.tar.gz
volse-hubzilla-045d23a27c26d9d6daec7412c8726eba068f594a.tar.bz2
volse-hubzilla-045d23a27c26d9d6daec7412c8726eba068f594a.zip
Merge https://github.com/friendica/red into pending_merge
-rw-r--r--include/bbcode.php14
-rw-r--r--mod/photo.php34
-rw-r--r--view/theme/redbasic/css/style.css30
-rw-r--r--view/theme/redbasic/php/style.php18
-rw-r--r--view/theme/redbasic/schema/boxy.php19
-rwxr-xr-xview/tpl/head.tpl3
-rwxr-xr-xview/tpl/photo_view.tpl2
7 files changed, 103 insertions, 17 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 17b25c206..a4e7560d6 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -63,7 +63,7 @@ function bb_spacefy($st) {
}
// The previously spacefied [noparse][ i ]italic[ /i ][/noparse],
-// now turns back and the [noparse] tags are trimed
+// now turns back and the [noparse] tags are trimmed
// returning [i]italic[/i]
function bb_unspacefy_and_trim($st) {
@@ -630,24 +630,24 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
// Images
// [img]pathtoimage[/img]
if (strpos($Text,'[/img]') !== false) {
- $Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img src="$1" alt="' . t('Image/photo') . '" />', $Text);
+ $Text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img style="max-width=100%;" src="$1" alt="' . t('Image/photo') . '" />', $Text);
}
if (strpos($Text,'[/zmg]') !== false) {
- $Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$1" alt="' . t('Image/photo') . '" />', $Text);
+ $Text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img class="zrl" style="max-width=100%;" src="$1" alt="' . t('Image/photo') . '" />', $Text);
}
// [img float={left, right}]pathtoimage[/img]
if (strpos($Text,'[/img]') !== false) {
- $Text = preg_replace("/\[img float=left\](.*?)\[\/img\]/ism", '<img src="$1" style="float: left;" alt="' . t('Image/photo') . '" />', $Text);
+ $Text = preg_replace("/\[img float=left\](.*?)\[\/img\]/ism", '<img style="max-width=100%;" src="$1" style="float: left;" alt="' . t('Image/photo') . '" />', $Text);
}
if (strpos($Text,'[/img]') !== false) {
- $Text = preg_replace("/\[img float=right\](.*?)\[\/img\]/ism", '<img src="$1" style="float: right;" alt="' . t('Image/photo') . '" />', $Text);
+ $Text = preg_replace("/\[img float=right\](.*?)\[\/img\]/ism", '<img style="max-width=100%;" src="$1" style="float: right;" alt="' . t('Image/photo') . '" />', $Text);
}
if (strpos($Text,'[/zmg]') !== false) {
- $Text = preg_replace("/\[zmg float=left\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$1" style="float: left;" alt="' . t('Image/photo') . '" />', $Text);
+ $Text = preg_replace("/\[zmg float=left\](.*?)\[\/zmg\]/ism", '<img style="max-width=100%;" class="zrl" src="$1" style="float: left;" alt="' . t('Image/photo') . '" />', $Text);
}
if (strpos($Text,'[/zmg]') !== false) {
- $Text = preg_replace("/\[zmg float=right\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$1" style="float: right;" alt="' . t('Image/photo') . '" />', $Text);
+ $Text = preg_replace("/\[zmg float=right\](.*?)\[\/zmg\]/ism", '<img style="max-width=100%;" class="zrl" src="$1" style="float: right;" alt="' . t('Image/photo') . '" />', $Text);
}
// [img=widthxheight]pathtoimage[/img]
diff --git a/mod/photo.php b/mod/photo.php
index 1319f9569..9302278b6 100644
--- a/mod/photo.php
+++ b/mod/photo.php
@@ -80,6 +80,22 @@ function photo_init(&$a) {
* Other photos
*/
+ /* Check for a cookie to indicate display pixel density, in order to detect high-resolution
+ displays. This procedure was derived from the "Retina Images" by Jeremey Worboys,
+ used in accordance with the Creative Commons Attribution 3.0 Unported License.
+ Project link: https://github.com/Retina-Images/Retina-Images
+ License link: http://creativecommons.org/licenses/by/3.0/
+ */
+ $cookie_value = false;
+ if (isset($_COOKIE['devicePixelRatio'])) {
+ $cookie_value = intval($_COOKIE['devicePixelRatio']);
+ }
+ else {
+ // Force revalidation of cache on next request
+ $cache_directive = 'no-cache';
+ $status = 'no cookie';
+ }
+
$resolution = 0;
if(strpos($photo,'.') !== false)
@@ -88,7 +104,23 @@ function photo_init(&$a) {
if(substr($photo,-2,1) == '-') {
$resolution = intval(substr($photo,-1,1));
$photo = substr($photo,0,-2);
+ // If viewing on a high-res screen, attempt to serve a higher resolution image:
+ if ($resolution == 2 && ($cookie_value > 1))
+ {
+ $resolution = 1;
+ }
}
+
+ // If using resolution 1, make sure it exists before proceeding:
+ if ($resolution == 1)
+ {
+ $r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND scale = %d LIMIT 1",
+ dbesc($photo),
+ intval($resolution)
+ );
+ if (!($r))
+ $resolution = 2;
+ }
$r = q("SELECT uid FROM photo WHERE resource_id = '%s' AND scale = %d LIMIT 1",
dbesc($photo),
@@ -125,7 +157,7 @@ function photo_init(&$a) {
dbesc($photo),
intval($resolution)
);
-
+
if($r) {
logger('mod_photo: forbidden. ' . $a->query_string);
$observer = $a->get_observer();
diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css
index ba26f8910..88fd693ad 100644
--- a/view/theme/redbasic/css/style.css
+++ b/view/theme/redbasic/css/style.css
@@ -1911,29 +1911,45 @@ img.mail-list-sender-photo {
.wall-item-content-wrapper:hover {
z-index:99;
}
-/*
.comment .wall-item-body {
-padding-left: 42px;
+ padding-left: $comment_padding;
}
- */
+
.hide-comments-outer,
.wall-item-content-wrapper.comment {
background-color: $comment_item_colour;
- border-left: 1px solid $comment_border_colour;
- border-right: 1px solid $comment_border_colour;
- border-bottom: 1px solid $comment_border_colour;
+ border-left: $comment_border_left $comment_border_colour;
+ border-right: $comment_border_right $comment_border_colour;
+
+ border-bottom: $comment_border_bottom $comment_border_colour;
border-radius: 0px;
padding: 7px 10px 7px 7px;
}
+/*
+.thread-wrapper.toplevel_item{
+ border-bottom: $comment_border_bottom $comment_border_colour;
+ border-right: $comment_border_right $item_colour;
+ border-left: $comment_border_left $item_colour;
+
+ border-top-right-radius: $radiuspx;
+ border-top-left-radius: $radiuspx;
+ border-bottom-right-radius: $radiuspx;
+ border-bottom-left-radius: $radiuspx;
+}
+ */
.wall-item-comment-wrapper {
background-color: $comment_item_colour;
- border: 1px solid $item_colour;
+ /* border-top: $comment_border_top $item_colour; */
+ border-right: $comment_border_right $item_colour;
+ border-left: $comment_border_left $item_colour;
+ border-bottom: $comment_border_bottom $item_colour;
border-radius: 0px;
border-bottom-right-radius: $radiuspx;
border-bottom-left-radius: $radiuspx;
}
+
.wall-item-like,
.wall-item-dislike {
font-size: 11px;
diff --git a/view/theme/redbasic/php/style.php b/view/theme/redbasic/php/style.php
index 698adaf4d..e03d1c741 100644
--- a/view/theme/redbasic/php/style.php
+++ b/view/theme/redbasic/php/style.php
@@ -248,6 +248,17 @@ if(! $a->install) {
$reply_photo = '32px';
if(! $infomess_bgcolour)
$infomess_bgcolour = "#F0F0F0";
+ if (!$comment_padding)
+ $comment_padding="0px";
+ if (!$comment_border_left)
+ $comment_border_left="2px solid";
+ if (!$comment_border_right)
+ $comment_border_right="0px solid";
+ if (!$comment_border_top)
+ $comment_border_top="0px solid";
+ if (!$comment_border_bottom)
+ $comment_border_bottom="0px solid";
+
if($nav_min_opacity === false || $nav_min_opacity === '') {
$nav_float_min_opacity = 1.0;
$nav_percent_min_opacity = 100;
@@ -357,7 +368,12 @@ $options = array (
'$pmenu_reply' => $pmenu_reply,
'$wwtop' => $wwtop,
'$comment_indent' => $comment_indent,
-'$body_width' => $body_width
+'$body_width' => $body_width,
+'$comment_padding' => $comment_padding,
+'$comment_border_left' =>$comment_border_left,
+'$comment_border_right' =>$comment_border_right,
+'$comment_border_top' =>$comment_border_top,
+'$comment_border_bottom' =>$comment_border_bottom,
);
echo str_replace(array_keys($options), array_values($options), $x);
diff --git a/view/theme/redbasic/schema/boxy.php b/view/theme/redbasic/schema/boxy.php
new file mode 100644
index 000000000..1de2f98cd
--- /dev/null
+++ b/view/theme/redbasic/schema/boxy.php
@@ -0,0 +1,19 @@
+<?php
+
+if (!$comment_padding)
+ $comment_padding="42px";
+
+if (!$comment_border_left)
+ $comment_border_left="1px solid";
+
+if (!$comment_border_right)
+ $comment_border_right="1px solid";
+
+if (!$comment_border_top)
+ $comment_border_top="1px solid";
+
+if (!$comment_border_bottom)
+ $comment_border_bottom="1px solid";
+if (! $radiuspx)
+ $radiuspx = "4";
+ \ No newline at end of file
diff --git a/view/tpl/head.tpl b/view/tpl/head.tpl
index e7b41523f..a212fd486 100755
--- a/view/tpl/head.tpl
+++ b/view/tpl/head.tpl
@@ -7,6 +7,9 @@
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
+<script>(function(w){var dpr=((w.devicePixelRatio===undefined)?1:w.devicePixelRatio);if(!!w.navigator.standalone){var r=new XMLHttpRequest();r.open('GET','/retinaimages.php?devicePixelRatio='+dpr,false);r.send()}else{document.cookie='devicePixelRatio='+dpr+'; path=/'}})(window)</script>
+<noscript><style id="devicePixelRatio" media="only screen and (-moz-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)">html{background-image:url("/retinaimages.php?devicePixelRatio=2")}</style></noscript>
+
{{$head_css}}
{{$js_strings}}
diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl
index 01f135522..b34f3fcf5 100755
--- a/view/tpl/photo_view.tpl
+++ b/view/tpl/photo_view.tpl
@@ -9,7 +9,7 @@
</div>
{{if $prevlink}}<div id="photo-prev-link"><a href="{{$prevlink.0}}"><i class="icon-backward photo-icons"></i></div>{{/if}}
-<div id="photo-photo"><a href="{{$photo.href}}" title="{{$photo.title}}" onclick="$.colorbox({href: '{{$photo.href}}'}); return false;" ><img src="{{$photo.src}}" /></a></div>
+<div id="photo-photo"><a href="{{$photo.href}}" title="{{$photo.title}}" onclick="$.colorbox({href: '{{$photo.href}}'}); return false;" ><img style="max-width: 100%;" src="{{$photo.src}}" /></a></div>
{{if $nextlink}}<div id="photo-next-link"><a href="{{$nextlink.0}}"><i class="icon-forward photo-icons"></i></a></div>{{/if}}
<div id="photo-photo-end"></div>
<div id="photo-caption">{{$desc}}</div>