Switch to dynamic filling of the card (re: readmore) vs set value

This commit is contained in:
Squidly271 2021-05-29 16:18:06 -04:00
parent 1ab3f89ed7
commit e7cbd4a6c4
8 changed files with 47 additions and 36 deletions

Binary file not shown.

View File

@ -603,6 +603,10 @@ function setToolTip() {
maxWidth:unRaidFontSize*60,
triggerClose:{click:true},
onlyOne:true,
functionInit: function(instance,helper) {
var origin = $(helper.origin);
origin.tooltipster("content","<div class='popupHolder' style='height:450px;'>Loading</div>");
},
functionBefore: function(instance,helper) {
var origin = $(helper.origin);
var repository = origin.attr("data-repository");
@ -1412,7 +1416,12 @@ function installMulti() {
function updateDisplay(data) {
$("#templates_content").html(data);
var all_desc = document.getElementsByClassName("cardDescription");
for (var i=0;i<all_desc.length;i++) {
$clamp(all_desc[i],{clamp:3});
}
setToolTip();
$('.ca_appPopup, .ca_descriptionAreaRepository, .ca_repoinfo,.ca_repoPopup').attr("title","<?=tr("Click for more information")?>");
enableSearch();
$('img').on("error",function() {
$(this).attr('src',"/plugins/dynamix.docker.manager/images/question.png");

View File

@ -1,6 +1,6 @@
767d6f2203fed9541daeb57bbf7b58b3 ./Apps.page
83b3f89cd42e8601c7c217d5b4889c81 ./CA_notices.page
f91fe471f66f90b18a680ca7a83b0270 ./CommunityApps.page
a196e9c23b02d207a2eb1cf05111ef82 ./CommunityApps.page
6db73582f22dab13d329e862067ee84e ./PluginAPI.page
b398273cf7daa62ab00d2de2336ca25f ./README.md
1a908064914041c48be7bf0dab77515a ./ca_settings.page
@ -11,13 +11,13 @@ b398273cf7daa62ab00d2de2336ca25f ./README.md
6e48a62b91bdd066f023f46c6b491afd ./images/discord-gray.svg
8e7dc33512b8a78f28d7179a972c7c34 ./images/discord-hover.svg
54e46db492ddb033dfeb2827c5efd4a8 ./images/discord-white.svg
30e1d9b5d1891fa0052961e7b3743972 ./include/exec.php
c31d41a1f7e894c835c2323d4a2b223f ./include/exec.php
52120efaabf72bcb458de43faf368332 ./include/helpers.php
8f1129e0cdb994c6d1900192252433d8 ./include/paths.php
b73336e163337858313d87c9b923bb92 ./javascript/libraries.js
2ce2ef6894fa1d7bbc05eb932f2dc3c0 ./skins/Narrow/css.php
78ebc06bc2695262f668b359271eccee ./skins/Narrow/skin.html
edc275732992c65cdaf5e14a9de881f5 ./skins/Narrow/skin.php
3758b1cb84123ea534ce8fb68f92879e ./javascript/libraries.js
4a613e9480d7b3d9aa85741bd683b52f ./skins/Narrow/css.php
a65de3019ba259fb7855fac67ea28770 ./skins/Narrow/skin.html
69971e5535985823d712677e059b4aa5 ./skins/Narrow/skin.php
38d1f40cbc64eed32cdb3292e1ec1f6e ./scripts/PluginAPI.php
bbd9dec6c5df486d75c46388c14f09ce ./scripts/installMulti.php
ce2c904b6a40c4677a3ff3484776959e ./scripts/installMultiPlugin.sh

View File

@ -237,7 +237,7 @@ function DownloadApplicationFeed() {
if ( $o['Language'] ) {
$o['Category'] = "Language:";
$o['Compatible'] = true;
$o['Description'] = str_replace("\n","<br>",trim($o['Description']));
$o['Description'] = str_replace(" - ","<br>",trim($o['Description'])); // temp fix since this undoes a change feed makes. Don't make this change in the feed in the future.
}
# Move the appropriate stuff over into a CA data file
@ -249,7 +249,12 @@ function DownloadApplicationFeed() {
$o['SortAuthor'] = $o['Author'];
$o['SortName'] = str_replace("-"," ",$o['Name']);
$o['SortName'] = preg_replace('/\s+/',' ',$o['SortName']);
$o['CardDescription'] = (strlen($o['Description']) > 240) ? substr($o['Description'],0,240)." ..." : $o['Description'];
$des = $o['OriginalOverview'] ?: $o['Overview'];
$des = $o['Language'] ? $o['Description'] : $des;
$des = str_replace(["[","]"],["<",">"],$des);
$des = html_entity_decode($des);
$o['CardDescription'] = strip_tags(markdown(trim($des)),$o['Language'] ? "<br>" : "");
if ( $o['IconHTTPS'] )
$o['IconHTTPS'] = $caPaths['iconHTTPSbase'] .$o['IconHTTPS'];

View File

@ -23,23 +23,18 @@
MIT License
Copyright (c) 2019 Marcus Alsterfjord
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
var pluginTrendlineLinear={beforeDraw:function(t){var i,e;for(var s in t.scales)if("x"==s[0]?e=t.scales[s]:i=t.scales[s],e&&i)break;var a=t.chart.ctx;t.data.datasets.forEach(function(s,r){s.trendlineLinear&&t.isDatasetVisible(r)&&addFitter(t.getDatasetMeta(r),a,s,e,i)}),a.setLineDash([])}};function addFitter(t,i,e,s,a){var r=e.trendlineLinear.style||e.borderColor,n=e.trendlineLinear.width||e.borderWidth,o=e.trendlineLinear.lineStyle||"solid";r=void 0!==r?r:"rgba(169,169,169, .6)",n=void 0!==n?n:3;var h=new LineFitter,d=e.data.length-1,l=t.data[0]._model.x,u=t.data[d]._model.x,m=!1;e.data&&"object"==typeof e.data[0]&&(m=!0),e.data.forEach(function(t,i){m?h.add(t.x,t.y):h.add(i,t)});var c=s.getPixelForValue(h.minx),x=s.getPixelForValue(h.maxx),f=a.getPixelForValue(h.f(h.minx)),X=a.getPixelForValue(h.f(h.maxx));m||(c=l,x=u);var v=t.controller.chart.chartArea.bottom,g=t.controller.chart.width;if(f>v){var L=f-v,b=f-X;f=v,c+=g*(L/b)}else if(X>v){L=X-v,b=X-f;X=v,x=g-(x-(g-g*(L/b)))}i.lineWidth=n,"dotted"===o&&i.setLineDash([2,3]),i.beginPath(),i.moveTo(c,f),i.lineTo(x,X),i.strokeStyle=r,i.stroke()}function LineFitter(){this.count=0,this.sumX=0,this.sumX2=0,this.sumXY=0,this.sumY=0,this.minx=1e100,this.maxx=-1e100}Chart.plugins.register(pluginTrendlineLinear),LineFitter.prototype={add:function(t,i){this.count++,this.sumX+=t,this.sumX2+=t*t,this.sumXY+=t*i,this.sumY+=i,t<this.minx&&(this.minx=t),t>this.maxx&&(this.maxx=t)},f:function(t){var i=this.count*this.sumX2-this.sumX*this.sumX;return(this.sumX2*this.sumY-this.sumX*this.sumXY)/i+t*((this.count*this.sumXY-this.sumX*this.sumY)/i)}};
/*!
* Clamp.js 0.5.1
*
* Copyright 2011-2013, Joseph Schmitt http://joe.sh
* Released under the WTFPL license
* http://sam.zoy.org/wtfpl/
*/
(function(){window.$clamp=function(c,d){function s(a,b){n.getComputedStyle||(n.getComputedStyle=function(a,b){this.el=a;this.getPropertyValue=function(b){var c=/(\-([a-z]){1})/g;"float"==b&&(b="styleFloat");c.test(b)&&(b=b.replace(c,function(a,b,c){return c.toUpperCase()}));return a.currentStyle&&a.currentStyle[b]?a.currentStyle[b]:null};return this});return n.getComputedStyle(a,null).getPropertyValue(b)}function t(a){a=a||c.clientHeight;var b=u(c);return Math.max(Math.floor(a/b),0)}function x(a){return u(c)*
a}function u(a){var b=s(a,"line-height");"normal"==b&&(b=1.2*parseInt(s(a,"font-size")));return parseInt(b)}function l(a){if(a.lastChild.children&&0<a.lastChild.children.length)return l(Array.prototype.slice.call(a.children).pop());if(a.lastChild&&a.lastChild.nodeValue&&""!=a.lastChild.nodeValue&&a.lastChild.nodeValue!=b.truncationChar)return a.lastChild;a.lastChild.parentNode.removeChild(a.lastChild);return l(c)}function p(a,d){if(d){var e=a.nodeValue.replace(b.truncationChar,"");f||(h=0<k.length?
k.shift():"",f=e.split(h));1<f.length?(q=f.pop(),r(a,f.join(h))):f=null;m&&(a.nodeValue=a.nodeValue.replace(b.truncationChar,""),c.innerHTML=a.nodeValue+" "+m.innerHTML+b.truncationChar);if(f){if(c.clientHeight<=d)if(0<=k.length&&""!=h)r(a,f.join(h)+h+q),f=null;else return c.innerHTML}else""==h&&(r(a,""),a=l(c),k=b.splitOnChars.slice(0),h=k[0],q=f=null);if(b.animate)setTimeout(function(){p(a,d)},!0===b.animate?10:b.animate);else return p(a,d)}}function r(a,c){a.nodeValue=c+b.truncationChar}d=d||{};
var n=window,b={clamp:d.clamp||2,useNativeClamp:"undefined"!=typeof d.useNativeClamp?d.useNativeClamp:!0,splitOnChars:d.splitOnChars||[".","-","\u2013","\u2014"," "],animate:d.animate||!1,truncationChar:d.truncationChar||"\u2026",truncationHTML:d.truncationHTML},e=c.style,y=c.innerHTML,z="undefined"!=typeof c.style.webkitLineClamp,g=b.clamp,v=g.indexOf&&(-1<g.indexOf("px")||-1<g.indexOf("em")),m;b.truncationHTML&&(m=document.createElement("span"),m.innerHTML=b.truncationHTML);var k=b.splitOnChars.slice(0),
h=k[0],f,q;"auto"==g?g=t():v&&(g=t(parseInt(g)));var w;z&&b.useNativeClamp?(e.overflow="hidden",e.textOverflow="ellipsis",e.webkitBoxOrient="vertical",e.display="-webkit-box",e.webkitLineClamp=g,v&&(e.height=b.clamp+"px")):(e=x(g),e<=c.clientHeight&&(w=p(l(c),e)));return{original:y,clamped:w}}})();

View File

@ -108,8 +108,8 @@ a.ca_applicationName {text-decoration:none;color:inherit;}
a.ca_author {text-decoration:none;color:inherit;}
.ca_categoryLink {color:<?=$linkColor?>;font-weight:normal;}
a.ca_categoryLink {text-decoration:none;color:inherit;}
.ca_descriptionArea {margin:1rem;width:auto;height:4rem;position:relative;margin-top:-11rem;}
.ca_descriptionAreaRepository {margin:1rem;width:auto;height:4rem;position:relative;margin-top:-12rem;}
.ca_descriptionArea {margin:1rem;width:auto;height:5rem;position:relative;margin-top:-11rem;}
.ca_descriptionAreaRepository {margin:1rem;width:auto;height:5rem;position:relative;margin-top:-12rem;}
.ca_holderDocker {background-color:<?=$templateBackground?>;display:inline-block;float:left;height:24rem;min-width:37rem;max-width:50rem;flex-grow:1;flex-basis:37rem;overflow:hidden;padding:0px;margin-left:0px;margin-top:0px;margin-bottom:1rem;margin-right:1rem;font-size:1.2rem;border:1px solid;border-color:<?=$borderColor?>;border-radius:10px 10px 10px 10px;}
.ca_holderPlugin {background-color:<?=$templateBackground?>;display:inline-block;float:left;height:24rem;min-width:37rem;max-width:50rem;flex-grow:1;flex-basis:37rem;overflow:hidden;padding:0px;margin-left:0px;margin-top:0px;margin-bottom:1rem;margin-right:1rem;font-size:1.2rem;border:1px solid;border-color:<?=$borderColor?>;border-radius:10px 10px 10px 10px;}
.ca_holderFav {background-color:<?=$templateFavourite?> !important;}
@ -158,6 +158,7 @@ table tbody td {line-height:1.8rem;}
.ca_wide_info {display: inline-block;float:left;text-align:left;margin-left:1rem;margin-top:1.5rem;width:20rem;}
.ca_highlight {color:#0e5d08;font-weight:bold;}
.ca_description {color:#505E6F;}
.cardDescription {cursor:pointer;}
a.ca_appPopup {text-decoration:none;cursor:pointer;}
.ca_repoPopup {text-decoration:none!important;cursor:pointer;color:inherit;}
a.ca_repoPopup:hover {color:<?=$unRaid66color?>;}
@ -300,6 +301,7 @@ a.appIconsPopUp { text-decoration:none;color:inherit;}
.ca_bold {font-weight:bold;}
.ca_center {margin:auto;text-align:center;}
p {margin:auto;text-align:left;margin-bottom:10px;} /* override dynamix styling for popup */
h1 {font-size:1.5rem;} /* override dynamix styling for popup */
.ca_NoAppsFound {font-size:3rem;margin:auto;text-align:center;}
.ca_NoDockerAppsFound {font-size:3rem;margin:auto;text-align:center;}
.ca_templatesDisplay {display:flex;flex-wrap:wrap;justify-content:center;overflow-x:hidden;}

View File

@ -73,7 +73,7 @@
<div class='ca_center ca_creditheader'><?tr("Moderation");?></div>
<div class='ca_center ca_credit'>dockerPolice, pluginCop</div>
<div class='ca_center ca_creditheader'><?tr("Additional Libraries");?></div>
<div class='ca_center ca_credit'>Awesomeplete (Lea Verou), Chart.js (various), chartjs-plugin-trendline (Marcus Alsterfjord), XML2Array/Array2XML (Miles Johnson), sprintf.js (Alexandru Mărășteanu)</div>
<div class='ca_center ca_credit'>Awesomeplete (Lea Verou), Chart.js (various), chartjs-plugin-trendline (Marcus Alsterfjord), XML2Array/Array2XML (Miles Johnson), sprintf.js (Alexandru Mărășteanu) clamp.js (Joseph Schmitt)</div>
<br>
<div class='ca_center ca_italic'><font size='1rem;'><?tr("Copyright");?> &copy; 2015-2021 Andrew Zawadzki</font></div>
</div>

View File

@ -86,11 +86,10 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
$template['display_iconClickable'] = "<img class='displayIcon ca_tooltip ca_repoPopup' title='".tr("Click for more information")."' src='{$template['icon']}' data-repository='".htmlentities($template['RepoName'],ENT_QUOTES)."'></img>";
$template['display_infoIcon'] = "<a class='appIcons ca_repoinfo ca_tooltip' title='".tr("Click for more information")."' data-repository='".htmlentities($template['RepoName'],ENT_QUOTES)."'></a>";
if ( $template['bio'] ) {
$template['CardDescription'] = (strlen($template['bio']) > 240) ? substr($template['bio'],0,240)." ... <a class='ca_reporeadmore' data-repository='".htmlentities($template['RepoName'],ENT_QUOTES)."'> ".tr("Read more")."</a>" : $template['bio'];
} else {
if ( ! $template['bio'] )
$template['CardDescription'] = tr("No description present");
}
else
$template['CardDescription'] = $template['bio'];
$template['bio'] = strip_tags(markdown($template['bio']));
$template['display_dockerName'] = $template['RepoName'];
@ -297,9 +296,9 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
}
}
if ( endsWith($template['CardDescription'],"...") ) {
/* if ( endsWith($template['CardDescription'],"...") ) {
$template['CardDescription'] .= "<a class='ca_appreadmore ca_appPopup' data-appNumber='$ID' data-appPath='{$template['Path']}' data-appName='{$template['Name']}' data-beta='$appInfoBeta'> ".tr("Read more")."</a>";
}
} */
$template['display_dockerName'] = "<span class='ca_applicationName'>";
$template['display_dockerName'] .= $template['Name_highlighted'] ?: $template['Name'];
$template['display_dockerName'] .= "</span>";
@ -987,6 +986,7 @@ function displayCard($template) {
$descriptionArea = $template['RepositoryTemplate'] ? "ca_descriptionAreaRepository" : "ca_descriptionArea";
$popupType = $template['RepositoryTemplate'] ? "ca_repoPopup" : "ca_appPopup";
if ($template['Language']) {
$language = "{$template['Language']}";
@ -1023,7 +1023,7 @@ function displayCard($template) {
$display_removable $display_Uninstall
</span>
</div>
<div class='$descriptionArea'>
<div class='$descriptionArea cardDescription $popupType' data-appNumber='$ID' data-appPath='$Path' data-appName='$Name' data-repository='".htmlentities($RepoName,ENT_QUOTES)."'>
$CardDescription
</div>
</div>