Fix markdown editor with myShaarli plugin

This commit is contained in:
Knah Tsaeb 2018-02-09 15:56:22 +01:00
parent 95d55e9ea2
commit ba04c60849
11 changed files with 110 additions and 41 deletions

View file

@ -153,8 +153,7 @@ class FeedBuilder
$permalink = '<a href="'. $link['guid'] .'" title="'. t('Permalink') .'">'. t('Permalink') .'</a>';
}
$link['description'] = format_description($link['description'], '', false, $pageaddr);
$link['description'] .= PHP_EOL .'<br>&#8212; '. $permalink;
$link['permalink'] = PHP_EOL .'<br> &#8212; '. $permalink;
$pubDate = $link['created'];
$link['pub_iso_date'] = $this->getIsoDate($pubDate);

View file

@ -607,7 +607,21 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager)
$conf->get('redirector.url'),
$conf->get('redirector.encode_url')
);
$linksToDisplay[$key]['thumbnail'] = thumbnail($conf, $link['url']);
$thumb=lazyThumbnail($conf, $link['url'],$link['url']);
if ($thumb!='') // Only output links which have a thumbnail.
{
$linksToDisplay[$key]['thumbnail']=$thumb; // Thumbnail HTML code.
}
$thumUrl = $conf->get('plugins.ExternalThumbshot_URL');
if(empty($linksToDisplay[$key]['thumbnail'])){
$linksToDisplay[$key]['thumbnail'] = '<img class="b-lazy" src="#" data-src="'.$thumUrl.urlencode($link['url']).'" alt="Thumbnail" width="120" height="90">';
}
//$linksToDisplay[$key]['thumbnail'] = thumbnail($conf, $link['url']);
$linksToDisplay[$key]['timestamp'] = $link['created']->getTimestamp();
}
@ -780,8 +794,12 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager)
if ($thumb!='') // Only output links which have a thumbnail.
{
$link['thumbnail']=$thumb; // Thumbnail HTML code.
$linksToDisplay[]=$link; // Add to array.
}
$thumUrl = $conf->get('plugins.ExternalThumbshot_URL');
if(empty($link['thumbnail'])){
$link['thumbnail'] = '<img class="b-lazy" src="#" data-src="'.$thumUrl.urlencode($link['url']).'" alt="Thumbnail" width="120" height="90">';
}
$linksToDisplay[]=$link; // Add to array.
}
$data = array(

View file

@ -44,9 +44,10 @@ function hook_myShaarli_render_linklist($data,$conf)
foreach ($data['links'] as &$value) {
$thumb = computeThumbnail($conf, $value['url']);
if(empty($thumb)){
$value['thumbnail'] = '<img src="'.$thumUrl.urlencode($value['url']).'" alt="Thumbnail" width="120" height="90">';
//$value['thumbnail'] = '<img src="'.$thumUrl.urlencode($value['url']).'" alt="Thumbnail" width="120" height="90">';
$value['thumbnail'] = '<img class="b-lazy" src="#" data-src="'.$thumUrl.urlencode($value['url']).'" alt="Thumbnail" width="120" height="90">';
} else {
$value['thumbnail'] = '<img src="'.$thumb['src'].'">';
$value['thumbnail'] = '<img class="b-lazy" src="#" data-src="'.$thumb['src'].'" alt="Thumbnail" width="120" height="90">';
}
}
return $data;

View file

@ -77,8 +77,38 @@
}
// Try to get just domain for @via
function getJustDomain($url)
{
function getJustDomain($url) {
$parts = parse_url($url);
return trim($parts['host']);
if(!empty($parts['host'])){
return trim($parts['host']);
} else {
return false;
}
}
/**
* Execute render_feed hook.
* Called with ATOM and RSS feed.
*
* Special data keys:
* - _PAGE_: current page
* - _LOGGEDIN_: true/false
*
* @param array $data data passed to plugin
*
* @return array altered $data.
*/
function hook_origin_render_feed($data)
{
$origin_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/origin/render.html');
foreach ($data['links'] as &$value) {
if(!empty($value['via'])){
$host = getJustDomain($value['via']);
$origin = sprintf($origin_html, $value['via'], $host);
$value['description'] = $value['description'].$origin;
}
}
return $data;
}

View file

@ -1,3 +1,3 @@
<div class="origin clear">
Origin -> <a href="%s">%s</a>
Origin <i class="fa fa-share"></i> <a href="%s">%s</a>
</div>

View file

@ -23,18 +23,27 @@ body {
.label {
display: inline-block;
padding: .25em .4em;
padding: .3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25rem;
}
.linklist-item-infos .label a{
border-radius: .3rem;
background-color: #ddd;
border: 1px solid #fff;
padding: .3em .6em;
}
.linklist-item-infos .label a:hover {
color: #1b926c;
background-color: #fff;
border: 1px solid #333;
transition: color .2s linear, border .2s linear;
}
pre {
@ -117,10 +126,7 @@ body, .pure-g [class*="pure-u"] {
* MENU
**/
.shaarli-menu {
position: fixed;
top: 0;
width: 100%;
--height: 60px;
background: linear-gradient(#333333,#111111);
background-color: #333333;
box-shadow: 0 1px 2px rgba(0,0,0,0.5);
@ -413,7 +419,6 @@ body, .pure-g [class*="pure-u"] {
#content {
position: relative;
z-index: 2;
margin-top: 45px;
}
/**
@ -671,6 +676,10 @@ body, .pure-g [class*="pure-u"] {
color: #14553f;
}
.origin {
margin: .3em .3em .3em 0;
}
.linklist-item-thumbnail {
position: relative;
padding: .6em;
@ -721,6 +730,7 @@ body, .pure-g [class*="pure-u"] {
.linklist-item-infos .linklist-item-tags {
font-size: 0.8em;
margin-bottom: .6em;
}
.linklist-item-infos .label-tag {
@ -1199,25 +1209,32 @@ form[name="linkform"].page-form {
/**
* Picture wall CSS
*/
.myShaarli_picwall {
background-color: #000;
}
.myShaarli_picwall .pure-u-lg-4-5 {
margin:auto;
background-color: #000;
box-shadow: none;
}
#picwall_container {
margin: 0 10px 10px 10px;
color: #252525;
background-color: #f5f5f5;
background-color: #000;
clear: both;
text-align: center;
}
.picwall_pictureframe {
margin: 2px;
background-color: #f5f5f5;
background-color: #000;
z-index: 5;
position: relative;
display: table-cell;
vertical-align: middle;
width: 90px;
height: 90px;
display: inline-flex;
overflow: hidden;
text-align: center;
float: left;
}
.b-lazy {
@ -1235,6 +1252,7 @@ form[name="linkform"].page-form {
max-width: 100%;
height: auto;
color: transparent;
border-radius:.3em;
} /* Adapt the width of the image */
.picwall_pictureframe a {
@ -1252,13 +1270,14 @@ form[name="linkform"].page-form {
position: absolute;
top: 0;
left: 0;
width: 90px;
height: 90px;
width: 100%;
height: 100%;
font-weight: bold;
font-size: 9pt;
color: #f5f5f5;
text-align: left;
background-color: rgba(0, 0, 0, 0.8);
overflow-wrap: break-word;
}
/**
@ -1289,6 +1308,7 @@ form[name="linkform"].page-form {
.daily-entry {
padding: 0 10px;
clear: both;
}
.daily-entry .daily-entry-title:after {

View file

@ -69,9 +69,9 @@
</a>
<a href="{$link.real_url}">{$link.title}</a>
</div>
{$thumb=thumbnail($value.url)}
{if="$thumb!=false"}
<div class="daily-entry-thumbnail">{$thumb}</div>
{if="$link.thumbnail!=false"}
<div class="daily-entry-thumbnail">{$link.thumbnail}</div>
{/if}
<div class="daily-entry-description">{$link.formatedDescription}</div>
{if="$link.tags"}
@ -108,6 +108,9 @@
</div>
</div>
{include="page.footer"}
<script src="inc/blazy-1.3.1.min.js#"></script>
<script>
var bLazy = new Blazy();
</script>
</body>
</html>

View file

@ -28,7 +28,7 @@
<published>{$value.pub_iso_date}</published>
<updated>{$value.up_iso_date}</updated>
{/if}
<content type="html" xml:lang="{$language}"><![CDATA[{$value.description}]]></content>
<content type="html" xml:lang="{$language}"><![CDATA[{$value.description}]]> <![CDATA[{$value.permalink}]]></content>
{loop="$value.taglist"}
<category scheme="{$index_url}?searchtags=" term="{$value|strtolower}" label="{$value}" />
{/loop}

View file

@ -120,12 +120,9 @@
{loop="links"}
<div class="anchor" id="{$value.shorturl}"></div>
<div class="linklist-item linklist-item{if="$value.class"} {$value.class}{/if}" data-id="{$value.id}">
{$thumb=($value.thumbnail)}
{if="$thumb!=false"}
<div class="linklist-item-thumbnail">{$thumb}</div>
{if="isset($value.thumbnail) == true"}
<div class="linklist-item-thumbnail">{$value.thumbnail}</div>
{/if}
<div class="linklist-item-title">
{if="isLoggedIn()"}
<div class="linklist-item-editbuttons">
@ -250,5 +247,9 @@
</div>
{include="page.footer"}
<script src="inc/blazy-1.3.1.min.js#"></script>
<script>
var bLazy = new Blazy();
</script>
</body>
</html>

View file

@ -11,7 +11,7 @@
<div class="pure-u-1">
<div class="pure-menu menu-transform pure-menu-horizontal pure-g">
<ul class="pure-menu-list pure-u-lg-5-6 pure-u-1">
<li>
<li class="pure-menu-item">
<img src="img/logo_myShaarli.png" class="head-logo" alt="logo" />
</li>
<li class="pure-menu-item pure-u-0 pure-u-lg-visible">

View file

@ -6,9 +6,8 @@
<body>
{include="page.header"}
<div class="pure-g">
<div class="pure-u-lg-1-6 pure-u-1-24"></div>
<div class="pure-u-lg-2-3 pure-u-22-24 page-form page-visitor">
<div class="pure-g myShaarli_picwall">
<div class="pure-u-lg-4-5 pure-u-22-24 page-form page-visitor">
{$countPics=count($linksToDisplay)}
<h2 class="window-title">{'Picture Wall'|t} - {$countPics} {'pics'|t}</h2>
@ -35,11 +34,9 @@
{$value}
{/loop}
</div>
</div>
</div>
{include="page.footer"}
<script src="inc/blazy-1.3.1.min.js#"></script>
</body>
</html>