Skip to content

Commit

Permalink
4.0.7
Browse files Browse the repository at this point in the history
Loosing CSS : move mod_cg_memo.php back to module's root
  • Loading branch information
conseilgouz committed Dec 1, 2023
1 parent 02f445e commit 7351685
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 80 deletions.
89 changes: 89 additions & 0 deletions mod_cg_memo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php
/**
* CG Memo Module for Joomla 4.x/5.x
*
* @author ConseilgGouz
* @copyright (C) 2023 www.conseilgouz.com. All Rights Reserved.
* @license GNU/GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Factory;
$modulefield = 'media/mod_cg_memo/';
$document = Factory::getDocument();
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getDocument()->getWebAssetManager();
$wa->registerAndUseStyle('cgmemo',$modulefield.'css/cgmemo.css');
$core = $wa->useAsset('script', 'core');
if ((bool)Factory::getConfig()->get('debug')) { // Mode debug
$document->addScript(''.URI::base(true).'/media/mod_cg_memo/js/cgmemo.js');
} else {
$wa->registerAndUseScript('cgmemo',$modulefield.'js/cgmemo.js');
}
$style = "";
if ($params->get('font-family') == 'allthatmattersmedium') {
$style = "@font-face {
font-family: 'allthatmattersmedium';
src: url('".URI::root()."media/mod_cg_memo/fonts/allthatmatters-webfont.eot');
src: url('".URI::root()."media/mod_cg_memo/fonts/allthatmatters-webfont.eot?#iefix') format('embedded-opentype'), url('".URI::root()."media/mod_cg_memo/fonts/allthatmatters-webfont.woff') format('woff'), url('".URI::root()."media/mod_cg_memo/fonts/allthatmatters-webfont.ttf') format('truetype'), url('".URI::root()."media/mod_cg_memo/fonts/allthatmatters-webfont.svg#allthatmattersmedium') format('svg');
font-weight: normal;
font-style: normal;
}";
$style .= "@font-face {
font-family: 'Indie Flower';
url('".URI::root()."media/mod_cg_memo/fonts/IndieFlower-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}";
} else {
$wa->registerAndUseScript('googleFont','//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js');
}
$style .= ".".$params->get('class').".cg-memo-note {
max-height:".$params->get('max-height')."%;
max-width:".$params->get('max-width')."%;
font-size:".$params->get('font-size')."px;
color:".$params->get('color','black')."!important;
font-family:".$params->get('font-family').";
line-height:".$params->get('line-height')."px !important;
background-color:".$params->get('note-color').";
padding-top:".$params->get('padding-top')."px;
padding-right:".$params->get('padding-right')."px;
padding-bottom:".$params->get('padding-bottom')."px;
padding-left:".$params->get('padding-left')."px;
-webkit-transform: rotate(".$params->get('degrees')."deg);
/* Firefox */
-moz-transform: rotate(".$params->get('degrees')."deg);
/* IE */
-ms-transform: rotate(".$params->get('degrees')."deg);
/* Opera */
-o-transform: rotate(".$params->get('degrees')."deg);
box-shadow:".$params->get('shadow-horizontal')."px
".$params->get('shadow-vertical')."px
".$params->get('shadow-blur')."px'
".$params->get('shadow-color').";
}";
$style .= ".".$params->get('class').".editor-output {line-height:".$params->get('line-height')."px !important;}";
$style .= ".".$params->get('class')." ol li, .".$params->get('class')." ul li {line-height:".$params->get('line-height')."px!important;}";
$style .= ".".$params->get('class')." .tack {position: absolute;
top:".$params->get('tack-top')."px;left:".$params->get('tack-left')."px;";
$style .= 'background-image: url("'.URI::root().'/media/'.$module->module.'/img/'.$params->get('tack-color').'");
background-repeat: no-repeat;
background-position: center center;
height: 42px;
width: 31px;
}';
$style .= ".hidepin.tack {display:none !important;}";
$style .= ".".$params->get('class')." .line {display: block;}";
$style .= ".".$params->get('class')." .wf-loading h1 {visibility: hidden;}";
$style .= ".".$params->get('class')." .wf-active h1,. ".$params->get('class').".wf-inactive h1 {
visibility: visible;
font-family: 'Cantarell';
}";
$document->addScriptOptions('mod_cg_memo_'.$module->id,
array('fontfamily' => $params->get('font-family'),
));

