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 @@ protected function buildItem($link, $pageaddr)
$permalink = '<a href="'. $link['guid'] .'" title="'. t('Permalink') .'">'. t('Permalink') .'</a>'; $permalink = '<a href="'. $link['guid'] .'" title="'. t('Permalink') .'">'. t('Permalink') .'</a>';
} }
$link['description'] = format_description($link['description'], '', false, $pageaddr); $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']; $pubDate = $link['created'];
$link['pub_iso_date'] = $this->getIsoDate($pubDate); $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.url'),
$conf->get('redirector.encode_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(); $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. if ($thumb!='') // Only output links which have a thumbnail.
{ {
$link['thumbnail']=$thumb; // Thumbnail HTML code. $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( $data = array(

View file

@ -44,9 +44,10 @@ function hook_myShaarli_render_linklist($data,$conf)
foreach ($data['links'] as &$value) { foreach ($data['links'] as &$value) {
$thumb = computeThumbnail($conf, $value['url']); $thumb = computeThumbnail($conf, $value['url']);
if(empty($thumb)){ 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 { } 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; return $data;

View file

@ -77,8 +77,38 @@ function hook_origin_render_linklist($data,$conf)
} }
// Try to get just domain for @via // Try to get just domain for @via
function getJustDomain($url) function getJustDomain($url) {
{
$parts = parse_url($url); $parts = parse_url($url);
if(!empty($parts['host'])){
return trim($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"> <div class="origin clear">
Origin -> <a href="%s">%s</a> Origin <i class="fa fa-share"></i> <a href="%s">%s</a>
</div> </div>

View file

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

View file

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

View file

@ -28,7 +28,7 @@
<published>{$value.pub_iso_date}</published> <published>{$value.pub_iso_date}</published>
<updated>{$value.up_iso_date}</updated> <updated>{$value.up_iso_date}</updated>
{/if} {/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"} {loop="$value.taglist"}
<category scheme="{$index_url}?searchtags=" term="{$value|strtolower}" label="{$value}" /> <category scheme="{$index_url}?searchtags=" term="{$value|strtolower}" label="{$value}" />
{/loop} {/loop}

View file

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

View file

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

View file

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