3 * expand contract jquery script
6 * @link http://www.open-emr.org
7 * @author Ranganath Pathak <pathak@scrs1.org>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2018 Ranganath Pathak <pathak@scrs1.org>
10 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 // ensure that $user_settings_php_path, $arr_files_php variables are set in the script calling this script
15 use OpenEMR\Common\Csrf\CsrfUtils
;
18 $
( document
).ready(function() {
19 $
('.expand_contract').click(function() {
20 var elementTitle
= $
(this
).prop('title');
21 var contractTitle
= <?php
echo xlj('Click to Contract and set to henceforth open in Centered mode'); ?
>;
22 var expandTitle
= <?php
echo xlj('Click to Expand and set to henceforth open in Expanded mode'); ?
>;
23 var arrFiles
= <?php
echo json_encode($arr_files_php) ?
>;
25 if (elementTitle
== contractTitle
) {
26 elementTitle
= expandTitle
;
27 $
(this
).toggleClass('fa-expand fa-compress');
28 $
('.expandable').toggleClass('container container-fluid');
29 if ($
(arrFiles
).length
) {
30 $
.each(arrFiles
, function (index
, value
) {
31 $
.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
33 target
: arrFiles
[index
].trim(),
35 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
40 } else if (elementTitle
== expandTitle
) {
41 elementTitle
= contractTitle
;
42 $
(this
).toggleClass('fa-compress fa-expand');
43 $
('.expandable').toggleClass('container-fluid container');
44 if ($
(arrFiles
).length
) {
45 $
.each(arrFiles
, function (index
, value
) {
46 $
.post( "<?php echo $GLOBALS['webroot'] ?>/library/ajax/user_settings.php",
48 target
: arrFiles
[index
].trim(),
50 csrf_token_form
: <?php
echo js_escape(CsrfUtils
::collectCsrfToken()); ?
>
56 $
(this
).prop('title', elementTitle
);