// Add an inline content as usual, will be rendered in flow after all assets
$wa->addInlineStyle($style);
require_once(ModuleHelper::getLayoutPath($module->module));
7 changes: 4 additions & 3 deletions mod_cg_memo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
<extension type="module" version="4.2.0" client="site" method="upgrade">
<name>CG Responsive Memo</name>
<author>ConseilGouz</author>
<creationDate>2023-10-27</creationDate>
<creationDate>2023-12-01</creationDate>
<copyright>Copyright (C) 2023 ConseilGouz. All rights reserved.</copyright>
<authorEmail>pascal.leconte@conseilgouz.com</authorEmail>
<authorUrl>www.conseilgouz.com</authorUrl>
<version>4.0.6</version>
<version>4.0.7</version>
<namespace path="src">ConseilGouz\Module\Cgmemo</namespace>
<description>CG_MEMO_DESC</description>
<files>
<folder module="mod_cg_memo">services</folder>
<filename module="mod_cg_memo">mod_cg_memo.php</filename>
<filename>index.html</filename>
<filename>mod_cg_memo.xml</filename>
<folder>services</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
Expand Down
11 changes: 11 additions & 0 deletions mod_cg_memo_changelog.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<changelogs>
<changelog>
<element>mod_cg_memo</element>
<type>Module</type>
<version>4.0.7</version>
<note>
<item>Update : 01/12/2023</item>
</note>
<fix>
<item>Loosing CSS : move mod_cg_memo.php back to module's root </item>
</fix>
</changelog>
<changelog>
<element>mod_cg_memo</element>
<type>Module</type>
Expand Down
77 changes: 0 additions & 77 deletions tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,84 +8,7 @@
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Factory;
$modulefield = 'media/mod_cg_memo/';
$document = Factory::getDocument();
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getDocument()->getWebAssetManager();
$wa->registerAndUseStyle('cgmemo',$modulefield.'css/cgmemo.css');
$core = $wa->useAsset('script', 'core');
if ((bool)Factory::getConfig()->get('debug')) { // Mode debug
$document->addScript(''.URI::base(true).'/media/mod_cg_memo/js/cgmemo.js');
} else {
$wa->registerAndUseScript('cgmemo',$modulefield.'js/cgmemo.js');
}
$style = "";
if ($params->get('font-family') == 'allthatmattersmedium') {
$style = "@font-face {
font-family: 'allthatmattersmedium';
src: url('".URI::root()."media/mod_cg_memo/fonts/allthatmatters-webfont.eot');
src: url('".URI::root()."media/mod_cg_memo/fonts/allthatmatters-webfont.eot?#iefix') format('embedded-opentype'), url('".URI::root()."media/mod_cg_memo/fonts/allthatmatters-webfont.woff') format('woff'), url('".URI::root()."media/mod_cg_memo/fonts/allthatmatters-webfont.ttf') format('truetype'), url('".URI::root()."media/mod_cg_memo/fonts/allthatmatters-webfont.svg#allthatmattersmedium') format('svg');
font-weight: normal;
font-style: normal;
}";
$style .= "@font-face {
font-family: 'Indie Flower';
url('".URI::root()."media/mod_cg_memo/fonts/IndieFlower-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}";
} else {
$wa->registerAndUseScript('googleFont','//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js');
}
$style .= ".".$params->get('class').".cg-memo-note {
max-height:".$params->get('max-height')."%;
max-width:".$params->get('max-width')."%;
font-size:".$params->get('font-size')."px;
color:".$params->get('color','black')."!important;
font-family:".$params->get('font-family').";
line-height:".$params->get('line-height')."px !important;
background-color:".$params->get('note-color').";
padding-top:".$params->get('padding-top')."px;
padding-right:".$params->get('padding-right')."px;
padding-bottom:".$params->get('padding-bottom')."px;
padding-left:".$params->get('padding-left')."px;
-webkit-transform: rotate(".$params->get('degrees')."deg);
/* Firefox */
-moz-transform: rotate(".$params->get('degrees')."deg);
/* IE */
-ms-transform: rotate(".$params->get('degrees')."deg);
/* Opera */
-o-transform: rotate(".$params->get('degrees')."deg);
box-shadow:".$params->get('shadow-horizontal')."px
".$params->get('shadow-vertical')."px
".$params->get('shadow-blur')."px'
".$params->get('shadow-color').";
}";
$style .= ".".$params->get('class').".editor-output {line-height:".$params->get('line-height')."px !important;}";
$style .= ".".$params->get('class')." ol li, .".$params->get('class')." ul li {line-height:".$params->get('line-height')."px!important;}";
$style .= ".".$params->get('class')." .tack {position: absolute;
top:".$params->get('tack-top')."px;left:".$params->get('tack-left')."px;";
$style .= 'background-image: url("'.URI::root().'/media/'.$module->module.'/img/'.$params->get('tack-color').'");
background-repeat: no-repeat;
background-position: center center;
height: 42px;
width: 31px;
}';
$style .= ".hidepin.tack {display:none !important;}";
$style .= ".".$params->get('class')." .line {display: block;}";
$style .= ".".$params->get('class')." .wf-loading h1 {visibility: hidden;}";
$style .= ".".$params->get('class')." .wf-active h1,. ".$params->get('class').".wf-inactive h1 {
visibility: visible;
font-family: 'Cantarell';
}";
$document->addScriptOptions('mod_cg_memo_'.$module->id,
array('fontfamily' => $params->get('font-family'),
));

// Add an inline content as usual, will be rendered in flow after all assets
$wa->addInlineStyle($style);
header("Content-type: text/css; charset: UTF-8");
?>
<div class="<?php echo $params->get('class');?> cg-memo-note <?php echo $params->get('customclass');?>" data="<?php echo $module->id;?>" >
Expand Down

0 comments on commit 7351685

Please sign in to comment.